Exemplo n.º 1
0
        /// <summary>
        /// Pass Url to Internet Download Manager
        /// </summary>
        /// <param name="link"></param>
        public static void DownloadWithIDM(string link)
        {
            var command = $"/C /d \"{link}\"";

            if (File.Exists(Consts.IDManX64Location))
            {
                Process.Start(Consts.IDManX64Location, command);
            }
            else if (File.Exists(Consts.IDManX86Location))
            {
                Process.Start(Consts.IDManX86Location, command);
            }
            else
            {
                MessageBox.Error("Internet Download Manager (IDM) is not installed on your system, please download and install it first", "Not Found");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set folder icon for a given folder.
        /// </summary>
        /// <param name="icoFile"> path to the icon file [MUST BE .Ico]</param>
        /// <param name="folderPath">path to the folder</param>
        public static void SetFolderIcon(string icoFile, string folderPath)
        {
            try
            {
                var folderSettings = new SHFOLDERCUSTOMSETTINGS
                {
                    dwMask      = FOLDERCUSTOMSETTINGSMASK.FCSM_ICONFILE,
                    pszIconFile = icoFile,
                    dwSize      = (uint)Marshal.SizeOf(typeof(SHFOLDERCUSTOMSETTINGS)),
                    cchIconFile = 0
                };
                //FolderSettings.iIconIndex = 0;
                var pszPath = folderPath;
                var unused  =
                    SHGetSetFolderCustomSettings(ref folderSettings, pszPath, FCS.FCS_FORCEWRITE);
            }
            catch (Exception e)
            {
                MessageBox.Error(e.Message);
            }

            ApplyChanges(folderPath);
        }