public static AppInfo Load(string installPath) { var file = new FileInfo(Path.Combine(installPath, nameof(Manifest))); if (file.Exists) { using (var t = File.OpenRead(file.FullName)) { try { DataContractSerializer s = new DataContractSerializer(typeof(AppInfo), ExtraTypes.ToArray()); var xc = s.ReadObject(t) as AppInfo; return(xc); } catch (Exception e) { Common.Utils.Ionsole.WriteLine(file.FullName); } } } return(null); }
public void GenerateManifest() { var f = new FileInfo(Path.Combine(InstalationPath, nameof(Manifest))); if (!f.Exists) { f.Create().Dispose(); } ReInitResources(); using (var t = File.Open(f.FullName, FileMode.Truncate)) { DataContractSerializer s = new DataContractSerializer(typeof(AppInfo), ExtraTypes.ToArray()); s.WriteObject(t, this); } }