Example #1
0
        public BuildOrderGroup(BuildOrderData buildOrderData)
        {
            Author   = buildOrderData.Author;
            Date     = buildOrderData.Date;
            Revision = buildOrderData.Revision;

            for (int i = 0; i < buildOrderData.GameVersions.Length; i++)
            {
                GameVersions.Add(buildOrderData.GameVersions[i]);
            }

            for (int i = 0; i < buildOrderData.BuildOrders.Length; i++)
            {
                BuildOrders.Add(new DynamicBuildOrder(buildOrderData.BuildOrders[i]));
            }
        }
Example #2
0
        Process GetGameProcess()
        {
            Process game = Process.GetProcesses().FirstOrDefault(p => p.ProcessName.ToLower() == "ua" && !p.HasExited && !_ignorePIDs.Contains(p.Id));

            if (game == null)
            {
                LevelSystemInstancePointer = IntPtr.Zero;
                failedScansCount           = 0;
                isLevelSystemHooked        = false;
                return(null);
            }

            if (game.MainWindowTitle == null || game.MainWindowTitle == "")
            {
                return(null);
            }

            if (game.MainWindowTitle != "Underworld Ascendant")
            {
                _ignorePIDs.Add(game.Id);
                return(null);
            }

            var assemblyCsharpPath = Path.Combine(Path.GetDirectoryName(game.MainModule.FileName), "UA_Data", "Managed", "Assembly-CSharp.dll");

            if (File.Exists(assemblyCsharpPath))
            {
                FileInfo info = new FileInfo(assemblyCsharpPath);
                switch (info.Length)
                {
                case ((long)CsharpAssemblySizes.v1_00):
                    gameVersion = GameVersions.v1_00;
                    break;

                case ((long)CsharpAssemblySizes.v1_02):
                    gameVersion = GameVersions.v1_02;
                    break;

                case ((long)CsharpAssemblySizes.v1_1):
                    gameVersion = GameVersions.v1_1;
                    break;

                default:
                    gameVersion = GameVersions.v1_3;
                    break;
                }
            }
            else if (FindModuleByName(game, "gameassembly.dll", out ProcessModule gameAssemblyModule))
            {
                switch (gameAssemblyModule.ModuleMemorySize)
                {
                case (int)GameAssemblySizes.v1_4:
                    gameVersion = GameVersions.v1_4;
                    break;

                default:
                    SetInjectionLabelInSettings(InjectionStatus.UnknownLibrarySize, IntPtr.Zero);
                    gameVersion = GameVersions.Unsupported;
                    _ignorePIDs.Add(game.Id);
                    return(null);
                }
            }
            else
            {
                _ignorePIDs.Add(game.Id);
                return(null);
            }


            return(game);
        }