Пример #1
0
        public static Card56ErrorData GetRoundSuitCardExistsErrorData(string suit)
        {
            Card56ErrorData error = new Card56ErrorData();

            error.Suit = suit;
            return(error);
        }
Пример #2
0
        public static Card56ErrorData GetMustPlayTheTrumpCardErrorData(string thuruppuCard)
        {
            Card56ErrorData error = new Card56ErrorData();

            error.ThuruppuCard = thuruppuCard;
            return(error);
        }
Пример #3
0
        public static Card56ErrorData GetMustPlayTrumpSuitErrorData(string trumpSuit)
        {
            Card56ErrorData error = new Card56ErrorData();

            error.TrumpSuit = trumpSuit;
            return(error);
        }
Пример #4
0
        public static Card56ErrorData GetNotHighBidderErrorData(string playerName)
        {
            Card56ErrorData error = new Card56ErrorData();

            error.PlayerName = playerName;
            return(error);
        }
Пример #5
0
        public static Card56ErrorData GetCardNotOfRoundSuitErrorData(string suit)
        {
            Card56ErrorData error = new Card56ErrorData();

            error.Suit = suit;
            return(error);
        }
Пример #6
0
        public static Card56ErrorData GetBidOutOfRangeErrorData(int MinBid, int MaxBid)
        {
            Card56ErrorData error = new Card56ErrorData();

            error.MinBid = MinBid;
            error.MaxBid = MaxBid;
            return(error);
        }
Пример #7
0
 public RoundSuitCardExistsException(string suit) : base(Cards56Error.RoundSuitCardExistsException,
                                                         Card56ErrorData.GetRoundSuitCardExistsErrorData(suit))
 {
 }
Пример #8
0
 public MustPlayTheTrumpCardException(string thuruppuCard) : base(Cards56Error.MustPlayTheTrumpCardException,
                                                                  Card56ErrorData.GetMustPlayTheTrumpCardErrorData(thuruppuCard))
 {
 }
Пример #9
0
 public MustPlayTrumpSuitException(string trumpSuit) : base(Cards56Error.MustPlayTrumpSuitException,
                                                            Card56ErrorData.GetMustPlayTrumpSuitErrorData(trumpSuit))
 {
 }
Пример #10
0
 public CardNotOfRoundSuitException(string suit) : base(Cards56Error.CardNotOfRoundSuitException,
                                                        Card56ErrorData.GetCardNotOfRoundSuitErrorData(suit))
 {
 }
Пример #11
0
 public NotHighBidderException(string playerName) : base(Cards56Error.NotHighBidderException,
                                                         Card56ErrorData.GetNotHighBidderErrorData(playerName))
 {
 }
Пример #12
0
 public BidOutOfRangeException(int MinBid, int MaxBid) : base(Cards56Error.BidOutOfRangeException,
                                                              Card56ErrorData.GetBidOutOfRangeErrorData(MinBid, MaxBid))
 {
 }
Пример #13
0
 public NotPlayersTurnException(string playerName) : base(Cards56Error.NotPlayersTurnException,
                                                          Card56ErrorData.GetNotPlayersTurnErrorData(playerName))
 {
 }
Пример #14
0
        public Card56Exception(int errorCode, Card56ErrorData errorData = null) : base()
        {
            ErrorData           = (errorData != null)? errorData: new Card56ErrorData();
            ErrorData.ErrorCode = errorCode;
            ErrorData.ErrorName = this.GetType().Name;

            string StringsDir = Card56Exception.AssemblyDirectory + System.IO.Path.DirectorySeparatorChar + "locale";

            _catalog = new Catalog("strings", StringsDir, Thread.CurrentThread.CurrentCulture);
            Message  = _catalog.GetString(Cards56Error.MSG[errorCode]);

            switch (errorCode)
            {
            case Cards56Error.NotPlayersTurnException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.PlayerName);
                }
                break;

            case Cards56Error.BidOutOfRangeException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.MinBid, errorData.MaxBid);
                }
                break;

            case Cards56Error.NotHighBidderException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.PlayerName);
                }
                break;

            case Cards56Error.CardNotOfRoundSuitException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.Suit);
                }
                break;

            case Cards56Error.MustPlayTheTrumpCardException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.ThuruppuCard);
                }
                break;

            case Cards56Error.MustPlayTrumpSuitException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.TrumpSuit);
                }
                break;

            case Cards56Error.RoundSuitCardExistsException:
                Debug.Assert(errorData != null);
                if (errorData != null)
                {
                    Message = string.Format(Message, errorData.Suit);
                }
                break;
            }
        }