public static LoadGameResult LoadSaveGameData(
            string saveName,
            string[] loadedModuleNames)
        {
            List <ModuleInfo> modules = MBSaveLoad.GetModules(loadedModuleNames);

            MBSaveLoad.InitializeAutoSaveIndex(saveName);
            string      fileName = saveName + ".sav";
            ISaveDriver driver   = MBSaveLoad._saveDriver;

            driver.SetFileName(fileName);
            ApplicationVersion applicationVersion = driver.LoadMetaData().GetApplicationVersion();

            if (applicationVersion.Major <= 1 && applicationVersion.Minor <= 4 && applicationVersion.Revision < 2)
            {
                driver = (ISaveDriver) new OldFileDriver();
                driver.SetFileName(fileName);
            }
            LoadResult loadResult = SaveManager.Load(driver, true);

            if (loadResult.Successful)
            {
                MBSaveLoad.ActiveSaveSlotName = !MBSaveLoad.IsSaveFileNameReserved(saveName) ? saveName : (string)null;
                return(new LoadGameResult(loadResult, MBSaveLoad.CheckModules(loadResult.MetaData, modules)));
            }
            Debug.Print("Error: Could not load the game!");
            return((LoadGameResult)null);
        }
        private static MetaData GetSaveMetaData(CampaignSaveMetaDataArgs data)
        {
            MetaData          metaData = new MetaData();
            List <ModuleInfo> modules  = MBSaveLoad.GetModules(data.ModuleNames);

            metaData["Modules"] = string.Join(";", modules.Select <ModuleInfo, string>((Func <ModuleInfo, string>)(q => q.Name)));
            foreach (ModuleInfo moduleInfo in modules)
            {
                metaData["Module_" + moduleInfo.Name] = moduleInfo.Version.ToString();
            }
            metaData.Add("ApplicationVersion", ApplicationVersion.FromParametersFile(ApplicationVersionGameType.Singleplayer).ToString());
            metaData.Add("CreationTime", DateTime.Now.ToString());
            foreach (KeyValuePair <string, string> keyValuePair in data.OtherData)
            {
                metaData.Add(keyValuePair.Key, keyValuePair.Value);
            }
            return(metaData);
        }