Index: trunk/src/Dam/Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r8 -r93 --- trunk/src/Dam/Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 8) +++ trunk/src/Dam/Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 93) @@ -458,6 +458,9 @@ + + PreserveNewest + Designer Index: trunk/src/Dam/Data/StabilityServiceAgent.cs =================================================================== diff -u -r7 -r93 --- trunk/src/Dam/Data/StabilityServiceAgent.cs (.../StabilityServiceAgent.cs) (revision 7) +++ trunk/src/Dam/Data/StabilityServiceAgent.cs (.../StabilityServiceAgent.cs) (revision 93) @@ -371,23 +371,54 @@ #region Helper Methods + private string CreateMStabIniFile(string inputFileName) + { + string filename = Path.GetTempFileName(); + filename = Path.ChangeExtension(filename, "ini"); + string defaultIniFilename = Path.Combine(Path.GetDirectoryName(MStabExePath), "DGeoStability.ini"); + string newIniContent = "[D-Geo Stability batch processing]"; + var isDirectoryBatchCalculation = Directory.Exists(inputFileName); + if (isDirectoryBatchCalculation) + { + newIniContent += System.Environment.NewLine + "Path=" + inputFileName; + newIniContent += System.Environment.NewLine + "Filespec=*.sti"; + } + else + { + newIniContent += System.Environment.NewLine + "InputFileName=" + inputFileName; + } + newIniContent += System.Environment.NewLine + "Plot Critical Circle=1"; + newIniContent += System.Environment.NewLine + "PlotWMF=1"; + newIniContent += System.Environment.NewLine + "PlotJPeg=1"; + if (File.Exists(defaultIniFilename)) + { + string iniContent = File.ReadAllText(defaultIniFilename); + newIniContent += System.Environment.NewLine + System.Environment.NewLine + iniContent; + }; + File.WriteAllText(filename, newIniContent); + return filename; + + } + /// /// Processes the input file using the working folder /// - /// The working folder - private void ProcessInputfFile(string workingFolderName) + /// The folder or file name; for MStab: if a filename is specified then the file will be calculated; if a foldername is specified, all the stability files in the folder will be calculated. For SlopeW only filename is allowed + private void ProcessInputfFile(string folderOrFileName) { const string quote = "\""; var argument = ""; var programpath = ""; + string mStabIniFilename = ""; if (ProgramType == ProgramType.SlopeW) { - argument = " /s /x " + quote + workingFolderName + quote + " " + quote + Path.GetFileNameWithoutExtension(workingFolderName) + quote; + argument = " /s /x " + quote + folderOrFileName + quote + " " + quote + Path.GetFileNameWithoutExtension(folderOrFileName) + quote; programpath = SlopeWExePath; } else { - argument = string.Format("/B /PlotJPeg /Plot \"{0}\"", workingFolderName); // note: use the folder name only for running MStab in batch mode + mStabIniFilename = CreateMStabIniFile(folderOrFileName); + argument = string.Format("/b \"{0}\"", mStabIniFilename); programpath = MStabExePath; } @@ -414,8 +445,16 @@ { // thread was killed by user action to stop calculation } + finally + { + if (File.Exists(mStabIniFilename)) + { + File.Delete(mStabIniFilename); + } + } } + /// /// Creates a random working folder by using a GUID /// Index: trunk/src/Dam/Data/DGeoStability.exe =================================================================== diff -u -r7 -r93 Binary files differ Index: trunk/src/Dam/Data/DGeoStability.ini =================================================================== diff -u --- trunk/src/Dam/Data/DGeoStability.ini (revision 0) +++ trunk/src/Dam/Data/DGeoStability.ini (revision 93) @@ -0,0 +1,6 @@ +[PlotHack] +PlotHackOn=0 +PlotHackTop=200 +PlotHackLeft=100 +PlotHackHeight=1300 +PlotHackWidth=1700