Commit 04d49a00 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:purerosefallen/DataEditorX

parents 104861e2 12d5a4b5
Pipeline #59 failed with stages
in 1 minute and 5 seconds
......@@ -8,6 +8,7 @@
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace DataEditorX.Common
{
......@@ -30,7 +31,7 @@ static CheckUpdate()
/// </summary>
const string HEAD = "[DataEditorX]";
const string HEAD2 = "[URL]";
public const string DEFALUT = "0.0.0.0";
public const string DEFAULT = "0.0.0.0";
#region 检查版本
/// <summary>
......@@ -40,24 +41,18 @@ static CheckUpdate()
/// <returns>版本号</returns>
public static string GetNewVersion(string VERURL)
{
string urlver = DEFALUT;
string urlver = DEFAULT;
string html = GetHtmlContentByUrl(VERURL);
if (!string.IsNullOrEmpty(html))
{
int t, w;
t = html.IndexOf(HEAD);
w = (t > 0) ? html.IndexOf(HEAD, t + HEAD.Length) : 0;
if (w > 0)
Regex ver = new Regex(@"\[DataEditorX\]([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\[DataEditorX\]");
Regex url = new Regex(@"\[URL\]([^\[]+?)\[URL\]");
if (ver.IsMatch(html) && url.IsMatch(html))
{
//获取版本
urlver = html.Substring(t + HEAD.Length, w - t - HEAD.Length);
}
t = html.IndexOf(HEAD2);
w = (t > 0) ? html.IndexOf(HEAD2, t + HEAD2.Length) : 0;
if (w > 0)
{
//获取下载地址
URL = html.Substring(t + HEAD2.Length, w - t - HEAD2.Length);
Match mVer = ver.Match(html);
Match mUrl = url.Match(html);
URL = mUrl.Groups[1].Value;
return $"{mVer.Groups[1].Value}";
}
}
return urlver;
......
......@@ -138,7 +138,7 @@ public void ToImg(string img, string saveimg1)
public static void CheckVersion(bool showNew)
{
string newver = CheckUpdate.GetNewVersion(MyConfig.ReadString(MyConfig.TAG_UPDATE_URL));
if (newver == CheckUpdate.DEFALUT)
if (newver == CheckUpdate.DEFAULT)
{ //检查失败
if (!showNew)
{
......
......@@ -142,6 +142,7 @@ private void InitializeComponent()
this.mainMenu.SuspendLayout();
this.pl_bottom.SuspendLayout();
this.pl_main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
......@@ -1249,7 +1250,7 @@ private void InitializeComponent()
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DataEditorX";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DataEditFormFormClosing);
this.Load += new System.EventHandler(this.DataEditForm_Load);
this.Load += new System.EventHandler(this.DataEditFormLoad);
this.SizeChanged += new System.EventHandler(this.DataEditFormSizeChanged);
this.Enter += new System.EventHandler(this.DataEditFormEnter);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DataEditForm_KeyDown);
......@@ -1261,6 +1262,7 @@ private void InitializeComponent()
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
......
......@@ -1166,10 +1166,6 @@ public void CheckUpdate(bool showNew)
{
if (!this.isRun())
{
if (this.tasker == null)
{
this.tasker = new TaskHelper("", new System.ComponentModel.BackgroundWorker(), null);
}
this.tasker.SetTask(MyTask.CheckUpdate, null, showNew.ToString());
this.Run(LanguageHelper.GetMsg(LMSG.checkUpdate));
}
......
......@@ -112,18 +112,18 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>135, 17</value>
</metadata>
<metadata name="bgWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="bgWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>
\ No newline at end of file
......@@ -7,7 +7,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>DataEditorX</RootNamespace>
<AssemblyName>DataEditorX</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<StartupObject>DataEditorX.Program</StartupObject>
<ApplicationIcon>icon.ico</ApplicationIcon>
......
......@@ -21,7 +21,7 @@
<!-- DataEditorX source code -->
<add key="sourceURL" value="https://github.com/purerosefallen/DataEditorX"/>
<!-- DataEditorX update url-->
<add key="updateURL" value="https://cdn01.moecube.com/DataEditorX/version.txt" />
<add key="updateURL" value="https://cdn01.moecube.com/DataEditorX/version.txt"/>
<!-- delete,modify with card's files image script -->
<add key="opera_with_cards_file" value="true"/>
<!-- open file in this.such as lua -->
......@@ -53,4 +53,4 @@
<!-- 1024 : 40-->
<add key="autolength" value="37"/>
</appSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment