Exemple #1
0
        public bool SaveFileForCGI(string filename)
        {
            try
            {
                StreamWriter sw          = new StreamWriter(filename, false, System.Text.Encoding.Unicode);
                CardLibrary  cardLibrary = CardLibrary.GetInstance();

                Card[] Cards = MainDeck.GetList();
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    string          s  = CharacterSet.JPDBCToSBC(cd.japName);
                    sw.WriteLine(s);
                }

                Cards = SideDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("####");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine(CharacterSet.JPDBCToSBC(cd.japName));
                }

                Cards = ExtraDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("====");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine(CharacterSet.JPDBCToSBC(cd.japName));
                }

                Cards = TempDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("$$$$");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine(CharacterSet.JPDBCToSBC(cd.japName));
                }

                sw.Close();

                deckname            = Regex.Replace(filename, @".[^.]*$", "");
                deckname            = Regex.Replace(deckname, @"^.*\\", "");
                MainDeck.isChanged  = false;
                SideDeck.isChanged  = false;
                ExtraDeck.isChanged = false;
                TempDeck.isChanged  = false;
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #2
0
        public bool SaveFileForPRO(string filename)
        {
            try
            {
                StreamWriter sw          = new StreamWriter(filename, false, System.Text.Encoding.ASCII);
                CardLibrary  cardLibrary = CardLibrary.GetInstance();

                sw.WriteLine("#created by DeckBuilder2");

                //Êä³öÖ÷¿¨×é
                Card[] Cards = MainDeck.GetList();
                sw.WriteLine("#main");
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine(cd.cheatcode);
                }

                //Êä³ö¶îÍ⿨×é
                Cards = ExtraDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("#extra");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine(cd.cheatcode);
                }

                //Êä³ö¸±¿¨×é
                Cards = SideDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("!side");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine(cd.cheatcode);
                }

                //Êä³öºòÑ¡¿¨±í
                Cards = TempDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("#wait list");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    sw.WriteLine("#" + cd.cheatcode);
                }

                sw.Close();

                deckname            = Regex.Replace(filename, @".[^.]*$", "");
                deckname            = Regex.Replace(deckname, @"^.*\\", "");
                MainDeck.isChanged  = false;
                SideDeck.isChanged  = false;
                ExtraDeck.isChanged = false;
                TempDeck.isChanged  = false;
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #3
0
        public bool SaveFile(string filename)
        {
            this.filename = filename;

            try
            {
                StreamWriter sw          = new StreamWriter(filename, false, System.Text.Encoding.GetEncoding("gb2312"));
                CardLibrary  cardLibrary = CardLibrary.GetInstance();

                Card[] Cards = MainDeck.GetList();
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    if (card.Text.Length > 0)
                    {
                        sw.WriteLine("[" + cd.name + "]#" + card.Text + "#");
                    }
                    else
                    {
                        sw.WriteLine("[" + cd.name + "]");
                    }
                }

                Cards = SideDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("####");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    if (card.Text.Length > 0)
                    {
                        sw.WriteLine("[" + cd.name + "]#" + card.Text + "#");
                    }
                    else
                    {
                        sw.WriteLine("[" + cd.name + "]");
                    }
                }

                Cards = ExtraDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("====");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    if (card.Text.Length > 0)
                    {
                        sw.WriteLine("[" + cd.name + "]#" + card.Text + "#");
                    }
                    else
                    {
                        sw.WriteLine("[" + cd.name + "]");
                    }
                }

                Cards = TempDeck.GetList();
                if (Cards.Length > 0)
                {
                    sw.WriteLine("$$$$");
                }
                foreach (Card card in Cards)
                {
                    CardDescription cd = cardLibrary.GetCardByID(card.ID);
                    if (card.Text.Length > 0)
                    {
                        sw.WriteLine("[" + cd.name + "]#" + card.Text + "#");
                    }
                    else
                    {
                        sw.WriteLine("[" + cd.name + "]");
                    }
                }

                sw.Close();

                deckname            = Regex.Replace(filename, @".[^.]*$", "");
                deckname            = Regex.Replace(deckname, @"^.*\\", "");
                MainDeck.isChanged  = false;
                SideDeck.isChanged  = false;
                ExtraDeck.isChanged = false;
                TempDeck.isChanged  = false;
                return(true);
            }
            catch
            {
                return(false);
            }
        }