Skip to content

Commit

Permalink
Merge pull request #12 from HakuSystems/Indevelopment
Browse files Browse the repository at this point in the history
Cleaning
  • Loading branch information
HakuSystems authored Oct 5, 2024
2 parents b73bf01 + 0e1074e commit ef48d91
Show file tree
Hide file tree
Showing 14 changed files with 227 additions and 120 deletions.
22 changes: 16 additions & 6 deletions EasyExtractUnitypackageRework/EasyExtract/Config/ExtractedFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,27 @@ public DateTime ExtractedDate
}
}

private string unityFileMessasge =>
$"Category: {Category} / File Size: {Size}";
private string unityFileMessasge
{
get => $"Category: {Category} / File Size: {Size}";
}


public string UnityFileMessasge => unityFileMessasge;
public string UnityFileMessasge
{
get => unityFileMessasge;
}

private string unityFileMessasgeTooltip =>
$"Category: {Category}\nFile Size: {Size}";
private string unityFileMessasgeTooltip
{
get => $"Category: {Category}\nFile Size: {Size}";
}


public string UnityFileMessasgeTooltip => unityFileMessasgeTooltip;
public string UnityFileMessasgeTooltip
{
get => unityFileMessasgeTooltip;
}

public event PropertyChangedEventHandler PropertyChanged;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,55 @@ public class ExtractedUnitypackageModel : INotifyPropertyChanged
private int unitypackageTotalScriptCount;
private int unitypackageTotalShaderCount;

private string linkDetectionCountMessage =>
LinkDetectionCount > 0
private string linkDetectionCountMessage
{
get => LinkDetectionCount > 0
? $"Possible Link(s) Detected: {LinkDetectionCount}"
: "No Links Detected";
}

private string malicousDiscordWebhookCountMessage =>
MalicousDiscordWebhookCount > 0
private string malicousDiscordWebhookCountMessage
{
get => MalicousDiscordWebhookCount > 0
? $"Possible Malicious Discord Webhook(s): {MalicousDiscordWebhookCount}"
: "No Malicious Discord Webhooks Found";
}


private string unitypackageTotalFileCountMessage =>
$"Total Files: {UnitypackageTotalFileCount:N2} / Package Size: {UnitypackageSize}";
private string unitypackageTotalFileCountMessage
{
get => $"Total Files: {UnitypackageTotalFileCount:N2} / Package Size: {UnitypackageSize}";
}

public string LinkDetectionCountMessage => linkDetectionCountMessage;
public string MalicousDiscordWebhookCountMessage => malicousDiscordWebhookCountMessage;
public string LinkDetectionCountMessage
{
get => linkDetectionCountMessage;
}

public string UnitypackageTotalFileCountMessage => unitypackageTotalFileCountMessage;
public string MalicousDiscordWebhookCountMessage
{
get => malicousDiscordWebhookCountMessage;
}

public string UnitypackageTotalFileCountMessage
{
get => unitypackageTotalFileCountMessage;
}

public SolidColorBrush GetCurrentLinkDetectionColor => LinkDetectionCount > 0
? new SolidColorBrush(Colors.Red)
: new SolidColorBrush(Colors.Green);

public SolidColorBrush GetCurrentMalicousDiscordWebhookColor => MalicousDiscordWebhookCount > 0
? new SolidColorBrush(Colors.Red)
: new SolidColorBrush(Colors.Green);
public SolidColorBrush GetCurrentLinkDetectionColor
{
get => LinkDetectionCount > 0
? new SolidColorBrush(Colors.Red)
: new SolidColorBrush(Colors.Green);
}

public SolidColorBrush GetCurrentMalicousDiscordWebhookColor
{
get => MalicousDiscordWebhookCount > 0
? new SolidColorBrush(Colors.Red)
: new SolidColorBrush(Colors.Green);
}


public bool PackageIsChecked
Expand Down Expand Up @@ -330,9 +352,12 @@ public List<ExtractedFiles> SubdirectoryItems
}
}

public Dictionary<string, List<ExtractedFiles>> SubdirectoryItemsGroupedByCategory => SubdirectoryItems
.GroupBy(file => file.Category)
.ToDictionary(group => group.Key, group => group.ToList());
public Dictionary<string, List<ExtractedFiles>> SubdirectoryItemsGroupedByCategory
{
get => SubdirectoryItems
.GroupBy(file => file.Category)
.ToDictionary(group => group.Key, group => group.ToList());
}

public event PropertyChangedEventHandler PropertyChanged;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ await Task.Run(() =>
// Creates all directories and subdirectories as specified by filePath.
Directory.CreateDirectory(Path.GetDirectoryName(filePath));

entry.WriteToFile(filePath, new ExtractionOptions { Overwrite = true });
entry.WriteToFile(filePath, new ExtractionOptions
{
Overwrite = true
});
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public class ExtractionHelper
/// <returns>The readable file size.</returns>
public async Task<string> GetReadableFileSize(long size)
{
string[] sizes = { "B", "KB", "MB", "GB", "TB" };
string[] sizes =
{
"B", "KB", "MB", "GB", "TB"
};
var order = 0;
while (size >= 1024 && order < sizes.Length - 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ private DiscordRpcManager()
DiscordStart();
}

public static DiscordRpcManager Instance => _instance ??= new DiscordRpcManager();
public static DiscordRpcManager Instance
{
get => _instance ??= new DiscordRpcManager();
}

public async void Dispose()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ private async void About_OnLoaded(object sender, RoutedEventArgs e)

_logger.LogAsync("Added cards to RandomCardDesign", "About.xaml.cs", Importance.Info); // Log card addition

var repeatTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
var repeatTimer = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(500)
};
repeatTimer.Tick += (o, args) => ChangeRandomMargins();
repeatTimer.Start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
if (value is ImageBrush imageBrush) return new object[] { imageBrush, imageBrush.Opacity };
if (value is ImageBrush imageBrush)
return new object[]
{
imageBrush, imageBrush.Opacity
};

return new[] { Binding.DoNothing, Binding.DoNothing };
return new[]
{
Binding.DoNothing, Binding.DoNothing
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ public class BackgroundManager : INotifyPropertyChanged

private BackgroundManager()
{
_currentBackground = new ImageBrush { Stretch = Stretch.Fill };
_currentBackground = new ImageBrush
{
Stretch = Stretch.Fill
};
_backgroundOpacity = 1.0;
}

public static BackgroundManager Instance => _instance ??= new BackgroundManager();
public static BackgroundManager Instance
{
get => _instance ??= new BackgroundManager();
}

public ImageBrush CurrentBackground
{
Expand Down Expand Up @@ -84,7 +90,11 @@ await _logger.LogAsync("Background reset to default", "BackgroundManager.cs",
}
catch (ResourceReferenceKeyNotFoundException ex)
{
CurrentBackground = new ImageBrush { Opacity = BackgroundOpacity, Stretch = Stretch.Fill };
CurrentBackground = new ImageBrush
{
Opacity = BackgroundOpacity,
Stretch = Stretch.Fill
};
await _logger.LogAsync($"Default background resource not found: {ex.Message}", "BackgroundManager.cs",
Importance.Warning); // Log resource not found
}
Expand Down
Loading

0 comments on commit ef48d91

Please sign in to comment.