示例#1
0
        private void xml2cs(object sender, EventArgs e)
        {
            CityBikeInfo cs   = new CityBikeInfo();
            string       json = "";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                StreamReader sr = new StreamReader(openFileDialog.FileName);
                json = sr.ReadToEnd();
            }
            //for (int i = 0; i < 206; i++)
            //{
            //    Console.Write("items.BIKEStation.cbs.Add(items.BIKEStation.CS"+(i+1)+");\n");
            //}
            //string apart = "},";
            //json = json.Replace(apart, apart + "\"CS\":");
            cs = CityBikeInfo.ReadJson(json);
            bs = cs.BIKEStation;
        }
示例#2
0
        public static CityBikeInfo ReadJson(string jSon)
        {
            //jSon = jSon.Insert(24, "Station_");
            //string apart = "\"},\"";
            //jSon = jSon.Replace(apart, apart + "Station_");
            //Console.Write(jSon);
            //將JSON格式做反序列化之動作
            CityBikeInfo items = JsonConvert.DeserializeObject <CityBikeInfo>(jSon);

            items.BIKEStation.cbs.Add(items.BIKEStation.CS1);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS2);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS3);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS4);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS5);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS6);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS7);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS8);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS9);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS10);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS11);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS12);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS13);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS14);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS15);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS16);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS17);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS18);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS19);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS20);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS21);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS22);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS23);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS24);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS25);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS26);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS27);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS28);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS29);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS30);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS31);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS32);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS33);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS34);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS35);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS36);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS37);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS38);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS39);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS40);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS41);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS42);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS43);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS44);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS45);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS46);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS47);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS48);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS49);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS50);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS51);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS52);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS53);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS54);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS55);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS56);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS57);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS58);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS59);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS60);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS61);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS62);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS63);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS64);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS65);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS66);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS67);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS68);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS69);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS70);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS71);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS72);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS73);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS74);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS75);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS76);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS77);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS78);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS79);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS80);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS81);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS82);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS83);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS84);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS85);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS86);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS87);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS88);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS89);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS90);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS91);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS92);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS93);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS94);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS95);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS96);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS97);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS98);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS99);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS100);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS101);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS102);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS103);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS104);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS105);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS106);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS107);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS108);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS109);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS110);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS111);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS112);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS113);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS114);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS115);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS116);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS117);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS118);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS119);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS120);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS121);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS122);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS123);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS124);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS125);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS126);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS127);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS128);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS129);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS130);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS131);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS132);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS133);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS134);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS135);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS136);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS137);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS138);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS139);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS140);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS141);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS142);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS143);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS144);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS145);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS146);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS147);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS148);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS149);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS150);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS151);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS152);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS153);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS154);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS155);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS156);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS157);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS158);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS159);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS160);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS161);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS162);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS163);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS164);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS165);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS166);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS167);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS168);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS169);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS170);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS171);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS172);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS173);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS174);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS175);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS176);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS177);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS178);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS179);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS180);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS181);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS182);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS183);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS184);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS185);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS186);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS187);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS188);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS189);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS190);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS191);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS192);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS193);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS194);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS195);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS196);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS197);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS198);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS199);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS200);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS201);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS202);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS203);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS204);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS205);
            items.BIKEStation.cbs.Add(items.BIKEStation.CS206);
            return(items);
        }