diff --git a/README.md b/README.md index 04cb502..68df852 100644 --- a/README.md +++ b/README.md @@ -5,24 +5,14 @@ A less shitty DDS plugin for Paint.NET - Read just about any DDS file (NEW DDS FILES SUPPORTED) - Write the DDS back to a file -- Fast performance, easy to use installer +- Faster DDS performance all around ## Installation: Download the latest [Release.zip](https://github.com/dtzxporter/FileTypeDDS/releases) and extract the archive. -Next, launch `FileTypeDDSInstaller.exe` and run as admin if prompted to do so. Click `install` and wait, this will only take a few moments. - -You may now launch Paint.NET and open a DDS file. +Next, follow the instructions in `README.txt` to properly install it. ## Uninstall: -Relaunch `FileTypeDDSInstaller.exe` and run as admin if prompted to do so. Click `uninstall` and wait, this will only take a few moments. - -## Notes: - -When Paint.NET has an update, you `must` re-run the installer, it will ensure that the plugin is up-to-date and ready to go. - -This plugin is provided as-is with no warranty provided. Use at your own risk. - -Wanna help? Send a message to `Rick Brewster` over at [https://forums.getpaint.net/](https://forums.getpaint.net/) asking for the ability to override default filetypes via plugins! This will make it easier to use our custom DDS plugin, without the need for an installer! \ No newline at end of file +Just delete all the files you have copied over. \ No newline at end of file diff --git a/src/FileTypeDDS/FileTypeDDS.sln b/src/FileTypeDDS/FileTypeDDS.sln index 20bd427..59eb32b 100644 --- a/src/FileTypeDDS/FileTypeDDS.sln +++ b/src/FileTypeDDS/FileTypeDDS.sln @@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\..\deps\Di EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTypeDDSInstaller", "FileTypeDDSInstaller\FileTypeDDSInstaller.csproj", "{B52721A0-14B5-438E-8359-70A406CB037D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTypeDDSEffect", "FileTypeDDSEffect\FileTypeDDSEffect.csproj", "{ECCCB43B-AE85-4431-86DB-17C761976DEA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -88,6 +90,24 @@ Global {B52721A0-14B5-438E-8359-70A406CB037D}.Release|Win32.Build.0 = Release|Any CPU {B52721A0-14B5-438E-8359-70A406CB037D}.Release|x64.ActiveCfg = Release|Any CPU {B52721A0-14B5-438E-8359-70A406CB037D}.Release|x64.Build.0 = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Debug|Win32.ActiveCfg = Debug|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Debug|x64.ActiveCfg = Debug|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Profile|Any CPU.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Profile|Any CPU.Build.0 = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Profile|Mixed Platforms.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Profile|Mixed Platforms.Build.0 = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Profile|Win32.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Profile|x64.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Release|Any CPU.Build.0 = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Release|Win32.ActiveCfg = Release|Any CPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA}.Release|x64.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/FileTypeDDS/FileTypeDDSEffect/FileTypeDDSEffect.csproj b/src/FileTypeDDS/FileTypeDDSEffect/FileTypeDDSEffect.csproj new file mode 100644 index 0000000..1a83fb7 --- /dev/null +++ b/src/FileTypeDDS/FileTypeDDSEffect/FileTypeDDSEffect.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {ECCCB43B-AE85-4431-86DB-17C761976DEA} + Library + Properties + FileTypeDDSEffect + FileTypeDDSEffect + v4.6 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\Dependencies\PaintDotNet.Base.dll + + + ..\..\Dependencies\PaintDotNet.Core.dll + + + ..\..\Dependencies\PaintDotNet.Data.dll + + + ..\..\Dependencies\PaintDotNet.Effects.dll + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/FileTypeDDS/FileTypeDDSEffect/PatcherEffect.cs b/src/FileTypeDDS/FileTypeDDSEffect/PatcherEffect.cs new file mode 100644 index 0000000..63199fd --- /dev/null +++ b/src/FileTypeDDS/FileTypeDDSEffect/PatcherEffect.cs @@ -0,0 +1,52 @@ +using PaintDotNet; +using PaintDotNet.Effects; +using PaintDotNet.PropertySystem; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace FileTypeDDSEffect +{ + [EffectCategory(EffectCategory.DoNotDisplay), PluginSupportInfo(typeof(PluginSupportInfo), DisplayName = "FileTypeDDS")] + public class PatcherEffect : PropertyBasedEffect + { + public PatcherEffect() + : base("FileTypeDDSPatcher", null, "", EffectFlags.None) + { + try + { + // Prepare to patch the built-in file type array + var PaintAssembly = Assembly.GetEntryAssembly(); + + // Find the internal file type array + var Type = PaintAssembly.GetType("PaintDotNet.Data.PdnFileTypes"); + var Field = Type.GetField("fileTypes", BindingFlags.NonPublic | BindingFlags.Static); + + // Get it's value, then, replace with one that doesn't have the DDS + var Result = (FileType[])Field.GetValue(null); + var NewResult = Result.Where(x => !x.Name.ToLower().Contains("dds")).ToArray(); + + // Patch it, we want full access... + Field.SetValue(null, NewResult); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("FileTypeDDS - Failed to patch the plugin (Report this on Github) [" + ex.Message + "]", "FileTypeDDS"); + } + } + + protected override void OnRender(Rectangle[] rois, int startIndex, int length) + { + // Nothing... + } + + protected override PropertyCollection OnCreatePropertyCollection() + { + return new PropertyCollection(new List()); + } + } +} diff --git a/src/FileTypeDDS/FileTypeDDSEffect/Properties/AssemblyInfo.cs b/src/FileTypeDDS/FileTypeDDSEffect/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..195ac3f --- /dev/null +++ b/src/FileTypeDDS/FileTypeDDSEffect/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FileTypeDDSEffect")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FileTypeDDSEffect")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("628e11f7-bf8d-4d22-8969-d38633450661")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]