Esempio n. 1
0
 public static void SaveData()
 {
     Serilizer.SaveDataToAddress(SAVE_KEY, TimesPlayed);
     Serilizer.SaveDataToAddress(SAVE_KEY + "Hard", TimesPlayedOnHard);
     Serilizer.SaveDataToAddress(SAVE_KEY + "Normal", TimesPlayedOnNormal);
     Serilizer.SaveDataToAddress(SAVE_KEY + "Easy", TimesPlayedOnEasy);
 }
Esempio n. 2
0
        public static async void Restore()
        {
            string background    = (string)Serilizer.RestoreDataFromAddress(ADDRESS_BACKGROUND);
            string font          = (string)Serilizer.RestoreDataFromAddress(ADDRESS_FONT);
            string btnFont       = (string)Serilizer.RestoreDataFromAddress(ADDRESS_BTN_FONT);
            string btnBackground = (string)Serilizer.RestoreDataFromAddress(ADDRESS_BTN_BACKGROUND);
            string btnBorder     = (string)Serilizer.RestoreDataFromAddress(ADDRESS_BTN_BORDER);
            string titleFont     = (string)Serilizer.RestoreDataFromAddress(ADDRESS_TITLE_FONT);
            string pictureURL    = (string)Serilizer.RestoreDataFromAddress(ADDRESS_PICTURE_URL);

            if (background == null)
            {
                background    = "Gray";
                font          = "Cyan";
                btnFont       = "Black";
                btnBackground = "Cyan";
                btnBorder     = "Dark Green";
                titleFont     = "Dark Green";
                pictureURL    = null;
            }

            SetBackgroundColor(background);
            SetFontColor(font);
            SetButtonFontColor(btnFont);
            SetButtonBackgroundColor(btnBackground);
            SetButtonBorderColor(btnBorder);
            SetTitleFontColor(titleFont);
            PictureURL = pictureURL;
            if (PictureURL != null)
            {
                // We also have a file associated here.
                _pictureFile = await ApplicationData.Current.LocalFolder.GetFileAsync(PictureURL);
            }
        }
Esempio n. 3
0
 public static void Save()
 {
     Serilizer.SaveDataToAddress(ADDRESS_BACKGROUND, GetBackgroundColorAsString());
     Serilizer.SaveDataToAddress(ADDRESS_FONT, GetFontColorAsString());
     Serilizer.SaveDataToAddress(ADDRESS_BTN_FONT, GetButtonFontColorAsString());
     Serilizer.SaveDataToAddress(ADDRESS_BTN_BACKGROUND, GetButtonBackgroundColorAsString());
     Serilizer.SaveDataToAddress(ADDRESS_BTN_BORDER, GetButtonBorderColorAsString());
     Serilizer.SaveDataToAddress(ADDRESS_TITLE_FONT, GetTitleFontColorAsString());
     Serilizer.SaveDataToAddress(ADDRESS_PICTURE_URL, PictureURL);
 }
Esempio n. 4
0
        public void SaveState()
        {
            var           state = new ApplicationDataCompositeValue();
            StringBuilder sb    = new StringBuilder();

            foreach (int i in _currentSolveState)
            {
                sb.Append(i);
                sb.Append(";");
            }
            string finalSaveData = sb.ToString();

            Serilizer.SaveDataToAddress(SAVE_ADDRESS, finalSaveData);
        }
Esempio n. 5
0
        public void RestoreState()
        {
            var    state             = Serilizer.GetPuzzleState();
            string piecesTextRep     = (string)state["Pieces"];
            string initPosTextRep    = (string)state["OriginalState"];
            string currentPosTextRep = (string)state["CurrentPos"];

            string[] pieceData = piecesTextRep.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (_rows * _rows != pieceData.Length)
            {
                throw new IOException();
            }
            int loc = 0;

            for (int i = 0; i < _rows; ++i)
            {
                for (int j = 0; j < _rows; ++j)
                {
                    SodukoPiece p = new SodukoPiece(false);
                    p.InitFromInfoString(pieceData[loc]);
                    _sodukoPieces[i, j] = p;
                    ++loc;
                }
            }

            string[] initPosData = initPosTextRep.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            loc = 0;
            for (int i = 0; i < _rows; ++i)
            {
                for (int j = 0; j < _rows; ++j)
                {
                    _startingState[i, j] = int.Parse(initPosData[loc]);
                    ++loc;
                }
            }

            string[] currentPosData = currentPosTextRep.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            loc = 0;
            for (int i = 0; i < _rows; ++i)
            {
                for (int j = 0; j < _rows; ++j)
                {
                    _currentValues[i, j] = int.Parse(currentPosData[loc]);
                    ++loc;
                }
            }

            _solver.LoadState();
        }
Esempio n. 6
0
        public static void LoadData()
        {
            TimesPlayed         = 0;
            TimesPlayedOnHard   = 0;
            TimesPlayedOnNormal = 0;
            TimesPlayedOnEasy   = 0;
            object obj = Serilizer.RestoreDataFromAddress(SAVE_KEY);

            if (obj != null)
            {
                TimesPlayed         = (int)obj;
                TimesPlayedOnHard   = (int)Serilizer.RestoreDataFromAddress(SAVE_KEY + "Hard");
                TimesPlayedOnNormal = (int)Serilizer.RestoreDataFromAddress(SAVE_KEY + "Normal");
                TimesPlayedOnEasy   = (int)Serilizer.RestoreDataFromAddress(SAVE_KEY + "Easy");
            }
        }
Esempio n. 7
0
        public void LoadState()
        {
            string data = (string)Serilizer.RestoreDataFromAddress(SAVE_ADDRESS);

            string[] pieceData = data.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (81 != pieceData.Length)
            {
                throw new IOException();
            }

            int loc = 0;

            for (int i = 0; i < 9; ++i)
            {
                for (int j = 0; j < 9; ++j)
                {
                    _currentSolveState[i, j] = Int32.Parse(pieceData[loc]);
                    ++loc;
                }
            }
        }
Esempio n. 8
0
 public void SaveState()
 {
     Serilizer.SavePuzzleState(_sodukoPieces, _startingState, _currentValues);
     _solver.SaveState();
 }
Esempio n. 9
0
 public void LoadData()
 {
     _esd.Parse((string)Serilizer.RestoreDataFromAddress(DATA_ADDRESS));
 }
Esempio n. 10
0
        public void SerilizeData()
        {
            string dataAsStr = _esd.ToString();

            Serilizer.SaveDataToAddress(DATA_ADDRESS, dataAsStr);
        }