Exemplo n.º 1
0
 private void ApplySetting(CSMDownSetting setting)
 {
     URLTextBox.Text = setting.URL;
     onlyLinkCheckBox.Checked = setting.OnlyLink;
     highPriorityPathTextBox.Text = setting.HighPriorityPath;
     startLinkTextBox.Text = setting.StartLink;
     endLinkTextBox.Text = setting.EndLink;
     DownloadPathTextBox.Text = setting.DownloadPath;
     ignoreConflictFileNameRadioButton.Checked = setting.ConflictNoDownLoad;
     renameConflictNameRadioButton.Checked = setting.ConflictRename;
     overwriteConflictFileNameRadioButton.Checked = setting.ConflictOverWrite;
     createDirectoryRadioButton.Checked = setting.DLTargetDirectory;
     createFlatDirectoryRadioButton.Checked = setting.DLTargetFlatDir;
     bataDirectoryRadioButton.Checked = setting.DLTargetBeta;
     recursiveLevelTextBox.Text = setting.RecursiveMax.ToString();
     ignoreSmallPictureCheckBox.Checked = setting.DeleteSmall;
     needExtensionCheckBox.Checked = setting.DownloadOnlyExtension;
     minimumSizeWidth.Text = setting.SmallWidth.ToString();
     minimumSizeHeight.Text = setting.SmallHeight.ToString();
     DLWaitCheckBox.Checked = setting.ViewWait;
     DLIntervalTextBox.Text = setting.ViewInterval.ToString();
     priorityOnlyCheckBox.Checked = setting.PrioritySameDomain;
     previewCheckBox.Checked = setting.Preview;
     InterruptCheck.Checked = setting.InterruptCheck;
     SiteTimeoutTextBox.Text = setting.SiteTimeout.ToString();
     checkBoxKeepAlready.Checked = setting.KeepAlready;
 }
Exemplo n.º 2
0
 private void CSMDown_Load(object sender, EventArgs e)
 {
     m_setting = LoadSettingXML( CSMDown.SETTING_XML );
     if (m_setting != null)
     {
         ApplySetting(m_setting);
     }
 }
Exemplo n.º 3
0
        private void 設定読込ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.RestoreDirectory = true;

            fileDialog.FileName = "setting.xml";
            fileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";

            DialogResult result = fileDialog.ShowDialog();
            if (result != DialogResult.OK)
            {
                return;
            }

            string fileName = fileDialog.FileName;
            fileDialog.Dispose();

            CSMDownSetting setting = LoadSettingXML(fileName);
            if (setting == null)
            {
                MessageBox.Show("読み込みに失敗しました。");
                return;
            }
            m_setting = setting;
            ApplySetting(m_setting);

            return;
        }
Exemplo n.º 4
0
        private void CSMDown_FormClosing(object sender, FormClosingEventArgs e)
        {
            // スレッド動作中なら、閉じない。
            if (m_cansel == false)
            {
                MessageBox.Show("処理中はウィンドウを閉じられません。\r\n「キャンセル」をクリックして、処理を停止してください。");
                e.Cancel = true;
                return;
            }

            // 更新
            try
            {
                m_setting = TakeInSettings();

                //<XMLファイルに書き込む>
                //XmlSerializerオブジェクトを作成
                //書き込むオブジェクトの型を指定する
                XmlSerializer serializer1 = new XmlSerializer(typeof(CSMDownSetting));

                //ファイルを開く
                FileStream fs1 = new FileStream(CSMDown.SETTING_XML, FileMode.Create);

                //シリアル化し、XMLファイルに保存する
                serializer1.Serialize(fs1, m_setting);

                //閉じる
                fs1.Close();
            }
            catch (Exception)
            {
                // Nothing to do.
            }
        }
Exemplo n.º 5
0
 private CSMDownSetting TakeInSettings()
 {
     CSMDownSetting setting = new CSMDownSetting();
     setting.URL                   = URLTextBox.Text;
     setting.OnlyLink              = onlyLinkCheckBox.Checked;
     setting.HighPriorityPath      = highPriorityPathTextBox.Text;
     setting.StartLink = startLinkTextBox.Text;
     setting.EndLink = endLinkTextBox.Text;
     setting.DownloadPath = DownloadPathTextBox.Text;
     setting.ConflictNoDownLoad    = ignoreConflictFileNameRadioButton.Checked;
     setting.ConflictRename        = renameConflictNameRadioButton.Checked;
     setting.ConflictOverWrite     = overwriteConflictFileNameRadioButton.Checked;
     setting.DLTargetDirectory = createDirectoryRadioButton.Checked;
     setting.DLTargetFlatDir = createFlatDirectoryRadioButton.Checked;
     setting.DLTargetBeta = bataDirectoryRadioButton.Checked;
     setting.RecursiveMax          = int.Parse(recursiveLevelTextBox.Text);
     setting.DeleteSmall           = ignoreSmallPictureCheckBox.Checked;
     setting.DownloadOnlyExtension = needExtensionCheckBox.Checked;
     setting.SmallWidth            = int.Parse(minimumSizeWidth.Text);
     setting.SmallHeight           = int.Parse(minimumSizeHeight.Text);
     setting.ViewWait              = DLWaitCheckBox.Checked;
     setting.ViewInterval          = int.Parse(DLIntervalTextBox.Text);
     setting.PrioritySameDomain    = priorityOnlyCheckBox.Checked;
     setting.Preview = previewCheckBox.Checked;
     setting.InterruptCheck = InterruptCheck.Checked;
     setting.SiteTimeout = int.Parse(SiteTimeoutTextBox.Text);
     setting.KeepAlready = this.checkBoxKeepAlready.Checked;
     return setting;
 }