public Difficulty(StepFile stepFile) { this.StepFile = stepFile; this.Measures = new List<Measure>(); this.Level = 0; this.ChartType = ChartType.None; }
public void Write(StepFile stepFile, string destiantionPath) { string fileExtension = Path.GetExtension(destiantionPath); if (this.stepFileWriter.ContainsKey(fileExtension)) { this.stepFileWriter[fileExtension].Write(stepFile, destiantionPath); } }
public void Write(StepFile stepFile, string destinationPath) { if (stepFile.IsValid()) { using (FileStream fileStream = new FileStream(destinationPath, FileMode.CreateNew, FileAccess.Write)) { using (BinaryWriter binaryWriter = new BinaryWriter(fileStream, Encoding.UTF8)) { this.WriteProperty("TITLE", stepFile.Title, binaryWriter); this.WriteProperty("SUBTITLE", "", binaryWriter); this.WriteProperty("ARTIST", stepFile.Artist, binaryWriter); this.WriteProperty("TITLETRANSLIT", "", binaryWriter); this.WriteProperty("SUBTITLETRANSLIT", "", binaryWriter); this.WriteProperty("ARTISTTRANSLIT", "", binaryWriter); this.WriteProperty("GENRE", "", binaryWriter); this.WriteProperty("CREDIT", "", binaryWriter); this.WriteProperty("BANNER", "", binaryWriter); this.WriteProperty("BACKGROUND", "", binaryWriter); this.WriteProperty("LYRICSPATH", "", binaryWriter); this.WriteProperty("CDTITLE", "", binaryWriter); this.WriteProperty("MUSIC", "", binaryWriter); this.WriteProperty("OFFSET", "", binaryWriter); this.WriteProperty("BPMS", this.WriteTimings(stepFile.BPMs), binaryWriter); this.WriteProperty("STOPS", this.WriteTimings(stepFile.Stops), binaryWriter); this.WriteProperty("SAMPLESTART", "", binaryWriter); this.WriteProperty("SAMPLELENGTH", "", binaryWriter); this.WriteProperty("DISPLAYBPM", "", binaryWriter); this.WriteProperty("SELECTABLE", "", binaryWriter); this.WriteProperty("BGCHANGES", "", binaryWriter); this.WriteProperty("FGCHANGES", "", binaryWriter); this.WriteNotes(stepFile, binaryWriter); } } } else { // not valid } }
public Measure(StepFile stepFile) { this.StepFile = stepFile; this.Lines = new List<Line>(); this.Index = 0; }
public Measure(StepFile stepFile) { this.StepFile = stepFile; this.Lines = new List <Line>(); this.Index = 0; }
public Line(StepFile stepFile) { this.StepFile = stepFile; this.Steps = new List <Step>(); this.Index = 0; }
public Line(StepFile stepFile) { this.StepFile = stepFile; this.Steps = new List<Step>(); this.Index = 0; }
private void WriteNotes(StepFile stepFile, BinaryWriter binaryWriter) { foreach (Difficulty difficulty in stepFile.Difficulties) { this.WriteString("#NOTES:", binaryWriter); this.WriteNewLine(binaryWriter); // ChartType string chartType = string.Empty; switch (difficulty.ChartType) { case ChartType.FourKey: chartType = "dance-single"; break; case ChartType.FiveKey: chartType = "pump-single"; break; case ChartType.SixKey: chartType = "dance-solo"; break; case ChartType.SevenKey: chartType = "kb7-single"; break; case ChartType.EightKey: chartType = "dance-double"; break; case ChartType.TenKey: chartType = "pump-double"; break; } this.WriteString(string.Format("{0}:", chartType), binaryWriter); this.WriteNewLine(binaryWriter); // Description this.WriteString(string.Format("{0}:", "description"), binaryWriter); this.WriteNewLine(binaryWriter); // Difficulty (string) this.WriteString(string.Format("{0}:", ""), binaryWriter); this.WriteNewLine(binaryWriter); // Numeric Difficulty (int) this.WriteString(string.Format("{0}:", difficulty.Level), binaryWriter); this.WriteNewLine(binaryWriter); //Groove Radar (CSV-List) this.WriteString(string.Format("{0}:", ""), binaryWriter); this.WriteNewLine(binaryWriter); int currentMeasureIndex = 0; difficulty.Measures.Sort((x, y) => y.Index.CompareTo(x.Index)); foreach (Measure measure in difficulty.Measures) { measure.Lines.Sort((x, y) => y.Index.CompareTo(x.Index)); foreach (Line line in measure.Lines) { line.Steps.Sort((x, y) => y.Index.CompareTo(x.Index)); foreach (Step step in line.Steps) { char stepType = '0'; switch (step.StepType) { case StepType.Normal: stepType = '1'; break; case StepType.HoldStart: stepType = '2'; break; case StepType.HoldEnd: stepType = '3'; break; case StepType.RollStart: stepType = '4'; break; case StepType.Mine: stepType = 'M'; break; default: case StepType.None: stepType = '0'; break; } binaryWriter.Write((byte)stepType); } this.WriteNewLine(binaryWriter); } currentMeasureIndex++; if (difficulty.Measures.Count == currentMeasureIndex) { binaryWriter.Write((byte)';'); } else { binaryWriter.Write((byte)','); } this.WriteNewLine(binaryWriter); } } }