Beispiel #1
0
 /// <summary>
 /// 指定されたリストをCSVとして保存します
 /// </summary>
 /// <param name="list">リスト</param>
 /// <param name="fileName">ファイル名</param>
 /// <param name="header"></param>
 private static void WriteCsv(List <string> list, string fileName, string header)
 {
     /*保存*/
     using (StreamWriter writer =
                new StreamWriter(fileName, false, Encoding.GetEncoding("UTF-8")))
     {
         writer.WriteLine(header + "\n" + FreeStyle.ToCSV(list));
     }
 }
Beispiel #2
0
        public void Save(string fileName)
        {
            if (this.playState != PlaybackState.Stopped)
            {
                throw new NotChangeException();
            }

            //データ作成
            string text = "yymp,0\n";

            {
                text += this.freeStyleLength + "\n";
                text += FreeStyle.ToCSV(Name.ToStringArray(this.comboNameList)) + "\n";
                text += FreeStyle.ToCSV(Name.ToStringArray(this.trickNameList)) + "\n";

                List <string> comboString = new List <string>();
                List <string> trickString = new List <string>();
                foreach (Combo c in this.comboList)
                {
                    string cText = this.comboNameList.IndexOf(new Name(c.Name)) + ":";
                    cText += c.Start + ":";
                    cText += c.End;
                    comboString.Add(cText);

                    foreach (Trick t in c.TrickList)
                    {
                        string tText = this.comboList.IndexOf(c) + ":";
                        tText += this.trickNameList.IndexOf(new Name(t.Name)) + ":";
                        tText += t.Start + ":";
                        tText += t.End;
                        trickString.Add(tText);
                    }
                }
                text += FreeStyle.ToCSV(comboString) + "\n";
                text += FreeStyle.ToCSV(trickString) + "\n";
                if (this.music != null)
                {
                    text += Convert.ToBase64String(this.music.ByteData);
                }
            }

            using (StreamWriter writer =
                       new StreamWriter(fileName, false, Encoding.GetEncoding("UTF-8")))
            {
                writer.WriteLine(text);
            }
        }