DecryptString() public method

public DecryptString ( string EncryptedString ) : string
EncryptedString string
return string
Exemplo n.º 1
0
        private void buttonEncrypt_Click(object sender, EventArgs e)
        {
            SimpleAES crypto = new SimpleAES();

            if (buttonEncryptState && rtBody.Text.Length != 0)
            {
                string encryptedBody;
                encryptedBody = crypto.EncryptToString(rtBody.Text);
                rtBody.Text = encryptedBody;
                buttonEncrypt.Text = "Decrypt";
                buttonEncryptState = false;
            }
            else
            {
                try
                {
                    string decryptedBody;
                    decryptedBody = crypto.DecryptString(rtBody.Text);
                    rtBody.Text = decryptedBody;
                    buttonEncrypt.Text = "Encrypt";
                    buttonEncryptState = true;
                }

                catch (Exception ex)
                {
                    MessageBox.Show("Decrypt error: " + ex.Message);
                }
            }
        }
Exemplo n.º 2
0
 public static string dekriptuj(string s)
 {
     SimpleAES aes = new SimpleAES();
     if (s != "* * * * * * * * * *" && s != "" && s != "====================" && s != null)
     {
         s = aes.DecryptString(s);
         return s;
     }
     else return s;
 }
Exemplo n.º 3
0
        private static string DecryptPassword()
        {
            string password = "";

            if (Config.Instance.Password.Length != 0)
            {
                SimpleAES aes = new SimpleAES ();
                password = aes.DecryptString (Config.Instance.Password);
            }
            return password;
        }
Exemplo n.º 4
0
 public void ExportPlayer2()
 {
     using (StreamReader reader = new StreamReader(Application.persistentDataPath + savePath))
     {
         SimpleAES aes        = new SimpleAES();
         string    outputData = reader.ReadLine();
         reader.Close();
         exportValue.text = outputData;
         Debug.Log(aes.DecryptString(outputData, encryptKey));
         Debug.Log(outputData);
     }
 }
Exemplo n.º 5
0
        private static IExactTargetConfiguration GetConfig()
        {
            SimpleAES ObjAes = new SimpleAES();

            // Needs to get Loaded from Config File
            return(new ExactTargetConfiguration
            {
                ApiUserName = "******",                               // Generic ApiUserName
                ApiPassword = ObjAes.DecryptString("133171215054227028068033180158000111090232083231"),
                EndPoint = "https://webservice.s6.exacttarget.com/Service.asmx", //  Proper End Point Required From SMS
                ClientId = 6191809
            });
        }
Exemplo n.º 6
0
        public static string decode2(string item)
        {
            try
            {
                SimpleAES saes = new SimpleAES();
                string    tt   = saes.DecryptString(item);

                return(tt);
            }
            catch (Exception ex)
            {
                return("");
            }
        }
