Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();

            // Enable Portable mode as default if possible
            GlobalSetting.IsPortableMode = GlobalSetting.IsStartUpDirWritable;

            string topcmd = args[0].ToLower().Trim();

            if (topcmd == "igupdate")// check for update
            {
                Core.CheckForUpdate();
            }
            else if (topcmd == "igautoupdate")// auto check for update
            {
                Core.AutoUpdate();
            }
            else if (topcmd == "firstlaunch")
            {
                Application.Run(new frmFirstLaunch());
            }
        }
Ejemplo n.º 2
0
        static int Main(string[] args)
        {
            string topcmd = args[0].ToLower().Trim();

            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();


            //Set desktop wallpaper
            #region setwallpaper <string imgPath> [int style]
            if (topcmd == "setwallpaper")
            {
                //Get image's path
                string imgPath = args[1];
                var    style   = DesktopWallapaper.Style.Current;

                if (args.Length > 2)
                {
                    //Get style
                    Enum.TryParse(args[2], out style);
                }

                //Apply changes and return exit code
                return((int)DesktopWallapaper.Set(imgPath, style));
            }
            #endregion


            // check for update
            else if (topcmd == "igupdate")
            {
                Core.CheckForUpdate();
            }


            // auto check for update
            else if (topcmd == "igautoupdate")
            {
                Core.AutoUpdate();
            }


            // run first launch configs
            else if (topcmd == "firstlaunch")
            {
                Application.Run(new frmFirstLaunch());
            }

            return(0);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get and load value of General tab
        /// </summary>
        private void LoadTabGeneralConfig()
        {
            //Get value of chkWelcomePicture ----------------------------------------------------
            chkWelcomePicture.Checked = GlobalSetting.IsShowWelcome;

            //Get value of chkShowToolBar
            chkShowToolBar.Checked = GlobalSetting.IsShowToolBar;

            //Get Portable mode value -----------------------------------------------------------
            chkPortableMode.Checked = GlobalSetting.IsPortableMode;
            if (!GlobalSetting.CheckStartUpDirWritable())
            {
                chkPortableMode.Enabled = false;
            }

            //Get value of cmbAutoUpdate --------------------------------------------------------
            string configValue = GlobalSetting.GetConfig("AutoUpdate", DateTime.Now.ToString());

            if (configValue != "0")
            {
                chkAutoUpdate.Checked = true;
            }
            else
            {
                chkAutoUpdate.Checked = false;
            }

            //Get value of IsAllowMultiInstances
            chkAllowMultiInstances.Checked = GlobalSetting.IsAllowMultiInstances;

            //Get value of IsPressESCToQuit
            chkESCToQuit.Checked = GlobalSetting.IsPressESCToQuit;

            //Get value of IsConfirmationDelete
            chkConfirmationDelete.Checked = GlobalSetting.IsConfirmationDelete;

            //Get value of IsScrollbarsVisible
            chkShowScrollbar.Checked = GlobalSetting.IsScrollbarsVisible;

            //Get background color
            picBackgroundColor.BackColor = GlobalSetting.BackgroundColor;
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();

            // Enable Portable mode as default if possible
            GlobalSetting.IsPortableMode = GlobalSetting.IsStartUpDirWritable;

            string topcmd = args[0].ToLower().Trim();

            if (topcmd == "igupdate")// check for update
            {
                Core.CheckForUpdate();
            }
            else if (topcmd == "igautoupdate")// auto check for update
            {
                Core.AutoUpdate();
            }
            else if (topcmd == "igpacktheme")// pack theme *.igtheme
            {
                //cmd: igcmd.exe igpacktheme "srcDir" "desFile"
                Core.PackTheme(args[1], args[2]);
            }
            else if (topcmd == "iginstalltheme")//install theme
            {
                Core.InstallTheme(args[1]);
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] argv)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Guid guid = new Guid(appGuid);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();


            //check if user enable TEMPORARY portable mode ------------------------------
            GlobalSetting.IsPortableMode = false;

            if (argv.ToList().IndexOf("--portable") != -1)
            {
                GlobalSetting.IsPortableMode = true;
            }
            else
            {
                string configValue = GlobalSetting.GetConfig("IsPortableMode", "False", true);
                GlobalSetting.IsPortableMode = bool.Parse(configValue);
            }

            //auto update----------------------------------------------------------------
            string lastUpdateConfig = GlobalSetting.GetConfig("AutoUpdate", "7/26/1991 12:13:08 AM");

            if (lastUpdateConfig != "0")
            {
                DateTime lastUpdate = DateTime.Now;

                if (DateTime.TryParse(lastUpdateConfig, out lastUpdate))
                {
                    //Check for update every 7 days
                    if (DateTime.Now.Subtract(lastUpdate).TotalDays > 7)
                    {
                        Process p = new Process();
                        p.StartInfo.FileName  = GlobalSetting.StartUpDir + "igcmd.exe";
                        p.StartInfo.Arguments = "igautoupdate";
                        p.Start();
                    }
                }
            }

            //save last update
            GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"));

            //get current config
            GlobalSetting.IsAllowMultiInstances = bool.Parse(GlobalSetting.GetConfig("IsAllowMultiInstances", "true"));

            //check if allows multi instances
            if (GlobalSetting.IsAllowMultiInstances)
            {
                Application.Run(formMain = new frmMain());
            }
            else
            {
                //single instance is required
                using (SingleInstance singleInstance = new SingleInstance(guid))
                {
                    if (singleInstance.IsFirstInstance)
                    {
                        singleInstance.ArgumentsReceived += SingleInstance_ArgumentsReceived;
                        singleInstance.ListenForArgumentsFromSuccessiveInstances();

                        Application.Run(formMain = new frmMain());
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(Environment.GetCommandLineArgs());
                    }
                }
            } //end check multi instances
        }
