示例#1
0
        /// <summary>
        ///     Initializes the mock system. Pass in the path to the Space Engineers Bin64 folder.
        /// </summary>
        /// <param name="mdkOptionsPath">The path to the MDK options file</param>
        public static void Load(string mdkOptionsPath = @"mdk\mdk.paths.props")
        {
            if (string.IsNullOrEmpty(mdkOptionsPath))
            {
                throw new ArgumentException(Resources.MDK_Load_EmptyPath, nameof(mdkOptionsPath));
            }

            var props       = MDKProjectPaths.Load(mdkOptionsPath);
            var gameBinPath = props.GameBinPath;

            var directory = new DirectoryInfo(gameBinPath);

            if (!directory.Exists)
            {
                throw new ArgumentException(string.Format(Resources.MDK_Load_PathNotFound, gameBinPath), nameof(gameBinPath));
            }

            foreach (var dllFileName in directory.EnumerateFiles("*.dll"))
            {
                AssemblyName assemblyName;
                try
                {
                    assemblyName = AssemblyName.GetAssemblyName(dllFileName.FullName);
                }
                catch (BadImageFormatException)
                {
                    // Not a .NET assembly or wrong platform, ignore
                    continue;
                }
                AssemblyNames[assemblyName.FullName] = assemblyName;
            }
            AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;

            GameBinPath = directory.FullName;
        }
示例#2
0
        static partial void ImportLegacy_1_1(string legacyOptionsFileName, ref MDKProjectOptions options, string optionsFileName, ref MDKProjectPaths paths, string pathsFileName)
        {
            var scriptInfo = LegacyProjectScriptInfo_1_1.Load(legacyOptionsFileName);

            if (scriptInfo.IsValid)
            {
                options = MDKProjectOptions.Import(scriptInfo, optionsFileName);
                paths   = MDKProjectPaths.Import(scriptInfo, pathsFileName);
            }
        }