Esempio n. 1
0
        public static Attempt ParseXml(XmlElement node)
        {
            var            newTime       = Time.FromXml(node);
            var            index         = int.Parse(node.Attributes["id"].InnerText, CultureInfo.InvariantCulture);
            AtomicDateTime?started       = null;
            var            startedSynced = false;
            AtomicDateTime?ended         = null;
            var            endedSynced   = false;

            if (node.HasAttribute("started"))
            {
                var startedTime = DateTime.Parse(node.Attributes["started"].InnerText, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
                if (node.HasAttribute("isStartedSynced"))
                {
                    startedSynced = bool.Parse(node.Attributes["isStartedSynced"].InnerText);
                }
                started = new AtomicDateTime(startedTime, startedSynced);
            }

            if (node.HasAttribute("ended"))
            {
                var endedTime = DateTime.Parse(node.Attributes["ended"].InnerText, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
                if (node.HasAttribute("isEndedSynced"))
                {
                    endedSynced = bool.Parse(node.Attributes["isEndedSynced"].InnerText);
                }
                ended = new AtomicDateTime(endedTime, endedSynced);
            }

            return(new Attempt(index, newTime, started, ended));
        }
Esempio n. 2
0
 public Attempt(int index, Time time, AtomicDateTime? started, AtomicDateTime? ended)
     : this()
 {
     Index = index;
     Time = time;
     Started = started;
     Ended = ended;
 }
Esempio n. 3
0
        public static Attempt ParseXml(XmlElement node)
        {
            var            newTime       = Time.FromXml(node);
            var            index         = int.Parse(node.Attributes["id"].InnerText, CultureInfo.InvariantCulture);
            AtomicDateTime?started       = null;
            var            startedSynced = false;
            AtomicDateTime?ended         = null;
            var            endedSynced   = false;

            if (node.HasAttribute("started"))
            {
                var startedTime = DateTime.Parse(node.Attributes["started"].InnerText, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
                if (node.HasAttribute("isStartedSynced"))
                {
                    startedSynced = bool.Parse(node.Attributes["isStartedSynced"].InnerText);
                }
                started = new AtomicDateTime(startedTime, startedSynced);
            }

            if (node.HasAttribute("ended"))
            {
                var endedTime = DateTime.Parse(node.Attributes["ended"].InnerText, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
                if (node.HasAttribute("isEndedSynced"))
                {
                    endedSynced = bool.Parse(node.Attributes["isEndedSynced"].InnerText);
                }
                ended = new AtomicDateTime(endedTime, endedSynced);
            }

            TimeSpan?pauseTime = null;

            if (node.GetElementsByTagName("PauseTime").Count > 0)
            {
                TimeSpan x;
                if (TimeSpan.TryParse(node["PauseTime"].InnerText, out x))
                {
                    pauseTime = x;
                }
            }

            return(new Attempt(index, newTime, started, ended, pauseTime));
        }
Esempio n. 4
0
        public static Attempt ParseXml(XmlElement node)
        {
            var newTime = Time.FromXml(node);
            var index = int.Parse(node.Attributes["id"].InnerText, CultureInfo.InvariantCulture);
            AtomicDateTime? started = null;
            var startedSynced = false;
            AtomicDateTime? ended = null;
            var endedSynced = false;

            if (node.HasAttribute("started"))
            {
                var startedTime = DateTime.Parse(node.Attributes["started"].InnerText, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
                if (node.HasAttribute("isStartedSynced"))
                    startedSynced = bool.Parse(node.Attributes["isStartedSynced"].InnerText);
                started = new AtomicDateTime(startedTime, startedSynced);
            }

            if (node.HasAttribute("ended"))
            {
                var endedTime = DateTime.Parse(node.Attributes["ended"].InnerText, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
                if (node.HasAttribute("isEndedSynced"))
                    endedSynced = bool.Parse(node.Attributes["isEndedSynced"].InnerText);
                ended = new AtomicDateTime(endedTime, endedSynced);
            }

            return new Attempt(index, newTime, started, ended);
        }