Ejemplo n.º 6
0
        static void Main(string[] argv)
        {
            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();


            // Set up Startup Profile to improve launch performance
            // https://blogs.msdn.microsoft.com/dotnet/2012/10/18/an-easy-solution-for-improving-app-launch-performance/
            ProfileOptimization.SetProfileRoot(GlobalSetting.ConfigDir());
            ProfileOptimization.StartProfile("igstartup.profile");

            // Issue #360: IG periodically searching for dismounted device
            SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS);

            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Guid guid = new Guid(appGuid);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            // Save App version
            GlobalSetting.SetConfig("AppVersion", Application.ProductVersion.ToString());


            #region Check First-launch Configs
            var firstLaunchVersion = 0;

            int.TryParse(GlobalSetting.GetConfig("FirstLaunchVersion", "0"), out firstLaunchVersion);

            if (firstLaunchVersion < GlobalSetting.FIRST_LAUNCH_VERSION)
            {
                Process p = new Process();
                p.StartInfo.FileName  = GlobalSetting.StartUpDir("igcmd.exe");
                p.StartInfo.Arguments = "firstlaunch";

                try
                {
                    p.Start();
                }
                catch { }

                Application.Exit();
                return;
            }
            #endregion


            #region Auto update
            string lastUpdateConfig = GlobalSetting.GetConfig("AutoUpdate", "7/26/1991 12:13:08 AM");

            if (lastUpdateConfig != "0")
            {
                DateTime lastUpdate = DateTime.Now;

                if (DateTime.TryParseExact(lastUpdateConfig, "M/d/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out lastUpdate))
                {
                    //Check for update every 3 days
                    if (DateTime.Now.Subtract(lastUpdate).TotalDays > 3)
                    {
                        RunCheckForUpdate();
                    }
                }
                else
                {
                    RunCheckForUpdate();
                }
            }


            void RunCheckForUpdate()
            {
                Process p = new Process();

                p.StartInfo.FileName  = GlobalSetting.StartUpDir("igcmd.exe");
                p.StartInfo.Arguments = "igautoupdate";
                p.Start();

                //save last update
                GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.ToString("M/d/yyyy HH:mm:ss"));
            }

            #endregion


            #region Multi instances
            //get current config
            GlobalSetting.IsAllowMultiInstances = bool.Parse(GlobalSetting.GetConfig("IsAllowMultiInstances", "true"));

            //check if allows multi instances
            if (GlobalSetting.IsAllowMultiInstances)
            {
                Application.Run(formMain = new frmMain());
            }
            else
            {
                //single instance is required
                using (SingleInstance singleInstance = new SingleInstance(guid))
                {
                    if (singleInstance.IsFirstInstance)
                    {
                        singleInstance.ArgumentsReceived += SingleInstance_ArgumentsReceived;
                        singleInstance.ListenForArgumentsFromSuccessiveInstances();

                        Application.Run(formMain = new frmMain());
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(Environment.GetCommandLineArgs());
                    }
                }
            } //end check multi instances
            #endregion
        }
        static void Main(string[] argv)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Guid guid = new Guid(appGuid);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();

            // Enable Portable mode as default if possible
            GlobalSetting.IsPortableMode = GlobalSetting.IsStartUpDirWritable;

            // Save App version
            GlobalSetting.SetConfig("AppVersion", Application.ProductVersion.ToString());

            #region Check First-launch Configs
            var firstLaunchVersion = 0;

            int.TryParse(GlobalSetting.GetConfig("FirstLaunchVersion", "0"), out firstLaunchVersion);

            if (firstLaunchVersion < GlobalSetting.FIRST_LAUNCH_VERSION)
            {
                Process p = new Process();
                p.StartInfo.FileName  = Path.Combine(GlobalSetting.StartUpDir, "igcmd.exe");
                p.StartInfo.Arguments = "firstlaunch";

                try
                {
                    p.Start();
                }
                catch { }

                Application.Exit();
                return;
            }
            #endregion


            #region Auto update
            string lastUpdateConfig = GlobalSetting.GetConfig("AutoUpdate", "7/26/1991 12:13:08 AM");

            if (lastUpdateConfig != "0")
            {
                DateTime lastUpdate = DateTime.Now;

                if (DateTime.TryParseExact(lastUpdateConfig, "M/d/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out lastUpdate))
                {
                    //Check for update every 3 days
                    if (DateTime.Now.Subtract(lastUpdate).TotalDays > 3)
                    {
                        RunCheckForUpdate();
                    }
                }
                else
                {
                    RunCheckForUpdate();
                }
            }


            void RunCheckForUpdate()
            {
                Process p = new Process();

                p.StartInfo.FileName  = GlobalSetting.StartUpDir + "igcmd.exe";
                p.StartInfo.Arguments = "igautoupdate";
                p.Start();

                //save last update
                GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.ToString("M/d/yyyy HH:mm:ss"));
            }

            #endregion


            #region Multi instances
            //get current config
            GlobalSetting.IsAllowMultiInstances = bool.Parse(GlobalSetting.GetConfig("IsAllowMultiInstances", "true"));

            //check if allows multi instances
            if (GlobalSetting.IsAllowMultiInstances)
            {
                Application.Run(formMain = new frmMain());
            }
            else
            {
                //single instance is required
                using (SingleInstance singleInstance = new SingleInstance(guid))
                {
                    if (singleInstance.IsFirstInstance)
                    {
                        singleInstance.ArgumentsReceived += SingleInstance_ArgumentsReceived;
                        singleInstance.ListenForArgumentsFromSuccessiveInstances();

                        Application.Run(formMain = new frmMain());
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(Environment.GetCommandLineArgs());
                    }
                }
            } //end check multi instances
            #endregion
        }
