Skip to content

Commit

Permalink
Moved Everything Onto New File Moving framework.
Browse files Browse the repository at this point in the history
Fixed mod Page sort Bug
Fixed Mod Page Info Bug
Fixed Master Server Turn off
Fixed Win 11 Install Compat
Fixed Launch Issues
Fixed .Net 3 Compat.
  • Loading branch information
BigSpice committed Oct 28, 2022
1 parent 6bc13cb commit 74464f2
Show file tree
Hide file tree
Showing 11 changed files with 1,499 additions and 232 deletions.
Binary file modified VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v1
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/v17/fileList.bin
Binary file not shown.
148 changes: 146 additions & 2 deletions VTOL_2.0.0/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public MainWindow()

if (!File.Exists(DocumentsFolder + @"\VTOL_DATA\Settings\User_Settings.Json"))
{
Directory.CreateDirectory(DocumentsFolder + @"\VTOL_DATA\Settings");
TryCreateDirectory(DocumentsFolder + @"\VTOL_DATA\Settings");
dynamic User_Settings_Json = new JObject();
User_Settings_Json.Current_Version = "NODATA";
User_Settings_Json.Theme = "NODATA";
Expand Down Expand Up @@ -187,7 +187,151 @@ public MainWindow()


}
public bool TryDeleteDirectory(
string directoryPath, bool overwrite = true,
int maxRetries = 10,
int millisecondsDelay = 300)
{
if (directoryPath == null)
throw new ArgumentNullException(directoryPath);
if (maxRetries < 1)
throw new ArgumentOutOfRangeException(nameof(maxRetries));
if (millisecondsDelay < 1)
throw new ArgumentOutOfRangeException(nameof(millisecondsDelay));

for (int i = 0; i < maxRetries; ++i)
{
try
{
if (Directory.Exists(directoryPath))
{
Directory.Delete(directoryPath, overwrite);
}

return true;
}
catch (IOException)
{
Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
{
Thread.Sleep(millisecondsDelay);
}
}

return false;
}
public bool TryCreateDirectory(
string directoryPath,
int maxRetries = 10,
int millisecondsDelay = 200)
{
if (directoryPath == null)
throw new ArgumentNullException(directoryPath);
if (maxRetries < 1)
throw new ArgumentOutOfRangeException(nameof(maxRetries));
if (millisecondsDelay < 1)
throw new ArgumentOutOfRangeException(nameof(millisecondsDelay));

for (int i = 0; i < maxRetries; ++i)
{
try
{

Directory.CreateDirectory(directoryPath);

if (Directory.Exists(directoryPath))
{

return true;
}


}
catch (IOException)
{
Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
{
Thread.Sleep(millisecondsDelay);
}
}

return false;
}
public bool TryMoveFile(
string Origin, string Destination, bool overwrite = true,
int maxRetries = 10,
int millisecondsDelay = 200)
{
if (Origin == null)
throw new ArgumentNullException(Origin);
if (maxRetries < 1)
throw new ArgumentOutOfRangeException(nameof(maxRetries));
if (millisecondsDelay < 1)
throw new ArgumentOutOfRangeException(nameof(millisecondsDelay));

for (int i = 0; i < maxRetries; ++i)
{
try
{
if (File.Exists(Origin))
{
File.Move(Origin, Destination, overwrite);
}

return true;
}
catch (IOException)
{
Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
{
Thread.Sleep(millisecondsDelay);
}
}

return false;
}
public bool TryCopyFile(
string Origin, string Destination, bool overwrite = true,
int maxRetries = 10,
int millisecondsDelay = 300)
{
if (Origin == null)
throw new ArgumentNullException(Origin);
if (maxRetries < 1)
throw new ArgumentOutOfRangeException(nameof(maxRetries));
if (millisecondsDelay < 1)
throw new ArgumentOutOfRangeException(nameof(millisecondsDelay));

for (int i = 0; i < maxRetries; ++i)
{
try
{
if (File.Exists(Origin))
{
File.Copy(Origin, Destination, true);
}
Thread.Sleep(millisecondsDelay);

return true;
}
catch (IOException)
{
Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
{
Thread.Sleep(millisecondsDelay);
}
}

return false;
}
public static void RegisterUriScheme()
{
using (var key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Classes\\" + UriScheme))
Expand Down Expand Up @@ -262,7 +406,7 @@ private void CloseButton_Click(object sender, RoutedEventArgs e)




private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
Expand Down
Loading

0 comments on commit 74464f2

Please sign in to comment.