Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c9db88458d | ||
c103e17b0b |
@ -23,9 +23,6 @@ namespace Discord_Cache_Viewer
|
|||||||
Console.WriteLine("Processed all files, closing in 10 seconds");
|
Console.WriteLine("Processed all files, closing in 10 seconds");
|
||||||
// Wait a few seconds before closing
|
// Wait a few seconds before closing
|
||||||
await Task.Delay(kill);
|
await Task.Delay(kill);
|
||||||
// Collect the garbage and close
|
|
||||||
GC.Collect();
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -39,16 +36,17 @@ namespace Discord_Cache_Viewer
|
|||||||
// Constants for more efficient memory management
|
// Constants for more efficient memory management
|
||||||
const string header = "PNG", extension = ".png";
|
const string header = "PNG", extension = ".png";
|
||||||
const ushort index = 0;
|
const ushort index = 0;
|
||||||
for (ushort i = 0; i < files.Length; i++)
|
for (var i = 0; i < files.Length; i++)
|
||||||
{
|
{
|
||||||
// Cache the file path
|
// Cache the file path
|
||||||
var filePath = files[i];
|
var filePath = files[i];
|
||||||
// We only have to read the first line and check if it has the PNG header.
|
// We only have to read the first line and check if it has the PNG header.
|
||||||
// This also saves some processing time, as we don't have to check the entire file for "PNG", and it reduces false positives.
|
// This also saves some processing time, as we don't have to check the entire file for "PNG", and it reduces false positives.
|
||||||
if (File.ReadAllLines(filePath)[index].Contains(header))
|
if (File.ReadAllLines(filePath)[index].Contains(header)) {
|
||||||
Console.WriteLine($"{filePath} - Added {extension} extension");
|
Console.WriteLine($"{filePath} - Added {extension} extension");
|
||||||
// "Move" => "Rename", alright then Microsoft.
|
// "Move" => "Rename", alright then Microsoft.
|
||||||
File.Move(filePath, filePath + extension);
|
File.Move(filePath, filePath + extension);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user