Exemplo n.º 7
0
        public bool ValidateDateTimeToken(string token)
        {
            string aes = simpleAes.DecryptString(token);

            DateTime time;

            if (DateTime.TryParse(aes, out time))
            {
                if (time > DateTime.UtcNow.AddHours(-DateTimeValid))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 8
0
 protected void Unsubcribe()
 {
     email = AppConstants.GetString("email");
     if (email == string.Empty || email == null)
     {
         UnsubcribeButton.Enabled = false;
         return;
     }
     else
     {
         UnsubcribeButton.Enabled = true;
         SimpleAES encryptEmail = new SimpleAES();
         email = encryptEmail.DecryptString(email);
     }
 }
Exemplo n.º 9
0
 public static void BeforeAccessNotification(TokenCacheNotificationArgs args)
 {
     lock (FileLock)
     {
         if (File.Exists(CacheFilePath))
         {
             byte[] decryptedbytes = SimpleAES.DecryptString(File.ReadAllBytes(CacheFilePath), GetCipher());
             args.TokenCache.Deserialize(decryptedbytes);
         }
         else
         {
             args.TokenCache.Deserialize(null);
         }
     }
 }
 private void Unsubcribe()
 {
     email = AppConstants.GetString("email");
     if (email == string.Empty || email == null)
     {
         ReceiveRelatedStoxEmail.Enabled = false;
         return;
     }
     else
     {
         ReceiveRelatedStoxEmail.Enabled = true;
         SimpleAES encryptEmail = new SimpleAES();
         email = encryptEmail.DecryptString(email);
     }
 }
Exemplo n.º 11
0
        public string GetSettings()
        {
            byte[] stub = File.ReadAllBytes(_file);
            //Format: filedata|split|appendData
            string appendData = Regex.Split(Encoding.Default.GetString(stub), _splitter)[1];

            //Format: keyPart1|lilsplit|encryptedSettings|lilsplit|keyPart2
            string[]  firstCycle        = Regex.Split(appendData, _littleSplitter);
            string    key               = firstCycle[0] + firstCycle[2];
            string    encryptedSettings = firstCycle[1];
            SimpleAES decryptor         = new SimpleAES(key);
            string    decryptedSettings = decryptor.DecryptString(encryptedSettings);

            return(decryptedSettings);
        }
        protected bool IsValidUser(Func <string[], bool> logic)
        {
            if (Request["sessionkey"] == null || Request["sessionkey"] == "")
            {
                return(false);
            }

            string decryptedsessionkey = SimpleAES.DecryptString(Request["sessionkey"].ToString());

            AuthTokens = decryptedsessionkey.Split('|');
            if (!logic(AuthTokens))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 13
0
        /// <summary>
        /// đối tượng gửi email được giải mã mật khẩu
        /// </summary>
        /// <param name="_emailnhan">email nhận</param>
        /// <param name="_tieude">tiêu đề</param>
        /// <param name="_noidung">Nội dung</param>
        /// <param name="_emailgui">Email gửi</param>
        /// <param name="_passemailgui">Mật khẩu email gửi (dạng đã mã hóa -> cần giải mã)</param>
        /// <param name="lstReplace">Danh sách replace tiêu đề, nội dung nếu có</param>
        public sendMailObj(string _emailnhan, string _tieude, string _noidung, string _emailgui, string _passemailgui, Dictionary <string, string> lstReplace)
        {
            SimpleAES aes = new SimpleAES();

            this.noidung = _noidung;
            this.tieude  = _tieude;
            //rep
            if (lstReplace != null && lstReplace.Any())
            {
                foreach (var rep in lstReplace)
                {
                    this.tieude  = this.tieude.Replace("{" + rep.Key + "}", rep.Value);
                    this.noidung = this.noidung.Replace("{" + rep.Key + "}", rep.Value);
                }
            }

            this.emailNhan    = _emailnhan;
            this.emailGui     = _emailgui;
            this.passEmailGui = aes.DecryptString(_passemailgui);
        }
Exemplo n.º 14
0
        // GET: Admin/Users/Edit/5
        public ActionResult Edit(int?id)
        {
            var __auth = MySsAuthUsers.GetAuth();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User user = _userServ.GetEntry(id.Value);

            if (user == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ddlRole = _roleServ.GetList(w => w.Id == 3).ToList().Select(s => new SelectListItem()
            {
                Text  = s.Name,
                Value = s.Id.ToString()
            });
            ViewBag.dsQuyen = _permisionServ.GetList().ToList();
            SimpleAES aes = new SimpleAES();

            user.Password = aes.DecryptString(user.Password);

            FrmCreateUserVM model = Mapper.Map <User, FrmCreateUserVM>(user);

            model.ddlGioiTinh = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Nam", Value = "Nam"
                },
                new SelectListItem()
                {
                    Text = "Nữ", Value = "Nữ"
                }
            };
            model.DanhSachQuan     = __db.Quan.Where(w => w.UserId == __auth.ID);
            model.DanhSachQuanChon = user.UserQuans.Select(s => s.QuanID).ToList();
            return(View(model));
        }
Exemplo n.º 15
0
        /// <summary>
        /// base authentication
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public bool ValidateAuthenticationBase(HttpRequestMessage request)
        {
            HttpRequestHeaders headers = request.Headers;

            if (!headers.Contains("x-tdws-auth"))
            {
                return(false);
            }
            SimpleAES decryptText = new SimpleAES("V&WWJ3d39brdR5yUh5(JQGHbi:FB@$^@", "W4aRWS!D$kgD8Xz@");
            string    strDecrypt  = decryptText.DecryptString(headers.GetValues("x-tdws-auth").First());

            DateTime dtRequestTime = DateTime.ParseExact(strDecrypt, "yyyy-MM-ddTHH:mm:sszzz", null);

            if ((dtRequestTime > DateTime.Now.AddMinutes(-15) && dtRequestTime < DateTime.Now.AddMinutes(15)))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static string Decrypt(string cipherText)
        {
            SimpleAES aes = new SimpleAES();
            // Get the complete stream of bytes that represent:
            // [32 bytes of Salt] + [32 bytes of IV] + [n bytes of CipherText]
            var cipherTextBytesWithSaltAndIv = Convert.FromBase64String(cipherText);
            // Get the saltbytes by extracting the first 32 bytes from the supplied cipherText bytes.
            var saltStringBytes = cipherTextBytesWithSaltAndIv.Take(Keysize / 8).ToArray();
            // Get the IV bytes by extracting the next 32 bytes from the supplied cipherText bytes.
            var ivStringBytes = cipherTextBytesWithSaltAndIv.Skip(Keysize / 8).Take(Keysize / 8).ToArray();
            // Get the actual cipher text bytes by removing the first 64 bytes from the cipherText string.
            var cipherTextBytes = cipherTextBytesWithSaltAndIv.Skip((Keysize / 8) * 2).Take(cipherTextBytesWithSaltAndIv.Length - ((Keysize / 8) * 2)).ToArray();

            using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
            {
                var keyBytes = password.GetBytes(Keysize / 8);
                using (var symmetricKey = new RijndaelManaged())
                {
                    symmetricKey.BlockSize = 256;
                    symmetricKey.Mode      = CipherMode.CBC;
                    symmetricKey.Padding   = PaddingMode.PKCS7;
                    using (var decryptor = symmetricKey.CreateDecryptor(keyBytes, ivStringBytes))
                    {
                        using (var memoryStream = new MemoryStream(cipherTextBytes))
                        {
                            using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
                            {
                                var plainTextBytes     = new byte[cipherTextBytes.Length];
                                var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
                                memoryStream.Close();
                                cryptoStream.Close();
                                return(aes.DecryptString(Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount)));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Validates Authentication
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public bool ValidateAuthentication(HttpRequestMessage request)
        {
            bool accepted = true;
            HttpRequestHeaders headers = request.Headers;

            if (!headers.Contains("x-tdws-authid"))
            {
                return(false);
            }
            SimpleAES decryptText = new SimpleAES("V&WWJ3d39brdR5yUh5(JQGHbi:FB@$^@", "W4aRWS!D$kgD8Xz@");
            string    strDecrypt  = decryptText.DecryptString(headers.GetValues("x-tdws-authid").First());

            DBMapper dbMapper = new DBMapper();

            if (!dbMapper.ValidateDevice(Guid.Parse(strDecrypt)))
            {
                return(false);
            }

            accepted = ValidateAuthenticationBase(request);

            return(accepted);
        }
Exemplo n.º 18
0
        public Profile Unpack(string dataEnc)
        {
            SimpleAES enc = new SimpleAES();

            string data = enc.DecryptString(dataEnc);

            Profile p        = new Profile();
            var     actMark  = 0;
            var     specMark = 0;
            var     pasMark  = 0;
            var     AppMark  = 0;

            actMark  = data.IndexOf("ACTION=") + ("ACTION=").Length;
            specMark = data.IndexOf("SPECIFICATION=");
            pasMark  = data.IndexOf("PASS="******":");

            p.AppName       = data.Substring(0, AppMark);
            p.Action        = data.Substring(actMark, specMark - actMark);
            p.Specification = data.Substring(specMark + ("SPECIFICATION=").Length, pasMark - (specMark + ("SPECIFICATION=").Length));
            p.Password      = data.Substring(pasMark + ("PASS="******"PASS=").Length));

            return(p);
        }
Exemplo n.º 19
0
        private void guna2Button3_Click(object sender, EventArgs e)
        {
            SimpleAES enc = new SimpleAES();

            txtdecrpit.Text = enc.DecryptString(txtpassstring.Text);
        }
Exemplo n.º 20
0
        public override void Update(GameTime gameTime)
        {
            // Reset keys
            if (!Keyboard.GetState().IsKeyDown(Keys.Down))
                pressDown = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.Up))
                pressUp = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.Enter))
                pressEnter = true;

            // Cycle through choices
            if (Keyboard.GetState().IsKeyDown(Keys.Down) && pressDown)
            {
                pressDown = false;
                selected++;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Up) && pressUp)
            {
                pressUp = false;
                selected--;
            }

            // Select a choice
            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && pressEnter)
            {
                if (selected == 0)
                {
                    SimpleAES enc = new SimpleAES();
                    if (!File.Exists("Content\\records.txt"))
                    {
                        StreamWriter w = new StreamWriter("Content\\records.txt");
                        w.WriteLine(enc.EncryptToString("fullgame 0 -1"));
                        w.Flush();
                        w.Dispose();
                    }
                    else
                    {
                        StreamReader r = new StreamReader("Content\\records.txt");
                        string s = enc.DecryptString(r.ReadLine());
                        while (s.Split(' ')[1] != "0" && s.Split(' ')[0] != "fullgame" && !r.EndOfStream)
                            s = enc.DecryptString(r.ReadLine());
                        if (s.Split(' ')[1] == "0" && s.Split(' ')[0] == "fullgame")
                            Game1.totalRecord = int.Parse(s.Split(' ')[2]);
                        else
                            Game1.totalRecord = -1;
                        r.Close();
                        r.Dispose();
                    }
                    Game1.finishedSS = false;
                    Levels.Index = 0;
                    Game1.startTotalTime = true;
                    Game1.currentRoom = new Room(Levels.levels[0], true, new ReplayRecorder());
                }
                else if (selected == 1)
                    Game1.currentRoom = new LevelSelect(0);
                else if (selected == 2)
                    Game1.currentRoom = new Settings();
                else if (selected == 3)
                    Game1.exit = true;
            }

            if (selected < 0)
                selected = 0;
            else if (selected > MAX_SELECTED)
                selected = MAX_SELECTED;
        }
Exemplo n.º 21
0
        protected override void Update(GameTime gameTime)
        {
            //			if (Keyboard.GetState().IsKeyDown(Keys.Z))
            //				this.TargetElapsedTime = TimeSpan.FromSeconds(0.5f);
            //			else
            //				this.TargetElapsedTime = TimeSpan.FromSeconds(0.016f);

            if (!Keyboard.GetState().IsKeyDown(Keys.Escape))
                pressEscape = true;
            if (Keyboard.GetState().IsKeyDown(Keys.Escape) && pressEscape || exit)
            {
                if (Game1.finishedSS)
                {
                    Game1.finishedSS = false;
                    SimpleAES enc = new SimpleAES();
                    if (!File.Exists("Content\\records.txt"))
                    {
                        StreamWriter w = new StreamWriter("Content\\records.txt");
                        w.WriteLine(enc.EncryptToString("fullgame 0 -1"));
                        w.Flush();
                        w.Dispose();
                    }
                    else
                    {
                        StreamReader r = new StreamReader("Content\\records.txt");
                        string s = enc.DecryptString(r.ReadLine());
                        while (s.Split(' ')[1] != "0" && s.Split(' ')[0] != "fullgame" && !r.EndOfStream)
                            s = enc.DecryptString(r.ReadLine());
                        if (s.Split(' ')[1] == "0" && s.Split(' ')[0] == "fullgame")
                            totalRecord = int.Parse(s.Split(' ')[2]);
                        else
                            totalRecord = -1;
                        r.Close();
                        r.Dispose();
                    }
                }
                totalTime = 0;
                startTotalTime = false;
                currentRoom.viewingLeaderboards = false;
                pressEscape = false;
                if (currentRoom is MainMenu)
                    this.Exit();
                else if (currentRoom is SkinSelection)
                    currentRoom = new Settings();
                else if (currentRoom is FGLeaderboard)
                    currentRoom = new LevelSelect(0);
                else
                    currentRoom = new MainMenu(true);
            }

            currentRoom.Update(gameTime);
            base.Update(gameTime);
        }
Exemplo n.º 22
0
        public Game1(bool on)
        {
            online = on;
            game = this;
            totalTime = 0;
            startTotalTime = false;
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferredBackBufferWidth = 960;
            Content.RootDirectory = "Content";
            skinManager = new ContentManager(this.Services, "Content");
            finishedSS = false;
            totalRecord = -1;
            commRecord = -1;

            SimpleAES enc = new SimpleAES();
            if (!File.Exists("Content\\records.txt"))
            {
                StreamWriter w = new StreamWriter("Content\\records.txt");
                w.WriteLine(enc.EncryptToString("fullgame 0 -1"));
                w.Flush();
                w.Dispose();
            }
            else
            {
                StreamReader r = new StreamReader("Content\\records.txt");
                bool totalFound = false;
                while (!r.EndOfStream)
                {
                    string s = enc.DecryptString(r.ReadLine());
                    if (s.Split(' ')[1] == "0")
                    {
                        if (s.Split(' ')[0] == "Level_26_-_Credits")
                            beatGame = true;
                        else if (s.Split(' ')[0] == "fullgame")
                        {
                            totalRecord = int.Parse(s.Split(' ')[2]);
                            totalFound = true;
                        }
                        else
                        {
                            if (commRecord == -1)
                                commRecord = 0;
                            commRecord += int.Parse(s.Split(' ')[2]);
                        }
                    }
                }
                if (!totalFound)
                    totalRecord = -1;

                r.Close();
                r.Dispose();
            }
        }
Exemplo n.º 23
0
        public Room(string file, bool freeroam, ReplayRecorder recorder)
            : this()
        {
            freeroaming = freeroam;
            this.recorder = recorder;

            // Get level name
            levelName = file.Split('\\')[file.Split('\\').Length - 1].Replace(".srl", "");
            custom = true;

            SimpleAES decryptor = new SimpleAES();
            StreamReader levelReader = new StreamReader(file);
            string[] line;

            // Get level id
            levelID = levelReader.ReadLine();

            // Check if level will have a leaderboard
            canViewLeaderboards = decryptor.DecryptString(levelReader.ReadLine()) == "1";

            // Get level theme
            line = decryptor.DecryptString(levelReader.ReadLine()).Split(' ');
            Theme = FindTheme(line[0]);
            wallSet = new Tileset(Game1.tileSet[(int)Theme], 32, 32, 3, 3);

            // Get room dimensions
            line = decryptor.DecryptString(levelReader.ReadLine()).Split(' ');
            roomWidth = int.Parse(line[0]);
            roomHeight = int.Parse(line[1]);

            // Get goal times
            goals = new int[3];
            line = decryptor.DecryptString(levelReader.ReadLine()).Split(' ');
            for (int i = 0; i < 3; i++)
                goals[i] = int.Parse(line[i]);

            // Get objects and tiles
            while (!levelReader.EndOfStream)
            {
                string s = levelReader.ReadLine();
                if (s.Length > 0)
                {
                    line = decryptor.DecryptString(s).Split(' ');
                    ParseObjectOrTile(line, freeroam);
                }
            }
            levelReader.Dispose();

            BuildTiles();

            // Generate zipline poles
            foreach (ZipLine z in ziplines)
                z.SetPoles(this);

            // Get current record for this level
            FindRecord(decryptor);

            UpdateViewBox(false);
        }
Exemplo n.º 24
0
        public virtual void Update(GameTime gameTime)
        {
            // Reset keys
            if (!Keyboard.GetState().IsKeyDown(Settings.controls["Restart"]))
                rcheck = true;
            if (!Keyboard.GetState().IsKeyDown(Settings.controls["Pause"]))
                pcheck = true;
            if (!Keyboard.GetState().IsKeyDown(Settings.controls["Freeroam"]))
                fcheck = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.L))
                lcheck = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.Up))
                upcheck = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.Down))
                downcheck = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.S))
                scheck = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.O))
                ocheck = true;
            if (!Keyboard.GetState().IsKeyDown(Keys.T))
                tcheck = true;

            // Rate level
            if (Keyboard.GetState().IsKeyDown(Keys.T) && tcheck && Game1.online && custom)
            {
                tcheck = false;
                Paused = true;
                int temp;
                if (int.TryParse(Microsoft.VisualBasic.Interaction.InputBox("Enter a number from 1 to 5, 5 being a great level.", "Rate"), out temp))
                {
                    if (temp > 0 && temp <= 5)
                    {
                        try
                        {
                            WebStuff.SendRating(temp, Game1.userName, levelID);
                        }
                        catch (Exception)
                        {
                            System.Windows.Forms.MessageBox.Show("Rating failed to upload. Please try again later.", "Rating Failed");
                        }
                    }
                    else
                        System.Windows.Forms.MessageBox.Show("Your rating must be a number between 1 and 5");
                }
            }

            // Restart when R is pressed
            if (Keyboard.GetState().IsKeyDown(Settings.controls["Restart"]) && rcheck)
            {
                if (custom)
                    Game1.currentRoom = new Room("Content\\rooms\\" + levelName + ".srl", false, new ReplayRecorder());
                else
                    Game1.currentRoom = new Room(Levels.levels[Levels.Index], false, new ReplayRecorder());
            }
            else if (Keyboard.GetState().IsKeyDown(Settings.controls["Freeroam"]) && fcheck)
            {
                if (custom)
                    Game1.currentRoom = new Room("Content\\rooms\\" + levelName + ".srl", true, new ReplayRecorder());
                else
                    Game1.currentRoom = new Room(Levels.levels[Levels.Index], true, new ReplayRecorder());
            }

            // Pause the game when P is pressed
            if (Keyboard.GetState().IsKeyDown(Settings.controls["Pause"]) && pcheck && !viewingLeaderboards)
            {
                pcheck = false;
                Paused = !Paused;
            }

            // Show leaderboards when L is pressed
            if (Keyboard.GetState().IsKeyDown(Keys.L) && lcheck && (Paused || Finished) && Game1.online && canViewLeaderboards)
            {
                lcheck = false;
                if (!viewingLeaderboards)
                {
                    try
                    {
                        viewingLeaderboards = true;
                        leaderboardData = WebStuff.GetScores(levelID, Game1.userName, leaderboardPage * 10);
                        canScrollDown = leaderboardData.Length == 11;
                    }
                    catch (Exception)
                    {
                        System.Windows.Forms.MessageBox.Show("There was a problem connecting to the leaderboards.", "Connection Error");
                        viewingLeaderboards = false;
                    }
                }
                else
                    viewingLeaderboards = false;
            }

            if (viewingLeaderboards)
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Up) && upcheck && leaderboardPage > 0)
                {
                    upcheck = false;
                    try
                    {
                        leaderboardData = WebStuff.GetScores(levelID, Game1.userName, (leaderboardPage - 1) * 10);
                    }
                    catch (Exception)
                    {
                        System.Windows.Forms.MessageBox.Show("There was a problem connecting to the leaderboards.", "Connection Error");
                    }
                    leaderboardPage--;
                    canScrollDown = true;
                }
                else if (Keyboard.GetState().IsKeyDown(Keys.Down) && downcheck && canScrollDown)
                {
                    downcheck = false;
                    try
                    {
                        leaderboardData = WebStuff.GetScores(levelID, Game1.userName, (leaderboardPage + 1) * 10);
                    }
                    catch (Exception)
                    {
                        System.Windows.Forms.MessageBox.Show("There was a problem connecting to the leaderboards.", "Connection Error");
                    }
                    leaderboardPage++;
                    canScrollDown = leaderboardData.Length == 11;
                }
            }

            // Update freeroam cam
            if (freeroaming && !Paused)
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Left))
                    viewBox.X -= 8;
                if (Keyboard.GetState().IsKeyDown(Keys.Right))
                    viewBox.X += 8;
                if (Keyboard.GetState().IsKeyDown(Keys.Up))
                    viewBox.Y -= 8;
                if (Keyboard.GetState().IsKeyDown(Keys.Down))
                    viewBox.Y += 8;
            }

            if (!Finished)
            {
                if (!Paused)
                {
                    if (recorder.playing)
                        recorder.PlayFrame();
                    else
                        recorder.RecordFrame();

                    // Update booster animations
                    foreach (Booster b in boosters)
                        b.Update();

                    // Find platforms
                    var plats = from Wall f in walls
                                where f is FloatingPlatform
                                select f as FloatingPlatform;
                    foreach (FloatingPlatform f in plats)
                        f.Update();

                    // Update boxes
                    foreach (Box b in boxes)
                        b.Update();

                    // Update character
                    Runner.Update();

                    // Update rocket launchers
                    foreach (RocketLauncher r in launchers)
                    {
                        if (r.explosion != null)
                            r.explosion.Update();
                        if (r.Update())
                        {
                            r.explosion = new Explosion(new Vector2(r.rocket.hitBox.X, r.rocket.hitBox.Y), Color.OrangeRed);
                            r.pause = 0;
                            r.rocket.position.X = -10000;
                            r.rocket.position.Y = -10000;
                            r.rocket.hitBox.X = -10000;
                            r.rocket.hitBox.Y = -10000;
                        }
                    }

                    // Update flamethrowers
                    foreach (Flamethrower f in flamethrowers)
                        f.Update();

                    // Move viewbox to keep up with character
                    UpdateViewBox(freeroaming);

                    // If the runner can be moved, increment the timer
                    if (Runner.controllable)
                    {
                        time += gameTime.ElapsedGameTime.Milliseconds;
                        if (!Game1.finishedSS && Game1.startTotalTime && !recorder.playing)
                            Game1.totalTime += gameTime.ElapsedGameTime.Milliseconds;
                    }
                }
                else
                {
                    Game1.run.Stop();
                    Game1.slide.Stop();

                    if (Keyboard.GetState().IsKeyDown(Keys.O) && ocheck)
                    {
                        ocheck = false;
                        System.Windows.Forms.OpenFileDialog openFD = new System.Windows.Forms.OpenFileDialog();
                        if (!Directory.Exists("Content\\replays"))
                            Directory.CreateDirectory("Content\\replays");
                        openFD.InitialDirectory = "Content\\replays";
                        openFD.Filter = "Replay Files (*.rpl)|*.rpl";
                        if (openFD.ShowDialog() == System.Windows.Forms.DialogResult.OK && File.Exists(openFD.FileName))
                        {
                            ReplayRecorder rec = new ReplayRecorder(openFD.FileName);
                            if (custom)
                                Game1.currentRoom = new Room("Content\\rooms\\" + levelName + ".srl", false, rec);
                            else
                                Game1.currentRoom = new Room(Levels.levels[Levels.Index], false, rec);
                        }
                    }
                }
            }
            else
            {
                Game1.run.Stop();
                Game1.slide.Stop();

                // Fix glitch where you can restart at the same time you hit the finish and achieve a time of 0 seconds
                if (time == 0)
                {
                    if (custom)
                        Game1.currentRoom = new Room("Content\\rooms\\" + levelName + ".srl", false, new ReplayRecorder());
                    else
                        Game1.currentRoom = new Room(Levels.levels[Levels.Index], false, new ReplayRecorder());
                    return;
                }

                if (write && !recorder.playing)
                {
                    write = false;

                    // Get goal beaten, if any
                    if (goals.Length > 3 && time <= goals[3])
                        goalBeaten = 0;
                    else if (time <= goals[0])
                        goalBeaten = 1;
                    else if (time <= goals[1])
                        goalBeaten = 2;
                    else if (time <= goals[2])
                        goalBeaten = 3;

                    StreamWriter writer;
                    SimpleAES encryptor = new SimpleAES();

                    // If record is beaten, save new record
                    if (time < record || record == -1)
                    {
                        StreamReader reader = new StreamReader("Content\\records.txt");
                        writer = new StreamWriter("Content\\recordstemp.txt", false);
                        bool found = false;

                        // Rewrite records file, but only change current level's time
                        while (!reader.EndOfStream)
                        {
                            string line = encryptor.DecryptString(reader.ReadLine());
                            if (line.Split(' ')[0] == levelName)
                            {
                                found = true;
                                writer.WriteLine(encryptor.EncryptToString(levelName + " " + (custom ? "1" : "0") + " " + time.ToString()));
                            }
                            else
                                writer.WriteLine(encryptor.EncryptToString(line));
                        }
                        if (!found)
                            writer.WriteLine(encryptor.EncryptToString(levelName + " " + (custom ? "1" : "0") + " " + time.ToString()));
                        reader.Dispose();
                        writer.Flush();
                        writer.Dispose();
                        File.Delete("Content\\records.txt");
                        File.Move("Content\\recordstemp.txt", "Content\\records.txt");
                    }

                    if (Levels.Index == Levels.levels.Length - 2)
                        Game1.beatGame = true;

                    if (!Game1.finishedSS && Game1.startTotalTime && Levels.Index == Levels.levels.Length - 2 && (Game1.totalTime < Game1.totalRecord || Game1.totalRecord == -1))
                    {
                        Game1.finishedSS = true;
                        StreamReader reader = new StreamReader("Content\\records.txt");
                        writer = new StreamWriter("Content\\recordstemp.txt", false);
                        bool found = false;

                        // Rewrite records file, but only change current level's time
                        while (!reader.EndOfStream)
                        {
                            string line = encryptor.DecryptString(reader.ReadLine());
                            if (line.Split(' ')[0] == "fullgame" && line.Split(' ')[1] == "0")
                            {
                                found = true;
                                writer.WriteLine(encryptor.EncryptToString("fullgame 0 " + Game1.totalTime.ToString()));
                            }
                            else
                                writer.WriteLine(encryptor.EncryptToString(line));
                        }
                        if (!found)
                            writer.WriteLine(encryptor.EncryptToString("fullgame 0 " + Game1.totalTime.ToString()));
                        reader.Dispose();
                        writer.Flush();
                        writer.Dispose();
                        File.Delete("Content\\records.txt");
                        File.Move("Content\\recordstemp.txt", "Content\\records.txt");
                    }
                }

                if (upload && canViewLeaderboards && !recorder.playing)
                {
                    // Upload score to leaderboard
                    upload = false;
                    if (Game1.online)
                    {
                        try
                        {
                            WebStuff.WriteScore(time, Game1.userName, levelID);
                            if (Game1.finishedSS && !custom)
                            {
                                WebStuff.WriteScore(Game1.totalTime, Game1.userName, "fullgame");
                                if (Game1.totalTime < Game1.totalRecord)
                                    Game1.totalRecord = Game1.totalTime;
                            }
                        }
                        catch (Exception)
                        {
                            System.Windows.Forms.MessageBox.Show("Uploading score to leaderboards failed.", "Leaderboard Error");
                        }
                        if (Game1.beatGame && !custom)
                        {
                            Game1.commRecord = -1;
                            StreamReader r = new StreamReader("Content\\records.txt");
                            SimpleAES enc = new SimpleAES();
                            while (!r.EndOfStream)
                            {
                                string s = enc.DecryptString(r.ReadLine());
                                if (s.Split(' ')[1] == "0")
                                {
                                    if (s.Split(' ')[0] != "Level_26_-_Credits" && s.Split(' ')[0] != "fullgame")
                                    {
                                        if (Game1.commRecord == -1)
                                            Game1.commRecord = 0;
                                        Game1.commRecord += int.Parse(s.Split(' ')[2]);
                                    }
                                }
                            }
                            r.Close();
                            r.Dispose();
                        }
                    }
                }

                if (writeNext && !custom && Levels.Index < Levels.levels.Count() - 1 && !recorder.playing)
                {
                    // Add next level to level select if not already unlocked
                    writeNext = false;
                    bool recordFound = false;
                    StreamReader reader = new StreamReader("Content\\records.txt");
                    SimpleAES encryptor = new SimpleAES();
                    string name = Levels.levels[Levels.Index + 1][0];
                    while (!reader.EndOfStream)
                    {
                        string s = encryptor.DecryptString(reader.ReadLine());
                        if (s.Split(' ')[0] == name)
                        {
                            recordFound = true;
                            break;
                        }
                    }
                    reader.Close();
                    reader.Dispose();
                    if (!recordFound)
                    {
                        StreamWriter writer = new StreamWriter("Content\\records.txt", true);
                        writer.WriteLine(encryptor.EncryptToString(name + " 0 -1"));
                        writer.Flush();
                        writer.Dispose();
                    }
                }

                // Check if they want to see replay
                if (Keyboard.GetState().IsKeyDown(Keys.W))
                {
                    recorder.playing = true;
                    recorder.start = true;
                    if (custom)
                        Game1.currentRoom = new Room("Content\\rooms\\" + levelName + ".srl", false, recorder);
                    else
                        Game1.currentRoom = new Room(Levels.levels[Levels.Index], false, recorder);
                }

                // Check if they want to save replay
                if (Keyboard.GetState().IsKeyDown(Keys.S) && scheck)
                {
                    scheck = false;
                    recorder.Save(levelName);
                    recorderSaved = true;
                }

                // Move to next level when enter is pressed, or back to menu if custom level
                if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                {
                    if (!custom)
                    {
                        if (!recorder.playing || !recorder.loaded)
                        {
                            if (Game1.startTotalTime && Levels.Index == Levels.levels.Length - 2)
                                Game1.startTotalTime = false;
                            Levels.Index++;
                            if (Levels.Index == Levels.levels.Count())
                                Game1.currentRoom = new MainMenu(false);
                            else
                            {
                                while (Levels.Index < Levels.levels.Length && Levels.levels[Levels.Index][0] == "")
                                    Levels.Index++;
                                Game1.currentRoom = new Room(Levels.levels[Levels.Index], true, new ReplayRecorder());
                            }
                        }
                    }
                    else
                        Game1.currentRoom = new LevelSelect(1);
                }
            }
        }
