From 46b3bfd5f0ba79fb8022a9b638fa8e5668da3fcd Mon Sep 17 00:00:00 2001
From: 2593828650 <2593828650@qq.com>
Date: Sat, 6 Feb 2021 22:15:42 +0800
Subject: [PATCH] commit updates
---
Properties/Resources.Designer.cs | 10 ++
Properties/Resources.resx | 3 +
Readme.md | 2 +
Windows Store Downloader.csproj | 3 +
code/Form1.Designer.cs | 31 +++-
code/Form1.cs | 124 ++++++++++++----
code/Form2.Designer.cs | 5 +-
code/Form2.cs | 85 ++++++-----
code/Language.cs | 7 +-
code/Post.cs | 8 +-
code/Program.cs | 4 +
code/ShapeButton.cs | 245 +++++++++++++++++++++++++++++++
code/WriteToTemp.cs | 52 ++++++-
code/global.cs | 1 +
code/zh-CN.cs | 1 +
doc/cn.md | 2 +
resource/res.zip | Bin 696252 -> 699761 bytes
17 files changed, 511 insertions(+), 72 deletions(-)
create mode 100644 code/ShapeButton.cs
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 34a19c3..e6485ff 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -60,6 +60,16 @@ internal Resources() {
}
}
+ ///
+ /// 查找 System.Byte[] 类型的本地化资源。
+ ///
+ internal static byte[] res {
+ get {
+ object obj = ResourceManager.GetObject("res", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
///
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
///
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 97c394f..d047ffc 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -118,6 +118,9 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\resource\res.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
..\resources\store.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
diff --git a/Readme.md b/Readme.md
index 039b475..ace2c04 100644
--- a/Readme.md
+++ b/Readme.md
@@ -11,6 +11,8 @@ You can download paid, restricted and free Apps.
You should download packages of your system and install them all.
+Some codes are from the Internet.
+
Example:![image](doc/example.gif)
### Features
diff --git a/Windows Store Downloader.csproj b/Windows Store Downloader.csproj
index dc1842b..64ba0bf 100644
--- a/Windows Store Downloader.csproj
+++ b/Windows Store Downloader.csproj
@@ -118,6 +118,9 @@
+
+ Component
+
diff --git a/code/Form1.Designer.cs b/code/Form1.Designer.cs
index b216803..8bb51ca 100644
--- a/code/Form1.Designer.cs
+++ b/code/Form1.Designer.cs
@@ -44,6 +44,8 @@ private void InitializeComponent()
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.progressText = new System.Windows.Forms.Label();
+ this.debugWebBrowser = new System.Windows.Forms.Button();
+ this.debugWebsite = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
@@ -155,6 +157,7 @@ private void InitializeComponent()
// label1
//
this.label1.AutoSize = true;
+ this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.label1.Location = new System.Drawing.Point(12, 525);
this.label1.Name = "label1";
@@ -164,6 +167,7 @@ private void InitializeComponent()
//
// groupBox1
//
+ this.groupBox1.BackColor = System.Drawing.Color.Transparent;
this.groupBox1.Controls.Add(this.langText);
this.groupBox1.Controls.Add(this.langPackText);
this.groupBox1.Controls.Add(this.attributeText);
@@ -180,6 +184,7 @@ private void InitializeComponent()
//
// pictureBox1
//
+ this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.BackgroundImage = global::Windows_Store_Downloader.Properties.Resources.store;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pictureBox1.Location = new System.Drawing.Point(775, 396);
@@ -198,6 +203,7 @@ private void InitializeComponent()
//
// progressText
//
+ this.progressText.BackColor = System.Drawing.Color.Transparent;
this.progressText.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
this.progressText.Location = new System.Drawing.Point(11, 329);
this.progressText.Name = "progressText";
@@ -205,11 +211,31 @@ private void InitializeComponent()
this.progressText.TabIndex = 12;
this.progressText.Text = "Query Progress";
//
+ // debugWebBrowser
+ //
+ this.debugWebBrowser.Location = new System.Drawing.Point(17, 406);
+ this.debugWebBrowser.Name = "debugWebBrowser";
+ this.debugWebBrowser.Size = new System.Drawing.Size(171, 90);
+ this.debugWebBrowser.TabIndex = 13;
+ this.debugWebBrowser.Text = "WebBrowser";
+ this.debugWebBrowser.UseVisualStyleBackColor = true;
+ this.debugWebBrowser.Click += new System.EventHandler(this.debugWebBrowser_Click);
+ //
+ // debugWebsite
+ //
+ this.debugWebsite.Location = new System.Drawing.Point(223, 407);
+ this.debugWebsite.Name = "debugWebsite";
+ this.debugWebsite.Size = new System.Drawing.Size(532, 29);
+ this.debugWebsite.TabIndex = 14;
+ this.debugWebsite.Text = "https://www.example.com";
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1109, 618);
+ this.ClientSize = new System.Drawing.Size(1109, 749);
+ this.Controls.Add(this.debugWebsite);
+ this.Controls.Add(this.debugWebBrowser);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.progressText);
this.Controls.Add(this.progressBar1);
@@ -227,6 +253,7 @@ private void InitializeComponent()
this.Text = "Microsoft Store Downloader";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
+ this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
@@ -251,6 +278,8 @@ private void InitializeComponent()
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label progressText;
private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.Button debugWebBrowser;
+ private System.Windows.Forms.TextBox debugWebsite;
}
}
diff --git a/code/Form1.cs b/code/Form1.cs
index 3db780b..e5aa19e 100644
--- a/code/Form1.cs
+++ b/code/Form1.cs
@@ -1,18 +1,21 @@
using System;
+using System.Diagnostics;
using System.Drawing;
-using System.Windows.Forms;
-using System.Threading;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
+using System.Threading;
+using System.Windows.Forms;
namespace Windows_Store_Downloader
{
public partial class Form1 : Form
{
+
public Form1()
{
InitializeComponent();
+
}
private bool textBoxHasText = false;
@@ -68,6 +71,7 @@ private string SetAttributeText() {
return Language.lang_attributes[typeBox.SelectedIndex];
}
+
private void DownloadButton_Click(object sender, EventArgs e)
{
downloadButton.Enabled = false;
@@ -81,8 +85,8 @@ private void DownloadButton_Click(object sender, EventArgs e)
{
if (langText.Text == "")
{
- langText.Text = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
- }
+ langText.Text = Thread.CurrentThread.CurrentCulture.Name;
+ }//提交语言
postContent = "type=" + Http_Post.type[typeBox.SelectedIndex] + "&url=" + attributeText.Text + "&ring=" +
Http_Post.ring[routeBox.SelectedIndex] + "&lang=" + langText.Text;
@@ -97,15 +101,36 @@ private void DownloadButton_Click(object sender, EventArgs e)
Thread.Sleep(random.Next(67, 101));
progressBar1.PerformStep();
}
- }
+ }//伪装进度条
progressBar1.Value = 100;
downloadButton.Enabled = true;
+ if (Form2.returnid == -1)
+ {
+ MessageBox.Show(Language.lang_interr, Language.lang_interr, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }//意外
new Form2().ShowDialog();
+ if (Form2.returnid == 1)
+ {
+ try
+ {
+
+
+
+
+ }
+ catch (InvalidComObjectException) { }
+ catch (Exception ex)
+ {
+ Language.InternalErrMsgBox(ex);
+ }
+ }
+
}
}
- private void ChangeLanguage(object sender, EventArgs e)
+ private void ChangeLanguage(object sender, EventArgs e)//更改语言
{
if (langBox.Text == "English")
{
@@ -117,19 +142,9 @@ private void ChangeLanguage(object sender, EventArgs e)
private void Form1_Load(object sender, EventArgs e)
{
-
-
- User32.AnimateWindow(this.Handle, 1000, User32.AW_BLEND | User32.AW_ACTIVE | User32.AW_VER_NEGATIVE);
-
- Bitmap a = Properties.Resources.store;
- a.MakeTransparent(Color.FromArgb(0, 255, 0));
- pictureBox1.BackgroundImage = a;
- if (System.Diagnostics.Debugger.IsAttached != true)
- {
- langText.Visible = false;
- langPackText.Visible = false;
- }
+
+ RefreshForm();
WriteToTemp.ReadFrom();
if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == "zh-CN") {
Chinese_Lang();
@@ -138,12 +153,13 @@ private void Form1_Load(object sender, EventArgs e)
English_Lang();
langBox.SelectedIndex = 0;
}
- typeBox.SelectedIndex = 0;
- routeBox.SelectedIndex = 2;
-
- }
+ User32.AnimateWindow(this.Handle, 200, User32.AW_BLEND | User32.AW_ACTIVE | User32.AW_VER_NEGATIVE);
+ RefreshForm();
+ this.Opacity = 0.9;
+
+ }
private void Chinese_Lang()
{
@@ -164,9 +180,9 @@ private void SetLang() {
groupBox1.Text = Language.lang_downbutton;
attributeText.Text = Language.lang_input;
progressText.Text = Language.lang_prog;
- }
+ }//设置语言文本
- private void RefreshText(object sender, EventArgs e)
+ private void RefreshText(object sender, EventArgs e)//刷新文本
{
HasText();
if (textBoxHasText == false)
@@ -181,10 +197,63 @@ private void RefreshText(object sender, EventArgs e)
}
}
- private void Form1_FormClosed(object sender, FormClosedEventArgs e)
+ private void Form1_FormClosed(object sender, FormClosedEventArgs e)//淡出
{
- User32.AnimateWindow(this.Handle, 1000, User32.AW_BLEND | User32.AW_HIDE);
+ this.Opacity = 1;
+ User32.AnimateWindow(this.Handle, 300, User32.AW_BLEND | User32.AW_HIDE);
}
+ private void RefreshForm()//初始化窗口
+ {
+ Bitmap a = Properties.Resources.store;
+ a.MakeTransparent(Color.FromArgb(0, 255, 0));//透明图片
+ pictureBox1.BackgroundImage = a;
+ if (System.Diagnostics.Debugger.IsAttached != true)
+ {
+ langText.Visible = false;
+ langPackText.Visible = false;
+ debugWebsite.Visible = false;
+ debugWebBrowser.Visible = false;
+ }//调试内容
+ typeBox.SelectedIndex = 0;
+ routeBox.SelectedIndex = 2;
+ //初始化选择框
+
+ attributeText.Text = SetAttributeText();
+ attributeText.ForeColor = Color.Gray;
+ textBoxHasText = false;
+ //初始化文字
+
+ }
+
+
+ private void Form1_Paint(object sender, PaintEventArgs e)
+ {
+
+
+
+ Graphics g = e.Graphics; //实例化Graphics 对象g
+ Color FColor = Color.FromArgb(0xE8, 0xF1, 0xE7); //颜色1
+ Color TColor = Color.FromArgb(0xCA, 0xC7, 0xC7); //颜色2
+ Brush b = new LinearGradientBrush(this.ClientRectangle, FColor, TColor, LinearGradientMode.BackwardDiagonal); //实例化刷子,第一个参数指示上色区域,第二个和第三个参数分别渐变颜色的开始和结束,第四个参数表示颜色的方向。
+ g.FillRectangle(b, this.ClientRectangle); //进行上色
+
+
+
+
+ }
+
+ private void debugWebBrowser_Click(object sender, EventArgs e)
+ {
+ new Form2().Show();
+ //Form2.webBrowser1.Navigate(debugWebsite.Text);
+
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ Debug.WriteLine(Form2.webBrowser1.Url);
+ }
+
}
class User32
{
@@ -208,5 +277,6 @@ class User32
public const int AW_ACTIVE = 0x20000;//激活窗口,在使用了AW_HIDE标志后不要使用这个标志
public const int AW_SLIDE = 0x40000;//使用滑动类型动画效果,默认为滚动动画类型,当使用AW_CENTER标志时,这个标志就被忽略
public const int AW_BLEND = 0x80000;//使用淡入淡出效果
- }
+ }//淡入淡出
+
}
diff --git a/code/Form2.Designer.cs b/code/Form2.Designer.cs
index 24b7ed0..46de13a 100644
--- a/code/Form2.Designer.cs
+++ b/code/Form2.Designer.cs
@@ -35,7 +35,6 @@ private void InitializeComponent()
//
// webBrowser1
//
- this.webBrowser1.AllowWebBrowserDrop = false;
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.IsWebBrowserContextMenuEnabled = false;
this.webBrowser1.Location = new System.Drawing.Point(0, 0);
@@ -45,6 +44,7 @@ private void InitializeComponent()
this.webBrowser1.ScrollBarsEnabled = false;
this.webBrowser1.Size = new System.Drawing.Size(1256, 750);
this.webBrowser1.TabIndex = 0;
+ this.webBrowser1.Url = new System.Uri("", System.UriKind.Relative);
//
// Form2
//
@@ -59,12 +59,13 @@ private void InitializeComponent()
this.Name = "Form2";
this.ShowIcon = false;
this.Text = "Form2";
+ this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
- private System.Windows.Forms.WebBrowser webBrowser1;
+ public System.Windows.Forms.WebBrowser webBrowser1;
}
}
\ No newline at end of file
diff --git a/code/Form2.cs b/code/Form2.cs
index b9579ba..03d0f75 100644
--- a/code/Form2.cs
+++ b/code/Form2.cs
@@ -5,6 +5,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Text;
+using System.Threading;
using System.Windows.Forms;
namespace Windows_Store_Downloader
@@ -16,47 +17,49 @@ public Form2()
{
InitializeComponent();
}
+ public static string result; //post返回的表格
+ public static int returnid;
+ ///
+ /// Returnid:
+ /// -1:意外
+ /// 1:完成
+ /// 2:空响应
+ ///
public bool complete = false;
Http_Post Http_Post = new Http_Post();
public void Browse()
- {
+ {
+ WriteToTemp WriteToTemp = new WriteToTemp();
complete = false;
+ result = "";
string content = Form1.postContent;
- string result = Http_Post.StartPostData(content);
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(@WriteToTemp.tmpPath + "\\..\\post.log", true))
+ result = Http_Post.StartPostData(content); //POST
+ if (result == "")
{
- file.WriteLine(result);
-
- }
+ returnid = -1;
+ complete = true;
+ return;
+ }//意外-1
+ Thread postlog = new Thread(WriteToTemp.PostLog);
+ postlog.Start();//记录日志
if (result.IndexOf("The server returned an empty list") != -1)
{
complete = true;
-
- try
- {
- InitBrowser();
- //webBrowser1.Navigate("\""+WriteToTemp.tmpPath + @"\" + Language.lang_errhtm+"\"");
- webBrowser1.Navigate(new Uri("file:///C:/Users/User-WIN/AppData/Roaming/Local/Temp/MSStoreDownloadTemp/xPfeOin6F7/error-cn.html"));
- }
- catch (System.Runtime.InteropServices.InvalidComObjectException) { }
- catch (Exception ex)
- {
- Language.InternalErrMsgBox(ex);
- }
-
-
-
+ returnid = 2;
return;
- }
- if (result == "") { complete = true; return; }
- string result2 = RemoveUselessContent(result);
- if (result2 == "") { complete = true; return; }
+ }//空响应0
+ string result2 = RemoveUselessContent(result);//格式化
+ if (result2 == "") {
+ returnid = -1;
+ complete = true;
+ return;
+ } // 处理错误-1
+ returnid = 1; //成功
complete = true;
- MessageBox.Show(result2);
-
+ Debug.WriteLine(result2);
return;
}
- private string RemoveUselessContent(string old)
+ private string RemoveUselessContent(string old)//格式化
{
try
{
@@ -72,15 +75,29 @@ private string RemoveUselessContent(string old)
}
}
- private void InitBrowser()
+ private string Mdui(string old)//加入Mdui格式
{
- webBrowser1.ScriptErrorsSuppressed = true; //禁用错误脚本提示
- webBrowser1.IsWebBrowserContextMenuEnabled = false; // 禁用右键菜单
- webBrowser1.WebBrowserShortcutsEnabled = false; //禁用快捷键
- webBrowser1.AllowWebBrowserDrop = false; // 禁止文件拖动
-
+ return old;
+ }
+ private void Form2_Load(object sender, EventArgs e)
+ {
+ var urlString = new Uri(WriteToTemp.tmpPath + @"\" + Language.lang_errhtm);
+ Debug.WriteLine(urlString);
+ if (System.Diagnostics.Debugger.IsAttached == true)
+ {
+ webBrowser1.AllowWebBrowserDrop = true;
+ }
+ webBrowser1.Navigate(urlString);
+ webBrowser1.DocumentTitleChanged += DocTitleClose;
+ }
+ private void DocTitleClose(object sender, EventArgs e)
+ {
+ if (webBrowser1.DocumentTitle == "IAMOKAY")
+ {
+ Close();
+ }
}
}
diff --git a/code/Language.cs b/code/Language.cs
index 7c930ee..11d6157 100644
--- a/code/Language.cs
+++ b/code/Language.cs
@@ -5,8 +5,10 @@ namespace Windows_Store_Downloader
{
class Language
{
+ //语言系统
static zh_CN zh_CN = new zh_CN();
static global global = new global();
+
public static string[] lang_attributes = new string[4];
public static string lang_baddown;
public static string lang_baddowninfo;
@@ -20,6 +22,7 @@ class Language
public static string lang_prog;
public static string lang_interr;
public static string lang_errhtm;
+ public static string lang_neterr;
public static void Chinese_Lang()
{
lang_attributes[0] = zh_CN.lang_attributes[0];
@@ -38,6 +41,7 @@ public static void Chinese_Lang()
lang_prog = zh_CN.lang_prog;
lang_interr = zh_CN.lang_interr;
lang_errhtm = zh_CN.lang_errhtm;
+ lang_neterr = zh_CN.lang_neterr;
}
public static void English_Lang()
{
@@ -57,6 +61,7 @@ public static void English_Lang()
lang_prog = global.lang_prog;
lang_interr = global.lang_interr;
lang_errhtm = global.lang_errhtm;
+ lang_neterr = global.lang_neterr;
}
public static void InternalErrMsgBox(System.Exception ex){
MessageBox.Show(Language.lang_interr, Language.lang_interr, MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -65,6 +70,6 @@ public static void InternalErrMsgBox(System.Exception ex){
file.WriteLine(ex);
}
- }
+ }//内部错误信息框
}
}
diff --git a/code/Post.cs b/code/Post.cs
index 44acde7..92a270a 100644
--- a/code/Post.cs
+++ b/code/Post.cs
@@ -7,9 +7,11 @@ namespace Windows_Store_Downloader
{
class Http_Post
{
+ //参数转换
public static string[] ring = new string[] { "WIF", "WIS", "RP", "Retail" };
public static string[] type = new string[] { "url", "ProductId", "PackageFamilyName", "CategoryId" };
- private const string LINK_HTTP = "https://store.rg-adguard.net/api/GetFiles";
+ private const string LINK_HTTP = "https://store.rg-adguard.net/api/GetFiles";//链接
+
public string StartPostData(string content)
{
Debug.WriteLine(" Post Link: " + LINK_HTTP + " ; Post Data: " + content + "");
@@ -27,7 +29,7 @@ public string StartPostData(string content)
Language.InternalErrMsgBox(ex);
return "";
}
- }
+ }//开始Post
private static string Post(string url, string content)
{
string result = "";
@@ -53,7 +55,7 @@ private static string Post(string url, string content)
result = reader.ReadToEnd();
}
return result;
- }
+ }//POST
}
}
diff --git a/code/Program.cs b/code/Program.cs
index 51c2cbf..77a5761 100644
--- a/code/Program.cs
+++ b/code/Program.cs
@@ -5,12 +5,16 @@ namespace Windows_Store_Downloader
{
static class Program
{
+ [System.Runtime.InteropServices.DllImport("user32.dll")]
+ private static extern bool SetProcessDPIAware();
///
/// 应用程序的主入口点。
///
[STAThread]
static void Main()
{
+
+ if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); }//dpi适配
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
diff --git a/code/ShapeButton.cs b/code/ShapeButton.cs
new file mode 100644
index 0000000..06f3d66
--- /dev/null
+++ b/code/ShapeButton.cs
@@ -0,0 +1,245 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Windows_Store_Downloader.code
+{
+ public partial class ShapeButton : Button
+ {
+ private Color m_CustomClickColor;
+ private Color m_CustomDisabledColor;
+ private Color m_CustomDefaultColor;
+ private Color m_CustomClickTextColor;
+ private Color m_CustomDisabledTextColor;
+ private Color m_CustomDefaultTextColor;
+ private int m_Fillet;
+
+ public ShapeButton()
+ {
+ this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.FlatAppearance.BorderSize = 0;
+ this.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
+ this.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
+ this.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.MouseEnter += new EventHandler(UserControlRoundButton_MouseEnter);
+ this.MouseLeave += new EventHandler(UserControlRoundButton_MouseLeave);
+ this.EnabledChanged += new EventHandler(UserControlCustomButton_EnabledChanged);
+
+ }
+
+ ///
+ /// 不可用背景颜色
+ ///
+ public Color CustomDisabledColor
+ {
+ get
+ {
+ return m_CustomDisabledColor;
+ }
+ set
+ {
+ m_CustomDisabledColor = value;
+ }
+ }
+
+ ///
+ /// 默认背景颜色
+ ///
+ [Browsable(true)]
+ public Color CustomDefaultColor
+ {
+ get
+ {
+ return m_CustomDefaultColor;
+ }
+ set
+ {
+ m_CustomDefaultColor = value;
+ }
+ }
+
+ ///
+ /// 光标放上去时颜色
+ ///
+ [Browsable(true)]
+ public Color CustomClickColor
+ {
+ get
+ {
+ return m_CustomClickColor;
+ }
+ set
+ {
+ m_CustomClickColor = value;
+ }
+ }
+
+
+ ///
+ /// 不可用文字颜色
+ ///
+ [Browsable(true)]
+ public Color CustomDisabledTextColor
+ {
+ get
+ {
+ return m_CustomDisabledTextColor;
+ }
+ set
+ {
+ m_CustomDisabledTextColor = value;
+ }
+ }
+
+ ///
+ /// 默认文字颜色
+ ///
+ [Browsable(true)]
+ public Color CustomDefaultTextColor
+ {
+ get
+ {
+ return m_CustomDefaultTextColor;
+ }
+ set
+ {
+ m_CustomDefaultTextColor = value;
+ }
+ }
+
+ ///
+ /// 光标放上去时文字颜色
+ ///
+ [Browsable(true)]
+ public Color CustomClickTextColor
+ {
+ get
+ {
+ return m_CustomClickTextColor;
+ }
+ set
+ {
+ m_CustomClickTextColor = value;
+ }
+ }
+
+
+ ///
+ /// 圆角度数、
+ ///
+ [Browsable(true)]
+ public int Fillet
+ {
+ get
+ {
+ return m_Fillet;
+ }
+ set
+ {
+ m_Fillet = value;
+ }
+ }
+
+ ///
+ /// 按钮不可用
+ ///
+ ///
+ ///
+ void UserControlCustomButton_EnabledChanged(object sender, EventArgs e)
+ {
+ if (!this.Enabled)
+ {
+ this.BackColor = m_CustomDisabledColor;
+ this.ForeColor = m_CustomDisabledTextColor;
+ }
+ else
+ {
+ this.BackColor = m_CustomDefaultColor;
+ this.ForeColor = m_CustomDefaultTextColor;
+ }
+ }
+
+ ///
+ /// 鼠标离开
+ ///
+ ///
+ ///
+ void UserControlRoundButton_MouseLeave(object sender, EventArgs e)
+ {
+ if (!this.Enabled)
+ return;
+
+ this.BackColor = m_CustomDefaultColor;
+ this.ForeColor = m_CustomDefaultTextColor;
+ }
+
+ ///
+ /// 鼠标进入
+ ///
+ ///
+ ///
+ void UserControlRoundButton_MouseEnter(object sender, EventArgs e)
+ {
+ this.BackColor = m_CustomClickColor;
+ this.ForeColor = m_CustomClickTextColor;
+ this.ResetFlagsandPaint();
+ }
+
+ ///
+ /// 绘制的路径
+ ///
+ ///
+ ///
+ ///
+ private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
+ {
+ int diameter = radius;
+ Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
+ GraphicsPath path = new GraphicsPath();
+ path.AddArc(arcRect, 180, 90);
+ arcRect.X = rect.Right - diameter;
+ path.AddArc(arcRect, 270, 90);
+ arcRect.Y = rect.Bottom - diameter;
+ path.AddArc(arcRect, 0, 90);
+ arcRect.X = rect.Left;
+ path.AddArc(arcRect, 90, 90);
+ path.CloseFigure();
+ return path;
+ }
+
+ ///
+ /// 绘制的代码,需要在设计页面声明事件
+ ///
+ ///
+ ///
+ private void ShapeButton_Paint(object sender, PaintEventArgs e)
+ {
+
+ System.Drawing.Drawing2D.GraphicsPath FormPath;
+ FormPath = new System.Drawing.Drawing2D.GraphicsPath();
+ Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);//this.Left-10,this.Top-10,this.Width-10,this.Height-10);
+ e.Graphics.Clear(Color.White);
+ FormPath = GetRoundedRectPath(rect, m_Fillet);
+ e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
+ e.Graphics.FillPath(new SolidBrush(this.BackColor), FormPath);
+
+ StringFormat gs = new StringFormat();
+ gs.Alignment = StringAlignment.Center; //居中
+ gs.LineAlignment = StringAlignment.Center;//垂直居中
+ // gs.Alignment = StringAlignment.Far; //右对齐
+ string str = "Hello World";
+ Rectangle rc = new Rectangle(0, 0, this.Width, this.Height);
+ Font fo = new Font("宋体", 10.5F);
+ Brush brush = new SolidBrush(this.ForeColor);
+ e.Graphics.DrawString(str, fo, brush, rc, gs);
+
+ }
+ }
+
+}
diff --git a/code/WriteToTemp.cs b/code/WriteToTemp.cs
index 0a95ca5..bafc716 100644
--- a/code/WriteToTemp.cs
+++ b/code/WriteToTemp.cs
@@ -1,6 +1,8 @@
using System;
using System.IO;
using System.Windows.Forms;
+using System.IO.Compression;
+using System.Text;
namespace Windows_Store_Downloader
{
@@ -46,14 +48,23 @@ public string GetRnd(int length, bool useNum, bool useLow, bool useUpp, bool use
"\\Local\\Temp\\MSStoreDownloadTemp\\data" ;
public void ReadFrom()
{
+ try {
+ if (File.Exists(@tmpPath + "\\..\\res.zip") == false)
+ {
+ File.WriteAllBytes(@tmpPath + "\\..\\res.zip", Properties.Resources.res);
+ }
+ } catch (Exception) { }
try
{
+ if (File.Exists(@tmpPath + "\\error.html") == false)
+ {
+ ZipFile.ExtractToDirectory(@tmpPath + "\\..\\res.zip", @tmpPath);
+ }
- System.IO.Compression.ZipFile.ExtractToDirectory(@Directory.GetCurrentDirectory() + "\\res.zip", @tmpPath);
- } catch(System.IO.FileNotFoundException ex)
+ } catch(FileNotFoundException ex)
{
MessageBox.Show(ex.Message, "!");
- System.Environment.Exit(0);
+ Environment.Exit(0);
}
catch (IOException)
{
@@ -63,9 +74,42 @@ public void ReadFrom()
{
Language.InternalErrMsgBox(ex);
}
+
}
+ public void PostLog()
+ {
+ try
+ {
+ File.Delete(WriteToTemp.tmpPath + "\\..\\post.log");
+ }
+ catch (Exception) { }
+
+
+
+ //压缩
+ var str = Form2.result;
+ var memoryStream = new MemoryStream();
+ var gZipStream = new GZipStream(memoryStream, CompressionMode.Compress);
+ var byteList = Encoding.UTF8.GetBytes(str);
+ gZipStream.Write(byteList, 0, byteList.Length);
+ gZipStream.Close();
+ var output = memoryStream.ToArray();
+ File.WriteAllBytes(tmpPath + "\\..\\post.log." + GetTimeStamp().ToString() + ".gz", output);
+
+
+
+ }//记录日志
+ ///
+ /// 获取时间戳
+ ///
+ ///
+ public static string GetTimeStamp()
+ {
+ TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Convert.ToInt64(ts.TotalMilliseconds).ToString();
+ }// 获取时间戳
+
-
}
}
diff --git a/code/global.cs b/code/global.cs
index 77f6874..9beac8b 100644
--- a/code/global.cs
+++ b/code/global.cs
@@ -21,5 +21,6 @@ class global
public string lang_interr = "Internal Error Occurred.\nView " + WriteToTemp.tmpPath +
"\\..\\exception.log" + "for technical information.";
public string lang_errhtm = "error.html";
+ public string lang_neterr = "Network error.";
}
}
diff --git a/code/zh-CN.cs b/code/zh-CN.cs
index d346c98..04e43a4 100644
--- a/code/zh-CN.cs
+++ b/code/zh-CN.cs
@@ -21,5 +21,6 @@ class zh_CN
public string lang_interr = "发生内部错误。\n查看" + WriteToTemp.tmpPath +
"\\..\\exception.log" + "以获得技术信息。";
public string lang_errhtm = "error-cn.html";
+ public string lang_neterr = "网络错误.";
}
}
diff --git a/doc/cn.md b/doc/cn.md
index f2cd7fb..fdfe25d 100644
--- a/doc/cn.md
+++ b/doc/cn.md
@@ -11,6 +11,8 @@
你应该下载符合你系统的全部的包,并全部安装。
+部分代码来自互联网。
+
例图:![image](example.gif)
### Features
diff --git a/resource/res.zip b/resource/res.zip
index 0baefbff00c11966a2ef1d0a117effbcb35c0aad..9716ef95fdef9ca8970a826e579a5cad2a1f8203 100644
GIT binary patch
delta 3768
zcmZ`+2UHVV6W)Z-LPvUegf2*tB2ok%NR!?LM0yvb3Iv3uNjEf+-UR6=9r9=b0urhP
zks?SlpaDdsNCN!vz4MO#=Rg15^X=@;+5Kkj+`0G6boYtw&5MG@dL%F=001Ze-y$tj
ztbQs%m-rS-1e^$0AHN`^gh!B%cZ*5TUI=XxwV%a{^P>|@Ya7kcui$?=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