Exemple #1
0
        public static void LoadProfileLevelsFromFile()
        {
            string        FileName  = FileInteraction.CreateDirectory("DEF") + "PROFILE.DEF";
            List <Levels> LevelList = new List <Levels>();

            try
            {
                FileInfo fi = new FileInfo(FileName);
                if (fi.Exists)
                {
                    string StopString = "THIS line MUST remain";
                    string FileData   = FileInteraction.ReadCompleteFile("DEF", "PROFILE.DEF");

                    if (FileData != "")
                    {
                        string[] FileInfo = FileData.Split('\n');

                        if (FileInfo.Length > 2)
                        {
                            int    OrderValue = 0;
                            string curLevel   = "";
                            string FileLevel  = FileInfo[1].Trim();
                            int    OffSet     = 73;
                            if (FileLevel.Length >= 8)
                            {
                                OffSet += 10;
                            }

                            while (curLevel.IndexOf(StopString) == -1)
                            {
                                curLevel = FileInfo[OffSet + OrderValue].Trim();
                                if (curLevel.IndexOf(StopString) == -1)
                                {
                                    Levels ll = new Levels();
                                    OrderValue++;

                                    ll.Order = OrderValue;
                                    ll.Level = curLevel;
                                    LevelList.Add(ll);
                                }
                            }
                        }



                        DataAccess.UpdateLevelsTable(LevelList);
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }
Exemple #2
0
        public static void LoadBadgesFromFile()
        {
            string           FileName  = FileInteraction.CreateDirectory("DEF") + "BADGE.DEF";
            List <BadgeType> BadgeList = new List <BadgeType>();

            try
            {
                FileInfo fi = new FileInfo(FileName);
                if (fi.Exists)
                {
                    string FileData = FileInteraction.ReadCompleteFile("DEF", "BADGE.DEF");

                    if (FileData != "")
                    {
                        string[] FileInfo = FileData.Split('\n');

                        for (int Count = 2; Count < FileInfo.Length - 1; Count += 2)
                        {
                            string[]  strItems = FileInfo[Count].Split(';');
                            BadgeType bt       = new BadgeType();
                            bt.Type1 = strItems[1];
                            bt.Type2 = strItems[2];

                            bt.BadgeID     = strItems[3];
                            bt.Description = strItems[6];
                            bt.Misc        = strItems[7];
                            bt.ButtonID    = strItems[5];
                            bt.Details     = "";

                            BadgeList.Add(bt);
                        }


                        DataAccess.UpdateBadgeTable(BadgeList);
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }