Commit e25d7aff authored by 247321453's avatar 247321453

fix

parent 94a5187d
......@@ -21,7 +21,8 @@ public partial class DataEditForm : Form
{
#region 成员变量
string GAMEPATH,PICPATH,LUAPTH;
string GITURL="https://github.com/247321453/DataEcitorX";
readonly string GITURL="https://github.com/247321453/DataEcitorX";
readonly string VERURL="http://hi.baidu.com/247321453";
Card oldCard=new Card(0);
Card srcCard=new Card(0);
ImageForm imgform=new ImageForm();
......@@ -788,10 +789,7 @@ void Menuitem_aboutClick(object sender, EventArgs e)
void Menuitem_checkupdateClick(object sender, EventArgs e)
{
if(MyUpdate.CheckUpdate())
{
MyUpdate.Download();
}
MyUpdate.CheckUpdate(VERURL);
}
void Menuitem_githubClick(object sender, EventArgs e)
{
......
......@@ -71,7 +71,6 @@
<ItemGroup>
<Folder Include="Data" />
<Folder Include="Core" />
<Folder Include="Update" />
</ItemGroup>
<ItemGroup>
<None Include="Data\card-attribute.txt">
......@@ -104,8 +103,6 @@
<None Include="readme.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Update\Release.zip" />
<None Include="Update\version.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -18,30 +18,69 @@ namespace DataEditorX
/// </summary>
public static class MyUpdate
{
static readonly string VERURL="https://github.com/247321453/DataEditorX/raw/master/DataEditorX/Update/version.txt";
static readonly string DOWNURL="https://github.com/247321453/DataEditorX/raw/master/DataEditorX/Update/Release.zip";
public static bool CheckUpdate()
static string downloadURL="";
static string Head="[DataEditorX]";
static string Vhead="v";
static string Thead="t";
static string Dhead="d";
public static bool CheckUpdate(string url)
{
string ver,lasttime;
int l=-1;
string html=GetHtmlContentByUrl(VERURL);
string ver,lasttime,verurl;
int t,w;
string html=GetHtmlContentByUrl(url);
if(string.IsNullOrEmpty(html))
{
MyMsg.Error("无法获取版本!");
return false;
}
l=html.IndexOf(" time:");
ver=(l>=0)?html.Substring(4,l):"?.?.?.?";
lasttime=(l>=0)?html.Substring(l):"????-??-?? ??:??";
t=html.IndexOf(Head);
w=(t>=0)?html.IndexOf(Head,t+1):0;
if(w<=0)
{
MyMsg.Error("无法解释网址内容!\n"+url);
return false;
}
verurl=html.Substring(t+Head.Length,w-t-Head.Length);
if(!verurl.StartsWith("http://",StringComparison.OrdinalIgnoreCase))
verurl="http://"+verurl;
#if DEBUG
MyMsg.Show(verurl);
#endif
html= GetHtmlContentByUrl(verurl);
if(string.IsNullOrEmpty(html))
{
MyMsg.Error("无法解释网址内容!\n"+verurl);
return false;
}
w=0;
t=html.IndexOf("<"+Vhead+">",w);
w=(t>=0)?html.IndexOf("<"+Vhead+">",t+1):0;
ver=(w>0)?html.Substring(t+Vhead.Length+2,w-t-Vhead.Length-2):"?.?.?.?";
t=html.IndexOf("<"+Thead+">",w);
w=(t>=0)?html.IndexOf("<"+Thead+">",t+1):0;
lasttime=(w>0)?html.Substring(t+Thead.Length+2,w-t-Thead.Length-2):"????-??-?? ??:??";
t=html.IndexOf("<"+Dhead+">",w);
w=(t>=0)?html.IndexOf("<"+Dhead+">",t+1):0;
downloadURL=(w>0)?html.Substring(t+Dhead.Length+2,w-t-Dhead.Length-2):"";
if(!string.IsNullOrEmpty(downloadURL))
{
downloadURL=downloadURL.Replace(" http://","\nhttp://");
Clipboard.SetText(downloadURL);
}
MyMsg.Show("当前版本:"+Application.ProductVersion
+"\n最新版本:"+ver
+"\n最后更新时间:"+lasttime);
+"\n最后更新时间:"+lasttime
+"\n下载地址:(已经复制到粘贴板)\n"+downloadURL
);
return false;
}
public static void Download()
{
}
/// <summary>
///根据url获取网站html内容 /// </summary>
......
......@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.1.0.3")]
[assembly: AssemblyVersion("1.2.0.0")]
ver:1.1.0.3 time:2014-5-21 10:00
\ No newline at end of file
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