Ejemplo n.º 1
0
        public void GenerateMap(string mapName)
        {
            if (Name == mapName)
            {
                Console.WriteLine("Map: " + mapName + " Is Already Loaded");
                return;
            }

            if (Layers != null)
            {
                TileArray = null;
                foreach (Layer layer in Layers)
                {
                    layer.Dispose();
                }
                foreach (string tileSet in TileSetNames)
                {
                    Assets.RemoveTexture(tileSet);
                }
                System.GC.Collect();
            }

            Name = mapName;
            FillMap(JsonDeserialize.DeserializeJSON <TiledMapData>(mapName + ".Json"));
            Console.WriteLine("Map " + mapName + "Has Loaded");
        }
        public void Execute()
        {
            try {
                var defaultDeserialize =
                    new JsonDeserialize <AbsoluteCategory>(JsonDeserialize <AbsoluteCategory> .DefaultCategoriesFilename);
                List = defaultDeserialize.ListJson();
                //using (SQLiteCommand command = new SQLiteCommand(Logic.Db.Properties.Resources.SQL_SELECT_ALL_CATEGORIES, _conn.DbConnection))

                //using (SQLiteDataReader reader = command.ExecuteReader())
                //{

                //    while (reader.Read())
                //    {
                //        CategoryDto cat = new CategoryDto()
                //        {

                //            Name = reader.GetString(0),
                //            //Min_Age = reader.GetInt16(1),
                //            //Max_Age = reader.GetInt16(1)
                //    };

                //        list.Add(cat);
                //    }
                //}
            }
            catch (SQLiteException) {
                _conn.DbConnection?.Close();
                throw;
            }
        }
Ejemplo n.º 3
0
        private static void Main(string[] args)
        {
            JsonDeserialize des        = new JsonDeserialize();
            var             collection = des.GetManyDiffUser(50);

            if (collection != null)
            {
                foreach (var item in collection.results)
                {
                    Console.WriteLine(item.name.first + " " + item.name.last);
                    Console.WriteLine(item.dob.date);
                    Console.Write(collection.info.results);
                    Console.WriteLine(" " + collection.info.seed + " " + collection.info.version);
                    Console.WriteLine();
                }
            }

            Console.WriteLine("***********************************");
            var singler = des.GetSingleDiffUser();

            if (singler != null)
            {
                Console.WriteLine(singler.results[0].name.first + " " + singler.results[0].name.last);
                Console.WriteLine(singler.results[0].dob.date);
                Console.Write(singler.info.results);
                Console.WriteLine(" " + singler.info.seed + " " + singler.info.version);
            }

            Console.WriteLine();
            Console.ReadKey();
        }
        public static HandleEarthProfileProcess HandleEarthProfileProcess()
        {
            IServiceSecurity      serviceSecurity      = new ServiceSecurityValue();
            IDeserialize          deserialize          = new JsonDeserialize();
            ISerialize            serialize            = new JsonSerialize();
            Service               service              = new Service(serviceSecurity, deserialize, serialize);
            IOpenElevationService openElevationService = new OpoElevationService(service, serviceSecurity.Url);
            SetElevationEarth     setElevationEarth    = new SetElevationEarth(openElevationService);

            return(new HandleEarthProfileProcess(setElevationEarth));
        }
Ejemplo n.º 5
0
        public void TestListOfCocApi()
        {
            List <TestJsonCoc> result = null;

            using (var httpClient = new HttpClient())
            {
                using (var response = httpClient.GetAsync("http://localhost/MCPDIP.Api/api/Coc/2020/02/IEHP"))
                {
                    var apiResponse = response.Result.Content.ReadAsStringAsync();
                    result = JsonDeserialize.DeserializeListOfCoc(apiResponse.Result);
                }
            }
            Assert.IsTrue(result.Count > 0);
        }
Ejemplo n.º 6
0
        public void TestCocApi()
        {
            TestJsonCoc result = null;

            using (var httpClient = new HttpClient())
            {
                using (var response = httpClient.GetAsync("http://localhost/MCPDIP.Api/api/Coc/1"))
                {
                    var apiResponse = response.Result.Content.ReadAsStringAsync();
                    result = JsonDeserialize.DeserializeCoc(apiResponse.Result);
                }
            }
            Assert.IsTrue(result != null);
        }
Ejemplo n.º 7
0
 public static void ListBoxFiller(JsonDeserialize deserializer, string strResponse, ListBox listBox, TextBox textBoxLog, TextBox textBox)
 {
     try
     {
         foreach (var item in deserializer.DeserializeInfo(strResponse, textBox.Text))
         {
             listBox.Items.Add(item);
         }
     }
     catch
     {
         textBoxLog.Text += strResponse + Environment.NewLine;
     }
 }
        public void GeneratorDefaultCategoriesTest()
        {
            var json = new JsonDeserialize <AbsoluteCategory>("DefaultCategories.json");

            string[] categorias = { "JUNIOR", "SENIOR", "VETERAN_A", "VETERAN_B", "VETERAN_C" };
            int[]    agem       = { 18, 19, 35, 45, 55 };
            int[]    ageM       = { 18, 34, 44, 54, int.MaxValue };
            var      categories = new AbsoluteCategory[categorias.Length];

            for (var i = 0; i < categories.Length; i++)
            {
                var str = categorias[i];

                var absoluteCategory = new AbsoluteCategory {
                    Id        = 1,
                    Name      = str,
                    CategoryM = new CategoryDto {
                        Id     = 1,
                        Name   = $"{str}_M",
                        MinAge = agem[i],
                        MaxAge = ageM[i],
                        Gender = "M"
                    },
                    CategoryF = new CategoryDto {
                        Id     = 1,
                        Name   = $"{str}_F",
                        MinAge = agem[i],
                        MaxAge = ageM[i],
                        Gender = "F"
                    }
                };

                categories[i] = absoluteCategory;
            }

            json.Serialize(categories);
            foreach (var category in json.ListJson())
            {
                if (category != null)
                {
                    Console.WriteLine($@"{category.Name} {category.CategoryF.Name} {category.CategoryM.Name}");
                }
            }
        }
Ejemplo n.º 9
0
        public static void ListBoxFiller(JsonDeserialize deserializer, string strResponse, ListBox listBox, TextBox textBoxLog, string find)
        {
            Regex regex = new Regex($@"^{find}", RegexOptions.IgnoreCase);

            try
            {
                foreach (var item in deserializer.DeserializePair(strResponse))
                {
                    if (regex.IsMatch(item))
                    {
                        listBox.Items.Add(item);
                    }
                }
            }
            catch
            {
                textBoxLog.Text += strResponse + Environment.NewLine;
            }
        }
Ejemplo n.º 10
0
 public void Setup()
 {
     jsonDeserialize = new JsonDeserialize();
 }
Ejemplo n.º 11
0
 public static void StreamDataGrid(bool reloadTable, DataGridView dataGridViewParser, TextBox textBoxLog, TextBox textBoxLink, RestClient client, JsonDeserialize deserializer)
 {
     if (reloadTable == true)
     {
         if (!String.IsNullOrWhiteSpace(textBoxLink.Text))
         {
             client.EndPoint = textBoxLink.Text;
             int    counter     = 0;
             string strResponse = client.MakeRequest();
             try
             {
                 foreach (KeyValuePair <string, CurrencyTickerYobit> item in deserializer.DeserializeTicker(strResponse))
                 {
                     dataGridViewParser.Rows[counter].Cells[1].Value = item.Value.Buy;
                     dataGridViewParser.Rows[counter].Cells[2].Value = item.Value.Sell;
                     counter++;
                 }
             }
             catch
             {
                 textBoxLog.Text += strResponse + Environment.NewLine;
             }
         }
     }
 }