示例#1
0
        /// <summary>
        /// 아이콘 체인지 메서드
        /// </summary>
        public CiconResult ChangeIco()
        {
            IconChanger Ic      = new IconChanger();
            string      icoPath = "";

            if (!Path.GetExtension(_icoPath).Equals(".ico"))
            {
                using (MagickImage image = new MagickImage(_icoPath))
                {
                    image.Settings.SetDefine("icon:auto-resize", "256,128,96,64,48,32,16"); //TODO:https://www.imagemagick.org/discourse-server/viewtopic.php?t=14080
                    image.Write(_tempPath + @"\tempico.ico");
                    image.Dispose();
                }
                icoPath = _tempPath + @"\tempico.ico";
            }
            else
            {
                icoPath = _icoPath;
            }
            if (_fileDestPath == null) //exe파일 저장 경로를 지정 안했을때
            {
                return(Ic.ChangeIcon(Path.GetDirectoryName(_scriptPath) + @"\" + Path.GetFileNameWithoutExtension(_scriptPath) + ".exe", icoPath));
            }
            else
            {
                return(Ic.ChangeIcon(Path.GetDirectoryName(_fileDestPath) + @"\" + Path.GetFileNameWithoutExtension(_fileDestPath) + ".exe", icoPath));
            }
        }
示例#2
0
        public CiconResult ChangeIcon(string p_exeFilePath, string p_iconFilePath)
        {
            if (!File.Exists(p_iconFilePath))
            {
                return(CiconResult.NotExistImageFile);
            }
            if (!File.Exists(p_exeFilePath))
            {
                return(CiconResult.NotExistBinFile);
            }
            using (FileStream fs = new FileStream(p_iconFilePath, FileMode.Open, FileAccess.Read))
            {
                var reader = new IconReader(fs);

                var iconChanger = new IconChanger();
                return(iconChanger.ChangeIcon(p_exeFilePath, reader.Icons));
            }
        }