Ejemplo n.º 8
0
        private static int Main(string[] argv)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            args = argv;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();

            // Command
            string topcmd = args[0].ToLower().Trim();


            // Set desktop wallpaper
            #region setwallpaper <string imgPath> [int style]
            if (topcmd == "setwallpaper")
            {
                //Get image's path
                string imgPath = args[1];
                var    style   = DesktopWallapaper.Style.Current;

                if (args.Length > 2)
                {
                    //Get style
                    Enum.TryParse(args[2], out style);
                }

                //Apply changes and return exit code
                return((int)DesktopWallapaper.Set(imgPath, style));
            }
            #endregion


            // Register file associations
            #region regassociations <string exts>
            else if (topcmd == "regassociations")
            {
                //get Extensions
                string exts = args[1];

                return(Functions.SetRegistryAssociations(exts));
            }
            #endregion


            // Delete all file associations
            #region delassociations
            else if (topcmd == "delassociations")
            {
                return(Functions.DeleteRegistryAssociations(GlobalSetting.AllImageFormats, true));
            }
            #endregion


            // Install new language packs
            #region iginstalllang
            else if (topcmd == "iginstalllang")
            {
                Functions.InstallLanguagePacks();
            }
            #endregion


            // Create new language packs
            #region ignewlang
            else if (topcmd == "ignewlang")
            {
                Functions.CreateNewLanguagePacks();
            }
            #endregion


            // Edit language packs
            #region igeditlang <string filename>
            else if (topcmd == "igeditlang")
            {
                //get Executable file
                string filename = args[1];

                Functions.EditLanguagePacks(filename);
            }
            #endregion


            // Register URI Scheme for Web-to-App linking
            #region reg-uri-scheme
            else if (topcmd == "reg-uri-scheme")
            {
                return(Functions.SetURIScheme());
            }
            #endregion


            // Delete URI Scheme registry
            #region del-uri-scheme
            else if (topcmd == "del-uri-scheme")
            {
                return(Functions.DeleteURIScheme());
            }
            #endregion


            return(0);
        }