/// <summary> /// Receive as parameter the steam backup folder where the desactivated games are saved, /// and the game folder. Search on all directories of the backup folder for game instalations /// with integrity files. Returns a list of desactivated profiles. /// </summary> /// <param name="bakcupFolder"></param> /// <param name="gameFolder"></param> /// <returns></returns> public static List <SPProfile> loadDesactivatedProfiles(string backupFolder, string gameFolder) { ILogger slog = Log4NetLogger.getInstance(LogAppender.APP_SETTINGS, Consts.DIR_SETTINGS); List <SPProfile> listDesactivated = new List <SPProfile>(); string[] allDirs = Directory.GetDirectories(backupFolder); slog.Debug("* allDirs:{" + CSharp.arrayToCsv(allDirs) + "}"); slog.Debug("* allDirs.Length:{" + allDirs.Length + "}"); if ((allDirs != null) && (allDirs.Length > 0)) { foreach (var item in allDirs) { string itemPath = item + "\\" + gameFolder + "\\" + Consts.FILE_INTEGRITYFILE; slog.Info("-- Loding profile from: {" + itemPath + "}"); if (File.Exists(itemPath)) { string content = File.ReadAllText(itemPath); SPProfile prof = new SPProfile(content); if (prof.isReady) { listDesactivated.Add(prof); } else { slog.Warn("** ERROR LOADING PROFILE FROM itemPath:" + itemPath); } } else { slog.Warn("** INTEGRITY FILE DOES NOT EXIT itemPath:" + itemPath); } } } return(listDesactivated); }
/// <summary> /// Receive as parameter the Steam Game Folder where the game is installed or /// should be installed. Returns a profile object is the profile is activated, otherwise /// returns a empty list /// </summary> /// <param name="steamGameFolder"></param> /// <returns></returns> public static SPProfile loadActivatedProfile(string steamGameFolder) { ILogger slog = Log4NetLogger.getInstance(LogAppender.APP_SETTINGS, Consts.DIR_SETTINGS); slog.Debug("-- loadActiveProfiles() steamGameFolder:" + steamGameFolder); SPProfile prof = new SPProfile(); string pathFile = steamGameFolder + "\\" + Consts.FILE_INTEGRITYFILE; slog.Debug("pathFile:" + pathFile); if (File.Exists(pathFile)) { string content = File.ReadAllText(pathFile); slog.Debug("integrity file content:{" + content + "}"); prof = new SPProfile(content); } return(prof); }