public string WeatherDataListing() { //Forms the weather data into a string separated by line feeds string wsList = ""; if (weaList.Count > 0) { { wsList += "WriteDate:\t" + ReportDate.ToString("hh:mm:ss"); wsList += "\r\n" + "TempScale:\t" + TempScale.ToString(); wsList += "\r\n" + "WindScale:\t" + WindScale.ToString(); wsList += "\r\n" + "SkyTemp:\t" + SkyTemp.ToString(); wsList += "\r\n" + "AmbTemp:\t" + AmbTemp.ToString(); wsList += "\r\n" + "SenTemp:\t" + SenTemp.ToString(); wsList += "\r\n" + "WindSpeed:\t" + WindSpeed.ToString(); wsList += "\r\n" + "Humidity:\t\t" + Humidity.ToString(); wsList += "\r\n" + "DewPoint:\t" + DewPoint.ToString(); wsList += "\r\n" + "DewHeat:\t" + DewHeat.ToString(); wsList += "\r\n" + "RainFlag:\t\t" + RainFlag.ToString(); wsList += "\r\n" + "WetFlag:\t\t" + WetFlag.ToString(); wsList += "\r\n" + "ElapsedTime:\t" + ElapsedSeconds.ToString(); wsList += "\r\n" + "LastDataWrite:\t" + LastDataWrite.ToString("hh:mm:ss"); wsList += "\r\n" + "Cloudiness:\t" + Cloudiness.ToString(); wsList += "\r\n" + "Windiness:\t" + Windiness.ToString(); wsList += "\r\n" + "Raininess:\t" + Raininess.ToString(); wsList += "\r\n" + "Darkness:\t" + Darkness.ToString(); wsList += "\r\n" + "RoofCloseFlag:\t" + RoofCloseFlag.ToString(); wsList += "\r\n" + "AlertFlag:\t\t" + AlertFlag.ToString(); } } return(wsList); }
public void Save(int rdungeonNum, int floorNum) { if (!Directory.Exists(Paths.DataPath + "RDungeon\\" + rdungeonNum)) { Directory.CreateDirectory(Paths.DataPath + "RDungeon\\" + rdungeonNum); } using (XmlWriter writer = XmlWriter.Create(Paths.DataPath + "RDungeon\\" + rdungeonNum + "\\" + floorNum + ".xml", Logger.XmlWriterSettings)) { writer.WriteStartDocument(); writer.WriteStartElement("FloorEntry"); #region Basic data writer.WriteStartElement("General"); writer.WriteElementString("Algorithm", Algorithm.ToString()); writer.WriteElementString("Darkness", Darkness.ToString()); writer.WriteElementString("Music", Music); writer.WriteElementString("NpcSpawnTime", NpcSpawnTime.ToString()); writer.WriteElementString("NpcMin", NpcMin.ToString()); writer.WriteElementString("NpcMax", NpcMax.ToString()); writer.WriteEndElement(); #endregion #region FloorSettings writer.WriteStartElement("FloorSettings"); for (int i = 0; i < FloorSettings.Count; i++) { string key = FloorSettings.Keys.ElementAt(i); writer.WriteElementString(key, FloorSettings[key].ToString()); } writer.WriteEndElement(); #endregion #region TileLayers writer.WriteStartElement("TileLayers"); for (int i = 0; i < TileLayers.Count; i++) { string key = TileLayers.Keys.ElementAt(i); List <Maps.TileAnim> layers = TileLayers[key]; writer.WriteStartElement(key); for (int j = 0; j < layers.Count; j++) { writer.WriteStartElement("Element"); writer.WriteElementString("TextureX", layers[j].Frames[0].Texture.X.ToString()); writer.WriteElementString("TextureY", layers[j].Frames[0].Texture.Y.ToString()); writer.WriteElementString("Sheet", layers[j].Frames[0].Sheet.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); #endregion #region TileData writer.WriteStartElement("TileData"); for (int i = 0; i < TileData.Count; i++) { string key = TileData.Keys.ElementAt(i); List <Maps.TileData> data = TileData[key]; writer.WriteStartElement(key); for (int j = 0; j < data.Count; j++) { writer.WriteStartElement("Element"); writer.WriteElementString("Type", data[j].Type.ToString()); writer.WriteElementString("Data1", data[j].Data1.ToString()); writer.WriteElementString("Data2", data[j].Data2.ToString()); writer.WriteElementString("Data3", data[j].Data3.ToString()); writer.WriteElementString("String", data[j].String1); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); #endregion #region Weather writer.WriteStartElement("FloorWeather"); for (int i = 0; i < FloorWeather.Count; i++) { writer.WriteStartElement("Weather"); Enums.Weather key = FloorWeather.Keys.ElementAt(i); writer.WriteElementString(key.ToString(), FloorWeather[key].ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); #endregion #region Items writer.WriteStartElement("Items"); for (int i = 0; i < Items.Count; i++) { string key = Items.Keys.ElementAt(i); List <Tuple <ItemPreset, int> > data = Items[key]; writer.WriteStartElement(key); for (int j = 0; j < data.Count; j++) { writer.WriteStartElement("Element"); writer.WriteElementString("ItemNum", data[j].Item1.ItemNum.ToString()); writer.WriteElementString("MinAmount", data[j].Item1.MinAmount.ToString()); writer.WriteElementString("MaxAmount", data[j].Item1.MaxAmount.ToString()); writer.WriteElementString("AppearanceRate", data[j].Item2.ToString()); writer.WriteElementString("StickyRate", data[j].Item1.StickyRate.ToString()); writer.WriteElementString("Tag", data[j].Item1.Tag); writer.WriteElementString("Hidden", data[j].Item1.Hidden.ToString()); writer.WriteElementString("Ground", data[j].Item1.OnGround.ToString()); writer.WriteElementString("Water", data[j].Item1.OnWater.ToString()); writer.WriteElementString("Wall", data[j].Item1.OnWall.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); #endregion #region Npcs writer.WriteStartElement("Npcs"); for (int i = 0; i < Npcs.Count; i++) { string key = Npcs.Keys.ElementAt(i); List <Tuple <NpcPreset, int> > data = Npcs[key]; writer.WriteStartElement(key); for (int j = 0; j < data.Count; j++) { writer.WriteStartElement("Element"); writer.WriteElementString("NpcNum", data[j].Item1.NpcNum.ToString()); writer.WriteElementString("SpawnX", data[j].Item1.SpawnX.ToString()); writer.WriteElementString("SpawnY", data[j].Item1.SpawnY.ToString()); writer.WriteElementString("MinLevel", data[j].Item1.MinLevel.ToString()); writer.WriteElementString("MaxLevel", data[j].Item1.MaxLevel.ToString()); writer.WriteElementString("AppearanceRate", data[j].Item2.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); #endregion #region Rooms writer.WriteStartElement("Rooms"); for (int i = 0; i < Rooms.Count; i++) { string key = Rooms.Keys.ElementAt(i); List <Tuple <int, int> > data = Rooms[key]; writer.WriteStartElement(key); for (int j = 0; j < data.Count; j++) { writer.WriteStartElement("Element"); writer.WriteElementString("RoomNum", data[j].Item1.ToString()); writer.WriteElementString("AppearanceRate", data[j].Item2.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); #endregion writer.WriteEndElement(); writer.WriteEndDocument(); } }