예제 #1
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);
        }
예제 #2
0
        private static int Main(string[] args)
        {
            // Issue #360: IG periodically searching for dismounted device
            // This _must_ be executed first!
            SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS);

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

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

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

            // Load user configs
            Configs.Load();

            // Set desktop wallpaper
            #region setwallpaper <string imgPath> [int style]
            if (topcmd == "setwallpaper")
            {
                // Get image's path
                var 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")
            {
                return(Core.CheckForUpdate() ? 1 : 0);
            }

            // auto check for update
            else if (topcmd == "igautoupdate")
            {
                return(Core.AutoUpdate() ? 1 : 0);
            }

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

            return(0);
        }
예제 #3
0
        /// <summary>
        /// Set desktop wallpaper - without administrator rights.
        /// Not using admin allows using network shares which are not
        /// connected for the Admin account.
        /// If this fails, invoke igtasks to attempt again.
        /// </summary>
        internal static int SetWallpaper(string[] args)
        {
            if (args.Length < 2)
            {
                return((int)DesktopWallapaper.Result.Success); // Failed to provide image path (but 'success')
            }
            string imgPath = args[1];

            DesktopWallapaper.Style style = DesktopWallapaper.Style.Centered;
            if (args.Length > 2)
            {
                if (!Enum.TryParse(args[2], out style))
                {
                    style = DesktopWallapaper.Style.Current;
                }
            }
            var result = DesktopWallapaper.Set(imgPath, style);

            // TODO attempt to clear local policy settings

            return((int)result);
        }
예제 #4
0
        static void Main(string[] argv)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            args = argv;

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

            //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];

                if (args.Length > 2)
                {
                    //Get style
                    string style = args[2];

                    //Apply changes
                    if (style == "1")
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Stretched);
                    }
                    else if (style == "2")
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Tiled);
                    }
                    else //style == "0"
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Current);
                    }
                }
                else
                {
                    //Apply changes
                    DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Centered);
                }

                Application.Exit();
            }
            #endregion

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

                Functions.SetRegistryAssociations(exts);

                Application.Exit();
            }
            #endregion

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

                Application.Exit();
            }
            #endregion

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

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

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

                Functions.EditLanguagePacks(filename);
                Application.Exit();
            }
            #endregion

            //Install new extensions
            #region iginstallext
            else if (topcmd == "iginstallext")
            {
                Functions.InstallExtensions();
                Application.Exit();
            }
            #endregion
        }
예제 #5
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);

            // Load user configs
            Configs.Load();

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

            // Set desktop wallpaper
            #region setwallpaper <string imgPath> [int style]
            if (topcmd == "setwallpaper")
            {
                //Get image's path
                var 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
                var exts = args[1];

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

            // Delete all file associations
            #region delassociations
            else if (topcmd == "delassociations")
            {
                var formats = Configs.GetImageFormats(Configs.AllFormats);
                return(Functions.DeleteRegistryAssociations(formats, 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
                var 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);
        }
예제 #6
0
        static void Main(string[] argv)
        {
            args = argv;

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

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


            //Add menu 'Open with ImageGlass'
            #region addext <string igPath> [string ext]
            if (topcmd == "addext")
            {
                //Get executable file path
                string exePath = args[1];

                if (args.Length > 2)
                {
                    //Get extension
                    string ext = args[2];

                    //Apply changes
                    Functions.AddImageGlassToContextMenu(exePath, ext);
                }
                else
                {
                    //Apply changes
                    Functions.AddImageGlassToContextMenu(exePath);
                }

                Application.Exit();
            }
            #endregion

            //Remove menu 'Open with ImageGlass'
            #region removeext
            else if (topcmd == "removeext")
            {
                //Apply changes
                Functions.RemoveImageGlassToContextMenu();

                Application.Exit();
            }
            #endregion

            //Update extension for Menu
            #region updateext <string exePath> <string exts>
            else if (topcmd == "updateext")
            {
                //Remove all
                Functions.RemoveImageGlassToContextMenu();

                //Add new
                if (args.Length > 2)
                {
                    //Get executable file path
                    string exePath = args[1];

                    //Get extension
                    string ext = args[2];

                    //Apply changes
                    Functions.AddImageGlassToContextMenu(exePath, ext);
                }

                Application.Exit();
            }
            #endregion

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

                if (args.Length > 2)
                {
                    //Get style
                    string style = args[2];

                    //Apply changes
                    if (style == "1")
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Stretched);
                    }
                    else if (style == "2")
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Tiled);
                    }
                    else //style == "0"
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Centered);
                    }
                }
                else
                {
                    //Apply changes
                    DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Centered);
                }

                Application.Exit();
            }
            #endregion

            //Register file association
            #region regassociations <string appPath> <string exts>
            else if (topcmd == "regassociations")
            {
                //get Executable file
                string appPath = args[1];
                //get Extension
                string exts = args[2];

                Functions.RegisterAssociation(appPath, exts);

                Application.Exit();
            }
            #endregion

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

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

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

                Functions.EditLanguagePacks(filename);
                Application.Exit();
            }
            #endregion

            //Install new extensions
            #region iginstallext
            else if (topcmd == "iginstallext")
            {
                Functions.InstallExtensions();
                Application.Exit();
            }
            #endregion
        }
