コード例 #1
0
 private string WriteCommandsToString(CommandSet cmdset)
 {
     using (var stream = new StringWriter())
     {
         DateTime timestampUtc = DateTime.UtcNow;
         stream.WriteLine("FileVersion:{0}", MASTER_FILE_VERSION);
         stream.WriteLine("Timestamp=TimeUtc:'{0:o}'", timestampUtc);
         stream.WriteLine("AcknowledgementUtc:{0:o}", cmdset.Acknowledgement);
         stream.WriteLine("CommandCount:{0}", cmdset.Commands.Count);
         for (int i = 0; i < cmdset.Commands.Count; ++i)
         {
             Command cmd = cmdset.Commands[i];
             stream.WriteLine("Command{0}=TimeStampUtc:'{1}' CommandString:'{2}'", i + 1, cmd.TimeStampUtc, cmd.CommandString);
         }
         return(stream.ToString());
     }
 }
コード例 #2
0
        public void WriteCommandsToFile(CommandSet cmdset, string filepath)
        {
            var contents = WriteCommandsToString(cmdset);

            WriteTextToFile(contents, filepath);
        }