Esempio n. 1
0
        public void Serialize(object eventArgs)
        {
            if (!Model.CheckMurphySet())
            {
                (new Exception(ExceptionType.ForgotMurphy)).ShowException();
                return;
            }
            if (!AvilableLvl.Contains(_level))
            {
                AvilableLvl.Add(_level);
            }
            var savedModel = Model.DeepCopy();

            savedModel.ManageBorders(true);
            savedModel.Serialize();
            SaveConsequence();
        }
Esempio n. 2
0
        private void SaveConsequence()
        {
            var index = int.Parse(LevelIndex);

            if (index > AvilableLvl.Count)
            {
                index = AvilableLvl.Count;
            }
            if (index < 0)
            {
                index = 0;
            }
            if (AvilableLvl.Contains(Level))
            {
                AvilableLvl.Remove(Level);
            }
            AvilableLvl.Insert(index == 0? 0: index - 1, Level);
            File.WriteAllLines(MainMenuParameters.LvlOrderFilePath, AvilableLvl, Encoding.UTF8);
        }