コード例 #1
0
 public SelectionInstructionFactory(string filename)
 {
     if (string.IsNullOrEmpty(filename))
     {
         mCurrentInstruction = LoadDefaultInstruction();
     }
     else
     {
         mFilename = filename;
         XmlDocument doc = new XmlDocument();
         doc.Load(mFilename);
         XmlElement doc_root          = doc.DocumentElement;
         string     selected_strategy = doc_root.Attributes["strategy"].Value;
         foreach (XmlElement xml_level1 in doc_root.ChildNodes)
         {
             if (xml_level1.Name == "strategy")
             {
                 string attrname = xml_level1.Attributes["name"].Value;
                 if (attrname == selected_strategy)
                 {
                     mCurrentInstruction = LoadInstructionFromXml(selected_strategy, xml_level1);
                 }
             }
         }
         if (mCurrentInstruction == null)
         {
             mCurrentInstruction = LoadDefaultInstruction();
         }
     }
 }
コード例 #2
0
 public SelectionInstructionFactory()
 {
     mCurrentInstruction = LoadDefaultInstruction();
 }