Ejemplo n.º 1
0
 /// <summary>
 /// Sets a specific image encoder as the encoder for a specific image format.
 /// </summary>
 /// <param name="imageFormat">The image format to register the encoder for.</param>
 /// <param name="encoder">The encoder to use,</param>
 public void SetEncoder(ITextureFormat imageFormat, ITextureEncoder encoder)
 {
     Guard.NotNull(imageFormat, nameof(imageFormat));
     Guard.NotNull(encoder, nameof(encoder));
     this.AddImageFormat(imageFormat);
     this.mimeTypeEncoders.AddOrUpdate(imageFormat, encoder, (s, e) => encoder);
 }
Ejemplo n.º 2
0
        static Native()
        {
            var executingAssembly = Assembly.GetExecutingAssembly();

            string dllFilePath = Path.Combine(Path.GetDirectoryName(executingAssembly.Location),
                                              $"MikuMikuLibrary.Native.X{( IntPtr.Size == 8 ? "64" : "86" )}.dll");

            if (!File.Exists(dllFilePath))
            {
                throw new FileNotFoundException("Native MML library could not be found", dllFilePath);
            }

            var assembly = Assembly.LoadFile(dllFilePath);

            assembly.GetType("MikuMikuLibrary.NativeContext")
            .GetMethod("Initialize", BindingFlags.Public | BindingFlags.Static).Invoke(null, null);

            FbxExporter = ( IFbxExporter )Activator.CreateInstance(
                assembly.GetType("MikuMikuLibrary.Objects.Processing.Fbx.FbxExporterCore"));

            TextureDecoder = ( ITextureDecoder )Activator.CreateInstance(
                assembly.GetType("MikuMikuLibrary.Textures.Processing.TextureDecoderCore"));

            TextureEncoder = ( ITextureEncoder )Activator.CreateInstance(
                assembly.GetType("MikuMikuLibrary.Textures.Processing.TextureEncoderCore"));
        }