diff --git a/MES_Wind/Program.cs b/MES_Wind/Program.cs index 7d8cb9c89eaeabee69498f6023213d86521e766e..ba2c360e01507e861dddd2b49250fe1082d1fd0a 100644 --- a/MES_Wind/Program.cs +++ b/MES_Wind/Program.cs @@ -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; + } + + } + } diff --git a/MES_Wind/frmMain.cs b/MES_Wind/frmMain.cs index 2c73368a788e0e4bb9120bb2b17cca23fb53c792..d8e5519c8e621cf5f97adf5b15381359c0f1987c 100644 --- a/MES_Wind/frmMain.cs +++ b/MES_Wind/frmMain.cs @@ -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; } - }