private Version(string version) { var match = VersionRegex.Match(version); if (!match.Success) { throw new ArgumentException($"'{version}' is not a valid eHSN version identifier."); } _versionComponents = match.Groups["components"].Value .Split('.') .Select(int.Parse) .ToArray(); _suffix = match.Groups["suffix"].Value; _version = version; }
void OnComment(Token token) { var value = (string)token.Value; var comment = value.Trim(); var versionMatch = VersionRegex.Match(comment); if (versionMatch.Success) { var version = int.Parse(versionMatch.Groups[1].Value); if (version > 1) { throw new InvalidDataException("Don't know how to parse yarn.lock with version " + version); } } _comments.Add(comment); }
// Takes the topmost selected drawing from data grid and sends to previewcontrol for displaying on sidebar public static void ShowDrawing() { MainForm.eDrawings.Control.eDrawingControlWrapper.CloseActiveDoc(""); IEnumerator <IDrawing> selected = DataGrid.GetSelectedDrawings(MainReference.DataGridReference); if (selected.MoveNext()) { Current = selected.Current.Path; MainReference.PreviewNameTextBoxRefernce.Text = Current.Split('\\').Last(); MainReference.PreviewLastModifiedTextBoxReference.Text = File.GetLastWriteTime(Current).ToShortDateString(); Match regMatch = VersionRegex.Match(Path.GetFileNameWithoutExtension(Current)); MainReference.PreviewRevisionTextBoxReference.Text = (regMatch.Success) ? regMatch.Value.ToUpper() : ""; MainForm.eDrawings.PreviewControl.eDrawingControlWrapper.OpenDoc(Current, false, false, false, ""); MainForm.eDrawings.PreviewControl.eDrawingControlWrapper.ViewOperator = EModelView.EMVOperators.eMVOperatorPan; } }