-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b976f56
commit 1989fe6
Showing
18 changed files
with
854 additions
and
10 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
Binary file added
BIN
+4.19 KB
Source-Code/Add-Ons/InstallerMotoplay.Desktop/motoplay-installer-logo.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.68 KB
Source-Code/Add-Ons/InstallerMotoplay/Assets/motoplay-installer-ic32x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.57 KB
...de/Add-Ons/InstallerMotoplay/Assets/motoplay-installer-logo-redistributable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
74 changes: 74 additions & 0 deletions
74
Source-Code/Add-Ons/InstallerMotoplay/Scripts/AppRepositoryInfo.cs
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,74 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace InstallerMotoplay.Scripts | ||
{ | ||
/* | ||
* This class manage the download info of a JSON | ||
*/ | ||
|
||
public class AppRepositoryInfo | ||
{ | ||
//Classes of script | ||
public class LoadedData | ||
{ | ||
//*** Data to be saved ***// | ||
|
||
public string version = ""; | ||
public string[] downloadPartsLinks = new string[0]; | ||
} | ||
|
||
//Private variables | ||
private string filePath = ""; | ||
|
||
//Public variables | ||
public LoadedData loadedData = null; | ||
|
||
//Core methods | ||
|
||
public AppRepositoryInfo(string filePath) | ||
{ | ||
//Check if save file exists | ||
bool saveExists = File.Exists(filePath); | ||
|
||
//Store the file path | ||
this.filePath = filePath; | ||
|
||
//If have a save file, load it | ||
if (saveExists == true) | ||
Load(); | ||
//If a save file don't exists, create it | ||
if (saveExists == false) | ||
Save(); | ||
} | ||
|
||
private void Load() | ||
{ | ||
//Load the data | ||
string loadedDataString = File.ReadAllText(filePath); | ||
|
||
//Convert it to a loaded data object | ||
loadedData = JsonConvert.DeserializeObject<LoadedData>(loadedDataString); | ||
} | ||
|
||
//Public methods | ||
|
||
public void Save() | ||
{ | ||
//If the loaded data is null, create one | ||
if (loadedData == null) | ||
loadedData = new LoadedData(); | ||
|
||
//Save the data | ||
File.WriteAllText(filePath, JsonConvert.SerializeObject(loadedData)); | ||
|
||
//Load the data to update loaded data | ||
Load(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.