From aad5f9ccb9cb655b09c3d32d8f21fd305f8d6553 Mon Sep 17 00:00:00 2001 From: dtremenak Date: Wed, 19 Oct 2011 01:17:01 +0000 Subject: [PATCH] Handle new mappings files a bit better. --- ProvinceMapper/LaunchForm.cs | 9 +++++++-- ProvinceMapper/MappingReader.cs | 7 +++++++ cpp_version/EU3toV2Converter/changeLog.txt | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ProvinceMapper/LaunchForm.cs b/ProvinceMapper/LaunchForm.cs index 999ce184d..91f5c15ad 100644 --- a/ProvinceMapper/LaunchForm.cs +++ b/ProvinceMapper/LaunchForm.cs @@ -79,13 +79,18 @@ private void button1_Click(object sender, EventArgs e) Program.targetMap = new MapReader(targetMap, Program.targetDef.provinces, PushStatusUpdate); // read existing mappings (if any) - if (tbMappingsFile.Text.Trim() != String.Empty) + string mappingFile = tbMappingsFile.Text.Trim(); + if (mappingFile != String.Empty && File.Exists(mappingFile)) { lblStatus.Text = "Parse Existing Mappings"; Application.DoEvents(); - Program.mappings = new MappingReader(tbMappingsFile.Text, tbSourceTag.Text, + Program.mappings = new MappingReader(mappingFile, tbSourceTag.Text, tbDestTag.Text, Program.sourceDef.provinces, Program.targetDef.provinces, PushStatusUpdate); } + else + { + Program.mappings = new MappingReader(mappingFile, tbSourceTag.Text, tbDestTag.Text); + } } private void btnExit_Click(object sender, EventArgs e) diff --git a/ProvinceMapper/MappingReader.cs b/ProvinceMapper/MappingReader.cs index fb1cd2b75..03aba4576 100644 --- a/ProvinceMapper/MappingReader.cs +++ b/ProvinceMapper/MappingReader.cs @@ -15,6 +15,13 @@ class MappingReader private string path; + public MappingReader(string _path, string _srcTag, string _destTag) + { + srcTag = _srcTag; + destTag = _destTag; + path = _path; + } + public MappingReader(string _path, string _srcTag, string _destTag, List srcProvs, List destProvs, StatusUpdate su) { srcTag = _srcTag; diff --git a/cpp_version/EU3toV2Converter/changeLog.txt b/cpp_version/EU3toV2Converter/changeLog.txt index d2686562c..d9804cd06 100644 --- a/cpp_version/EU3toV2Converter/changeLog.txt +++ b/cpp_version/EU3toV2Converter/changeLog.txt @@ -293,4 +293,5 @@ Revision Version Updated Log Message 271 C++ Allow Mantua to map to Lombardia. 272 C++ Fix Yap Islands/Micronesia Sea mappings. 273 N/A Clean up some stray files -274 C# Introduce Province Mapper tool +274 ProvinceMapper Introduce Province Mapper tool +275 ProvinceMapper Handle new mappings files a bit better