MCPcopy Create free account
hub / github.com/MapServer/MapServer / Main

Method Main

mapscript/csharp/examples/getbytes.cs:47–80  ·  view source on GitHub ↗
(string[] args)

Source from the content-addressed store, hash-verified

45 }
46
47 public static void Main(string[] args)
48 {
49 if (args.Length < 2) usage();
50
51 try
52 {
53 mapObj map = new mapObj(args[0]);
54
55 using(imageObj image = map.draw())
56 {
57 // solution 1
58 Console.WriteLine ("Drawing map: '" + map.name + "' using imageObj.getBytes");
59
60 byte[] img = image.getBytes();
61 using (MemoryStream ms = new MemoryStream(img))
62 {
63 Image mapimage = Image.FromStream(ms);
64 mapimage.Save(args[1]);
65 }
66
67 // solution 2
68 Console.WriteLine ("Drawing map: '" + map.name + "' using imageObj.write");
69
70 using (FileStream fs = File.Open("_" + args[1], FileMode.OpenOrCreate, FileAccess.ReadWrite))
71 {
72 image.write(fs);
73 }
74 }
75 }
76 catch (Exception ex)
77 {
78 Console.WriteLine( "GetBytes: ", ex.Message );
79 }
80 }
81
82}
83

Callers

nothing calls this directly

Calls 2

drawMethod · 0.80
usageFunction · 0.50

Tested by

no test coverage detected