mirror of
https://github.com/4sval/FModel.git
synced 2026-04-21 09:07:45 -05:00
serie rarities color detection even more accurate
This commit is contained in:
parent
85a581a551
commit
88f4e6e0be
|
|
@ -63,7 +63,7 @@ namespace FModel.Methods.Assets.IconCreator
|
|||
}
|
||||
}
|
||||
|
||||
private static void DrawBackground(Color background, Color backgroundUpDown, Color border)
|
||||
private static void DrawBackground(Color background, Color backgroundUpDown, Color border, bool series = false)
|
||||
{
|
||||
switch (FProp.Default.FRarity_Design)
|
||||
{
|
||||
|
|
@ -111,8 +111,22 @@ namespace FModel.Methods.Assets.IconCreator
|
|||
// Freeze the brush (make it unmodifiable) for performance benefits.
|
||||
radialGradient.Freeze();
|
||||
|
||||
//background + border
|
||||
IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(border), null, new Rect(0, 0, 515, 515));
|
||||
//border
|
||||
if (!series)
|
||||
IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(border), null, new Rect(0, 0, 515, 515));
|
||||
else
|
||||
{
|
||||
LinearGradientBrush linearGradient = new LinearGradientBrush();
|
||||
linearGradient.StartPoint = new Point(0, 1);
|
||||
linearGradient.EndPoint = new Point(1, 0);
|
||||
linearGradient.GradientStops.Add(new GradientStop(border, 0.3));
|
||||
linearGradient.GradientStops.Add(new GradientStop(backgroundUpDown, 1.5));
|
||||
linearGradient.Freeze();
|
||||
|
||||
IconCreator.ICDrawingContext.DrawRectangle(linearGradient, null, new Rect(0, 0, 515, 515));
|
||||
}
|
||||
|
||||
//background
|
||||
IconCreator.ICDrawingContext.DrawRectangle(radialGradient, null, new Rect(3, 3, 509, 509));
|
||||
break;
|
||||
default:
|
||||
|
|
@ -234,7 +248,7 @@ namespace FModel.Methods.Assets.IconCreator
|
|||
border = Color.FromRgb((byte)r, (byte)g, (byte)b);
|
||||
}
|
||||
|
||||
DrawBackground(backgroundupdown, background, ChangeColorBrightness(border, 0.25f));
|
||||
DrawBackground(background, backgroundupdown, ChangeColorBrightness(border, 0.25f), true);
|
||||
}
|
||||
|
||||
public static Color ChangeColorBrightness(Color color, float correctionFactor)
|
||||
|
|
|
|||
|
|
@ -47,17 +47,23 @@ namespace FModel.Methods.BackupsManager
|
|||
if (string.Equals(BackupFileName, ClickedBackup.Header))
|
||||
{
|
||||
new UpdateMyProcessEvents($"Downloading {Backup.TheFileName}", "Waiting").Update();
|
||||
string path = $"{OUTPUT_PATH}\\Backups\\{BackupFileName}";
|
||||
|
||||
RestClient EndpointClient = new RestClient(Backup.TheFileDownload);
|
||||
EndpointClient.ExecuteAsync(new RestRequest(Method.GET), response => {
|
||||
File.WriteAllText($"{OUTPUT_PATH}\\Backups\\{BackupFileName}", response.Content); //FILE WILL ALWAYS EXIST
|
||||
if (new FileInfo($"{OUTPUT_PATH}\\Backups\\{BackupFileName}").Length > 0) //HENCE WE CHECK THE LENGTH
|
||||
using (FileStream fileStream = new FileStream(path, FileMode.Create))
|
||||
using (BinaryWriter writer = new BinaryWriter(fileStream))
|
||||
{
|
||||
writer.Write(response.RawBytes);
|
||||
}
|
||||
|
||||
if (new FileInfo(path).Length > 0) //HENCE WE CHECK THE LENGTH
|
||||
{
|
||||
new UpdateMyProcessEvents($"\\Backups\\{BackupFileName} successfully downloaded", "Success").Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete($"{OUTPUT_PATH}\\Backups\\{BackupFileName}"); //WE DELETE THE EMPTY FILE CREATED
|
||||
File.Delete(path); //WE DELETE THE EMPTY FILE CREATED
|
||||
new UpdateMyProcessEvents($"Error while downloading {BackupFileName}", "Error").Update();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user