コード例 #1
0
        /// <summary>
        /// Formats a message with a given starting indent.
        /// </summary>
        /// <param name="msg">message to format</param>
        /// <param name="depth">starting indent</param>
        protected void Format(IFudgeFieldContainer msg, int depth)
        {
            if (msg == null)
            {
                return;
            }
            IList <IFudgeField> fields     = msg.GetAllFields();
            IList <string>      fieldSpecs = new List <string>(fields.Count);
            int maxFieldSpecWidth          = -1;
            int maxTypeNameWidth           = -1;

            for (int i = 0; i < fields.Count; i++)
            {
                IFudgeField field     = fields[i];
                string      fieldSpec = GetFieldSpec(field, i, depth);
                maxFieldSpecWidth = Math.Max(maxFieldSpecWidth, fieldSpec.Length);
                maxTypeNameWidth  = Math.Max(maxTypeNameWidth, GetTypeName(field.Type).Length);
                fieldSpecs.Add(fieldSpec);
            }
            for (int i = 0; i < fields.Count; i++)
            {
                IFudgeField field     = fields[i];
                string      fieldSpec = fieldSpecs[i];
                Format(field, i, depth, fieldSpec, maxFieldSpecWidth, maxTypeNameWidth);
            }
        }
コード例 #2
0
        private static int WriteMsgFields(BinaryWriter bw, IFudgeFieldContainer container, IFudgeTaxonomy taxonomy) //throws IOException
        {
            int nWritten = 0;

            foreach (IFudgeField field in container.GetAllFields())
            {
                nWritten += WriteField(bw, field.Type, field.Value, field.Ordinal, field.Name, taxonomy);
            }
            return(nWritten);
        }
コード例 #3
0
 //throws IOException
 private static int WriteMsgFields(BinaryWriter bw, IFudgeFieldContainer container, IFudgeTaxonomy taxonomy)
 {
     int nWritten = 0;
     foreach (IFudgeField field in container.GetAllFields())
     {
         nWritten += WriteField(bw, field.Type, field.Value, field.Ordinal, field.Name, taxonomy);
     }
     return nWritten;
 }
コード例 #4
0
 public State(IFudgeFieldContainer msg)
 {
     Msg = msg;
     Fields = new Queue<IFudgeField>(msg.GetAllFields());
 }
コード例 #5
0
 /// <summary>
 /// Formats a message with a given starting indent.
 /// </summary>
 /// <param name="msg">message to format</param>
 /// <param name="depth">starting indent</param>
 protected void Format(IFudgeFieldContainer msg, int depth)
 {
     if (msg == null)
     {
         return;
     }
     IList<IFudgeField> fields = msg.GetAllFields();
     IList<string> fieldSpecs = new List<string>(fields.Count);
     int maxFieldSpecWidth = -1;
     int maxTypeNameWidth = -1;
     for (int i = 0; i < fields.Count; i++)
     {
         IFudgeField field = fields[i];
         string fieldSpec = GetFieldSpec(field, i, depth);
         maxFieldSpecWidth = Math.Max(maxFieldSpecWidth, fieldSpec.Length);
         maxTypeNameWidth = Math.Max(maxTypeNameWidth, GetTypeName(field.Type).Length);
         fieldSpecs.Add(fieldSpec);
     }
     for (int i = 0; i < fields.Count; i++)
     {
         IFudgeField field = fields[i];
         string fieldSpec = fieldSpecs[i];
         Format(field, i, depth, fieldSpec, maxFieldSpecWidth, maxTypeNameWidth);
     }
 }