Example #1
0
        private void SaveSettingsDQXOption()
        {
            Settings.Default.DQXPlayerName     = this.DQXPlayerNameTextBox.Text;
            Settings.Default.DQXUtilityEnabled = this.DQXOptionEnabledCheckBox.Checked;

            // プレイヤー名をユーティリティに反映させる
            DQXUtility.PlayerName = Settings.Default.DQXPlayerName;
            DQXUtility.RefeshKeywords();

            // 設定を保存する
            Settings.Default.Save();
        }
        private string GetMatchingKeyword(
            string destinationKeyword,
            string sourceKeyword,
            bool forceUpdate = false)
        {
            if (string.IsNullOrEmpty(sourceKeyword))
            {
                return(string.Empty);
            }

            if (!sourceKeyword.Contains("<") ||
                !sourceKeyword.Contains(">"))
            {
                return(sourceKeyword);
            }

            var placeholders = this.PlaceholderList;

            string replace(string text)
            {
                var r = text;

                foreach (var p in placeholders)
                {
                    r = r.Replace(p.Placeholder, p.ReplaceString);
                }

                return(r);
            }

            if (forceUpdate ||
                string.IsNullOrEmpty(destinationKeyword))
            {
                var newKeyword = sourceKeyword;
                newKeyword = replace(newKeyword);
                newKeyword = DQXUtility.MakeKeyword(newKeyword);

                return(newKeyword);
            }

            return(destinationKeyword);
        }