Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat authored and Mat committed Nov 20, 2021
1 parent b776707 commit 1f76a91
Show file tree
Hide file tree
Showing 8 changed files with 631 additions and 0 deletions.
29 changes: 29 additions & 0 deletions DiscordCacheViewer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Configurations>Debug;Release;Test</Configurations>
<Platforms>AnyCPU;x64</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions DiscordCacheViewer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordCacheViewer", "DiscordCacheViewer.csproj", "{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Test|Any CPU = Test|Any CPU
Test|x64 = Test|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Debug|x64.ActiveCfg = Debug|x64
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Debug|x64.Build.0 = Debug|x64
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Release|Any CPU.Build.0 = Release|Any CPU
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Release|x64.ActiveCfg = Release|x64
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Release|x64.Build.0 = Release|x64
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Test|Any CPU.ActiveCfg = Test|Any CPU
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Test|Any CPU.Build.0 = Test|Any CPU
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Test|x64.ActiveCfg = Test|x64
{9B4F0754-92A4-4654-8EA1-92B065D8C8D7}.Test|x64.Build.0 = Test|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8467A0BF-2F7F-4647-9E67-4657F117BECE}
EndGlobalSection
EndGlobal
222 changes: 222 additions & 0 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
namespace DiscordCacheViewer
{
public partial class frm_main : Form
{
public frm_main()
{
InitializeComponent();

txt_cachePath.Text = @"C:\Users\" + Environment.UserName + @"\AppData\Roaming\discord\Cache";
txt_savePath.Text = @"C:\Users\" + Environment.UserName + @"\Desktop";

LoadCachedImages();
}

private void LoadCachedImages()
{
if (Directory.Exists(txt_cachePath.Text))
{
lvw_thumbnails.Clear();
ImageList imageList = new ImageList();
imageList.ImageSize = new System.Drawing.Size(128, 128);
imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth16Bit;
lvw_thumbnails.LargeImageList = imageList;

foreach (string file in Directory.GetFiles(txt_cachePath.Text))
{
string filename = Path.GetFileName(file);
if (filename[0] == 'f')
{
try
{
imageList.Images.Add(Image.FromFile(file));
lvw_thumbnails.Items.Add(new ListViewItem(filename, imageList.Images.Count - 1));
}
catch (OutOfMemoryException ex)
{ }
}
}
if(imageList.Images.Count == 0)
{
lbl_noImagesFound.Visible = true;
} else
{
lbl_noImagesFound.Visible = false;
}
}
}

private void btn_restore_Click(object sender, EventArgs e)
{
foreach(ListViewItem i in lvw_thumbnails.SelectedItems)
{
string originalPath = txt_cachePath.Text + "\\" + i.Text;
File.Copy(originalPath, txt_savePath.Text + "\\" + i.Text + "." + Image.FromFile(originalPath).RawFormat.ToString().ToLower(), true);
}
}

private void btn_browseCachePath_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
txt_cachePath.Text = folderBrowserDialog.SelectedPath;
LoadCachedImages();
}
}

private void btn_browseSavePath_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
txt_savePath.Text = folderBrowserDialog.SelectedPath;
}
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
Loading

0 comments on commit 1f76a91

Please sign in to comment.