private void OnCopySelectedRevisionToClipboard(object sender, EventArgs e) { if (this._givernuManager.GitEntriesViewer.SelectedItems.Count == 1) { GitEntry gitEntry = this._givernuManager.GitEntriesViewer.SelectedItems[0].Tag as GitEntry; Clipboard.SetText(gitEntry.ToText()); } }
private void ProceedLogFile(string fileName) { using (StreamReader reader = new StreamReader(fileName)) { string[] lines = reader.ReadToEnd().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string line in lines) { GitEntry gitEntry = new GitEntry(); string[] lineParts = line.Split(new string[] { "\t" }, StringSplitOptions.RemoveEmptyEntries); string data = lineParts[0]; string description = lineParts[1].Replace("commit:", "").Trim(); string[] cells = data.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); gitEntry.Number = 0; gitEntry.ID = cells[1]; gitEntry.Author = cells[2]; gitEntry.Description = description; gitEntry.Branch = new FileInfo(fileName).Name; long unixSeconds = Int64.Parse(cells[4]); float hourOffset = Single.Parse(cells[5].Substring(0, 3)); float minuteOffset = Single.Parse(cells[5].Substring(3, 2)); DateTimeOffset dto = DateTimeOffset.FromUnixTimeSeconds(unixSeconds); gitEntry.DateTime = dto.DateTime.AddHours(hourOffset).AddMinutes(minuteOffset); gitEntry.Tags = TagsDictionary.ContainsKey(gitEntry.ID)? TagsDictionary[gitEntry.ID] : new List <string>(); this.GitEntries.Add(gitEntry); } } }