Exemple #1
0
 public void UpdateFields(ref SequenceElementField[] fields)
 {
     if (fields.Length != fieldNames.Length)               // fields size change
     {
         SequenceElementField[] oldFields = new SequenceElementField[fields.Length];
         fields.CopyTo(oldFields, 0);
         fields = new SequenceElementField[fieldNames.Length];
         // Copy existing fields and trim
         for (int i = 0; i < oldFields.Length && i < fieldNames.Length; i++)
         {
             fields[i] = oldFields[i];
         }
         // Append new fields
         for (int i = oldFields.Length; i < fieldNames.Length; i++)
         {
             fields[i] = new SequenceElementField()
             {
                 type = fieldTypes[i]
             };
         }
     }
     // Convert fields
     for (int i = 0; i < fields.Length; i++)
     {
         if (fields[i].type != fieldTypes[i])                   // Conversion needed
         {
             fields[i].ConvertTo(fieldTypes[i]);
         }
     }
 }
Exemple #2
0
 public void ResetFields(ref SequenceElementField[] fields)
 {
     fields = new SequenceElementField[fieldTypes.Length];
     for (int i = 0; i < fieldTypes.Length; i++)
     {
         fields[i].type = fieldTypes[i];
     }
 }