示例#1
0
文件: Change.cs 项目: devoctomy/cachy
 private Change(
     ChangeLog log,
     Version releaseVersion,
     ItemChangeType type,
     DateTime date,
     string summary,
     string description,
     ItemChangePlatform platform)
 {
     _log            = log;
     _releaseVersion = releaseVersion;
     _changeType     = type;
     _date           = date;
     _summary        = summary;
     _description    = description;
     _platform       = platform;
 }
示例#2
0
        private static ChangeLog LoadDefault()
        {
            JObject json;

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("devoctomy.cachy.Build.Assets.Log.changes.json"))
            {
                using (JsonReader reader = new JsonTextReader(new StreamReader(stream)))
                {
                    reader.DateParseHandling = DateParseHandling.None;
                    json = JObject.Load(reader);
                }
            }

            ChangeLog changeLog = new ChangeLog(json);

            return(changeLog);
        }
示例#3
0
文件: Change.cs 项目: devoctomy/cachy
        public static Change FromJSON(
            ChangeLog log,
            Version version,
            JObject json)
        {
            ItemChangeType     type        = (ItemChangeType)Enum.Parse(typeof(ItemChangeType), json["Type"].Value <String>(), true);
            DateTime           date        = DateTime.ParseExact(json["Date"].Value <String>(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
            string             summary     = json["Summary"].Value <String>();
            string             description = json["Description"].Value <String>();
            ItemChangePlatform platform    = (ItemChangePlatform)Enum.Parse(typeof(ItemChangePlatform), json["Platform"].Value <String>(), true);

            return(new Change(
                       log,
                       version,
                       type,
                       date,
                       summary,
                       description,
                       platform));
        }
示例#4
0
        public static Release FromJSON(
            ChangeLog log,
            Version version,
            JObject json)
        {
            String   date        = json["Date"].Value <String>();
            DateTime?releaseDate = String.IsNullOrEmpty(date) ? (DateTime?)null : DateTime.ParseExact(date, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
            Release  release     = new Release(
                log,
                version,
                releaseDate);
            JArray changes = json["Changes"].Value <JArray>();

            foreach (JObject curChange in changes)
            {
                Change change = Change.FromJSON(
                    log,
                    release.Version,
                    curChange);
                release._changes.Add(change);
            }
            release._changes.OrderByDescending(ch => ch.Date);
            return(release);
        }