Exemple #1
0
        internal static bool Initialize( MainWindow mainWindow )
        {
            if (File.Exists( Path.Combine( StartupPath, "Updater_New.exe" ) ))
            {
                try
                {
                    File.Copy( Path.Combine( StartupPath, "Updater_New.exe" ), Path.Combine( StartupPath, "Updater.exe" ), true );
                }
                catch (Exception)
                {
                }
            }

            string[] renameFiles = Directory.GetFiles( StartupPath, "*.new", SearchOption.AllDirectories );
            foreach (string renameFile in renameFiles)
            {
                string path = Path.GetDirectoryName( renameFile );
                string origFile = Path.Combine( path, Path.GetFileNameWithoutExtension( renameFile ) );
                try
                {
                    File.Delete( origFile );
                    File.Move( renameFile, origFile );
                }
                catch (Exception)
                {
                }
            }

            if (!MainWindow.CurrentOptions.IsValid()) return false;
            try { Config.Register( "UOM hooks", Path.Combine( StartupPath, "UOMachine.exe" ), Path.Combine( StartupPath, "ClientHook.dll" ) ); }
            catch (Exception ex)
            {
                Utility.Log.LogMessage( ex );
                /* Ensure EasyHook files are in output directory if you get this error */
                System.Windows.MessageBox.Show( Strings.ErrorwithGACinstallation );
                return false;
            }
            myMainWindow = mainWindow;
            InternalEventHandler.IncomingPacketHandler.Initialize();
            InternalEventHandler.OutgoingPacketHandler.Initialize();
            Network.Initialize();
            InternalEventHandler.IPCHandler.Initialize();
            mySkillNames = Skills.GetSkills( MainWindow.CurrentOptions.UOFolder );
            TileData.Initialize( MainWindow.CurrentOptions.UOFolder );
            Map.Initialize( MainWindow.CurrentOptions.UOFolder, MainWindow.CurrentOptions.CacheLevel );
            Art.Initialize( MainWindow.CurrentOptions.UOFolder );
            Cliloc.Initialize( MainWindow.CurrentOptions.UOFolder );
            NamespaceToAssembly.Initialize();
            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();
            return true;
        }