private void CASCworker_DoWork(object sender, DoWorkEventArgs e) { var basedir = ConfigurationManager.AppSettings["basedir"]; if (Directory.Exists(basedir)) { if (File.Exists(Path.Combine(basedir, ".build.info"))) { cascworker.ReportProgress(0, "Loading WoW from disk.."); try { CASC.InitCasc(cascworker, basedir, ConfigurationManager.AppSettings["program"]); } catch (Exception exception) { Logger.WriteLine("CASCWorker: Exception from {0} during CASC startup: {1}", exception.Source, exception.Message); var result = MessageBox.Show("A fatal error occured during loading your local WoW installation.\n\n" + exception.Message + "\n\nPlease try updating/repairing WoW through the Battle.net App. \n\nIf that doesn't work do the following: \n- Go to your WoW install directory\n- Go inside the data folder\n- Rename the 'indices' folder to 'indices_old'\n- Start WoW to regenerate indices\n- After WoW has started, quit WoW\n\nStill having issues?\nGo to marlam.in/obj and contact me for further help.", "Fatal error", MessageBoxButton.OK, MessageBoxImage.Error); if (result == MessageBoxResult.OK) { Environment.Exit(1); } } } else { throw new Exception("Unable to find World of Warcraft client!"); } } else { cascworker.ReportProgress(0, "Loading WoW from web.."); CASC.InitCasc(cascworker, null, ConfigurationManager.AppSettings["program"]); } }
public void LoadMap(string mapName) { _loader = new BackgroundWorkerEx(); _loader.DoWork += (sender, e) => { _loader.ReportProgress(1, "Loading WDT..."); Renderer?.Delete(); var wdt = new WDT(string.Format(@"World\Maps\{0}\{0}.wdt", mapName)); Renderer = new WDTRenderer(this, mapName, wdt); _loader.ReportProgress(100, "Map loaded"); }; _loader.ProgressChanged += (sender, args) => { if (OnProgress != null) { OnProgress(args.ProgressPercentage, (string)args.UserState); } }; _loader.RunWorkerCompleted += (sender, e) => InitializeView(); _loader.RunWorkerAsync(); }
private void cascworker_DoWork(object sender, DoWorkEventArgs e) { var basedir = ConfigurationManager.AppSettings["basedir"]; if (Directory.Exists(basedir)) { if (File.Exists(Path.Combine(basedir, ".build.info"))) { cascworker.ReportProgress(0, "Loading WoW from disk.."); CASC.InitCasc(cascworker, basedir, ConfigurationManager.AppSettings["program"]); } else { throw new Exception("Unable to find World of Warcraft client!"); } } else { cascworker.ReportProgress(0, "Loading WoW from web.."); CASC.InitCasc(cascworker, null, ConfigurationManager.AppSettings["program"]); } }
private void fileworker_DoWork(object sender, DoWorkEventArgs e) { var results = new List <string>(); var remaining = new List <string>(); var progress = 0; remaining.Add((string)e.Argument); while (remaining.Count > 0) { var filename = remaining[0]; if (filename.EndsWith(".wmo")) { var wmo = new WoWFormatLib.FileReaders.WMOReader(); wmo.LoadWMO(filename); // Loop through filenames from WMO } else if (filename.EndsWith(".adt")) { var adt = new WoWFormatLib.FileReaders.ADTReader(); adt.LoadADT(filename); foreach (var entry in adt.adtfile.objects.wmoNames.filenames) { results.Add(entry.ToLower()); } foreach (var entry in adt.adtfile.objects.m2Names.filenames) { results.Add(entry.ToLower()); } } remaining.Remove(filename); } fileworker.ReportProgress(progress, results); }