Esempio n. 1
0
        private bool CheckFileWrite()
        {
            string filename  = "";
            string test_text = "testtest";

            try
            {
                filename = IJFile.GetTemporaryFileName(Directory.GetCurrentDirectory(), "txt");
                IJFile.Write(filename, test_text);
                string content = IJFile.Read(filename);
                return(content == test_text);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                try
                {
                    if (filename != "")
                    {
                        File.Delete(filename);
                    }
                }
                catch (Exception) { }
            }
        }
Esempio n. 2
0
        private void MakeUserFile()
        {
            string str = IJStringUtil.EncryptString(textBoxUser.Text, "dailyvocaran") + "\t" +
                         IJStringUtil.EncryptString(textBoxPassword.Text, "dailyvocaran");

            IJFile.Write(userdat_filename, str);
        }
Esempio n. 3
0
        private void buttonLayoutSave_Click(object sender, EventArgs e)
        {
            DialogResult result = DialogResult.Yes;

            if (System.IO.File.Exists(selectFileBoxLayout.FileName))
            {
                result = MessageBox.Show(this, "レイアウトファイルを上書きしますか?", "確認", MessageBoxButtons.YesNo);
            }
            if (result == DialogResult.Yes)
            {
                IJFile.Write(selectFileBoxLayout.FileName, textBoxLayout.Text);
                is_changed = false;
            }
        }
Esempio n. 4
0
        public void Save(string rank_filename, HoseiKind hosei_kind, int mylist_rate, IFilterManager filter)
        {
            StringBuilder buff_notfiltered = new StringBuilder();
            StringBuilder buff_filtered    = new StringBuilder();
            int           rank_notfiltered = 1;
            int           rank_filtered    = 1;

            for (int i = 0; i < video_list_.Count; ++i)
            {
                filter.DoEffect(video_list_[i]);
                if (filter.IsThrough(video_list_[i]))
                {
                    if (custom_format_.IsUsingCustomFormat())
                    {
                        buff_notfiltered.Append(custom_format_.VideoToString(video_list_[i], rank_notfiltered));
                    }
                    else
                    {
                        buff_notfiltered.Append(video_list_[i].ToStringWithRank(rank_notfiltered, hosei_kind, mylist_rate));
                    }
                    ++rank_notfiltered;
                    buff_notfiltered.Append("\r\n");
                }
                else
                {
                    if (custom_format_.IsUsingCustomFormat())
                    {
                        buff_filtered.Append(custom_format_.VideoToString(video_list_[i], rank_filtered));
                    }
                    else
                    {
                        buff_filtered.Append(video_list_[i].ToStringWithRank(rank_filtered, hosei_kind, mylist_rate));
                    }
                    ++rank_filtered;
                    buff_filtered.Append("\r\n");
                }
            }
            IJFile.Write(rank_filename, buff_notfiltered.ToString());

            if (filter.IsOutputFilteredVideo())
            {
                string rank_str = buff_filtered.ToString();
                if (rank_str != "")
                {
                    IJFile.Write(Path.GetDirectoryName(rank_filename) + "\\" + Path.GetFileNameWithoutExtension(rank_filename) +
                                 "_filter" + Path.GetExtension(rank_filename), rank_str);
                }
            }
        }
Esempio n. 5
0
        private void UpdateCutList(string video_id, string start_time_str, string end_time_str)
        {
            if (start_time_str == "")
            {
                MessageBox.Show("開始時間を設定してください。");
                return;
            }
            if (end_time_str == "")
            {
                MessageBox.Show("終了時間を設定してください。");
                return;
            }
            if (textBoxCutListPath.Text == "")
            {
                MessageBox.Show("カットリストのファイル名を設定してください。");
                return;
            }
            StringBuilder buff = new StringBuilder();

            if (File.Exists(textBoxCutListPath.Text))
            {
                string str   = IJFile.Read(textBoxCutListPath.Text);
                int    index = str.IndexOf(video_id);
                if (index >= 0)
                {
                    int end = str.IndexOf('\n', index) + 1;
                    buff.Append(str.Substring(0, index));
                    buff.Append(video_id + "\t" + start_time_str + "\t" + end_time_str + "\r\n");
                    buff.Append(str.Substring(end));
                }
                else
                {
                    buff.Append(str);
                    buff.Append(video_id + "\t" + start_time_str + "\t" + end_time_str + "\r\n");
                }
            }
            else
            {
                buff.Append(video_id + "\t" + start_time_str + "\t" + end_time_str + "\r\n");
            }
            IJFile.Write(textBoxCutListPath.Text, buff.ToString());
            labelInfo.Text = "書き込みました";
        }
Esempio n. 6
0
 private void FormLayout_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (is_changed)
     {
         DialogResult result;
         if (System.IO.File.Exists(selectFileBoxLayout.FileName))
         {
             result = MessageBox.Show(this, "レイアウトファイルを上書き保存しますか?", "確認", MessageBoxButtons.YesNoCancel);
         }
         else
         {
             result = MessageBox.Show(this, "レイアウトファイルを保存しますか?", "確認", MessageBoxButtons.YesNoCancel);
         }
         if (result == DialogResult.Yes)
         {
             IJFile.Write(selectFileBoxLayout.FileName, textBoxLayout.Text);
         }
         else if (result == DialogResult.Cancel)
         {
             e.Cancel = true;
         }
     }
 }
Esempio n. 7
0
        private void SaveConfig(string filename)
        {
            StringBuilder  buff         = new StringBuilder();
            List <Control> control_list = new List <Control>();

            GetAllControl(this, ref control_list);

            buff.Append("version\t" + program_version_.ToString() + "\r\n");
            for (int i = 0; i < control_list.Count; ++i)
            {
                if (control_list[i] is TextBox)
                {
                    TextBox c = (TextBox)control_list[i];
                    if (c.Name == "textBoxUploadText" || c.Name == "textBoxUser" ||
                        c.Name == "textBoxPassword" || c.Name == "textBoxInfo" || c.Name == "textBoxEditRankFile" ||
                        c.Name == "textBoxEditExclusionList" || c.Name == "textBoxMencWatching"
                        )
                    {
                        continue;
                    }
                    if (c.Name == "")
                    {
                        continue;
                    }
                    buff.Append("text");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(IJStringUtil.EscapeForConfig(c.Text));
                    buff.Append("\r\n");
                }
                else if (control_list[i] is RadioButton)
                {
                    RadioButton c = (RadioButton)control_list[i];
                    buff.Append("radio");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(c.Checked.ToString());
                    buff.Append("\r\n");
                }
                else if (control_list[i] is CheckBox)
                {
                    CheckBox c = (CheckBox)control_list[i];
                    if (c.Name == "checkBoxTimer1" || c.Name == "checkBoxTimer2" || c.Name == "checkBoxDailyTimer" || c.Name == "checkBoxTimerNews")
                    {
                        continue;
                    }
                    buff.Append("checkBox");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(c.Checked.ToString());
                    buff.Append("\r\n");
                }
                else if (control_list[i] is ListBox && !(control_list[i] is CheckedListBox))
                {
                    ListBox c = (ListBox)control_list[i];
                    buff.Append("listBox");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(c.SelectedIndex.ToString());
                    buff.Append("\r\n");
                }
                else if (control_list[i] is DateTimePicker)
                {
                    DateTimePicker c = (DateTimePicker)control_list[i];
                    buff.Append("dateTimePicker");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(NicoUtil.DateToString(c.Value));
                    buff.Append("\r\n");
                }
                else if (control_list[i] is ComboBox)
                {
                    ComboBox c = (ComboBox)control_list[i];
                    buff.Append("comboBox");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(c.SelectedIndex.ToString());
                    buff.Append("\r\n");
                }
                else if (control_list[i] is NumericUpDown)
                {
                    NumericUpDown c = (NumericUpDown)control_list[i];
                    buff.Append("numericUpDown");
                    buff.Append('\t');
                    buff.Append(c.Name);
                    buff.Append('\t');
                    buff.Append(c.Value.ToString());
                    buff.Append("\r\n");
                }
            }
            if (form_trans_option_ != null)
            {
                trans_detail_option_ = form_trans_option_.GetAppOption();
            }
            buff.Append(trans_detail_option_.SaveData());

            buff.Append("dlrank_category\t").Append(category_manager_.GetSaveString()).Append("\r\n");

            IJFile.Write(filename, buff.ToString());
        }