Esempio n. 1
0
        /// <summary>
        /// 除外ファイルか判定
        /// </summary>
        /// <param name="iFullPath">フルパス</param>
        /// <returns>除外対象ファイルの場合True</returns>
        private bool IsIgnoreFile(string iFullPath)
        {
            string filename = Path.GetFileName(iFullPath).ToLower();
            string dirname  = Path.GetDirectoryName(iFullPath).ToLower();
            // DllTypeでチェック
            DllType dllType = DllTypeExt.GetDllType(iFullPath);

            if (dllType == DllType.Nothing)
            {
                return(true);
            }
            if (!settings.DllTypeInfoList[dllType].Enable)
            {
                return(true);
            }

            // IgnorePathでチェック
            foreach (var ignorePath in settings.IgnorePathList)
            {
                if (!ignorePath.Enable || ignorePath.Path.Length == 0)
                {
                    continue;
                }
                if (dirname.IndexOf(ignorePath.Path.ToLower()) >= 0)
                {
                    if ((dllType == DllType.EliteAPI && ignorePath.EliteAPI) ||
                        (dllType == DllType.EliteMMOAPI && ignorePath.EliteMMOAPI))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// DLLを置換メインスレッド
        /// </summary>
        private void ExecuteReplaceThread()
        {
            try
            {
                this.IsRunningReplace = true;
                if (!IsReplaceOK())
                {
                    this.StatusMessage = Resources.MsgExecuteAfterDownload;
                    SystemSounds.Hand.Play();
                    return;
                }

                int count = 0;
                foreach (var target in this.DllList)
                {
                    if (!this.IsRunningReplace)
                    {
                        return;
                    }
                    if (!target.Enable)
                    {
                        continue;
                    }
                    //コピー元のファイルパス決定
                    DllType dllType = DllTypeExt.GetDllType(target.Path);
                    if (dllType == DllType.Nothing)
                    {
                        continue;
                    }
                    string sourcePath = GetSourcePath(dllType);
                    //ファイルコピー
                    if (target.Enable)
                    {
                        Console.WriteLine("処理中 {0} {1}", sourcePath, target.Path);
                        this.StatusMessage = string.Format(Resources.MsgReplace, target.Path);
                        if (!CopyDll(sourcePath, target.Path))
                        {
                            this.StatusMessage = string.Format(Resources.MsgErrorReplace, target.Path);
                            break;
                        }
                        count++;
                    }
                }
                this.StatusMessage = string.Format(Resources.MsgReplaced, count);
                SystemSounds.Asterisk.Play();
            }
            catch (Exception e)
            {
                this.StatusMessage = string.Format(Resources.MsgError, e.Message);
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                SystemSounds.Hand.Play();
            }
            finally
            {
                this.IsRunningReplace = false;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// DLLの検索(再起呼び出し)
        /// </summary>
        /// <param name="iFullPath">検索パス</param>
        private void SearchDll(string iPath)
        {
            if (!Directory.Exists(iPath))
            {
                return;
            }
            if (IsIgnorePath(iPath))
            {
                return;
            }
            this.StatusMessage = string.Format("検索中 : {0}", iPath);
            string[] files = Directory.GetFiles(iPath, "*.dll", SearchOption.TopDirectoryOnly);
            foreach (var fullpath in files)
            {
                if (!this.IsRunningSearch)
                {
                    return;
                }
                if (IsIgnoreFile(fullpath))
                {
                    continue;
                }

                bool   enable  = IsVersionAbobe(GetSourcePath(DllTypeExt.GetDllType(fullpath)), fullpath);
                string version = GetDllVersion(fullpath);
                DllList.Add(new SearchPathInfo(
                                enable,
                                fullpath,
                                version));
            }
            string[] directries = Directory.GetDirectories(iPath, "*", SearchOption.TopDirectoryOnly);
            foreach (var directory in directries)
            {
                if (!this.IsRunningSearch)
                {
                    return;
                }
                SearchDll(directory);
            }
        }