예제 #1
0
        public void ReadXml(XmlReader reader)
        {
            string t;

            Name    = reader.ReadElementString("Name");
            Author  = reader.ReadElementString("Author");
            Date    = reader.ReadElementString("Date");
            Version = reader.ReadElementString("Version");
            t       = reader.ReadElementString("Pin");
            if (t != null)
            {
                Pin = Int32.Parse(t);
            }
            t = reader.ReadElementString("StartOffset");
            if (t != null)
            {
                StartOffset = Int32.Parse(t);
            }
            reader.ReadElementString("StartOffset");
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                reader.ReadStartElement("Instruction");
                Instruction i = new Instruction();
                i.Operation = OperationHelper.Parse(reader.ReadElementString("Operation"));
                i.Modifier  = (Modifier)Enum.Parse(typeof(Modifier), reader.ReadElementString("Modifier"));
                i.ModeA     = ModeHelper.Parse(reader.ReadElementString("ModeA"));
                i.ValueA    = Int32.Parse(reader.ReadElementString("ValueA"));
                i.ModeB     = ModeHelper.Parse(reader.ReadElementString("ModeB"));
                i.ValueB    = Int32.Parse(reader.ReadElementString("ValueB"));
                Instructions.Add(i);
                reader.ReadEndElement();
                reader.MoveToContent();
            }
        }
예제 #2
0
 public void WriteXml(XmlWriter writer)
 {
     if (Name != null)
     {
         writer.WriteAttributeString("Name", Name);
     }
     if (Author != null)
     {
         writer.WriteAttributeString("Author", Author);
     }
     if (Date != null)
     {
         writer.WriteAttributeString("Date", Date);
     }
     if (Version != null)
     {
         writer.WriteAttributeString("Version", Version);
     }
     if (Pin != PSpace.UNSHARED)
     {
         writer.WriteAttributeString("Pin", Pin.ToString());
     }
     if (StartOffset != 0)
     {
         writer.WriteAttributeString("StartOffset", StartOffset.ToString());
     }
     foreach (IInstruction i in Instructions)
     {
         writer.WriteStartElement("Instruction");
         writer.WriteAttributeString("Operation", i.Operation.ToString());
         writer.WriteAttributeString("Modifier", i.Modifier.ToString());
         writer.WriteAttributeString("ModeA", ModeHelper.ToString(i.ModeA));
         writer.WriteAttributeString("ValueA", i.ValueA.ToString());
         writer.WriteAttributeString("ModeB", ModeHelper.ToString(i.ModeB));
         writer.WriteAttributeString("ValueB", i.ValueB.ToString());
         writer.WriteEndElement();
     }
 }
예제 #3
0
 public static string GetName(Operation Operation, Modifier Modifier, Mode ModeA, Mode ModeB)
 {
     return(Operation + "_" + Modifier + "_" + ModeHelper.ToAbrev(ModeA) + ModeHelper.ToAbrev(ModeB));
 }
예제 #4
0
 public override string ToString()
 {
     return
         (Operation + "." + Modifier.ToString().PadRight(3) + ModeHelper.ToString(ModeA) +
          ValueA.ToString().PadLeft(6) + ", " + ModeHelper.ToString(ModeB) + ValueB.ToString().PadLeft(6));
 }