Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Myth committed Aug 23, 2019
1 parent 75ed13b commit eb9b3e9
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 106 deletions.
28 changes: 17 additions & 11 deletions SteamDepotDownloader-GUI/ManifestIDSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,23 @@ private async void ManifestIDSelector_LoadAsync(object sender, EventArgs e)
}
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(webPageStr);
if (doc.DocumentNode.SelectSingleNode("//title").GetDirectInnerText() == "Just a moment... · Steam Database")
{
/*if (MessageBox.Show(Resources.FailedToGetManifestHistory + "\n" + Resources.refreshCookieRequest
, "SteamDepotDownloaderGUI", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)*/
{
ConfigStore.TheConfig.StoredCookies.Remove("__cfduid");
ConfigStore.TheConfig.StoredCookies.Remove("cf_clearance");
goto Refresh;
}
/*PendingReturnManifestID = ContentDownloader.INVALID_MANIFEST_ID;
Close();
return;*/
}
ManifestHistoryRecord manifestHistoryRecord= new ManifestHistoryRecord();
var DepotInfoNode = doc.DocumentNode.SelectNodes("//div[@class='wrapper-info scope-depot']/div/table/tbody/tr");
//Check if xpath is succeed.
if (DepotInfoNode.Count != 0)
if (DepotInfoNode != null)
{
//The sequence for these data seems to be fixed,so use Index directly.
//Actually maybe use ChildNodes[0] will be better?
Expand All @@ -109,20 +122,13 @@ private async void ManifestIDSelector_LoadAsync(object sender, EventArgs e)
manifestHistoryRecord.DepotName = DepotInfoNode[3].ChildNodes[3].GetDirectInnerText();
manifestHistoryRecord.LastUpdate = DepotInfoNode[4].SelectSingleNode("//i").GetDirectInnerText();
}
DepotInfoNode = doc.DocumentNode.SelectNodes("//div[@id='manifests']/div[@class='table-responsive']/table/tbody/tr");
if (DepotInfoNode.Count == 0)
else
{
if(MessageBox.Show(Resources.FailedToGetManifestHistory+"\n"+Resources.refreshCookieRequest
, "SteamDepotDownloaderGUI", MessageBoxButtons.YesNo, MessageBoxIcon.Error)==DialogResult.Yes)
{
ConfigStore.TheConfig.StoredCookies.Remove("__cfduid");
ConfigStore.TheConfig.StoredCookies.Remove("cf_clearance");
goto Refresh;
}
PendingReturnManifestID = ContentDownloader.INVALID_MANIFEST_ID;
MessageBox.Show(Resources.nomanifesthistory, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
return;
}
DepotInfoNode = doc.DocumentNode.SelectNodes("//div[@id='manifests']/div[@class='table-responsive']/table/tbody/tr");
manifestHistoryRecord.HistoryCollection = new List<ManifestHistoryRecord.ManifestHistoryRecordSingle>();
for (int i = 0; i < DepotInfoNode.Count; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions SteamDepotDownloader-GUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
9 changes: 9 additions & 0 deletions SteamDepotDownloader-GUI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions SteamDepotDownloader-GUI/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,7 @@ To use ManifestID for other branch, try Advanced Input</value>
<data name="refreshCookieRequest" xml:space="preserve">
<value>It may caused by invalid cookies,do you want to input new cookies?</value>
</data>
<data name="nomanifesthistory" xml:space="preserve">
<value>SteamDB doesn't have the infomation of this Depot</value>
</data>
</root>
3 changes: 3 additions & 0 deletions SteamDepotDownloader-GUI/Properties/Resources.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,7 @@
<data name="refreshCookieRequest" xml:space="preserve">
<value>这可能是由于过期的Cookies引起的,你想要重新输入Cookies吗?</value>
</data>
<data name="nomanifesthistory" xml:space="preserve">
<value>SteamDB 没有这个Depot的信息</value>
</data>
</root>
13 changes: 8 additions & 5 deletions SteamDepotDownloader-GUI/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ public Settings()

private void buttonClearCache_Click(object sender, EventArgs e)
{
var FileList = System.IO.Directory.GetFiles(Program.CacheDir);
foreach (string FileName in FileList)
if (System.IO.Directory.Exists(Program.CacheDir))
{
try
var FileList = System.IO.Directory.GetFiles(Program.CacheDir);
foreach (string FileName in FileList)
{
System.IO.File.Delete(FileName);
try
{
System.IO.File.Delete(FileName);
}
catch { };
}
catch { };
}
DepotDownloader.ConfigStore.TheConfig.LoginKeys.Clear();
DepotDownloader.ConfigStore.TheConfig.LastManifests.Clear();
Expand Down
4 changes: 2 additions & 2 deletions SteamDepotDownloader-GUI/SteamDepotDownloader-GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>By JackMyth.pfx</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="HtmlAgilityPack, Version=1.11.12.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
Expand Down Expand Up @@ -206,7 +207,6 @@
<EmbeddedResource Include="Waiting.resx">
<DependentUpon>Waiting.cs</DependentUpon>
</EmbeddedResource>
<None Include="By JackMyth.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand Down
Loading

0 comments on commit eb9b3e9

Please sign in to comment.