public static void UpdateWarData() { try { //FileStream fs = new FileStream(Application.StartupPath + "\\mythloginserviceconfig.xml", FileMode.Open, FileAccess.Read); FileStream fs = new FileStream(Application.StartupPath.Remove(Application.StartupPath.LastIndexOf('\\')) + "\\mythloginserviceconfig.xml", FileMode.Open, FileAccess.Read); // Je Fawk | 13 April 2014 | Accessing the game folder path taken from Accueil from ServerLauncher try { Directory.SetCurrentDirectory(Accueil.pathToGameFolder); } catch (Exception exp) { MessageBox.Show("Error trying to set the current directory: " + exp.Message); return; } #region Old code //Directory.SetCurrentDirectory(Directory.GetCurrentDirectory() + "\\..\\"); #endregion HashDictionary hashDictionary = new HashDictionary(); hashDictionary.AddHash(0x3FE03665, 0x349E2A8C, "mythloginserviceconfig.xml", 0); MYPHandler.MYPHandler mypHandler = new MYPHandler.MYPHandler("data.myp", null, null, hashDictionary); mypHandler.GetFileTable(); FileInArchive theFile = mypHandler.SearchForFile("mythloginserviceconfig.xml"); if (theFile == null) { MessageBox.Show("Can not find config file in data.myp"); return; } // Je Fawk | 13 April 2014 | Modified the path from the Application.StartupPath which was the \Launcher\Launcher.exe if (File.Exists(Application.StartupPath.Remove(Application.StartupPath.LastIndexOf('\\')) + "\\mythloginserviceconfig.xml") == false) #region Old code //if (File.Exists(Application.StartupPath + "\\mythloginserviceconfig.xml") == false) #endregion { MessageBox.Show("Missing file : mythloginserviceconfig.xml"); return; } mypHandler.ReplaceFile(theFile, fs); fs.Close(); } catch (Exception e) { Print(e.ToString()); } }
static public void UpdateWarData() { try { FileStream fs = new FileStream(Application.StartupPath + "\\mythloginserviceconfig.xml", FileMode.Open, FileAccess.Read); Directory.SetCurrentDirectory(Directory.GetCurrentDirectory() + "\\..\\"); HashDictionary hashDictionary = new HashDictionary(); hashDictionary.AddHash(0x3FE03665, 0x349E2A8C, "mythloginserviceconfig.xml", 0); MYPHandler.MYPHandler mypHandler = new MYPHandler.MYPHandler("data.myp", null, null, hashDictionary); mypHandler.GetFileTable(); FileInArchive theFile = mypHandler.SearchForFile("mythloginserviceconfig.xml"); if (theFile == null) { MessageBox.Show("Can not find config file in data.myp"); return; } if (File.Exists(Application.StartupPath + "\\mythloginserviceconfig.xml") == false) { MessageBox.Show("Missing file : mythloginserviceconfig.xml"); return; } mypHandler.ReplaceFile(theFile, fs); fs.Close(); } catch (Exception e) { Print(e.ToString()); } }