Skip to content
Snippets Groups Projects
Commit a1680bce authored by Debolskiy Andrey's avatar Debolskiy Andrey :bicyclist_tone5:
Browse files

Added automated DotSpatial Extentions coping to executable path

parent bf9aeafb
Branches
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.IO;
namespace MES_Wind
{
......@@ -16,6 +17,28 @@ namespace MES_Wind
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
public static class CommUtils
{
public static DirectoryInfo CopyTo(this DirectoryInfo sourceDir, string destinationPath, bool overwrite = false)
{
var sourcePath = sourceDir.FullName;
var destination = new DirectoryInfo(destinationPath);
destination.Create();
foreach (var sourceSubDirPath in Directory.EnumerateDirectories(sourcePath, "*", SearchOption.AllDirectories))
Directory.CreateDirectory(sourceSubDirPath.Replace(sourcePath, destinationPath));
foreach (var file in Directory.EnumerateFiles(sourcePath, "*", SearchOption.AllDirectories))
File.Copy(file, file.Replace(sourcePath, destinationPath), overwrite);
return destination;
}
}
}
......@@ -5,6 +5,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.ComponentModel.Composition;
using DotSpatial.Controls;
......@@ -25,6 +26,14 @@ namespace MES_Wind
InitializeComponent();
if (DesignMode) return;
Shell = this;
//check if needed extensions are in executable path
try
{
string extRelativeDir = "\\place_content_of_the_folder_to_bindebug";
DirectoryInfo extDir = new DirectoryInfo(Directory.GetParent(Directory.GetParent(Environment.CurrentDirectory).FullName) + extRelativeDir);
extDir.CopyTo(Directory.GetCurrentDirectory());
}
catch { }
appManager1.LoadExtensions();
}
#region
......@@ -76,7 +85,7 @@ namespace MES_Wind
{
string curDir = Environment.CurrentDirectory;
string pathToTests = "\\MES_test_new\\";
string file_path = System.IO.Directory.GetParent(System.IO.Directory.GetParent(curDir).FullName).FullName + pathToTests;
string file_path = Directory.GetParent(Directory.GetParent(curDir).FullName).FullName + pathToTests;
string test = file_path + "u_test.asc";
map1.AddLayer(file_path + "newstats.shp");
......@@ -329,5 +338,4 @@ namespace MES_Wind
public double Y;
public bool Ifbroken;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment