public ToolTip Tt { get; private set; } /*Tt*/ #endregion Autoproperties #region Constructor public ControlsController(FrmMain main) { Tt = new ToolTip(); Main = main; LblArrayAvailable = new Label[Main.MaxNrAvailableColors]; LblArrayFeedBackPins = new Label[Main.MaxNrOfTries, Main.MaxNrOfPins]; LblArrayPlayer = new Label[Main.MaxNrOfTries, Main.MaxNrOfPins]; LblArraySecret = new Label[Main.MaxNrOfPins]; } /*ControlsController*/
} /*serializeSavedGames*/ public SavedGamesList deserializeSavedGames(FrmMain main) { try { S = new FileStream("save.dat", FileMode.Open); SavedGamesList SgList = (SavedGamesList)F.Deserialize(S); S.Close(); return SgList; } catch (IOException) { return null; } catch (SerializationException) { S.Close(); return null; } catch (ArgumentNullException) { S.Close(); return null; } } /*deserializeSavedGames*/
} /*add*/ public Mastermind load(int i, FrmMain main) { return new Mastermind(SavedGames.ElementAt(i).Game); } /*load*/
} /*SavedGames*/ #endregion Properties #region Behavior public void add(FrmMain main) { try { SavedGames.Add(new SavedGame(main.Mastermind.GameState)); } catch (NullReferenceException) { } } /*add*/
} /*F*/ #endregion Properties #region Behavior public void serializeSavedGames(FrmMain main) { S = new FileStream("save.dat", FileMode.Create); F.Serialize(S, main.SgList); S.Close(); main.CtrlController.filltsLoad(); } /*serializeSavedGames*/