Exemplo n.º 25
0
        public Room(string[] lines, bool freeroam, ReplayRecorder recorder)
            : this()
        {
            freeroaming = freeroam;
            this.recorder = recorder;

            SimpleAES decryptor = new SimpleAES();
            string[] line;

            // Get level name
            levelName = lines[0];
            custom = false;

            // Get level id
            levelID = lines[1];

            // Check if level will have a leaderboard
            canViewLeaderboards = decryptor.DecryptString(lines[2]) == "1";

            // Get level theme
            line = decryptor.DecryptString(lines[3]).Split(' ');
            Theme = FindTheme(line[0]);
            wallSet = new Tileset(Game1.tileSet[(int)Theme], 32, 32, 3, 3);

            // Get room dimensions
            line = decryptor.DecryptString(lines[4]).Split(' ');
            roomWidth = int.Parse(line[0]);
            roomHeight = int.Parse(line[1]);

            // Get goal times
            // Find record
            int rec = -1;
            if (!File.Exists("Content\\records.txt"))
                File.Create("Content\\records.txt");
            StreamReader findLastLevel = new StreamReader("Content\\records.txt");
            while (!findLastLevel.EndOfStream)
            {
                string[] level = decryptor.DecryptString(findLastLevel.ReadLine()).Split(' ');
                if (level[0] == levelName && level[1] == "0")
                {
                    rec = int.Parse(level[2]);
                    break;
                }
            }
            findLastLevel.Close();
            findLastLevel.Dispose();

            // Check if record is a gold time
            bool gotGold = false;
            string findIndex = levelName.Split('_')[1];
            int ii = int.Parse(findIndex) - 1;
            string[] g = decryptor.DecryptString(Levels.levels[ii][5]).Split(' ');
            if (rec != -1 && rec < int.Parse(g[0]))
                gotGold = true;

            // If it is, unlock platinum time
            goals = new int[gotGold ? 4 : 3];
            line = decryptor.DecryptString(lines[5]).Split(' ');
            for (int i = 0; i < goals.Length; i++)
                goals[i] = int.Parse(line[i]);

            // Get objects and tiles
            int index = 6;
            while (index < lines.Length)
            {
                line = decryptor.DecryptString(lines[index]).Split(' ');
                ParseObjectOrTile(line, freeroam);
                index++;
            }
            BuildTiles();

            // Generate zipline poles
            foreach (ZipLine z in ziplines)
                z.SetPoles(this);

            // Check to see if level is already in records file. If not, add it.
            // This unlocks the level in level select, since main levels (levels hard coded into the game)
            // are added from the records file.
            bool recordFound = false;
            StreamReader reader = new StreamReader("Content\\records.txt");
            while (!reader.EndOfStream)
            {
                string s = decryptor.DecryptString(reader.ReadLine());
                if (s.Split(' ')[0] == levelName)
                {
                    record = int.Parse(s.Split(' ')[2]);
                    recordFound = true;
                    break;
                }
            }
            reader.Close();
            reader.Dispose();
            if (!recordFound)
            {
                record = -1;
                StreamWriter writer = new StreamWriter("Content\\records.txt", true);
                writer.WriteLine(decryptor.EncryptToString(levelName + " 0 -1"));
                writer.Flush();
                writer.Dispose();
            }

            UpdateViewBox(false);
        }
