Esempio n. 1
0
        public static ICoreSetup GetSetup()
        {
            var setup = new CoreSetup();

            setup.Disable(ComponentSlots.UserInterface);
            return(setup);
        }
Esempio n. 2
0
        private static void Encode(Stream input, Stream output, Stream error)
        {
            var setup = new CoreSetup();

            setup.Disable(ComponentSlots.All);
            setup.Enable(ComponentSlots.Configuration);
            setup.Enable(ComponentSlots.Logger);
            using (var core = new Core(setup))
            {
                try
                {
                    core.Load(new[]
                    {
                        //Stub component used to provide the configuration.
                        new BassEncoderBehaviourStub()
                    });
                    core.Initialize();
                }
                catch (Exception e)
                {
                    Logger.Write(typeof(BassEncoderHost), LogLevel.Error, "Failed to initialize core: {0}", e.Message);
                    throw;
                }
                try
                {
                    Logger.Write(typeof(BassEncoderHost), LogLevel.Debug, "Begin reading items.");
                    var encoderItems = ReadInput <EncoderItem[]>(input);
                    Logger.Write(typeof(BassEncoderHost), LogLevel.Debug, "Read {0} items.", encoderItems.Length);
                    using (var encoder = new BassEncoder(encoderItems))
                    {
                        encoder.InitializeComponent(core);
                        Encode(encoder, input, output, error);
                    }
                }
                catch (Exception e)
                {
                    Logger.Write(typeof(BassEncoderHost), LogLevel.Error, "Failed to encode items: {0}", e.Message);
                    throw;
                }
            }
        }