Exemple #1
0
        public void ImportAndDrawingTest()
        {
            Harbor harbor;
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(Harbor));
            using (StreamReader reader = new StreamReader(@"./Resources/HarborMap.xml"))
            {
                harbor = (Harbor)xmlSerializer.Deserialize(reader);
            }

            IList<TemporaryPersonn> ts = new List<TemporaryPersonn>();
            using (StreamReader reader = File.OpenText("./lerat - societaire.csv"))
            {
                reader.ReadLine(); // skip the title
                while (reader.Peek() >= 0)
                {
                    ts.Add(splitLineInObject(reader.ReadLine()));
                }
            }

            // create the link between harbor and temp class TemporaryPersonn
            foreach (var line in harbor.Lines)
            {
                foreach (var anchor in line.Anchorages)
                {
                    if (ts.Any(personn => personn.AnchorName.ToLowerInvariant().Equals(anchor.Name.ToLowerInvariant()) &&
                                                           personn.LineName.ToLowerInvariant().Equals(line.Name.ToLowerInvariant())))
                    {
                        anchor.LastName = ts.First(personn => personn.AnchorName.ToLowerInvariant().Equals(anchor.Name.ToLowerInvariant()) &&
                                                               personn.LineName.ToLowerInvariant().Equals(line.Name.ToLowerInvariant())).LastName;
                    }
                }
            }

            // draw the map

            DrawerName d = new DrawerName(@"./Resources/HarborMap.jpg", harbor);
            d.Draw();
        }
Exemple #2
0
 public void DrawingTest()
 {
     Harbor harbor;
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(Harbor));
     using (StreamReader reader = new StreamReader(@"./Resources/HarborMap.xml"))
     {
         harbor = (Harbor)xmlSerializer.Deserialize(reader);
     }
     
     DrawerName d = new DrawerName(@"./Resources/HarborMap.jpg", harbor);
     d.Draw();
 }