Exemplo n.º 26
0
        // Searches through records file and finds this level's current record, sets it to -1 if not found
        private void FindRecord(SimpleAES decryptor)
        {
            StreamReader levelReader = new StreamReader("Content\\records.txt");
            string nullCheck = levelReader.ReadLine();
            if (nullCheck != null)
            {
                string recordSearch = decryptor.DecryptString(nullCheck);
                while (recordSearch.Split(' ')[0] != levelName && !levelReader.EndOfStream)
                    recordSearch = decryptor.DecryptString(levelReader.ReadLine());

                if (recordSearch.Split(' ')[0] != levelName)
                    record = -1;
                else
                    record = int.Parse(recordSearch.Split(' ')[2]);
            }
            else
                record = -1;
            levelReader.Dispose();
        }
Exemplo n.º 27
0
        public LevelSelect(int tab)
        {
            pressDown = false;
            pressUp = false;
            pressEnter = false;
            pressLeft = false;
            pressRight = false;
            lastpage = false;
            pressS = false;
            showingBox = false;
            pressDel = false;
            pressD = false;
            pressY = false;
            pressN = false;
            areYouSure = false;
            pressL = false;

            background = Game1.backgrounds[0];
            roomHeight = 720;
            roomWidth = 960;

            levels = new List<Tuple<string, int, int, bool>>();
            selected = 0;
            scope = 0;
            this.tab = tab;

            dlpage = new List<Tuple<string, string, string, double>>();
            criteria = "";
            sortBy = 0;

            // Add main levels
            SimpleAES decryptor = new SimpleAES();
            if (!File.Exists("Content\\records.txt"))
            {
                StreamWriter newRecords = new StreamWriter("Content\\records.txt");
                newRecords.WriteLine(decryptor.EncryptToString("fullgame 0 -1"));
                newRecords.Flush();
                newRecords.Close();
                newRecords.Dispose();
            }
            StreamReader findMainLevels = new StreamReader("Content\\records.txt");
            while (!findMainLevels.EndOfStream)
            {
                string[] level = decryptor.DecryptString(findMainLevels.ReadLine()).Split(' ');
                if (level[1] == "0" && level[0] != "fullgame")
                    levels.Add(new Tuple<string, int, int, bool>(level[0], -1, -1, false));
            }
            findMainLevels.Close();
            findMainLevels.Dispose();

            // Add custom levels
            if (!Directory.Exists("Content\\rooms"))
                Directory.CreateDirectory("Content\\rooms");
            string[] choices = Directory.GetFiles("Content\\rooms");
            foreach (string s in choices)
                levels.Add(new Tuple<string, int, int, bool>(s.Split('\\')[s.Split('\\').Length - 1].Replace(".srl", ""), -1, -1, true));

            // Find record/medal achieved in each level
            for (int i = 0; i < levels.Count; i++)
            {
                // Find record
                string name = levels[i].Item1;
                StreamReader readRecords = new StreamReader("Content\\records.txt");
                if (readRecords.EndOfStream)
                {
                    readRecords.Close();
                    readRecords.Dispose();
                    break;
                }
                string line = decryptor.DecryptString(readRecords.ReadLine());
                while (line.Split(' ')[0] != name && !readRecords.EndOfStream)
                    line = decryptor.DecryptString(readRecords.ReadLine());
                bool iscustom = true;
                if (line.Split(' ')[0] == name)
                {
                    levels[i] = new Tuple<string, int, int, bool>(levels[i].Item1, int.Parse(line.Split(' ')[2]), -1, levels[i].Item4);
                    iscustom = line.Split(' ')[1] == "1";
                }
                readRecords.Close();
                readRecords.Dispose();

                // Find goal times
                if (!iscustom)
                {
                    if (name != "")
                    {
                        string findIndex = name.Split('_')[1];
                        int index = int.Parse(findIndex) - 1;
                        string[] goals = decryptor.DecryptString(Levels.levels[index][5]).Split(' ');
                        for (int j = 2; j >= 0; j--)
                        {
                            if (levels[i].Item2 != -1 && levels[i].Item2 <= int.Parse(goals[j]))
                                levels[i] = new Tuple<string, int, int, bool>(levels[i].Item1, levels[i].Item2, j, levels[i].Item4);
                        }
                        if (levels[i].Item3 == 0)
                        {
                            if (levels[i].Item2 != -1 && levels[i].Item2 <= int.Parse(goals[3]))
                                levels[i] = new Tuple<string, int, int, bool>(levels[i].Item1, levels[i].Item2, 3, levels[i].Item4);
                        }
                    }
                }
                else
                {
                    StreamReader findGoals = new StreamReader("Content\\rooms\\" + name + ".srl");
                    for (int skip = 1; skip <= 4; skip++)
                        findGoals.ReadLine();
                    string[] goals = decryptor.DecryptString(findGoals.ReadLine()).Split(' ');
                    for (int j = 2; j >= 0; j--)
                    {
                        if (levels[i].Item2 != -1 && levels[i].Item2 <= int.Parse(goals[j]))
                            levels[i] = new Tuple<string, int, int, bool>(levels[i].Item1, levels[i].Item2, j, levels[i].Item4);
                    }
                    findGoals.Close();
                    findGoals.Dispose();
                }
            }

            custompage = new List<Tuple<string, int, int, bool>>();
            var it = from Tuple<string, int, int, bool> t in levels
                     where t.Item4 == (tab == 1)
                     select t;
            foreach (Tuple<string, int, int, bool> t in it)
                custompage.Add(t);
            maxSelected = custompage.Count - 1;

            if (!Game1.playingGrass)
                MediaPlayer.Play(Game1.grassMusic);
            Game1.ResetMusic();
            Game1.playingGrass = true;
        }
