private static void generateXBlock(string toneKey, Stream outXblock, Tone.Tone tone) { var game = new GameXblock<Entity>(); var entity = new Entity { Name = String.Format("GRTonePreset_{0}", toneKey), Iterations = 1, ModelName = "GRTonePreset", Id = tone.PersistentID.ToLower() }; var properties = entity.Properties = new List<Property>(); var addProperty = new Action<string, object>((a, b) => properties.Add(CreateProperty(a, b.ToString()))); addProperty("Key", tone.Key); addProperty("Name", tone.Name); game.EntitySet = new List<Entity> {entity}; game.Serialize(outXblock); }
private static void generateXBlock(string toneKey, Stream outXblock, Tone tone) { var game = new GameXblock <Entity>(); var entity = new Entity { Name = String.Format("GRTonePreset_{0}", toneKey), Iterations = 1, ModelName = "GRTonePreset", Id = tone.PersistentID.ToLower() }; var properties = entity.Properties = new List <Property>(); var addProperty = new Action <string, object>((a, b) => properties.Add(CreateProperty(a, b.ToString()))); addProperty("Key", tone.Key); addProperty("Name", tone.Name); game.EntitySet = new List <Entity> { entity }; game.Serialize(outXblock); }
public void Serialize(Stream stream) { StreamWriter writer = new StreamWriter(stream); // JSON if (JsonDB != null) { foreach (var json in JsonDB) { json.Write(writer); } } // HSON if (currentPlatform.IsConsole) { if (HsonDB != null) { foreach (var hson in HsonDB) { hson.Write(writer); } } } if (currentPlatform.version == GameVersion.RS2014) { // HSAN if (!currentPlatform.IsConsole) { if (HsanDB != null) { HsanDB.Write(writer); } } // Showlight if (ShowlightXml != null) { ShowlightXml.Write(writer); } } // Song Xml if (SongXml != null) { foreach (var xml in SongXml) { xml.Write(writer); } } // Song SNG if (MusicgameSong != null) { foreach (var sng in MusicgameSong) { sng.Write(writer); } } // Album Art if (ImageArt != null) { foreach (var album in ImageArt) { album.Write(writer); } } // Soundbank if (Soundbank != null) { foreach (var bnk in Soundbank) { bnk.Write(writer); } } // InlayNif if (InlayNif != null) { InlayNif.Write(writer); } // Xblock GameXblock.Write(writer, true); writer.Flush(); }