-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathProgram.cs
More file actions
60 lines (52 loc) · 1.74 KB
/
Program.cs
File metadata and controls
60 lines (52 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// -------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="MapWindow OSS Team - www.mapwindow.org">
// MapWindow OSS Team - 2016
// </copyright>
// -------------------------------------------------------------------------------------------
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace MW5.PostBuild
{
internal class Program
{
private static void Main(string[] args)
{
UpdateManifest();
RemoveOcx();
}
private static void RemoveOcx()
{
try
{
File.Delete("mapwingis.ocx");
File.Delete("plugins\\mapwingis.ocx");
}
catch (Exception ex)
{
Console.WriteLine("Failed to remove mapwingis.ocx: " + ex.Message);
}
}
private static void UpdateManifest()
{
const string path = "Native.MW5.Api.manifest";
const string oldFilename = "name=\"MapWinGIS.ocx\"";
const string newFilename = "name=\"MapWinGis\\MapWinGIS.ocx\"";
try
{
var s = File.ReadAllText(path);
if (!string.IsNullOrWhiteSpace(s))
{
var regex = new Regex(oldFilename, RegexOptions.IgnoreCase);
var newText = regex.Replace(s, newFilename);
File.WriteAllText(path, newText);
Console.WriteLine("Text was replaced");
}
}
catch (Exception ex)
{
Console.WriteLine("Failed to update manifest: " + ex.Message);
}
}
}
}