示例#1
0
        public static string Gettype(string name)
        {
            FileStream stream = new FileStream(name + ".json", FileMode.Open);
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(objetFixejson));
            objetFixejson s = (objetFixejson)ser.ReadObject(stream);

            stream.Close();
            return(s.type);
        }
示例#2
0
        public static void Setnom(string name, string objet)
        {
            FileStream stream = new FileStream(name + ".json", FileMode.Open);
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(objetFixejson));
            objetFixejson s = (objetFixejson)ser.ReadObject(stream);

            s.nom           = objet;
            stream.Position = 0;
            ser.WriteObject(stream, s);
            stream.Close();
        }
示例#3
0
        public objetFixe(string name, int[] obj)
        {
            nom = name; gen = 1; bitmap = obj; type = "";
            objetFixejson j = new objetFixejson();

            j.nom    = nom;
            j.gen    = gen;
            j.bitmap = bitmap;
            j.type   = type;
            FileStream stream = new FileStream(name + ".json", FileMode.OpenOrCreate);
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(objetFixejson));

            ser.WriteObject(stream, j);
            stream.Position = 0;
            StreamReader sr = new StreamReader(stream);

            Console.Write("JSON form of objetFixe object: ");
            Console.WriteLine(sr.ReadToEnd());
            stream.Close();
            sr.Close();
        }