Exemplo n.º 28
0
    public void LoadDataFromString(string data)
    {
        string decryptedData = Encryptor.DecryptString(data);

        string[] lines = decryptedData.Split('#');

        Dictionary <GameItem, int> bankItems = Extensions.GetItemDicFromString(lines[0], itemDatabase);
        List <Skill> skills = Extensions.GetSkillsFromString(lines[1]);
        Dictionary <GameItem, int> invItems = Extensions.GetItemDicFromString(lines[2], itemDatabase);

        gameState.GetPlayerBank().GetInventory().LoadItems(bankItems);
        gameState.GetPlayer().SetSkills(skills);
        gameState.GetPlayerInventory().LoadItems(invItems);

        areaManager.LoadSaveData(lines[3]);
        followerManager.LoadSaveData(lines[4]);

        if (int.TryParse(lines[5], out int hp))
        {
            gameState.GetPlayer().CurrentHP = hp;
        }
        else
        {
            gameState.GetPlayer().CurrentHP = gameState.GetPlayer().MaxHP;
        }

        if (int.TryParse(lines[6], out int activeFollower))
        {
            gameState.GetPlayer().activeFollower = followerManager.GetFollowerByID(activeFollower);
        }

        List <string> recipes = lines[7].Split('/').ToList();

        gameState.GetPlayer().LoadRecipes(recipes);


        List <int> equippedItems = new List <int>();

        foreach (string s in lines[8].Split('/') ?? Enumerable.Empty <string>())
        {
            if (int.TryParse(s, out int id))
            {
                equippedItems.Add(id);
            }
        }
        if (equippedItems != null && equippedItems.Count > 0)
        {
            gameState.GetPlayer().EquipItems(equippedItems);
        }
        if (lines.Length > 9 && lines[9] != null)
        {
            string[] settings = lines[9].Split(',');
            gameState.isSplitView     = bool.Parse(settings[0]);
            gameState.compactBankView = bool.Parse(settings[1]);
            if (settings.Length > 2 && settings[2] != null)
            {
                gameState.expensiveItemThreshold = int.Parse(settings[2]);
            }
            if (settings.Length > 3 && settings[3] != null)
            {
                gameState.totalKills = int.Parse(settings[3]);
            }
            if (settings.Length > 4 && settings[4] != null)
            {
                gameState.PetShopUnlocked = bool.Parse(settings[4]);
            }
            if (settings.Length > 5 && settings[5] != null)
            {
                gameState.autoBuySushiSupplies = bool.Parse(settings[5]);
            }
            if (settings.Length > 6 && settings[6] != null)
            {
                gameState.totalCoinsEarned = long.Parse(settings[6]);
            }
            if (settings.Length > 7 && settings[7] != null)
            {
                gameState.totalDeaths = int.Parse(settings[7]);
            }
            if (settings.Length > 8 && settings[8] != null)
            {
                gameState.submitHighScores = bool.Parse(settings[8]);
            }
        }
        if (lines.Length > 10 && lines[10] != null)
        {
            npcManager.LoadNPCData(lines[10]);
        }
        if (lines.Length > 11 && lines[11] != null)
        {
            gameState.sushiHouseRice    = int.Parse(lines[11].Split(',')[0]);
            gameState.sushiHouseSeaweed = int.Parse(lines[11].Split(',')[1]);
        }
        if (lines.Length > 12 && lines[12] != null)
        {
            string[] salts = lines[12].Split('/');
            foreach (string salt in salts)
            {
                if (salt.Length > 0)
                {
                    int id     = int.Parse(salt.Split(',')[0]);
                    int amount = int.Parse(salt.Split(',')[1]);
                    buildingManager.GetBuildingByID(id).Salt = amount;
                }
            }
        }
        if (lines.Length > 13 && lines[13] != null)
        {
            string[] tanneries = lines[13].Split('@');

            foreach (string tannery in tanneries)
            {
                if (tannery.Length > 0)
                {
                    Building t           = buildingManager.GetBuildingByID(int.Parse(tannery.Split('>')[0]));
                    string[] tanneryData = tannery.Split('>')[1].Split('_');
                    int      i           = 0;
                    foreach (string s in tanneryData)
                    {
                        if (s.Length > 0 && i < t.TannerySlots)
                        {
                            TanningSlot slot = new TanningSlot();
                            slot.SetDataFromString(s);
                            t.TanneryItems.Add(slot);
                            i++;
                        }
                    }
                }
            }
        }
        if (lines.Length > 14 && lines[14] != null)
        {
            if (bool.TryParse(lines[14].Split(',')[0], out bool isHunting))
            {
                if (isHunting)
                {
                    gameState.isHunting        = true;
                    gameState.huntingAreaID    = int.Parse(lines[14].Split(',')[1]);
                    gameState.huntingStartTime = DateTime.Parse(lines[14].Split(',')[2]);
                    gameState.huntingEndTime   = DateTime.Parse(lines[14].Split(',')[3]);
                    huntingManager.LoadHunt(gameState.huntingStartTime, gameState.huntingEndTime);
                }
            }
        }
        if (lines.Length > 15 && lines[15] != null)
        {
            gameState.GetPlayerBank().LoadTabsFromString(lines[15]);
        }
        if (lines.Length > 16 && lines[16] != null)
        {
            gameState.GetPlayer().LoadPetsFromString(lines[16], petManager);
        }
        if (lines.Length > 17 && lines[17] != null)
        {
            gameState.LoadKC(lines[17]);
        }
        if (lines.Length > 18 && lines[18] != null)
        {
            battleManager.LoadDojoSaveData(lines[18]);
        }
        messageManager.AddMessage("Save game loaded.");
        gameState.saveDataLoaded = true;
        gameState.UpdateState();
    }