public static Grep ( string file, string regex ) : string | ||
file | string | |
regex | string | |
return | string |
public IdeConfigurationTool(string monoDevelopPath) { MonoDevelopPath = monoDevelopPath; string versionTxt = Path.Combine(MonoDevelopPath, "version.config"); Version = SystemUtil.Grep(versionTxt, @"Version=(.*)"); ProductVersionText = SystemUtil.Grep(versionTxt, "Label=(.*)"); CompatVersion = SystemUtil.Grep(versionTxt, "CompatVersion=(.*)"); SourceUrl = SystemUtil.Grep(versionTxt, "SourceUrl=(.*)", true); var customSource = Environment.GetEnvironmentVariable("MONODEVELOP_UPDATEINFO_SOURCE_URL"); if (!string.IsNullOrEmpty(customSource)) { SourceUrl = customSource; } var customLabel = Environment.GetEnvironmentVariable("MONODEVELOP_UPDATEINFO_LABEL"); if (!string.IsNullOrEmpty(customLabel)) { ProductVersionText = customLabel; } Version ver = new Version(Version); int vbuild = ver.Build != -1 ? ver.Build : 0; var cd = GetVersionCommitDistance(MonoDevelopPath); int vbrev = ver.Revision != -1 ? ver.Revision : cd; ReleaseId = "" + ver.Major + ver.Minor.ToString("00") + vbuild.ToString("00") + vbrev.ToString("0000"); ProductVersion = ver.Major + "." + ver.Minor + "." + vbuild + "." + vbrev; }
public IdeConfigurationTool(string monoDevelopPath) { MonoDevelopPath = monoDevelopPath; string versionTxt = Path.Combine(MonoDevelopPath, "version.config"); Version = SystemUtil.Grep(versionTxt, @"Version=(.*)"); ProductVersionText = SystemUtil.Grep(versionTxt, "Label=(.*)"); CompatVersion = SystemUtil.Grep(versionTxt, "CompatVersion=(.*)"); Version ver = new Version(Version); int vbuild = ver.Build != -1 ? ver.Build : 0; var cd = GetVersionCommitDistance(MonoDevelopPath); int vbrev = ver.Revision != -1 ? ver.Revision : cd; ReleaseId = "" + ver.Major + ver.Minor.ToString("00") + vbuild.ToString("00") + vbrev.ToString("0000"); ProductVersion = ver.Major + "." + ver.Minor + "." + vbuild + "." + vbrev; }