Exemplo n.º 1
0
        public static void OpenDatabase()
        {
            m_DBFile = FileInteraction.CreateDirectory("ADSFE") + "ADS_DB";

            try
            {
                //FileInfo fi = new FileInfo(m_DBFile);
                //fi.Delete();

                m_Conn = new SQLiteConnection(m_DBFile);

                if (m_Conn != null)
                {
                    m_Conn.CreateTable <ProfileRecord>();
                    m_Conn.CreateTable <RawDataRecord>();
                    m_Conn.CreateTable <Options>();
                    m_Conn.CreateTable <BadgeType>();
                    m_Conn.CreateTable <Levels>();



                    if (m_Conn.Table <Options>().Count() == 0)
                    {
                        m_Conn.Insert(new Options(), typeof(Options));
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }
Exemplo n.º 2
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)
            {
            }
        }
Exemplo n.º 3
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)
            {
            }
        }