Пример #1
0
        private static string GetChangedOptions()
        {
            StringBuilder changedOptions = new StringBuilder();
            OptionItems defaultOption = new OptionItems();
            typeof(OptionItems).GetProperties().ToList().ForEach(prop =>
                {
                    int undoLength = changedOptions.Length;
                    changedOptions.AppendFormat("[{0}]\r\n", prop.Name);//タグ
                    int length = changedOptions.Length;
                    object defaultObject = prop.GetGetMethod().Invoke(defaultOption, null);
                    object currentObject = prop.GetGetMethod().Invoke(Common.Options, null);

                    GetChangedOptionsInternal(prop, defaultObject, currentObject, changedOptions);
                    if (length == changedOptions.Length)
                    {
                        //変更された値が書き込まれなかったときはタグを削除
                        changedOptions.Remove(undoLength, length - undoLength);
                    }
                });

            return changedOptions.Length > 0 ? changedOptions.ToString() : "なし";
        }
Пример #2
0
 public virtual void Set(OptionItems source)
 {
     OnSet(EventArgs.Empty);
 }
Пример #3
0
 public virtual void Get(OptionItems destination)
 {
 }
Пример #4
0
        private static void Initialize(Settings settings, OptionItems options, PatrolTable patterns)
        {
            if (initialized)
            {
                throw new InvalidOperationException("既に初期化されています");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            OnInitializing();

            //シリアル化インスタンス
            //アプリケーション設定
            currentSettings = settings;
            currentSettings.MarkCrush();
            //ユーザー設定
            Options = options;
            Options.ItemsChanged += new EventHandler(Options_ItemsChanged);
            //巡回設定
            PatrolPatterns = patterns;

            //オプション
            InitializeOptions();

            //バージョンテキスト
            version = System.Windows.Forms.Application.ProductVersion;
            if (version.EndsWith(TrimedTailVersionText))
            {
                version = version.Substring(0, version.Length - TrimedTailVersionText.Length);
            }
            //if (IsBeta)
            //{
            //    version += "β";
            //}

            //詳細情報
            currentSettings.Information.LastUptime = DateTime.Now;

            //作業フォルダー
            if (System.IO.Directory.Exists(DeanCCCore.Core.VersionUp.VersionUpClient.NewVersionFolder))
            {
                System.IO.Directory.Delete(DeanCCCore.Core.VersionUp.VersionUpClient.NewVersionFolder, true);
            }

            //板一覧
            if (settings.FirstRunning)
            {
                try
                {
                    currentSettings.Boards.OnlineUpdate();
                }
                catch (ApplicationException ex)
                {
                    currentSettings.Boards.LoadBoardFromXml();
                    logs.Add("板一覧更新", ex.Message + " デフォルトの板一覧を読み込みます。", LogStatus.Error);
                }
                catch (System.Net.WebException ex)
                {
                    currentSettings.Boards.LoadBoardFromXml();
                    logs.Add("通信エラー", ex.Message + " デフォルトの板一覧を読み込みます。", LogStatus.Error);
                }
            }

            //スレッド一覧
            UpdateThreads();

            OnInitialized();
        }
Пример #5
0
        private static OptionItems CreateOptions()
        {
            OptionItems options = null;
            //if (loadBackup)
            //{
            //    try
            //    {
            //        options = OptionItems.CreateBackUp();
            //        return options;
            //    }
            //    catch (SerializationException ex)
            //    {
            //        MessageBox.Show(ex.Message,
            //            "バックアップ適用失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    }
            //}
            try
            {
                options = OptionItems.Create();//OptionItems.Import() ?? OptionItems.Create();
            }
            catch (SerializationException ex)
            {
                options = new OptionItems();
                MessageBox.Show(ex.Message + "\n初期設定を適用します",
                    "ユーザー設定読み込み失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return options;
        }
Пример #6
0
 private void OptionWizard_Load(object sender, EventArgs e)
 {
     Option = new OptionItems();
     beforeButton.Enabled = false;
     mainPanel.Controls.Add(settings[currentPosition]);
 }