Beispiel #1
0
        static void Main(string[] args)
        {
            //check for the first time
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (mySettings.FirstTime)
            {
                var i = new GUI.FirstTime();
                i.ShowDialog();
            }
            if (args.Length > 0)
            {
                //we have a context menu item...
                string filename = args[0].ToLower();
                if (System.IO.File.Exists(filename))
                {
                    //check if its a valid picture format.
                    if (Common.IsValidImage(filename))
                    {
                        skImage ski = new skImage(Image.FromFile(filename), filename);
                        Common.ShowToastForm(ski);
                    }
                    else if (System.IO.Path.GetExtension(filename) == ".psd")
                    {
                        //its a PSD file.
                        //save a local copy of the PSD as jpeg
                        //double check location
                        Photoshop.PsdFile psd = new Photoshop.PsdFile();
                        //load the file
                        psd.Load(filename);
                        //decode the image
                        Image myPsdImage = Photoshop.ImageDecoder.DecodeImage(psd);
                        //create new image
                        skImage ski = new skImage(myPsdImage);
                        Common.ShowToastForm(ski);
                    }
                    //exit silently
                }
            }
            else
            {
                bool  firstInstance;
                Mutex mutex = new Mutex(false, "Local\\" + "SkimptProgramRunning", out firstInstance);

                if (firstInstance)
                {
                    Application.Run(new GUI.main());
                }
            }
            //wait till all toast forms are closed
            while (Application.OpenForms.Count > 0)
            {
                Application.DoEvents();
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //check for the first time
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (mySettings.FirstTime) {
                var i = new GUI.FirstTime();
                i.ShowDialog();
            }
            if (args.Length > 0) {
                //we have a context menu item...
                string filename = args[0].ToLower();
                if (System.IO.File.Exists(filename)) {
                    //check if its a valid picture format.
                    if (Common.IsValidImage(filename)) {
                        skImage ski = new skImage(Image.FromFile(filename), filename);
                        Common.ShowToastForm(ski);
                    } else if (System.IO.Path.GetExtension(filename) == ".psd") {
                        //its a PSD file.
                        //save a local copy of the PSD as jpeg
                        //double check location
                        Photoshop.PsdFile psd = new Photoshop.PsdFile();
                        //load the file
                        psd.Load(filename);
                        //decode the image
                        Image myPsdImage = Photoshop.ImageDecoder.DecodeImage(psd);
                        //create new image
                        skImage ski = new skImage(myPsdImage);
                        Common.ShowToastForm(ski);
                    }
                    //exit silently
                }
            } else {
                bool firstInstance;
                Mutex mutex = new Mutex(false, "Local\\" + "SkimptProgramRunning", out firstInstance);

                if (firstInstance) {
                    Application.Run(new GUI.main());
                }
            }
            //wait till all toast forms are closed
            while (Application.OpenForms.Count > 0)
            {
                  Application.DoEvents();
            }
        }
Beispiel #3
0
        static void Main(string [] args)
        {
            if (args.Length > 0)
            {
                //we have a context menu item...
                string filename = args[0].ToLower();

                //check for valid item
                if (System.IO.File.Exists(filename))
                {
                    //check if its a valid picture format.
                    if (System.IO.Path.GetExtension(filename) == ".jpg")
                    {
                        Util.utilities.ShowToastForm(filename);
                    }
                    else if (System.IO.Path.GetExtension(filename) == ".psd")
                    {
                        //its a PSD file.

                        //save a local copy of the PSD as jpeg
                        //double check location
                        if (System.IO.File.Exists(filename))
                        {
                            Photoshop.PsdFile psd = new Photoshop.PsdFile();
                            //load the file
                            psd.Load(filename);
                            //decode the image
                            Image myPsdImage = Photoshop.ImageDecoder.DecodeImage(psd);
                            //create new filename string
                            string newfilename = System.IO.Path.GetFileNameWithoutExtension(filename) + "-skimpt" + ".jpg";
                            myPsdImage.Save(newfilename);
                            Util.utilities.ShowToastForm(newfilename);
                        }
                    }
                    else
                    {
                        Util.utilities.ShowMessage("Not a valid file", "failed");
                    }
                }
            }
            else
            {
                bool  firstInstance;
                Mutex mutex = new Mutex(false, "Local\\" + "SkimptProgramRunning", out firstInstance);

                if (firstInstance)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new main());
                }
            }

            //wait till all toast forms are closed
            while (Application.OpenForms.Count > 0)
            {
                Application.DoEvents();
            }


            //   Logger logger = new Logger(3, "test.txt");


            //   for (int x = 0; x < 100; x++)
            //   {
            //       for (int i = 0; i < 100; i++)
            //       {
            //           logger.log(i % 6, "TEST", "message " + i);
            //       }
            //       //Thread.Sleep(500);
            //   }
            //MessageBox.Show ((DateTime.Now.ToFileTime() / 10000).ToString());
            //   //			logger.log(0, "TEST", "message 1");
            //   //			logger.log(1, "TEST", "message 2");
            //   //			logger.log(2, "TEST", "message 3");
            //   //System.Console.ReadLine();
            //   logger.shutdown();
        }
Beispiel #4
0
        static void Main(string [] args)
        {
            if(args.Length > 0)
            {
                //we have a context menu item...
                string filename = args[0].ToLower();

                //check for valid item
                if(System.IO.File.Exists(filename))
                {

                    //check if its a valid picture format.
                    if(System.IO.Path.GetExtension(filename) == ".jpg") {
                        Util.utilities.ShowToastForm(filename);
                    } else if(System.IO.Path.GetExtension(filename) == ".psd") {
                        //its a PSD file.

                        //save a local copy of the PSD as jpeg
                        //double check location
                        if(System.IO.File.Exists(filename)) {
                            Photoshop.PsdFile psd = new Photoshop.PsdFile();
                            //load the file
                            psd.Load(filename);
                            //decode the image
                            Image myPsdImage = Photoshop.ImageDecoder.DecodeImage(psd);
                            //create new filename string
                            string newfilename = System.IO.Path.GetFileNameWithoutExtension(filename) + "-skimpt" + ".jpg";
                            myPsdImage.Save(newfilename);
                            Util.utilities.ShowToastForm(newfilename);
                        }
                    } else {
                        Util.utilities.ShowMessage("Not a valid file", "failed");
                    }
                }
            }
            else
            {
                bool firstInstance;
                Mutex mutex = new Mutex(false, "Local\\" + "SkimptProgramRunning", out firstInstance);

                if(firstInstance)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new main());
                }
            }

            //wait till all toast forms are closed
            while(Application.OpenForms.Count > 0)
                Application.DoEvents();

             //   Logger logger = new Logger(3, "test.txt");

             //   for (int x = 0; x < 100; x++)
             //   {
             //       for (int i = 0; i < 100; i++)
             //       {
             //           logger.log(i % 6, "TEST", "message " + i);
             //       }
             //       //Thread.Sleep(500);
             //   }
             //MessageBox.Show ((DateTime.Now.ToFileTime() / 10000).ToString());
             //   //			logger.log(0, "TEST", "message 1");
             //   //			logger.log(1, "TEST", "message 2");
             //   //			logger.log(2, "TEST", "message 3");
             //   //System.Console.ReadLine();
             //   logger.shutdown();
        }