-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from beyluta/online-resources
Feature fetch online HTML resources
- Loading branch information
Showing
8 changed files
with
91 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"version": "1.1.3" | ||
"version": "1.1.3", | ||
"remoteResources": "https://7xdeveloper.com/api/AccessEndpoint.php?endpoint=getappconfigs&id=resources" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Widgets.Manager; | ||
|
||
namespace Remote | ||
{ | ||
public class RemoteResources | ||
{ | ||
private Configuration appConfig; | ||
|
||
public RemoteResources() | ||
{ | ||
string json = File.ReadAllText(WidgetAssets.assetsPath + "/config.json"); | ||
appConfig = JsonConvert.DeserializeObject<Configuration>(json); | ||
} | ||
|
||
public async void DownloadRemoteResources() | ||
{ | ||
using (HttpClient client = new HttpClient()) | ||
{ | ||
try | ||
{ | ||
string response = await client.GetStringAsync(appConfig.remoteResources); | ||
JArray array = JArray.Parse(response); | ||
foreach (JObject resource in array) | ||
{ | ||
string name = (string)resource["name"]; | ||
string content = (string)resource["html"]; | ||
string path = WidgetAssets.widgetsPath + $"\\{name}.html"; | ||
WidgetAssets.CreateHTMLFile(path, content); | ||
} | ||
} | ||
catch { } | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
struct Configuration | ||
{ | ||
public string version; | ||
public string remoteResources; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters