Esempio n. 1
0
        public static MapPosDG desMapPog(List <Monument> monuments)
        {
            XmlSerializer ser    = new XmlSerializer(typeof(MapPosDG));
            StreamReader  reader = new StreamReader(@"../../resources/mappos.xml");
            MapPosDG      mpdg   = (MapPosDG)ser.Deserialize(reader);

            reader.Close();

            foreach (Monument monument in monuments)
            {
                foreach (MonumentPosition mp in mpdg.map1Monuments)
                {
                    mp.Monument = monuments.Find(x => x.Id == mp.Monument.Id);
                }
                foreach (MonumentPosition mp in mpdg.map2Monuments)
                {
                    mp.Monument = monuments.Find(x => x.Id == mp.Monument.Id);
                }
                foreach (MonumentPosition mp in mpdg.map3Monuments)
                {
                    mp.Monument = monuments.Find(x => x.Id == mp.Monument.Id);
                }
                foreach (MonumentPosition mp in mpdg.map4Monuments)
                {
                    mp.Monument = monuments.Find(x => x.Id == mp.Monument.Id);
                }
            }

            return(mpdg);
        }
Esempio n. 2
0
        public static void serMapPog(MapPosDG mpdg)
        {
            XmlSerializer ser    = new XmlSerializer(typeof(MapPosDG));
            TextWriter    writer = new StreamWriter(@"../../resources/mappos.xml");

            ser.Serialize(writer, mpdg);
            writer.Close();
        }