Exemple #1
0
        private static void AddReferences(string sourcecode, CompilerParameters cp)
        {
            cp.ReferencedAssemblies.Add("system.dll");
            string usingPattern     = @"using\s+([\w\.]+)[\s;{]";
            string referencePattern = "/\\*\\s*<\\s*[aA][rR][eE][fF]\\s*=\\s*?\"(.+?)\"\\s*>\\s*\\*/";

            string[] assemblies;

            foreach (Match m in Regex.Matches(sourcecode, usingPattern))
            {
                if (NamespaceToAssembly.Resolve(m.Groups[1].Value, out assemblies))
                {
                    foreach (string assembly in assemblies)
                    {
                        if (!cp.ReferencedAssemblies.Contains(assembly.ToLower()))
                        {
                            cp.ReferencedAssemblies.Add(assembly.ToLower());
                        }
                    }
                }
            }

            foreach (Match m in Regex.Matches(sourcecode, referencePattern))
            {
                if (!cp.ReferencedAssemblies.Contains(m.Groups[1].Value.ToLower()))
                {
                    cp.ReferencedAssemblies.Add(m.Groups[1].Value.ToLower());
                }
            }
        }
Exemple #2
0
 internal static bool Initialize(MainWindow mainWindow)
 {
     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("Error with GAC installation, please see log for details.");
         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);
     Cliloc.Initialize(MainWindow.CurrentOptions.UOFolder);
     NamespaceToAssembly.Initialize();
     return(true);
 }
Exemple #3
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);
        }