Example #1
0
        public void CreateConfig()
        {
            try
            {
                DodoWrapper baseData = new DodoWrapper();
                baseData.Dodos = new List <ServerDodos>()
                {
                    new ServerDodos()
                    {
                        SpecialID = 0
                    },
                    new ServerDodos()
                    {
                        SpecialID = 1
                    },
                    new ServerDodos()
                    {
                        SpecialID = 2
                    },
                    new ServerDodos()
                    {
                        SpecialID = 3
                    },
                    new ServerDodos()
                    {
                        SpecialID = 4
                    },
                    new ServerDodos()
                    {
                        SpecialID = 5
                    },
                    new ServerDodos()
                    {
                        SpecialID = 6
                    },
                    new ServerDodos()
                    {
                        SpecialID = 7
                    },
                    new ServerDodos()
                    {
                        SpecialID = 8
                    },
                    new ServerDodos()
                    {
                        SpecialID = 9
                    },
                    new ServerDodos()
                    {
                        SpecialID = 10
                    }
                };

                string jsonString = JsonConvert.SerializeObject(baseData);
                File.WriteAllText(Path.Combine(_filePath, _serverDodoFile), jsonString);
            }
            catch (Exception)
            {
            }
        }
Example #2
0
 private void LoadConfig()
 {
     try
     {
         string      json  = File.ReadAllText(Path.Combine(_filePath, _serverDodoFile));
         DodoWrapper dodos = JsonConvert.DeserializeObject <DodoWrapper>(json);
         if (dodos != null)
         {
             _specialDodos = dodos.Dodos.ToArray();
         }
     }
     catch (Exception)
     {
     }
 }