Read() public static method

public static Read ( string DB, bool reNewLine ) : Card[]
DB string
reNewLine bool
return Card[]
Esempio n. 1
0
            public bool Excute(params object[] args)
            {
                if (!this.dataform.CheckOpen())
                {
                    return(false);
                }

                Card[] cards = (Card[])args[0];

                if (cards == null || cards.Length == 0)
                {
                    return(false);
                }

                bool replace = false;

                Card[] oldcards = DataBase.Read(this.dataform.GetOpenFile(), true, "");
                if (oldcards != null && oldcards.Length != 0)
                {
                    int i = 0;
                    foreach (Card oc in oldcards)
                    {
                        foreach (Card c in cards)
                        {
                            if (c.id == oc.id)
                            {
                                i += 1;
                                if (i == 1)
                                {
                                    replace = MyMsg.Question(LMSG.IfReplaceExistingCard);
                                    break;
                                }
                            }
                        }
                        if (i > 0)
                        {
                            break;
                        }
                    }
                }
                DataBase.CopyDB(this.dataform.GetOpenFile(), !replace, cards);
                this.copied   = true;
                this.newCards = cards;
                this.replace  = replace;
                this.oldCards = oldcards;
                return(true);
            }