Exemple #1
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var catalog   = new AttributedAssemblyPartCatalog(System.Reflection.Assembly.GetExecutingAssembly());
            var container = new CompositionContainer(catalog);

            container.Compose();
            var inspectors = container.GetExportedObjects <IAudioFileInspector>();

            /*List<IAudioFileInspector> inspectors = new List<IAudioFileInspector>();
             * inspectors.Add(new WaveFileInspector());
             * inspectors.Add(new MidiFileInspector());
             * inspectors.Add(new SoundFontInspector());
             * inspectors.Add(new CakewalkMapInspector());*/

            if (args.Length > 0)
            {
                if (args[0] == "-install")
                {
                    try
                    {
                        OptionsForm.Associate(inspectors);
                        Console.WriteLine("Created {0} file associations", inspectors.Count);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Unable to create file associations");
                        Console.WriteLine(e.ToString());
                        return(-1);
                    }

                    return(0);
                }
                else if (args[0] == "-uninstall")
                {
                    try
                    {
                        OptionsForm.Disassociate(inspectors);
                        Console.WriteLine("Removed {0} file associations", inspectors.Count);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Unable to remove file associations");
                        Console.WriteLine(e.ToString());
                        return(-1);
                    }
                    return(0);
                }
            }
            var mainForm = container.GetExportedObject <AudioFileInspectorForm>();

            mainForm.CommandLineArguments = args;
            Application.Run(mainForm);
            return(0);
        }
Exemple #2
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            
            var catalog = new AttributedAssemblyPartCatalog(System.Reflection.Assembly.GetExecutingAssembly());            
            var container = new CompositionContainer(catalog);
            container.Compose();
            var inspectors = container.GetExportedObjects<IAudioFileInspector>();
            
            /*List<IAudioFileInspector> inspectors = new List<IAudioFileInspector>();
            inspectors.Add(new WaveFileInspector());
            inspectors.Add(new MidiFileInspector());
            inspectors.Add(new SoundFontInspector());
            inspectors.Add(new CakewalkMapInspector());*/

            if (args.Length > 0)
            {
                if (args[0] == "-install")
                {
                    try
                    {
                        OptionsForm.Associate(inspectors);
                        Console.WriteLine("Created {0} file associations", inspectors.Count); 
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Unable to create file associations");
                        Console.WriteLine(e.ToString());
                        return -1;
                    }

                    return 0;
                }
                else if (args[0] == "-uninstall")
                {
                    try
                    {
                        OptionsForm.Disassociate(inspectors);
                        Console.WriteLine("Removed {0} file associations", inspectors.Count);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Unable to remove file associations");
                        Console.WriteLine(e.ToString());
                        return -1;
                    }
                    return 0;
                }
            }
            var mainForm = container.GetExportedObject<AudioFileInspectorForm>();
            mainForm.CommandLineArguments = args;
            Application.Run(mainForm);
            return 0;
        }
Exemple #3
0
        /// <summary>
        /// use managed extensibility framework to discover effects and load them into the main form
        /// </summary>
        private void Compose()
        {
            var catalog = new AggregatingComposablePartCatalog();
            var mainAssemblyCatalog = new AttributedAssemblyPartCatalog(this.GetType().Assembly);
            var jsNetCatalog = new AttributedAssemblyPartCatalog(typeof(Effect).Assembly);
            //var addInEffects = new DirectoryPartCatalog("Effects");

            catalog.Catalogs.Add(mainAssemblyCatalog);
            catalog.Catalogs.Add(jsNetCatalog);
            //catalog.Catalogs.Add(addInEffects);
            var container = new CompositionContainer(catalog);

            container.AddPart(this);
            container.Compose();
        }
Exemple #4
0
        /// <summary>
        /// use managed extensibility framework to discover effects and load them into the main form
        /// </summary>
        private void Compose()
        {
            var catalog             = new AggregatingComposablePartCatalog();
            var mainAssemblyCatalog = new AttributedAssemblyPartCatalog(this.GetType().Assembly);
            var jsNetCatalog        = new AttributedAssemblyPartCatalog(typeof(Effect).Assembly);

            //var addInEffects = new DirectoryPartCatalog("Effects");

            catalog.Catalogs.Add(mainAssemblyCatalog);
            catalog.Catalogs.Add(jsNetCatalog);
            //catalog.Catalogs.Add(addInEffects);
            var container = new CompositionContainer(catalog);

            container.AddPart(this);
            container.Compose();
        }