Last active
August 3, 2019 18:38
-
-
Save pigeonhands/2207b3227489559d784f to your computer and use it in GitHub Desktop.
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
<?php | |
$data = array(); | |
//This is an associative array with named keys as indexes | |
$data['Version'] = '1.0.0.0'; | |
$data['Hash'] = '85f6ee768c10f9c09931a6ae2a94a395'; | |
$data['Addition'] = 'Implemented multi threading, remove redundant code'; | |
$data['Link'] = '/update/myapp.exe'; | |
echo json_encode($data); | |
?> |
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
//Created using http://json2csharp.com/ | |
public class Update | |
{ | |
public string Version { get; set; } | |
public string Hash { get; set; } | |
public string Addition { get; set; } | |
public string Link { get; set; } | |
} |
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
//Use | |
// https://gist.github.com/PatPositron/10076559 | |
// For the JSON Library | |
private static void Main(string[] args) | |
{ | |
Update updateData; | |
using (var wc = new WebClient()) | |
{ | |
string response = wc.DownloadString("mywebsite.com/updater.php"); | |
updateData = JsonUtil.Deserialize<Update>(response); | |
} | |
Console.WriteLine(updateData.Version); | |
Console.WriteLine(updateData.Hash) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment