示例#1
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (Directory.Exists(DWFTBox.Text) || DWFTBox.Text == "")
     {
         ((MainWindow)Owner).ColorBrush = localcbs;
         if (!File.Exists(System.IO.Path.GetFullPath("config.ini")))
         {
             StreamWriter cfs = new StreamWriter(@System.IO.Path.GetFullPath("config.ini"), false, System.Text.Encoding.Default);
             cfs.Close();
         }
         ReadWriteIni rwIni = new ReadWriteIni(System.IO.Path.GetFullPath("config.ini"));
         rwIni.WriteString("Path", "DefaultWorkSpace", DWFTBox.Text);
         rwIni.WriteString("ColorTheme", "SingleNote", localcbs[0].Item1.ToString() + "," + localcbs[0].Item1.ToString() + "," + localcbs[0].Item3.ToString());
         rwIni.WriteString("ColorTheme", "LongNote", localcbs[1].Item1.ToString() + "," + localcbs[1].Item1.ToString() + "," + localcbs[1].Item3.ToString());
         rwIni.WriteString("ColorTheme", "DoubleNote", localcbs[2].Item1.ToString() + "," + localcbs[2].Item1.ToString() + "," + localcbs[2].Item3.ToString());
         rwIni.WriteString("ColorTheme", "LongMidNote", localcbs[3].Item1.ToString() + "," + localcbs[3].Item1.ToString() + "," + localcbs[3].Item3.ToString());
         this.Topmost = false;
         if (((MainWindow)Owner)._SelectedChart != null)
         {
             ((MainWindow)Owner).DrawChartData();
         }
         Owner.Activate();
         this.Close();
     }
     else
     {
         MessageBox.Show("指定されたフォルダが存在しません!", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#2
0
        private void CreateButton_Clicked(object sender, RoutedEventArgs e)
        {
            string[] difs = ChartDifficulities.Split(',');
            string[] juds = ChartJudges.Split(',');
            string[] levs = ChartLevels.Split(',');
            bool     isoj = true;

            for (int i = 0; i < juds.Count(); i++)
            {
                if (juds[i] != "easy" && juds[i] != "normal" && juds[i] != "hard" && juds[i] != "gambol")
                {
                    isoj = false;
                    MessageBox.Show("判定はeasy,normal,hard,gambolのみ使用できます", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }
            }
            if (isoj && difs.Length == juds.Length && levs.Length == difs.Length && WorkSpaceDirectoryName != "" && SongName != "" && ArtistName != "" && AudioFilePath != "" && ChartDesignerName != "" && ChartDifficulities != "" && ChartLevels != "" && StandardBPM != "")
            {
                Directory.CreateDirectory(WSP + WorkSpaceDirectoryName);
                StreamWriter fs = new StreamWriter(@WSP + WorkSpaceDirectoryName + "\\music.txt", false, System.Text.Encoding.Default);
                fs.Write(SongName + "\n");
                fs.Write(ArtistName);
                fs.Close();
                if (ThumbFilePath != "")
                {
                    File.Copy(@ThumbFilePath, @WSP + WorkSpaceDirectoryName + "\\thumb" + ThumbFilePath.Substring(ThumbFilePath.LastIndexOf(".")));
                }
                File.Copy(@AudioFilePath, @WSP + WorkSpaceDirectoryName + "\\music" + AudioFilePath.Substring(AudioFilePath.LastIndexOf(".")));
                for (int j = 0; j < difs.Length; j++)
                {
                    String       path = WSP + WorkSpaceDirectoryName + "\\" + difs[j] + ".csv";
                    StreamWriter cfs  = new StreamWriter(@path, false, System.Text.Encoding.Default);
                    cfs.Write(difs[j] + "," + levs[j] + "," + ChartDesignerName + "," + StandardBPM + ",0," + juds[j] + "\n");
                    cfs.Write("START\n");
                    cfs.Write("END\n");
                    cfs.Close();
                }
                if (File.Exists(System.IO.Path.GetFullPath("config.ini")))
                {
                    ReadWriteIni rwIni = new ReadWriteIni(System.IO.Path.GetFullPath("config.ini"));
                    rwIni.WriteString("Path", "DefaultWorkSpace", WSP + WorkSpaceDirectoryName);
                }
                else
                {
                    StreamWriter cfs = new StreamWriter(@System.IO.Path.GetFullPath("config.ini"), false, System.Text.Encoding.Default);
                    cfs.Close();
                    ReadWriteIni rwIni = new ReadWriteIni(System.IO.Path.GetFullPath("config.ini"));
                    rwIni.WriteString("Path", "DefaultWorkSpace", WSP + WorkSpaceDirectoryName);
                }
                this.Owner.Activate();
                ((MainWindow)this.Owner).OpenProject(WSP + WorkSpaceDirectoryName);
                this.Close();
            }
            else
            {
                MessageBox.Show("不正な値です.すべての欄に記入したか確かめてください.");
            }
        }