first commit
This commit is contained in:
40
MadokamiDownloader/Form1.Designer.cs
generated
40
MadokamiDownloader/Form1.Designer.cs
generated
@@ -1,40 +0,0 @@
|
||||
namespace MadokamiDownloader
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MadokamiDownloader
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,14 +45,17 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<Compile Include="MainWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<Compile Include="MainWindow.Designer.cs">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="MainWindow.resx">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
108
MadokamiDownloader/MainWindow.Designer.cs
generated
Normal file
108
MadokamiDownloader/MainWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,108 @@
|
||||
namespace MadokamiDownloader
|
||||
{
|
||||
partial class MainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.treeView1 = new System.Windows.Forms.TreeView();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.thing2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 745);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(1147, 22);
|
||||
this.statusStrip1.TabIndex = 0;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.Location = new System.Drawing.Point(0, 27);
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.Size = new System.Drawing.Size(121, 715);
|
||||
this.treeView1.TabIndex = 1;
|
||||
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.thing2ToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1147, 28);
|
||||
this.menuStrip1.TabIndex = 2;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(66, 24);
|
||||
this.fileToolStripMenuItem.Text = "Thing1";
|
||||
this.fileToolStripMenuItem.Click += new System.EventHandler(this.fileToolStripMenuItem_Click);
|
||||
//
|
||||
// thing2ToolStripMenuItem
|
||||
//
|
||||
this.thing2ToolStripMenuItem.Name = "thing2ToolStripMenuItem";
|
||||
this.thing2ToolStripMenuItem.Size = new System.Drawing.Size(66, 24);
|
||||
this.thing2ToolStripMenuItem.Text = "Thing2";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1147, 767);
|
||||
this.Controls.Add(this.treeView1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.TreeView treeView1;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem thing2ToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
38
MadokamiDownloader/MainWindow.cs
Normal file
38
MadokamiDownloader/MainWindow.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace MadokamiDownloader
|
||||
{
|
||||
public partial class MainWindow : Form
|
||||
{
|
||||
const string baseURL = "https://manga.madokami.al";
|
||||
Dictionary<string, string[]> pagetopage = new Dictionary<string, string[]>();
|
||||
HttpClientHandler Handler = new HttpClientHandler();
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void fileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
126
MadokamiDownloader/MainWindow.resx
Normal file
126
MadokamiDownloader/MainWindow.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>154, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,22 +1,178 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Net.Http;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace MadokamiDownloader
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new MainWindow());
|
||||
}
|
||||
}
|
||||
public class MadoSeries
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string URL { get; private set; }
|
||||
public Bitmap Cover { get; private set; } = null;
|
||||
private List<MadoFile> Chapters;
|
||||
public MadoSeries (string name, string url)
|
||||
{
|
||||
Name = name;
|
||||
URL = url;
|
||||
}
|
||||
}
|
||||
static class Parser
|
||||
{
|
||||
//finds all links to 2-letter pages beginning with this letter
|
||||
static List<string> ParseSingle(char c, string page)
|
||||
{
|
||||
//grabs the URL and 2-letter name of each subpage
|
||||
var reg = new Regex($"https://manga.madokami.al/Manga/{c}/(?<Name>{c}[A-Z_])", RegexOptions.IgnoreCase);
|
||||
var matches = reg.Matches(page);
|
||||
var res = new List<string>(matches.Count);
|
||||
foreach (var match in matches)
|
||||
{
|
||||
res.Add(match.ToString());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public class MadoPage1
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string URL { get; private set; }
|
||||
private HttpClientHandler Handler;
|
||||
public List<MadoPage2> Children { get; private set; }
|
||||
/*
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mText != null) return mText;
|
||||
var client = new HttpClient(Handler);
|
||||
var response = client.GetAsync(URL).Result;
|
||||
//throws exception if get failed
|
||||
response.EnsureSuccessStatusCode();
|
||||
mText = response.Content.ReadAsStringAsync().Result;
|
||||
return mText;
|
||||
}
|
||||
}
|
||||
*/
|
||||
public MadoPage1(string name, string url, HttpClientHandler handler)
|
||||
{
|
||||
if (name.Length != 1)
|
||||
throw new InvalidNameLenthException($"Expected 1 letter name, got: {name}");
|
||||
Name = name;
|
||||
URL = url;
|
||||
Handler = handler;
|
||||
//Populate();
|
||||
}
|
||||
//gets children
|
||||
private void Populate()
|
||||
{
|
||||
string text;
|
||||
//is there a better way to do this?
|
||||
var client = new HttpClient(Handler);
|
||||
var response = client.GetAsync(URL).Result;
|
||||
client.Dispose();
|
||||
response.EnsureSuccessStatusCode();
|
||||
text = response.Content.ToString();
|
||||
response.Dispose();
|
||||
//grabs the URL and 2-letter name of each subpage
|
||||
var reg = new Regex($"https://manga.madokami.al/Manga/{Name}/(?<Name>{Name}[A-Z_])", RegexOptions.IgnoreCase);
|
||||
var matches = reg.Matches(text);
|
||||
foreach (Match m in matches)
|
||||
{
|
||||
Children.Add(new MadoPage2(m.Groups["Name"].ToString(), m.ToString(), this, Handler));
|
||||
}
|
||||
}
|
||||
}
|
||||
public class MadoPage2
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string URL { get; private set; }
|
||||
private HttpClientHandler Handler;
|
||||
public List<MadoPage4> Children;
|
||||
public MadoPage1 Parent { get; private set; }
|
||||
public MadoPage2(string name, string url, MadoPage1 parent, HttpClientHandler handler)
|
||||
{
|
||||
if (name.Length != 2)
|
||||
throw new InvalidNameLenthException($"Expected 2 letter name, got: {name}");
|
||||
Name = name;
|
||||
URL = url;
|
||||
Parent = parent;
|
||||
Handler = handler;
|
||||
}
|
||||
private void Populate()
|
||||
{
|
||||
string text;
|
||||
//is there a better way to do this?
|
||||
var client = new HttpClient(Handler);
|
||||
var response = client.GetAsync(URL).Result;
|
||||
client.Dispose();
|
||||
response.EnsureSuccessStatusCode();
|
||||
text = response.Content.ToString();
|
||||
response.Dispose();
|
||||
//grabs the URL and 2-letter name of each subpage
|
||||
var reg = new Regex($"https://manga.madokami.al/Manga/{Name}/(?<Name>{Name}[A-Z_]{2})", RegexOptions.IgnoreCase);
|
||||
var matches = reg.Matches(text);
|
||||
foreach (Match m in matches)
|
||||
{
|
||||
Children.Add(new MadoPage4(m.Groups["Name"].ToString(), m.ToString(), this, Handler));
|
||||
}
|
||||
}
|
||||
}
|
||||
public class MadoPage4
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string URL { get; private set; }
|
||||
MadoPage2 Parent;
|
||||
private HttpClientHandler Handler;
|
||||
public List<MadoSeries> Children { get; private set; }
|
||||
public MadoPage4(string name, string url, MadoPage2 parent, HttpClientHandler handler)
|
||||
{
|
||||
if (name.Length != 4)
|
||||
throw new InvalidNameLenthException($"Expected 4 letter name, got: {name}");
|
||||
Name = name;
|
||||
URL = url;
|
||||
Parent = parent;
|
||||
Handler = handler;
|
||||
}
|
||||
}
|
||||
public class MadoTree
|
||||
{
|
||||
|
||||
}
|
||||
public class MadoFile
|
||||
{
|
||||
public string Filename;
|
||||
public string URL;
|
||||
}
|
||||
public class InvalidNameLenthException : ArgumentException
|
||||
{
|
||||
public InvalidNameLenthException()
|
||||
{
|
||||
}
|
||||
public InvalidNameLenthException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
public InvalidNameLenthException(string message, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user