// // Copyright 2014 Perforce Software Inc. // using Perforce.Helper; using Perforce.P4; using Perforce.ViewModel; using System; using System.ComponentModel; namespace Perforce.Model { public class VersionItem : ViewModelBase { private FileHistory _history; private FileMetaData _metadata; public FileHistory History { get { return _history; } set { _history = value; OnPropertyChanged(string.Empty); } } public FileMetaData MetaData { get { return _metadata; } set { _metadata = value; OnPropertyChanged(string.Empty); } } public string Description { get { return _history.Description; } } public string UserName { get { return _history.UserName; } } public int Revision { get { return _history.Revision; } } public DateTime Date { get { DateTime localtime = DateTime.MinValue; if (_metadata != null) { localtime = _metadata.HeadTime.ToLocalTime(); } return localtime; } } public FileAction Action { get { return _history.Action; } } public string[] Tags { get { string[] tags = null; if (_metadata != null && _metadata.Attributes != null) { if (_metadata.Attributes.ContainsKey("tags")) { var hexTags = _metadata.Attributes["tags"] as string; var tagList = ListingHelper.HexToString(hexTags); tags = tagList.Split(','); } } return tags; } } } }