Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
Runtime patching of DDS structure, no more installer required.
  • Loading branch information
dtzxporter committed Mar 23, 2019
1 parent eaa4b74 commit 48cb983
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 13 deletions.
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Just delete all the files you have copied over.
20 changes: 20 additions & 0 deletions src/FileTypeDDS/FileTypeDDS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
68 changes: 68 additions & 0 deletions src/FileTypeDDS/FileTypeDDSEffect/FileTypeDDSEffect.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ECCCB43B-AE85-4431-86DB-17C761976DEA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FileTypeDDSEffect</RootNamespace>
<AssemblyName>FileTypeDDSEffect</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PaintDotNet.Base">
<HintPath>..\..\Dependencies\PaintDotNet.Base.dll</HintPath>
</Reference>
<Reference Include="PaintDotNet.Core">
<HintPath>..\..\Dependencies\PaintDotNet.Core.dll</HintPath>
</Reference>
<Reference Include="PaintDotNet.Data">
<HintPath>..\..\Dependencies\PaintDotNet.Data.dll</HintPath>
</Reference>
<Reference Include="PaintDotNet.Effects">
<HintPath>..\..\Dependencies\PaintDotNet.Effects.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PatcherEffect.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
52 changes: 52 additions & 0 deletions src/FileTypeDDS/FileTypeDDSEffect/PatcherEffect.cs
Original file line number Diff line number Diff line change
@@ -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<FileType>();

// 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<Property>());
}
}
}
36 changes: 36 additions & 0 deletions src/FileTypeDDS/FileTypeDDSEffect/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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")]

0 comments on commit 48cb983

Please sign in to comment.