Ejemplo n.º 1
0
 /// <summary>
 /// Unload ourselves.
 /// </summary>
 public void Stop()
 {
     log.Info("Movie manager stop");
     foreach (ICodec codec in Codecs)
     {
         codec.Stop();
     }
     Codecs.Clear();
     Instance = null;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize the singleton member and wait for the interpreter to
        /// load to reflect ourselves.
        /// </summary>
        public void Start()
        {
            Instance = this;
            ExternalTextureSourceManager.Instance.SetExternalTextureSource(
                MovieTextureSource.MV_SOURCE_NAME, new MovieTextureSource());

            Assembly assembly = Assembly.GetAssembly(typeof(Manager));
            foreach (Type type in assembly.GetTypes())
            {
                if ((type.GetInterface("ICodec") == typeof(ICodec)) && (!type.IsInterface))
                {
                    try
                    {
                        ICodec codec = (ICodec)Activator.CreateInstance(type);
                        if (codec != null)
                        {
                            if (codec.Name() != null)
                            {
                                codec.Start();
                                Codecs.Add(codec);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        LogManager.Instance.WriteException("Failed to create instance of codec of type {0} from assembly {1}",
                            type, assembly.FullName);
                        LogManager.Instance.WriteException(e.Message);
                    }
                }
            }
        }