private void LoadfilesBackground(System.Object sender, DoWorkEventArgs e) { string aerror = string.Empty; try { if (sender != null) { BackgroundWorker worker = (BackgroundWorker)sender; worker.DoWork -= LoadfilesBackground; } if (File.Exists(mPluginConfigfilename)) { this.mPluginConfig = (PluginSettings)Util.DeSerializeObject(mPluginConfigfilename, typeof(PluginSettings)); } //create default file if (mPluginConfig == null) { mPluginConfig = new PluginSettings(); mPluginConfig.Shortcuts = new SDictionary<string, string>(); mPluginConfig.Shortcuts.Add("hr", "House Recall"); mPluginConfig.Shortcuts.Add("mr", "House Mansion_Recall"); mPluginConfig.Shortcuts.Add("ah", "Allegiance Hometown"); mPluginConfig.Shortcuts.Add("ls", "Lifestone"); mPluginConfig.Shortcuts.Add("mp", "Marketplace"); mPluginConfig.Alerts = getbaseAlerts(); mPluginConfig.AlertKeyMob = "Monster"; mPluginConfig.AlertKeyPortal = "Portal"; mPluginConfig.AlertKeySalvage = "Salvage"; mPluginConfig.AlertKeyScroll = "Salvage"; mPluginConfig.AlertKeyThropy = "Trophy"; mPluginConfig.Alertwawfinished = "finished.wav"; } //HACK: Still hating the sounds // mplayer = new mediaplayer(); // mplayer.Volume = mPluginConfig.wavVolume; loadcolortable(); //Check for Gamedata.xml if (!File.Exists(Util.docPath + "\\GameData.xml")) { //Create it if !exists iGameData.defaultfill(); Util.SerializeObject(Util.docPath + "\\GameData.xml", iGameData); } //Now that it exists, check version and update if needed if (File.Exists(Util.docPath + "\\GameData.xml")) { iGameData = (AlincoVVS.PluginCore.GameData)Util.DeSerializeObject(Util.docPath + "\\GameData.xml", typeof(GameData)); //Look to code this for a single line revision of Gamedata version, currently must update in 2 locations if (iGameData.version < 10) { iGameData.defaultfill(); Util.SerializeObject(Util.docPath + "\\GameData.xml", iGameData); } } mWorldConfigfilename = Util.docPath + "\\" + Util.normalizePath(Core.CharacterFilter.Server); if (!Directory.Exists(mWorldConfigfilename)) { Directory.CreateDirectory(mWorldConfigfilename); } mExportInventoryname = Util.docPath + "\\Inventory"; if (!Directory.Exists(mExportInventoryname)) { Directory.CreateDirectory(mExportInventoryname); writebasexslt(mExportInventoryname + "\\Inventory.xslt"); } mExportInventoryname += "\\" + Core.CharacterFilter.Server + ".xml"; mWorldInventoryname = Util.docPath + "\\" + Util.normalizePath(Core.CharacterFilter.Server) + "\\Inventory.xml"; if (File.Exists(mWorldInventoryname)) { object tobj = Util.DeSerializeObject(mWorldInventoryname, typeof(SDictionary<int, InventoryItem>)); if (tobj != null) { mGlobalInventory = (global::AlincoVVS.PluginCore.SDictionary<int, global::AlincoVVS.PluginCore.InventoryItem>)tobj; mStorageInfo = (global::AlincoVVS.PluginCore.SDictionary<int, string>)Util.DeSerializeObject(mWorldInventoryname + "storage", typeof(SDictionary<int, string>)); } else { mGlobalInventory = new SDictionary<int, InventoryItem>(); } } else { writebasexslt(Util.docPath + "\\" + Util.normalizePath(Core.CharacterFilter.Server) + "\\Inventory.xslt"); } mCharConfigfilename = mWorldConfigfilename; mWorldConfigfilename += "\\Settings.xml"; if (File.Exists(mWorldConfigfilename)) { mWorldConfig = (WorldSettings)Util.DeSerializeObject(mWorldConfigfilename, typeof(WorldSettings)); } mCharConfigfilename += "\\" + Util.normalizePath(Core.CharacterFilter.Name) + ".xml"; if (File.Exists(mCharConfigfilename)) { mCharconfig = (CharSettings)Util.DeSerializeObject(mCharConfigfilename, typeof(CharSettings)); } if (mWorldConfig == null) { mWorldConfig = new WorldSettings(); } if (mCharconfig == null) { mCharconfig = new CharSettings(); } mProtectedCorpses.Add("Corpse of " + Core.CharacterFilter.Name); mFilesLoaded = true; } catch (Exception ex) { aerror = ex.Message + ex.StackTrace; Util.ErrorLogger(ex); } if (aerror != string.Empty) { Util.bcast(aerror); } }