Esempio n. 1
0
        public static IEnumerator <int> getLoadEnumerator(string file)
        {
            // ISSUE: reference to a compiler-generated field
            this.\u003C\u003E1__state = -1;
            Console.WriteLine("getLoadEnumerator('{0}')", (object)file);
            Game1.loadingMessage = "Accessing save...";
            SaveGame saveGame = new SaveGame();

            SaveGame.IsProcessing = true;
            if (SaveGame.CancelToTitle)
            {
                Game1.ExitToTitle();
            }
            // ISSUE: reference to a compiler-generated field
            this.\u003C\u003E2__current = 1;
            // ISSUE: reference to a compiler-generated field
            this.\u003C\u003E1__state = 1;
            return(true);
        }
Esempio n. 2
0
        public static IEnumerator <int> Save()
        {
            SaveGame.IsProcessing = true;
            yield return(1);

            IEnumerator <int> loader = SaveGame.getSaveEnumerator();
            Task task = new Task((Action)(() =>
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                if (loader == null)
                {
                    return;
                }
                do
                {
                    ;
                }while (loader.MoveNext() && loader.Current < 100);
            }));

            task.Start();
            while (!task.IsCanceled && !task.IsCompleted && !task.IsFaulted)
            {
                yield return(1);
            }
            SaveGame.IsProcessing = false;
            if (task.IsFaulted)
            {
                Exception baseException = task.Exception.GetBaseException();
                if (!(baseException is TaskCanceledException))
                {
                    throw baseException;
                }
                Game1.ExitToTitle();
            }
            else
            {
                yield return(100);
            }
        }