예제 #7
0
        static void Main(string[] argv)
        {
            args = argv;

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

            //Lay param dau tien
            string topcmd = args[0].ToLower().Trim();

            //Them menu 'Open with ImageGlass'
            #region addext <string igPath> [string ext]
            if (topcmd == "addext")
            {
                //Lay duong dan exe
                string exePath = args[1];

                if (args.Length > 2)
                {
                    //Lay extension
                    string ext = args[2];

                    //Ap dung
                    Functions.AddImageGlassToContextMenu(exePath, ext);
                }
                else
                {
                    //Ap dung
                    Functions.AddImageGlassToContextMenu(exePath);
                }

                Application.Exit();
            }
            #endregion

            //Xoa menu 'Open with ImageGlass'
            #region removeext
            else if (topcmd == "removeext")
            {
                //Ap dung
                Functions.RemoveImageGlassToContextMenu();

                Application.Exit();
            }
            #endregion

            //Cap nhat extension cho Menu
            #region updateext <string exePath> <string exts>
            else if (topcmd == "updateext")
            {
                //Xoa tat ca
                Functions.RemoveImageGlassToContextMenu();

                //Them moi
                if (args.Length > 2)
                {
                    //Lay duong dan ImageGlass.exe
                    string exePath = args[1];

                    //Lay extension
                    string ext = args[2];

                    //Ap dung
                    Functions.AddImageGlassToContextMenu(exePath, ext);
                }

                Application.Exit();
            }
            #endregion

            //Thiet dat hinh nen wallpaper
            #region setwallpaper <string imgPath> [int style]
            else if (topcmd == "setwallpaper")
            {
                //Lay duong dan img
                string imgPath = args[1];

                if (args.Length > 2)
                {
                    //Lay style
                    string style = args[2];

                    //Ap dung
                    if (style == "1")
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Stretched);
                    }
                    else if (style == "2")
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Tiled);
                    }
                    else //style == "0"
                    {
                        DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Centered);
                    }
                }
                else
                {
                    //Ap dung
                    DesktopWallapaper.Set(new Uri(imgPath), DesktopWallapaper.Style.Centered);
                }

                Application.Exit();
            }
            #endregion

            //Register file association
            #region regassociations <string ext> <string programID> <string description> <string icon> <string igPath> <string appName>
            else if (topcmd == "regassociations")
            {
                //get Extension
                string ext = args[1];
                //get Program ID
                string programID = args[2];
                //get Extension description
                string description = args[3];
                //get .ICO path
                string icon = args[4];
                //get Executable file
                string igPath = args[5];
                //get Application name
                string appName = args[6];

                Functions.RegisterAssociation(ext, programID, description, icon, igPath, appName);

                Application.Exit();
            }
            #endregion
        }
예제 #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



            return(0);
        }