コード例 #1
0
ファイル: Form.cs プロジェクト: ishkang/Gorgon
        /// <summary>
        /// Function to load our useless image codec plug in.
        /// </summary>
        /// <returns><b>true</b> if successful, <b>false</b> if not.</returns>
        private bool LoadCodec()
        {
            const string pluginName = "Gorgon.Graphics.Example.TvImageCodecPlugIn";

            _pluginCache = new GorgonMefPlugInCache(GorgonApplication.Log);

            // Load our plug in.
            _pluginCache.LoadPlugInAssemblies(GorgonApplication.StartupPath.FullName, "TVImageCodec.dll");

            // Activate the plugin service.
            IGorgonPlugInService pluginService = new GorgonMefPlugInService(_pluginCache);

            // Find the plugin.
            GorgonImageCodecPlugIn plugIn = pluginService.GetPlugIn <GorgonImageCodecPlugIn>(pluginName);

            if ((plugIn == null) || (plugIn.Codecs.Count == 0))
            {
                return(false);
            }

            // Normally you would enumerate the plug ins, but in this case we know there's only one.
            _customCodec = plugIn.CreateCodec(plugIn.Codecs[0].Name);

            return(_customCodec != null);
        }
コード例 #2
0
 /// <summary>Initializes a new instance of the <see cref="CodecSetting"/> class.</summary>
 /// <param name="description">The friendly description of the codec.</param>
 /// <param name="plugin">The plugin for the codec.</param>
 /// <param name="desc">The description of the codec.</param>
 public CodecSetting(string description, GorgonImageCodecPlugIn plugin, GorgonImageCodecDescription desc)
 {
     Description = description;
     PlugIn      = plugin;
     Name        = desc.Name;
 }