Пример #1
0
 public Tournament GOEPPImport()
 {
     fileManager.AddFilter("gip", "GÖPP Import File");
     if (fileManager.Open())
     {
         try
         {
             List <string> gipFile = new List <string>();
             using (StreamReader sr = new StreamReader(fileManager.FileName, Encoding.GetEncoding(28591)))
             {
                 string line;
                 while ((line = sr.ReadLine()) != null)
                 {
                     gipFile.Add(line);
                 }
             }
             //Fileformat:
             //1. Version:   v1.3.3
             //2. Name:      1. Schlacht um Tatooine
             //3. T3ID:      12484
             //4. Number:    30
             //              0     1          2     3          4         5            6                 7  8  9  10  11
             //5.+ Player:   ID  ||Forename ||Name||Nickname ||Faction ||City       ||Team            ||A||B||C||D||x
             //              7619||Dieter   ||Chri||DieChri  ||Rebellen||Leverkusen ||PGF Siegen e. V.||3|| ||1|| ||x
             //A: ArmyListGiven 3 = Yes, 0 = No
             //B: ?
             //C: Paid 1 = Yes, 0 = No
             //D: Actual T3 Rank
             //x = End
             Tournament tournament = new Tournament(Int32.Parse(gipFile[2]), gipFile[1], null, gipFile[0]);
             for (int i = 4; i < gipFile.Count; i++)
             {
                 tournament.AddPlayer(ConvertLineToPlayer(gipFile[i]));
             }
             //tournament.TeamProtection = false;
             return(tournament);
         }
         catch (Exception)
         {
             messageManager.Show("Please chosse a valid gip-File.");
             return(null);
         }
     }
     return(null);
 }