コード例 #1
0
ファイル: CalendarWeek.cs プロジェクト: Stexinator/chummer5a
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="objCulture">Culture in which to print numbers.</param>
        /// <param name="blnPrintNotes">Whether to print notes attached to the CalendarWeek.</param>
        public async ValueTask Print(XmlWriter objWriter, CultureInfo objCulture, bool blnPrintNotes = true)
        {
            if (objWriter == null)
            {
                return;
            }
            // <week>
            XmlElementWriteHelper objBaseElement = await objWriter.StartElementAsync("week");

            try
            {
                await objWriter.WriteElementStringAsync("guid", InternalId);

                await objWriter.WriteElementStringAsync("year", Year.ToString(objCulture));

                await objWriter.WriteElementStringAsync("month", Month.ToString(objCulture));

                await objWriter.WriteElementStringAsync("week", MonthWeek.ToString(objCulture));

                if (blnPrintNotes)
                {
                    await objWriter.WriteElementStringAsync("notes", Notes);
                }
            }
            finally
            {
                // </week>
                await objBaseElement.DisposeAsync();
            }
        }
コード例 #2
0
 /// <summary>
 /// Print the object's XML to the XmlWriter.
 /// </summary>
 /// <param name="objWriter">XmlTextWriter to write with.</param>
 /// <param name="objCulture">Culture in which to print numbers.</param>
 /// <param name="blnPrintNotes">Whether to print notes attached to the CalendarWeek.</param>
 public void Print(XmlTextWriter objWriter, CultureInfo objCulture, bool blnPrintNotes = true)
 {
     objWriter.WriteStartElement("week");
     objWriter.WriteElementString("year", Year.ToString(objCulture));
     objWriter.WriteElementString("month", Month.ToString(objCulture));
     objWriter.WriteElementString("week", MonthWeek.ToString(objCulture));
     if (blnPrintNotes)
     {
         objWriter.WriteElementString("notes", Notes);
     }
     objWriter.WriteEndElement();
 }