8
internal static class Interfaces {
9
internal static IHost Host = null;
13
/// <summary>Exposes version 1.0 of the interface to be implemented by a plugin.</summary>
14
public class Plugin : IPlugin10 {
19
/// <summary>Is called when the plugin is loaded.</summary>
20
/// <param name="hosts">A list of versions of the host interface as used for callbacks.</param>
21
/// <returns>A boolean indicating whether the plugin was successfully loaded.</returns>
22
/// <remarks>A plugin should make use of the smallest version the host interface provides as possible. If the plugin expects a certain version that is not supplied by the host application, this operation should return as unsuccessful.</remarks>
23
public bool Load(IHost[] hosts) {
27
/// <summary>Is called when the plugin is unloaded.</summary>
28
public void Unload() { }
33
/// <summary>Returns whether the plugin is capable of loading textures.</summary>
34
/// <returns>A boolean indicating whether the plugin is capable of loading textures.</returns>
35
public bool CanLoadTextures() {
39
/// <summary>Returns whether the plugin is capable of loading the specified texture.</summary>
40
/// <param name="type">The type of the path, i.e. a file or a folder.</param>
41
/// <param name="path">The absolute path of the file or folder where the texture is stored.</param>
42
/// <param name="encoding">The suggested encoding in case the texture format does not mandate a specific encoding.</param>
43
/// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
44
/// <returns>The priority at which the plugin supports loading the specified texture.</returns>
45
public General.Priority CanLoadTexture(Path.PathType type, string path, Encoding encoding, object data) {
46
return General.Priority.NotCapable;
49
/// <summary>Loads a texture into an output parameter and returns the success of the operation.</summary>
50
/// <param name="type">The type of the path, i.e. a file or a folder.</param>
51
/// <param name="path">The absolute path of the file or folder where the texture is stored.</param>
52
/// <param name="encoding">The suggested encoding in case the texture format does not mandate a specific encoding.</param>
53
/// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
54
/// <param name="texture">Receives the texture.</param>
55
/// <returns>The success of the operation.</returns>
56
public General.Result LoadTexture(Path.PathType type, string path, Encoding encoding, object data, out Texture.TextureData texture) {
58
return General.Result.NotSupported;
64
/// <summary>Returns whether the plugin is capable of loading objects.</summary>
65
/// <returns>A boolean indicating whether the plugin is capable of loading objects.</returns>
66
public bool CanLoadObjects() {
70
/// <summary>Returns whether the plugin is capable of loading the specified object.</summary>
71
/// <param name="type">The type of the path, i.e. a file or a folder.</param>
72
/// <param name="path">The absolute path of the file or folder where the object is stored.</param>
73
/// <param name="encoding">The suggested encoding in case the object format does not mandate a specific encoding.</param>
74
/// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
75
/// <returns>The priority at which the plugin supports loading the specified object.</returns>
76
public General.Priority CanLoadObject(Path.PathType type, string path, Encoding encoding, object data) {
77
return General.Priority.NotCapable;
80
/// <summary>Loads an object into an output parameter and returns the success of the operation.</summary>
81
/// <param name="type">The type of the path, i.e. a file or a folder.</param>
82
/// <param name="path">The absolute path of the file or folder where the object is stored.</param>
83
/// <param name="encoding">The suggested encoding in case the object format does not mandate a specific encoding.</param>
84
/// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
85
/// <param name="obj">Receives the object.</param>
86
/// <returns>The success of the operation.</returns>
87
public General.Result LoadObject(Path.PathType type, string path, Encoding encoding, object data, out Geometry.GenericObject obj) {
89
return General.Result.NotSupported;
95
/// <summary>Returns whether the plugin is capable of loading sounds.</summary>
96
/// <returns>A boolean indicating whether the plugin is capable of loading sounds.</returns>
97
public bool CanLoadSounds() {
101
/// <summary>Returns whether the plugin is capable of loading the specified sound.</summary>
102
/// <param name="type">The type of the path, i.e. a file or a folder.</param>
103
/// <param name="path">The absolute path of the file or folder where the sound is stored.</param>
104
/// <param name="encoding">The suggested encoding in case the sound format does not mandate a specific encoding.</param>
105
/// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
106
/// <returns>The priority at which the plugin supports loading the specified sound.</returns>
107
public General.Priority CanLoadSound(Path.PathType type, string path, Encoding encoding, object data) {
108
if (type != Path.PathType.File) {
109
return General.Priority.NotCapable;
111
if (string.Equals(System.IO.Path.GetExtension(path), ".wav", StringComparison.OrdinalIgnoreCase)) {
112
return General.Priority.Normal;
114
return General.Priority.NotCapable;
119
/// <summary>Loads a sound into an output parameter and returns the success of the operation.</summary>
120
/// <param name="type">The type of the path, i.e. a file or a folder.</param>
121
/// <param name="path">The absolute path of the file or folder where the sound is stored.</param>
122
/// <param name="encoding">The suggested encoding in case the sound format does not mandate a specific encoding.</param>
123
/// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
124
/// <param name="sound">Receives the sound.</param>
125
/// <returns>The success of the operation.</returns>
126
public General.Result LoadSound(Path.PathType type, string path, Encoding encoding, object data, out Sound.SoundData sound) {
127
return WaveParser.LoadFromFile(path, out sound);
b'\\ No newline at end of file'