private static pb_AboutEntry ParseAboutEntry(string path) { if (!File.Exists(path)) { return(null); } pb_AboutEntry about = new pb_AboutEntry(); foreach (string str in File.ReadAllLines(path)) { if (str.StartsWith(pb_AboutEntry.KEY_NAME)) { about.name = str.Replace(pb_AboutEntry.KEY_NAME, "").Trim(); } else if (str.StartsWith(pb_AboutEntry.KEY_IDENTIFIER)) { about.identifier = str.Replace(pb_AboutEntry.KEY_IDENTIFIER, "").Trim(); } else if (str.StartsWith(pb_AboutEntry.KEY_VERSION)) { about.version = str.Replace(pb_AboutEntry.KEY_VERSION, "").Trim(); } else if (str.StartsWith(pb_AboutEntry.KEY_DATE)) { about.date = str.Replace(pb_AboutEntry.KEY_DATE, "").Trim(); } else if (str.StartsWith(pb_AboutEntry.KEY_CHANGELOG)) { about.changelogPath = str.Replace(pb_AboutEntry.KEY_CHANGELOG, "").Trim(); } } return(about); }
void SetAbout(pb_AboutEntry about) { this.about = about; if (File.Exists(about.changelogPath)) { string raw = File.ReadAllText(about.changelogPath); if (!string.IsNullOrEmpty(raw)) { pb_VersionInfo vi; pb_VersionUtil.FormatChangelog(raw, out vi, out changelogRichText); } } }
/** * Get information from the currently installed ProBuilder version. */ public static bool GetAboutEntry(out pb_AboutEntry about) { about = null; string[] matches = Directory.GetFiles("./Assets", "pc_AboutEntry_ProBuilder.txt", SearchOption.AllDirectories); if (matches == null || matches.Length < 1) { return(false); } for (int i = 0; i < matches.Length && about == null; i++) { about = ParseAboutEntry(matches[i]); } return(about != null); }