예제 #1
0
파일: Profile.cs 프로젝트: yumiris/HCE
        private void Detect()
        {
            Info("Invoked the Profile.Detect command.");

            try
            {
                var result = LastprofFactory.Get(LastprofFactory.Type.Detect, Output);
                Console.WriteLine(result.Parse());
            }
            catch (FileNotFoundException e)
            {
                Fail(e.Message, ExitType.Exception);
            }
            catch (ProfileException e)
            {
                Fail(e.Message, ExitType.Exception);
            }
        }
예제 #2
0
        /// <summary>
        ///     Updates the initc.txt in the current directory with the detected profile's campaign progress.
        /// </summary>
        private void HandleCheckpoint()
        {
            if (_configuration.SkipResume)
            {
                return;
            }

            Notify("----------------------------");
            Notify("Initiated progress handle...");
            Notify("----------------------------");

            /**
             * Loader is assumed to be running from the working directory, where both the executable & initc reside in.
             */
            Notify("Infer init in working dir...");
            var initc = new Initc((File)"initc.txt");

            /**
             * Savegame binary ends up being the one detected on the filesystem.
             * Detection is implicitly done by attempting to figure out the profile's name.
             */
            Notify("Infer savegame in profile...");
            string saveName;

            try
            {
                saveName = LastprofFactory.DetectOnSystem().Name;
            }
            catch (FileNotFoundException)
            {
                Notify("Could not resolve profile...");
                Notify("Assuming fresh initiation...");
                return;
            }

            var personal = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var gamesHce = Path.Combine("My Games", "Halo CE");
            var savePath = Path.Combine(personal, gamesHce, "savegames", saveName, "savegame.bin");
            var saveGame = new Savegame((File)savePath);

            Progress progress;

            try
            {
                Notify("Infer saved progress data...");
                progress = saveGame.Load();
            }
            catch (ArgumentException)
            {
                Notify("Could not decode the data...");
                Notify("Assuming fresh checkpoint...");
                Notify("Will skip checkpoint commit!");
                return;
            }

            Notify("Commit checkpoint to init...");
            initc.Save(progress);

            Notify("----------------------------");
            Notify("Completed progress handle...");
            Notify("----------------------------");
        }
예제 #3
0
파일: Profile.cs 프로젝트: yumiris/HCE
 /// <summary>
 ///     Attempts to detect the currently used HCE profile on the filesystem.
 /// </summary>
 /// <returns>
 ///     Currently used HCE profile, assuming the environment is valid.
 /// </returns>
 public static string Detect()
 {
     return(LastprofFactory.Get(LastprofFactory.Type.Detect).Parse());
 }