コード例 #1
0
        /// <summary>
        /// Gets the full path of the mod dll to be injected for this individual game.
        /// </summary>
        private static string GetDLLPathToInject(ModConfig modConfig)
        {
            // If we are a 32bit process, inject 32bit mods.
            // We would have restarted in 64bit mode by now if the game was 64bit.
            if (IntPtr.Size == 4)
            {
                // Explicitly Set? Use that path.
                if (!String.IsNullOrEmpty(modConfig.DllFile32))
                {
                    return(Path.Combine(modConfig.GetModDirectory(), modConfig.DllFile32));
                }

                // Not Explicitly Set.
                string x86DllLocation = Path.Combine(modConfig.GetModDirectory(), Strings.Loader.Mod32BitDllFile);
                if (File.Exists(x86DllLocation))
                {
                    return(x86DllLocation);
                }
            }
            else
            {
                // Explicitly Set? Use that path.
                if (!String.IsNullOrEmpty(modConfig.DllFile64))
                {
                    return(Path.Combine(modConfig.GetModDirectory(), modConfig.DllFile64));
                }

                // Not Explicitly Set.
                string x64DllLocation = Path.Combine(modConfig.GetModDirectory(), Strings.Loader.Mod64BitDllFile);
                if (File.Exists(x64DllLocation))
                {
                    return(x64DllLocation);
                }
            }

            return(null);
        }