public static void LoadTilePrefab() { int Prefab = 0; int Layer = 0; XmlClass myXml = new XmlClass() { Filename = System.IO.Path.Combine(Application.StartupPath, "Data", "AutoMapper.xml"), Root = "Options" }; myXml.LoadXml(); Tile = new Types.TileRec[(int)TilePrefab.Count]; for (Prefab = 1; Prefab <= (int)TilePrefab.Count - 1; Prefab++) { Tile[Prefab].Layer = new Types.TileDataRec[(int)Enums.LayerType.Count]; for (Layer = 1; Layer <= (int)Enums.LayerType.Count - 1; Layer++) { Tile[Prefab].Layer[Layer].Tileset = (byte)(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset"))); Tile[Prefab].Layer[Layer].X = (byte)(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X"))); Tile[Prefab].Layer[Layer].Y = (byte)(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y"))); Tile[Prefab].Layer[Layer].AutoTile = (byte)(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile"))); } Tile[Prefab].Type = (byte)(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Type"))); } ResourcesNum = myXml.ReadString("Resources", "ResourcesNum"); Resources = ResourcesNum.Split(';'); myXml.CloseXml(false); }
internal static void LoadOptions() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\Config.xml", Root = "Options" }; myXml.LoadXml(); E_Types.Options.Username = myXml.ReadString("UserInfo", "Username", ""); E_Types.Options.Password = myXml.ReadString("UserInfo", "Password", ""); E_Types.Options.SavePass = bool.Parse(myXml.ReadString("UserInfo", "SavePass", "False")); E_Types.Options.IP = myXml.ReadString("Connection", "Ip", "127.0.0.1"); E_Types.Options.Port = System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Connection", "Port", "7001"))); E_Types.Options.MenuMusic = myXml.ReadString("Sfx", "MenuMusic", ""); E_Types.Options.Music = byte.Parse(myXml.ReadString("Sfx", "Music", "1")); E_Types.Options.Sound = byte.Parse(myXml.ReadString("Sfx", "Sound", "1")); E_Types.Options.Volume = (float)(Conversion.Val(myXml.ReadString("Sfx", "Volume", "100"))); myXml.CloseXml(false); FrmLogin.Default.txtLogin.Text = E_Types.Options.Username; FrmLogin.Default.txtPassword.Text = E_Types.Options.Password; }
public void BtnTileSetSave_Click(object sender, EventArgs e) { int Prefab = 0; int Layer = 0; XmlClass myXml = new XmlClass() { Filename = System.IO.Path.Combine(Application.StartupPath, "Data", "AutoMapper.xml"), Root = "Options" }; myXml.LoadXml(); Prefab = cmbPrefab.SelectedIndex + 1; for (Layer = 1; Layer <= 5; Layer++) { if (E_AutoMap.Tile[Prefab].Layer[Layer].Tileset > 0) { myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].Tileset))); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].X))); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].Y))); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].AutoTile))); } } myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Type", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Type))); myXml.CloseXml(true); pnlTileConfig.Visible = false; E_AutoMap.LoadTilePrefab(); }
internal static void SaveOptions() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\Config.xml", Root = "Options" }; myXml.LoadXml(); myXml.WriteString("UserInfo", "Username", C_Types.Options.Username); myXml.WriteString("UserInfo", "Password", C_Types.Options.Password); myXml.WriteString("UserInfo", "SavePass", System.Convert.ToString(C_Types.Options.SavePass)); myXml.WriteString("Connection", "Ip", C_Types.Options.Ip.Trim()); myXml.WriteString("Connection", "Port", System.Convert.ToString(C_Types.Options.Port)); myXml.WriteString("Sfx", "MenuMusic", C_Types.Options.MenuMusic); myXml.WriteString("Sfx", "Music", C_Types.Options.Music.ToString()); myXml.WriteString("Sfx", "Sound", C_Types.Options.Sound.ToString()); myXml.WriteString("Sfx", "Volume", System.Convert.ToString(C_Types.Options.Volume)); myXml.WriteString("Misc", "ScreenSize", C_Types.Options.ScreenSize.ToString()); myXml.WriteString("Misc", "VSync", C_Types.Options.VSync.ToString()); myXml.WriteString("Misc", "UnlockFPS", C_Types.Options.UnlockFPS.ToString()); myXml.WriteString("Misc", "ShowNpcBar", C_Types.Options.ShowNpcBar.ToString()); myXml.WriteString("Misc", "ApplicationID", C_Types.Options.ApplicationID); myXml.WriteString("Misc", "LargeImageKey", C_Types.Options.LargeImageKey); myXml.WriteString("Misc", "LargeImageText", C_Types.Options.LargeImageText); myXml.WriteString("Misc", "SmallImageKey", C_Types.Options.SmallImageKey); myXml.CloseXml(true); }
internal static void SaveOptions() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\Config.xml", Root = "Options" }; myXml.LoadXml(); myXml.WriteString("UserInfo", "Username", C_Types.Options.Username.Trim()); myXml.WriteString("UserInfo", "Password", C_Types.Options.Password.Trim()); myXml.WriteString("UserInfo", "SavePass", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.SavePass))); myXml.WriteString("Connection", "Ip", C_Types.Options.Ip.Trim()); myXml.WriteString("Connection", "Port", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Port))); myXml.WriteString("Sfx", "MenuMusic", C_Types.Options.MenuMusic.Trim()); myXml.WriteString("Sfx", "Music", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Music.ToString())); myXml.WriteString("Sfx", "Sound", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Sound.ToString())); myXml.WriteString("Sfx", "Volume", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Volume))); myXml.WriteString("Misc", "ScreenSize", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ScreenSize.ToString())); myXml.WriteString("Misc", "HighEnd", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.HighEnd.ToString())); myXml.WriteString("Misc", "ShowNpcBar", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ShowNpcBar.ToString())); myXml.CloseXml(true); }
public void BtnSaveResource_Click(object sender, EventArgs e) { int i = 0; string ResourceStr = ""; XmlClass myXml = new XmlClass() { Filename = System.IO.Path.Combine(Application.StartupPath, "Data", "AutoMapper.xml"), Root = "Options" }; myXml.LoadXml(); for (i = 0; i <= lstResources.Items.Count - 1; i++) { ResourceStr = Convert.ToString(ResourceStr + System.Convert.ToString(lstResources.Items[i])); if (i < lstResources.Items.Count - 1) { ResourceStr = ResourceStr + ";"; } } myXml.WriteString("Resources", "ResourcesNum", ResourceStr); myXml.CloseXml(true); pnlResources.Visible = false; }
internal static void LoadOptions() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\Config.xml", Root = "Options" }; myXml.LoadXml(); C_Types.Options.Username = myXml.ReadString("UserInfo", "Username", ""); C_Types.Options.Password = myXml.ReadString("UserInfo", "Password", ""); C_Types.Options.SavePass = bool.Parse(myXml.ReadString("UserInfo", "SavePass", "False")); C_Types.Options.Ip = myXml.ReadString("Connection", "Ip", "127.0.0.1"); C_Types.Options.Port = (int)(Conversion.Val(myXml.ReadString("Connection", "Port", "7001"))); C_Types.Options.MenuMusic = myXml.ReadString("Sfx", "MenuMusic", ""); C_Types.Options.Music = byte.Parse(myXml.ReadString("Sfx", "Music", "1")); C_Types.Options.Sound = byte.Parse(myXml.ReadString("Sfx", "Sound", "1")); C_Types.Options.Volume = (float)(Conversion.Val(myXml.ReadString("Sfx", "Volume", "100"))); C_Types.Options.ScreenSize = byte.Parse(myXml.ReadString("Misc", "ScreenSize", "0")); C_Types.Options.VSync = (byte)(Conversion.Val(myXml.ReadString("Misc", "VSync", "0"))); C_Types.Options.UnlockFPS = (byte)(Conversion.Val(myXml.ReadString("Misc", "UnlockFPS", "0"))); C_Types.Options.ShowNpcBar = (byte)(Conversion.Val(myXml.ReadString("Misc", "ShowNpcBar", "1"))); C_Types.Options.ApplicationID = myXml.ReadString("Misc", "ApplicationID", "AppID"); C_Types.Options.LargeImageKey = myXml.ReadString("Misc", "LargeImageKey", "LargeImageKey"); C_Types.Options.LargeImageText = myXml.ReadString("Misc", "LargeImageText", "LargeImageText"); C_Types.Options.SmallImageKey = myXml.ReadString("Misc", "SmallImageKey", "SmallImageKey"); myXml.CloseXml(true); // show in GUI if (C_Types.Options.Music == 1) { FrmOptions.Default.optMOn.Checked = true; } else { FrmOptions.Default.optMOff.Checked = false; } if (C_Types.Options.Music == 1) { FrmOptions.Default.optSOn.Checked = true; } else { FrmOptions.Default.optSOff.Checked = false; } FrmOptions.Default.lblVolume.Text = "Volume: " + System.Convert.ToString(C_Types.Options.Volume); FrmOptions.Default.scrlVolume.Value = (int)C_Types.Options.Volume; FrmOptions.Default.cmbScreenSize.SelectedIndex = C_Types.Options.ScreenSize; }
internal static void CreateOptions() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\Config.xml", Root = "Options" }; myXml.NewXmlDocument(); C_Types.Options.Password = ""; C_Types.Options.SavePass = false; C_Types.Options.Username = ""; C_Types.Options.Ip = "127.0.0.1"; C_Types.Options.Port = 7001; C_Types.Options.MenuMusic = ""; C_Types.Options.Music = (byte)1; C_Types.Options.Sound = (byte)1; C_Types.Options.Volume = 100; C_Types.Options.ScreenSize = (byte)0; C_Types.Options.VSync = (byte)0; C_Types.Options.UnlockFPS = (byte)0; C_Types.Options.ShowNpcBar = (byte)0; C_Types.Options.ApplicationID = ""; C_Types.Options.LargeImageKey = ""; C_Types.Options.LargeImageText = ""; C_Types.Options.SmallImageKey = ""; myXml.LoadXml(); myXml.WriteString("UserInfo", "Username", C_Types.Options.Username.Trim()); myXml.WriteString("UserInfo", "Password", C_Types.Options.Password.Trim()); myXml.WriteString("UserInfo", "SavePass", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.SavePass))); myXml.WriteString("Connection", "Ip", C_Types.Options.Ip.Trim()); myXml.WriteString("Connection", "Port", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Port))); myXml.WriteString("Sfx", "MenuMusic", C_Types.Options.MenuMusic.Trim()); myXml.WriteString("Sfx", "Music", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Music.ToString())); myXml.WriteString("Sfx", "Sound", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Sound.ToString())); myXml.WriteString("Sfx", "Volume", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Volume))); myXml.WriteString("Misc", "ScreenSize", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ScreenSize.ToString())); myXml.WriteString("Misc", "VSync", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.VSync.ToString())); myXml.WriteString("Misc", "UnlockFPS", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.UnlockFPS.ToString())); myXml.WriteString("Misc", "ShowNpcBar", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ShowNpcBar.ToString())); myXml.WriteString("Misc", "ApplicationID", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ApplicationID)); myXml.WriteString("Misc", "LargeImageKey", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.LargeImageKey)); myXml.WriteString("Misc", "LargeImageText", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.LargeImageText)); myXml.WriteString("Misc", "SmallImageKey", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.SmallImageKey)); myXml.CloseXml(true); }
internal static void CreateConfig() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\UIConfiguration\\MainMenu.xml", Root = "MainMenuConfig" }; myXml.NewXmlDocument(); myXml.LoadXml(); myXml.WriteString("Window", "Width", FrmMenu.Default.Width.ToString()); myXml.WriteString("Window", "Height", FrmMenu.Default.Height.ToString()); myXml.WriteString("ServerStatusHeader", "X", FrmMenu.Default.lblStatusHeader.Location.X.ToString()); myXml.WriteString("ServerStatusHeader", "Y", FrmMenu.Default.lblStatusHeader.Location.Y.ToString()); myXml.WriteString("ServerStatus", "X", FrmMenu.Default.lblServerStatus.Location.X.ToString()); myXml.WriteString("ServerStatus", "Y", FrmMenu.Default.lblServerStatus.Location.Y.ToString()); myXml.WriteString("Logo", "X", FrmMenu.Default.picLogo.Location.X.ToString()); myXml.WriteString("Logo", "Y", FrmMenu.Default.picLogo.Location.Y.ToString()); myXml.WriteString("Logo", "Width", FrmMenu.Default.picLogo.Width.ToString()); myXml.WriteString("Logo", "Height", FrmMenu.Default.picLogo.Height.ToString()); myXml.WriteString("ButtonPlay", "X", FrmMenu.Default.btnPlay.Location.X.ToString()); myXml.WriteString("ButtonPlay", "Y", FrmMenu.Default.btnPlay.Location.Y.ToString()); myXml.WriteString("ButtonPlay", "Width", FrmMenu.Default.btnPlay.Width.ToString()); myXml.WriteString("ButtonPlay", "Height", FrmMenu.Default.btnPlay.Height.ToString()); myXml.WriteString("ButtonRegister", "X", FrmMenu.Default.btnRegister.Location.X.ToString()); myXml.WriteString("ButtonRegister", "Y", FrmMenu.Default.btnRegister.Location.Y.ToString()); myXml.WriteString("ButtonRegister", "Width", FrmMenu.Default.btnRegister.Width.ToString()); myXml.WriteString("ButtonRegister", "Height", FrmMenu.Default.btnRegister.Height.ToString()); myXml.WriteString("ButtonCredits", "X", FrmMenu.Default.btnCredits.Location.X.ToString()); myXml.WriteString("ButtonCredits", "Y", FrmMenu.Default.btnCredits.Location.Y.ToString()); myXml.WriteString("ButtonCredits", "Width", FrmMenu.Default.btnCredits.Width.ToString()); myXml.WriteString("ButtonCredits", "Height", FrmMenu.Default.btnCredits.Height.ToString()); myXml.WriteString("ButtonExit", "X", FrmMenu.Default.btnExit.Location.X.ToString()); myXml.WriteString("ButtonExit", "Y", FrmMenu.Default.btnExit.Location.Y.ToString()); myXml.WriteString("ButtonExit", "Width", FrmMenu.Default.btnExit.Width.ToString()); myXml.WriteString("ButtonExit", "Height", FrmMenu.Default.btnExit.Height.ToString()); myXml.WriteString("PanelMain", "X", FrmMenu.Default.pnlMainMenu.Location.X.ToString()); myXml.WriteString("PanelMain", "Y", FrmMenu.Default.pnlMainMenu.Location.Y.ToString()); myXml.WriteString("PanelMain", "Width", FrmMenu.Default.pnlMainMenu.Width.ToString()); myXml.WriteString("PanelMain", "Height", FrmMenu.Default.pnlMainMenu.Height.ToString()); myXml.CloseXml(true); }
internal static void SendSaveAutoMapper() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\AutoMapper.xml", Root = "Options" }; ASFW.ByteStream buffer = new ASFW.ByteStream(4); buffer.WriteInt32((System.Int32)Packets.EditorPackets.SaveAutoMap); buffer.WriteInt32(MapStart); buffer.WriteInt32(MapSize); buffer.WriteInt32(MapX); buffer.WriteInt32(MapY); buffer.WriteInt32(SandBorder); buffer.WriteInt32(DetailFreq); buffer.WriteInt32(ResourceFreq); myXml.LoadXml(); //send xml info buffer.WriteString(myXml.ReadString("Resources", "ResourcesNum")); for (var Prefab = 1; Prefab <= (int)TilePrefab.Count - 1; Prefab++) { for (var Layer = 1; Layer <= (int)Enums.LayerType.Count - 1; Layer++) { if (Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset")) > 0) { buffer.WriteInt32(System.Convert.ToInt32(Layer)); buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset")))); buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X")))); buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y")))); buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile")))); } } buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Type")))); } myXml.CloseXml(false); E_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head); buffer.Dispose(); }
internal static void LoadConfig() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\UIConfiguration\\MainMenu.xml", Root = "MainMenuConfig" }; myXml.LoadXml(); FrmMenu.Default.Width = int.Parse(myXml.ReadString("Window", "Width")); FrmMenu.Default.Height = int.Parse(myXml.ReadString("Window", "Height")); FrmMenu.Default.pnlLoad.Width = int.Parse(myXml.ReadString("Window", "Width")); FrmMenu.Default.pnlLoad.Height = int.Parse(myXml.ReadString("Window", "Height")); FrmMenu.Default.lblStatusHeader.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ServerStatusHeader", "X")), int.Parse(myXml.ReadString("ServerStatusHeader", "Y"))); FrmMenu.Default.lblServerStatus.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ServerStatus", "X")), int.Parse(myXml.ReadString("ServerStatus", "Y"))); FrmMenu.Default.picLogo.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("Logo", "X")), int.Parse(myXml.ReadString("Logo", "Y"))); myXml.ReadString("Logo", "Width", FrmMenu.Default.picLogo.Width.ToString()); myXml.ReadString("Logo", "Height", FrmMenu.Default.picLogo.Height.ToString()); FrmMenu.Default.btnPlay.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonPlay", "X")), int.Parse(myXml.ReadString("ButtonPlay", "Y"))); myXml.ReadString("ButtonPlay", "Width", FrmMenu.Default.btnPlay.Width.ToString()); myXml.ReadString("ButtonPlay", "Height", FrmMenu.Default.btnPlay.Height.ToString()); FrmMenu.Default.btnRegister.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonRegister", "X")), int.Parse(myXml.ReadString("ButtonRegister", "Y"))); myXml.WriteString("ButtonRegister", "Width", FrmMenu.Default.btnRegister.Width.ToString()); myXml.WriteString("ButtonRegister", "Height", FrmMenu.Default.btnRegister.Height.ToString()); FrmMenu.Default.btnCredits.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonCredits", "X")), int.Parse(myXml.ReadString("ButtonCredits", "Y"))); myXml.ReadString("ButtonCredits", "Width", FrmMenu.Default.btnCredits.Width.ToString()); myXml.ReadString("ButtonCredits", "Height", FrmMenu.Default.btnCredits.Height.ToString()); FrmMenu.Default.btnExit.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonExit", "X")), int.Parse(myXml.ReadString("ButtonExit", "Y"))); myXml.ReadString("ButtonExit", "Width", FrmMenu.Default.btnExit.Width.ToString()); myXml.ReadString("ButtonExit", "Height", FrmMenu.Default.btnExit.Height.ToString()); FrmMenu.Default.pnlMainMenu.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("PanelMain", "X")), int.Parse(myXml.ReadString("PanelMain", "Y"))); myXml.ReadString("PanelMain", "Width", FrmMenu.Default.pnlMainMenu.Width.ToString()); myXml.ReadString("PanelMain", "Height", FrmMenu.Default.pnlMainMenu.Height.ToString()); myXml.CloseXml(true); }
public static void LoadSkillExp() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + @"\Data\SkillExp.xml", Root = "Data" }; myXml.LoadXml(); for (int i = 1; i <= 100; i++) { SkillExpTable[i] = Convert.ToInt32(myXml.ReadString("Level", i.ToString())); } myXml.CloseXml(false); }
public static void CreateHouses() { XmlClass myXml = new XmlClass { Filename = Path.Combine(Application.StartupPath, "data", "houseconfig.xml"), Root = "Config" }; myXml.NewXmlDocument(); myXml.LoadXml(); myXml.WriteString("House" + Conversions.ToString(1), "BaseMap", Conversions.ToString(S_Housing.HouseConfig[1].BaseMap)); myXml.WriteString("House" + Conversions.ToString(1), "Name", S_Housing.HouseConfig[1].ConfigName); myXml.WriteString("House" + Conversions.ToString(1), "MaxFurniture", Conversions.ToString(S_Housing.HouseConfig[1].MaxFurniture)); myXml.WriteString("House" + Conversions.ToString(1), "Price", Conversions.ToString(S_Housing.HouseConfig[1].Price)); myXml.WriteString("House" + Conversions.ToString(1), "X", Conversions.ToString(S_Housing.HouseConfig[1].X)); myXml.WriteString("House" + Conversions.ToString(1), "Y", Conversions.ToString(S_Housing.HouseConfig[1].Y)); myXml.CloseXml(true); }
public static void Packet_AutoMapper(ref byte[] data) { int Layer = 0; ASFW.ByteStream buffer = new ASFW.ByteStream(data); MapStart = buffer.ReadInt32(); MapSize = buffer.ReadInt32(); MapX = buffer.ReadInt32(); MapY = buffer.ReadInt32(); SandBorder = buffer.ReadInt32(); DetailFreq = buffer.ReadInt32(); ResourceFreq = buffer.ReadInt32(); XmlClass myXml = new XmlClass() { Filename = System.IO.Path.Combine(Application.StartupPath, "Data", "AutoMapper.xml"), Root = "Options" }; myXml.LoadXml(); myXml.WriteString("Resources", "ResourcesNum", buffer.ReadString()); for (var Prefab = 1; Prefab <= (int)TilePrefab.Count - 1; Prefab++) { Tile[(int)Prefab].Layer = new Types.TileDataRec[(int)Enums.LayerType.Count]; Layer = buffer.ReadInt32(); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset", System.Convert.ToString(buffer.ReadInt32())); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X", System.Convert.ToString(buffer.ReadInt32())); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y", System.Convert.ToString(buffer.ReadInt32())); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile", System.Convert.ToString(buffer.ReadInt32())); myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Type", System.Convert.ToString(buffer.ReadInt32())); } myXml.CloseXml(true); buffer.Dispose(); E_Globals.InitAutoMapper = true; }
public static void SaveHouse(int index) { XmlClass myXml = new XmlClass { Filename = Path.Combine(Application.StartupPath, "data", "houseconfig.xml"), Root = "Config" }; myXml.LoadXml(); if (index > 0 && index <= S_Housing.MAX_HOUSES) { myXml.WriteString("House" + Conversions.ToString(index), "BaseMap", Conversions.ToString(S_Housing.HouseConfig[index].BaseMap)); myXml.WriteString("House" + Conversions.ToString(index), "Name", S_Housing.HouseConfig[index].ConfigName); myXml.WriteString("House" + Conversions.ToString(index), "MaxFurniture", Conversions.ToString(S_Housing.HouseConfig[index].MaxFurniture)); myXml.WriteString("House" + Conversions.ToString(index), "Price", Conversions.ToString(S_Housing.HouseConfig[index].Price)); myXml.WriteString("House" + Conversions.ToString(index), "X", Conversions.ToString(S_Housing.HouseConfig[index].X)); myXml.WriteString("House" + Conversions.ToString(index), "Y", Conversions.ToString(S_Housing.HouseConfig[index].Y)); } myXml.CloseXml(true); S_Housing.LoadHouses(); }
// Token: 0x060001D8 RID: 472 RVA: 0x000398D4 File Offset: 0x00037AD4 public static void LoadHouses() { bool flag = !File.Exists(Path.Combine(Application.StartupPath, "data", "houseconfig.xml")); if (flag) { S_Housing.CreateHouses(); } XmlClass myXml = new XmlClass { Filename = Path.Combine(Application.StartupPath, "data", "houseconfig.xml"), Root = "Config" }; myXml.LoadXml(); int max_HOUSES = S_Housing.MAX_HOUSES; checked { for (int i = 1; i <= max_HOUSES; i++) { S_Housing.HouseConfig[i].BaseMap = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "BaseMap", ""))); S_Housing.HouseConfig[i].ConfigName = (myXml.ReadString("House" + Conversions.ToString(i), "Name", "").Trim()); S_Housing.HouseConfig[i].MaxFurniture = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "MaxFurniture", ""))); S_Housing.HouseConfig[i].Price = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "Price", ""))); S_Housing.HouseConfig[i].X = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "X", ""))); S_Housing.HouseConfig[i].Y = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "Y", ""))); } myXml.CloseXml(false); int playersOnline = S_GameLogic.GetPlayersOnline(); for (int i = 1; i <= playersOnline; i++) { bool flag2 = S_NetworkConfig.IsPlaying(i); if (flag2) { S_Housing.SendHouseConfigs(i); } } } }
internal static void CreateOptions() { XmlClass myXml = new XmlClass() { Filename = Application.StartupPath + "\\Data\\Config.xml", Root = "Options" }; myXml.NewXmlDocument(); E_Types.Options.Password = ""; E_Types.Options.SavePass = false; E_Types.Options.Username = ""; E_Types.Options.IP = "Localhost"; E_Types.Options.Port = 7001; E_Types.Options.MenuMusic = ""; E_Types.Options.Music = (byte)1; E_Types.Options.Sound = (byte)1; E_Types.Options.Volume = 100; myXml.LoadXml(); myXml.WriteString("UserInfo", "Username", E_Types.Options.Username.Trim()); myXml.WriteString("UserInfo", "Password", E_Types.Options.Password.Trim()); myXml.WriteString("UserInfo", "SavePass", System.Convert.ToString(E_Types.Options.SavePass).Trim()); myXml.WriteString("Connection", "Ip", E_Types.Options.IP.Trim()); myXml.WriteString("Connection", "Port", System.Convert.ToString(E_Types.Options.Port).Trim()); myXml.WriteString("Sfx", "MenuMusic", E_Types.Options.MenuMusic.Trim()); myXml.WriteString("Sfx", "Music", E_Types.Options.Music.ToString()); myXml.WriteString("Sfx", "Sound", E_Types.Options.Sound.ToString()); myXml.WriteString("Sfx", "Volume", System.Convert.ToString(E_Types.Options.Volume).Trim()); myXml.CloseXml(true); }