Skip to content

Commit

Permalink
Add alternate theme file host that should be accessible in China
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Nov 4, 2018
1 parent cdaf91e commit 328f12d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
25 changes: 19 additions & 6 deletions src/ProgressDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public void DownloadNext()
if (downloadQueue.Count > 0)
{
ThemeConfig theme = downloadQueue.Peek();
client.DownloadFileAsync(new Uri(theme.imagesZipUri),
theme.themeName + "_images.zip");
List<string> imagesZipUris = theme.imagesZipUri.Split('|').ToList();

client.DownloadFileAsync(new Uri(imagesZipUris.First()),
theme.themeName + "_images.zip", imagesZipUris.Skip(1).ToList());
}
else
{
Expand All @@ -52,14 +54,25 @@ public void OnDownloadProgressChanged(object sender, DownloadProgressChangedEven

public async void OnDownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
ThemeConfig theme = downloadQueue.Dequeue();
List<string> imagesZipUris = (List<string>)e.UserState;

if (e.Error == null)
if (e.Error != null && imagesZipUris.Count > 0)
{
await Task.Run(() => ThemeManager.ExtractTheme(theme.themeName));
ThemeConfig theme = downloadQueue.Peek();
client.DownloadFileAsync(new Uri(imagesZipUris.First()),
theme.themeName + "_images.zip", imagesZipUris.Skip(1).ToList());
}
else
{
ThemeConfig theme = downloadQueue.Dequeue();

if (e.Error == null)
{
await Task.Run(() => ThemeManager.ExtractTheme(theme.themeName));
}

DownloadNext();
DownloadNext();
}
}
}
}
4 changes: 2 additions & 2 deletions src/WinDynamicDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Costura.Fody.3.1.6\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.3.1.6\build\Costura.Fody.props'))" />
<Error Condition="!Exists('packages\Fody.3.2.13\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.3.2.13\build\Fody.targets'))" />
<Error Condition="!Exists('packages\Fody.3.2.16\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.3.2.16\build\Fody.targets'))" />
</Target>
<Import Project="packages\Fody.3.2.13\build\Fody.targets" Condition="Exists('packages\Fody.3.2.13\build\Fody.targets')" />
<Import Project="packages\Fody.3.2.16\build\Fody.targets" Condition="Exists('packages\Fody.3.2.16\build\Fody.targets')" />
</Project>
2 changes: 1 addition & 1 deletion src/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="Angle" version="2.0.0" targetFramework="net461" />
<package id="Costura.Fody" version="3.1.6" targetFramework="net461" />
<package id="DesktopBridge.Helpers" version="1.1" targetFramework="net461" />
<package id="Fody" version="3.2.13" targetFramework="net461" developmentDependency="true" />
<package id="Fody" version="3.2.16" targetFramework="net461" developmentDependency="true" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="RestSharp" version="106.5.4" targetFramework="net461" />
<package id="SolarCalculator" version="2.0.4" targetFramework="net461" />
Expand Down
2 changes: 1 addition & 1 deletion src/themes/Mojave_Desert.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"imagesZipUri": "https://files.rb.gd/mojave_dynamic.zip",
"imagesZipUri": "https://files.rb.gd/mojave_dynamic.zip|https://box.heliohost.org/mojave_desert.zip",
"imageFilename": "mojave_dynamic_*.jpeg",
"dayImageList": [
2,
Expand Down
2 changes: 1 addition & 1 deletion src/themes/Solar_Gradients.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"imagesZipUri": "https://onedrive.live.com/download?cid=CC2E3BD0360C1775&resid=CC2E3BD0360C1775%21721&authkey=AK4kktXlvN1KJzQ",
"imagesZipUri": "https://onedrive.live.com/download?cid=CC2E3BD0360C1775&resid=CC2E3BD0360C1775%21721&authkey=AK4kktXlvN1KJzQ|https://box.heliohost.org/solar_gradients.zip",
"imageFilename": "solar_gradients_*.jpeg",
"dayImageList": [
5,
Expand Down

0 comments on commit 328f12d

Please sign in to comment.