Ejemplo n.º 1
0
            /// <summary>
            /// Converts the report object to a settings string.
            /// </summary>
            /// <returns>A string that contains the report configuration settings.</returns>
            public override string ToString()
            {
                XmlDocument doc = new XmlDocument();

                // Create the document root.
                XmlElement rootElement = doc.CreateElement("report");

                rootElement.SetAttribute("enabled", Enabled.ToString());
                doc.AppendChild(rootElement);

                // If reporting is enabled continue to build the string. Otherwise we're done.
                if (Enabled)
                {
                    // Create the frequency of the report generation.
                    XmlElement parent = doc.CreateElement("generate");
                    parent.SetAttribute("frequency", Frequency.ToString());
                    rootElement.AppendChild(parent);

                    // Create the time element.
                    XmlElement child = doc.CreateElement("time");
                    child.InnerText = TimeOfDay.ToString();
                    parent.AppendChild(child);

                    // Depending on the frequency type, the time parameters will be different.
                    switch (Frequency)
                    {
                    case ReportFrequency.Daily:
                        break;

                    case ReportFrequency.Weekly:
                        // Create the day of the week.
                        child           = doc.CreateElement("dayofweek");
                        child.InnerText = Weekday.ToString();
                        parent.AppendChild(child);
                        break;

                    case ReportFrequency.Monthly:
                        // Create the day of the month.
                        child           = doc.CreateElement("dayofmonth");
                        child.InnerText = DayOfMonth.ToString();
                        parent.AppendChild(child);
                        break;
                    }

                    // Create the report location information.
                    parent           = doc.CreateElement("location");
                    parent.InnerText = (IsiFolder) ? "ifolder" : "directory";
                    rootElement.AppendChild(parent);

                    // Create the report format.
                    parent           = doc.CreateElement("format");
                    parent.InnerText = Format.ToString();
                    rootElement.AppendChild(parent);
                }

                return(doc.InnerXml);
            }
Ejemplo n.º 2
0
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("DayOfMonth", true, out subEle);
            subEle.Value = DayOfMonth.ToString();

            ele.TryPathTo("MonthsSince2001", true, out subEle);
            subEle.Value = MonthsSince2001.ToString();
        }
        public string ToString(bool full, string dateSeparator = "/", string timeSeparator = ":")
        {
            var date = new StringBuilder();

            date.Append(full ? Year.ToString("####") : Year.ToString())
            .Append(dateSeparator)
            .Append(full ? Month.ToString("##") : Month.ToString())
            .Append(dateSeparator)
            .Append(full ? DayOfMonth.ToString("##") : DayOfMonth.ToString());

            var time = new StringBuilder();

            time.Append(full ? Hour.ToString("##") : Hour.ToString())
            .Append(timeSeparator)
            .Append(full ? Minute.ToString("##") : Minute.ToString());

            if (ShowTimeSecond)
            {
                time.Append(timeSeparator)
                .Append(full ? Second.ToString("##") : Second.ToString());
            }

            return(ShowTime ? $"{date} {time}" : $"{date}");
        }
Ejemplo n.º 4
0
 public string ToLongString()
 {
     return(DayOfWeek + " " + DayOfMonth.ToString() + " " + MonthName + " " + Year.ToString());
 }
Ejemplo n.º 5
0
 public string ToShortString()
 {
     return(Year.ToString() + "/" + (Month < 10 ? "0" + Month.ToString() : Month.ToString()) + "/" + (DayOfMonth < 10 ? "0" + DayOfMonth.ToString() : DayOfMonth.ToString()));
 }
Ejemplo n.º 6
0
 // This form will be used in JSON.
 public override string ToString() => DayOfMonth.ToString();