aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/embeddable-dll-service/csharp/DemoUI/MainWindow.cs
diff options
context:
space:
mode:
Diffstat (limited to 'embeddable-dll-service/csharp/DemoUI/MainWindow.cs')
-rw-r--r--embeddable-dll-service/csharp/DemoUI/MainWindow.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/embeddable-dll-service/csharp/DemoUI/MainWindow.cs b/embeddable-dll-service/csharp/DemoUI/MainWindow.cs
index 50a42c42..7d1e3f6f 100644
--- a/embeddable-dll-service/csharp/DemoUI/MainWindow.cs
+++ b/embeddable-dll-service/csharp/DemoUI/MainWindow.cs
@@ -12,12 +12,13 @@ using System.Threading;
using System.IO.Pipes;
using System.Diagnostics;
using System.Net.Sockets;
+using System.Security.AccessControl;
namespace DemoUI
{
public partial class MainWindow : Form
{
- private static readonly string userDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
+ private static readonly string userDirectory = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "Config"); //TODO: put in Program Files in real code.
private static readonly string configFile = Path.Combine(userDirectory, "demobox.conf");
private static readonly string logFile = Path.Combine(userDirectory, "log.bin");
@@ -28,15 +29,22 @@ namespace DemoUI
public MainWindow()
{
+ makeConfigDirectory();
InitializeComponent();
Application.ApplicationExit += Application_ApplicationExit;
-
try { File.Delete(logFile); } catch { }
log = new Tunnel.Ringlogger(logFile, "GUI");
logPrintingThread = new Thread(new ThreadStart(tailLog));
transferUpdateThread = new Thread(new ThreadStart(tailTransfer));
}
+ private void makeConfigDirectory()
+ {
+ var ds = new DirectorySecurity();
+ ds.SetSecurityDescriptorSddlForm("O:BAG:BAD:PAI(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)");
+ FileSystemAclExtensions.CreateDirectory(ds, userDirectory);
+ }
+
private void tailLog()
{
var cursor = Tunnel.Ringlogger.CursorAll;