public void CreateNotesFromXml(XmlDocument doc) { foreach (XmlNode node in doc.DocumentElement) { notes.Add(DscNote.FromXmlNode(node)); } }
public static DscNote FromXmlNode(XmlNode node) { if (node.Name != "note") { return(new DscNote()); } DscNote note = new DscNote(); foreach (XmlNode child in node.ChildNodes) { switch (child.Name) { case "unk1": note.unk1 = uint.Parse(child.InnerText); break; case "timestamp": note.timestamp = float.Parse(child.InnerText); break; case "opcode": note.opcode = uint.Parse(child.InnerText); break; case "type": note.type = (NoteType)NoteType.Parse(typeof(NoteType), child.InnerText); break; case "holdLength": note.holdLength = float.Parse(child.InnerText); break; case "isHoldEnd": note.isHoldEnd = int.Parse(child.InnerText); break; case "posX": note.posX = float.Parse(child.InnerText); break; case "posY": note.posX = float.Parse(child.InnerText); break; case "curve1": note.curve1 = float.Parse(child.InnerText); break; case "curve2": note.curve1 = float.Parse(child.InnerText); break; case "unk2": note.unk2 = uint.Parse(child.InnerText); break; case "unk3": note.unk3 = uint.Parse(child.InnerText); break; case "timeOut": note.timeOut = float.Parse(child.InnerText); break; case "unk4": note.unk4 = uint.Parse(child.InnerText); break; case "unk5": note.unk5 = int.Parse(child.InnerText); break; default: return(new DscNote()); } } return(note); }
public DscFile(Stream s) { header = new DscHeader(s); notes = new List <DscNote>(); if (header.magic != "PVSC") { return; } //s.Seek(8, SeekOrigin.Current); for (int i = 0; i < 8; i++) { flags[i] = DataStream.ReadBoolean(s); } uint counter = 8; while (counter <= header.contentLength - 60) { DscNote newNote = new DscNote(s); notes.Add(newNote); counter += 60; } }