forked from typcn/DLSiteDumper
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework original 200 lines CPP into over-engineered C# project 1000+ l…
…ines OMEGALULZ
- Loading branch information
Showing
34 changed files
with
4,324 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 16 | ||
VisualStudioVersion = 16.0.31112.23 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DLSiteDumperCS", "DLSiteDumperCS\DLSiteDumperCS.csproj", "{833A0652-30AE-4036-8F2D-FA1CE33C32D9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Debug|x64.Build.0 = Debug|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Debug|x86.Build.0 = Debug|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Release|x64.ActiveCfg = Release|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Release|x64.Build.0 = Release|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Release|x86.ActiveCfg = Release|Any CPU | ||
{833A0652-30AE-4036-8F2D-FA1CE33C32D9}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5B0D083E-842D-43DD-BDB0-A295223D2752} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" 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>{833A0652-30AE-4036-8F2D-FA1CE33C32D9}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<RootNamespace>DLSiteDumperCS</RootNamespace> | ||
<AssemblyName>DLSiteDumperCS</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<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' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ExplorerLikeFilenameComparer.cs" /> | ||
<Compile Include="HtmlImageReaderGenerator.cs" /> | ||
<Compile Include="MainForm.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="MainForm.Designer.cs"> | ||
<DependentUpon>MainForm.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Gdi32.cs" /> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Include="User32.cs" /> | ||
<Compile Include="Kernel32.cs" /> | ||
<Compile Include="ViewerDumper.cs" /> | ||
<Compile Include="Win32StatusBar.cs" /> | ||
<Compile Include="WndSearcher.cs" /> | ||
<Compile Include="WorkingDialog.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="WorkingDialog.Designer.cs"> | ||
<DependentUpon>WorkingDialog.cs</DependentUpon> | ||
</Compile> | ||
<EmbeddedResource Include="MainForm.resx"> | ||
<DependentUpon>MainForm.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<EmbeddedResource Include="Resources.resx"> | ||
<Generator>PublicResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="WorkingDialog.resx"> | ||
<DependentUpon>WorkingDialog.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\HtmlTemplate.txt" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
/// <summary> | ||
/// Enable to compare filename like a boss. | ||
/// </summary> | ||
public class ExplorerLikeFilenameComparer : IComparer<string> | ||
{ | ||
[DllImport( "shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true )] | ||
static extern int StrCmpLogicalW( string x, string y ); | ||
|
||
public int Compare( string x, string y ) | ||
{ | ||
return StrCmpLogicalW( x, y ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
public static class Gdi32 | ||
{ | ||
public enum BitmapCompressionMode : uint | ||
{ | ||
BI_RGB = 0, | ||
BI_RLE8 = 1, | ||
BI_RLE4 = 2, | ||
BI_BITFIELDS = 3, | ||
BI_JPEG = 4, | ||
BI_PNG = 5 | ||
} | ||
|
||
[StructLayout( LayoutKind.Sequential )] | ||
public struct BITMAPINFOHEADER | ||
{ | ||
public uint biSize; | ||
public int biWidth; | ||
public int biHeight; | ||
public ushort biPlanes; | ||
public ushort biBitCount; | ||
public BitmapCompressionMode biCompression; | ||
public uint biSizeImage; | ||
public int biXPelsPerMeter; | ||
public int biYPelsPerMeter; | ||
public uint biClrUsed; | ||
public uint biClrImportant; | ||
} | ||
|
||
[StructLayout( LayoutKind.Sequential, Pack = 2 )] | ||
public struct BITMAPFILEHEADER | ||
{ | ||
public ushort bfType; | ||
public uint bfSize; | ||
public ushort bfReserved1; | ||
public ushort bfReserved2; | ||
public uint bfOffBits; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Text; | ||
using System.IO; | ||
|
||
class HtmlImageReaderGenerator | ||
{ | ||
public string[] FileList; | ||
public bool IsRightToLeft; | ||
public string OutputPath; | ||
public int ImageZoomPercent; | ||
|
||
/// <summary> | ||
/// It expects 3 string to replace | ||
/// /*READ_DIRECTION_FLAG*/ | ||
/// /*IMAGE_WIDTH*/ | ||
/// /*CONTENT*/ | ||
/// </summary> | ||
public string TemplateData; | ||
|
||
StringBuilder sb; | ||
StringBuilder contentSb; | ||
|
||
public bool Generate( ) | ||
{ | ||
if( sb == null ) | ||
sb = new StringBuilder( ); | ||
sb.Clear( ); | ||
sb.Append( TemplateData ); | ||
|
||
string readDirStyle; | ||
if( IsRightToLeft ) | ||
readDirStyle = "direction: rtl"; // This is going into CSS part | ||
else | ||
readDirStyle = ""; | ||
sb.Replace( "/*READ_DIRECTION_FLAG*/", readDirStyle ); | ||
|
||
string imageWidth = "width: 50%"; | ||
if( ImageZoomPercent > 0 && ImageZoomPercent <= 100 ) // Must be in valid range | ||
imageWidth = $"width: {ImageZoomPercent}%"; | ||
sb.Replace( "/*IMAGE_WIDTH*/", imageWidth ); | ||
|
||
// For all contents | ||
if( contentSb == null ) | ||
contentSb = new StringBuilder( ); | ||
contentSb.Clear( ); | ||
foreach( string line in FileList ) | ||
{ | ||
contentSb.AppendLine( $"<img src=\"{line}\">" ); | ||
} | ||
sb.Replace( "/*CONTENT*/", contentSb.ToString( ) ); | ||
|
||
try | ||
{ | ||
File.WriteAllText( OutputPath, sb.ToString( ) ); | ||
} | ||
catch( Exception e ) | ||
{ | ||
Debug.Print( e.ToString( ) ); | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
Oops, something went wrong.