Skip to content

Commit

Permalink
fix sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Nov 12, 2023
1 parent 5102e34 commit c3aad91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/OneWare.Core/Services/Paths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class Paths : IPaths
public string CrashReportsDirectory => Path.Combine(DocumentsDirectory, "CrashReports");
public string ModulesPath => Path.Combine(DocumentsDirectory, "Modules");
public string ChangelogUrl => "https://raw.githubusercontent.com/VHDPlus/vhdplus-website/master/docs/ide/changelog.md";

private FileStream? _fileStreamLock;

public Paths(string appName, string appIconPath)
{
Expand All @@ -45,7 +47,8 @@ public Paths(string appName, string appIconPath)
Directory.CreateDirectory(SessionDirectory);

//Lock file
File.Create(Path.Combine(SessionDirectory, ".session_lock"));
_fileStreamLock = new FileStream(Path.Combine(SessionDirectory, ".session_lock"), FileMode.OpenOrCreate,
FileAccess.ReadWrite, FileShare.None);
}

private static void CleanupSessions(string sessionsDir)
Expand All @@ -64,8 +67,9 @@ private static void CleanupSessions(string sessionsDir)

try
{
using (var stream = fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.None))
if (fileInfo.Exists)
{
using var stream = fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.None);
stream.Close();
}
Directory.Delete(session, true);
Expand Down
5 changes: 3 additions & 2 deletions src/OneWare.Core/Services/WindowService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
Expand Down Expand Up @@ -209,8 +210,8 @@ public Window CreateHost(FlexibleWindow flexible)
host.Bind(Window.SizeToContentProperty, flexible.GetObservable(FlexibleWindow.SizeToContentProperty));

//host.Bind(TopLevel.TransparencyLevelHintProperty, flexible.GetObservable(FlexibleWindow.TransparencyLevelHintProperty));
if(flexible.Background is not null)
host.Bind(TemplatedControl.BackgroundProperty, flexible.GetObservable(FlexibleWindow.WindowBackgroundProperty));
host.Bind(TemplatedControl.BackgroundProperty,
flexible.GetObservable(FlexibleWindow.WindowBackgroundProperty).Where(x => x is not null));

host.Height = flexible.PrefHeight;
host.Width = flexible.PrefWidth;
Expand Down

0 comments on commit c3aad91

Please sign in to comment.