Esempio n. 1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProgramExe  = Application.ExecutablePath;
            ProgramPath =
                Directory.GetParent(Application.ExecutablePath).ToString();
            OptionsFile = Environment.GetFolderPath(
                Environment.SpecialFolder.LocalApplicationData) +
                          "\\SBIP\\options.dat";

            if (args.Length == 1 &&
                args[0] == UpdateArgument &&
                VistaSecurity.IsAdmin())
            {
                AutoUpdater updater = new AutoUpdater(
                    OptionsFile,
                    "http://franknagl.de/updates/SBIP/update.csv",
                    ProgramPath,
                    ProgramExe);
                updater.MakeUpdate();
                return;
            }

            // check (and repair) context menu entries
            if (CheckContextMenuEntries())
            {
                return;
            }

            //Creates only by very first start of SBIP
            if (!File.Exists(OptionsFile))
            {
                CreateOptionsFile(OptionsFile);
            }

            ProcessorForm form;

            // start with parameter
            if (args.Length == 2 && args[1] == "sbip.frank")
            {
                form = new ProcessorForm(args[0]);
            }
            // normal start
            else
            {
                form = new ProcessorForm();
            }

            Application.Run(form);
            //if (form.IsDisposed)
            //{
            //    return;
            //}

            //form.Show();
            //while (form.Created)
            //{
            //    //form.Processor.Render();
            //    //form.UpdateEachFrame(false);
            //    Application.DoEvents();
            //}

            #region TODO Frank Nagl: Delete this region.
            //Bitmap image = new Bitmap("sample1.jpg");

            //// 1. Offline rendering
            //// create Processor, used as rendering framework
            //Processor processor = new Processor();
            //// starts Processor
            //processor.Begin(image);
            //// create RotateChannels filter
            //RotateChannels filter = new RotateChannels();
            //processor.Filter = filter;
            //// optional: configure filter
            //filter.Order = RGBOrder.GBR;
            //// apply the filter
            //Bitmap resultImage = processor.RenderToBitmap();
            ////Texture2D resultTexture = processor.RenderToTexture( );
            //resultImage.Save("RotateChannels.jpg", ImageFormat.Jpeg);
            //processor.End();

            //// 2. Online rendering
            //// create any windows control for rendering in
            //Form myForm = new Form();
            //// create Processor, used as rendering framework
            //Processor processor2 = new Processor();
            //// starts Processor
            //processor2.Begin(image, myForm);
            //// create ExtractChannel filter
            //RotateChannels filter2 = new RotateChannels();
            //processor2.Filter = filter2;
            //// optional: configure filter
            //filter2.Order = RGBOrder.GBR;

            //// apply the filter
            //myForm.Show();
            //while (myForm.Created)
            //{
            //    processor2.Render();
            //    Application.DoEvents();
            //}
            //processor2.End();

            #endregion TODO Frank Nagl: Delete this region.
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProgramExe = Application.ExecutablePath;
            ProgramPath =
                Directory.GetParent(Application.ExecutablePath).ToString();
            OptionsFile = Environment.GetFolderPath(
                Environment.SpecialFolder.LocalApplicationData) +
                "\\SBIP\\options.dat";

            if (args.Length == 1 &&
                args[0] == UpdateArgument &&
                VistaSecurity.IsAdmin())
            {
                AutoUpdater updater = new AutoUpdater(
                                OptionsFile,
                                "http://franknagl.de/updates/SBIP/update.csv",
                                ProgramPath,
                                ProgramExe);
                updater.MakeUpdate();
                return;
            }

            // check (and repair) context menu entries
            if (CheckContextMenuEntries())
            {
                return;
            }

            //Creates only by very first start of SBIP
            if (!File.Exists(OptionsFile))
            {
                CreateOptionsFile(OptionsFile);
            }

            ProcessorForm form;
            // start with parameter
            if (args.Length == 2 && args[1] == "sbip.frank")
            {
                form = new ProcessorForm(args[0]);
            }
            // normal start
            else
            {
                form = new ProcessorForm();
            }

            Application.Run(form);
            //if (form.IsDisposed)
            //{
            //    return;
            //}

            //form.Show();
            //while (form.Created)
            //{
            //    //form.Processor.Render();
            //    //form.UpdateEachFrame(false);
            //    Application.DoEvents();
            //}

            #region TODO Frank Nagl: Delete this region.
            //Bitmap image = new Bitmap("sample1.jpg");

            //// 1. Offline rendering
            //// create Processor, used as rendering framework
            //Processor processor = new Processor();
            //// starts Processor
            //processor.Begin(image);
            //// create RotateChannels filter
            //RotateChannels filter = new RotateChannels();
            //processor.Filter = filter;
            //// optional: configure filter
            //filter.Order = RGBOrder.GBR;
            //// apply the filter
            //Bitmap resultImage = processor.RenderToBitmap();
            ////Texture2D resultTexture = processor.RenderToTexture( );
            //resultImage.Save("RotateChannels.jpg", ImageFormat.Jpeg);
            //processor.End();

            //// 2. Online rendering
            //// create any windows control for rendering in
            //Form myForm = new Form();
            //// create Processor, used as rendering framework
            //Processor processor2 = new Processor();
            //// starts Processor
            //processor2.Begin(image, myForm);
            //// create ExtractChannel filter
            //RotateChannels filter2 = new RotateChannels();
            //processor2.Filter = filter2;
            //// optional: configure filter
            //filter2.Order = RGBOrder.GBR;

            //// apply the filter
            //myForm.Show();
            //while (myForm.Created)
            //{
            //    processor2.Render();
            //    Application.DoEvents();
            //}
            //processor2.End();

            #endregion TODO Frank Nagl: Delete this region.
        }