Exemplo n.º 1
0
        private bool UpdateWar(string WarhammerDirectory)
        {
            FileStream fs = new FileStream(Application.StartupPath + "\\mythloginserviceconfig.xml", FileMode.Open, FileAccess.Read);

            Directory.SetCurrentDirectory(WarhammerDirectory);

            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(false);
            }

            if (File.Exists(Application.StartupPath + "\\mythloginserviceconfig.xml") == false)
            {
                MessageBox.Show("Missing file : mythloginserviceconfig.xml");
                return(false);
            }

            mypHandler.ReplaceFile(theFile, fs);

            fs.Close();

            return(true);
        }
Exemplo n.º 2
0
        public static void UpdateWarData()
        {
            if (ApocLauncher.Acc.AllowServerPatch)
            {
                try
                {
                    _logger.Info("Updating mythloginserviceconfig.xml and data.myp");
                    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)
                    {
                        _logger.Error("Can not find config file in data.myp");
                        return;
                    }

                    if (File.Exists(Application.StartupPath + "\\mythloginserviceconfig.xml") == false)
                    {
                        _logger.Error("Missing file : mythloginserviceconfig.xml");
                        return;
                    }

                    mypHandler.ReplaceFile(theFile, fs);

                    fs.Close();
                }
                catch (Exception e)
                {
                    Print(e.ToString());
                }
            }
            else
            {
                _logger.Info("Not Patching data.myp");
            }
        }
Exemplo n.º 3
0
        private void updateMYP()
        {
            FileStream fs = new FileStream(Application.StartupPath + "\\PortalSettings.xml", FileMode.Open, FileAccess.Read);

            Directory.SetCurrentDirectory(path);
            HashDictionary hashDictionary = new HashDictionary();

            hashDictionary.AddHash(0x3FE03665, 0x349E2A8C, "F4FCD464_3FE03665349E2A8C.xml", 0);
            MYPHandler.MYPHandler mypHandler = new MYPHandler.MYPHandler("data.myp", null, null, hashDictionary);
            mypHandler.GetFileTable();
            FileInArchive theFile = mypHandler.SearchForFile("F4FCD464_3FE03665349E2A8C.xml");

            mypHandler.ReplaceFile(theFile, fs);

            fs.Close();

            if (theFile != null)
            {
                MessageBox.Show("patch success!");
            }
        }
Exemplo n.º 4
0
        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());
            }
        }
Exemplo n.º 5
0
        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());
            }
        }