-
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
Showing
5 changed files
with
71 additions
and
4 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
|
||
namespace GitInstaller | ||
{ | ||
[Serializable] | ||
public class ZipSettings | ||
{ | ||
public string Subfolder; | ||
|
||
public ZipSettings() { } | ||
|
||
public static ZipSettings FromFile(string fname) | ||
{ | ||
if (File.Exists(fname)) | ||
{ | ||
return JsonConvert.DeserializeObject<ZipSettings>(File.ReadAllText(fname)); | ||
} | ||
return null; | ||
} | ||
|
||
public static ZipSettings FromStream(Stream stream) | ||
{ | ||
using (StreamReader reader = new StreamReader(stream)) | ||
{ | ||
try | ||
{ | ||
ZipSettings zs = JsonConvert.DeserializeObject<ZipSettings>(reader.ReadToEnd()); | ||
return zs; | ||
} | ||
catch (Exception ex) | ||
{ | ||
System.Windows.Forms.MessageBox.Show("There was an error while reading the ZipSettings! => " + ex.Message); | ||
return null; | ||
} | ||
} | ||
} | ||
} | ||
} |