コード例 #1
0
 //Save
 private void MenuItem7_Click(object sender, EventArgs e)
 {
     IEnumerator enumerator = null;
     Transition.Transition transition = new Transition.Transition();
     TransitionTable transitionTable = new TransitionTable();
     if (this.Select_Group_A != null)
     {
         if (this.Select_Group_B != null)
         {
             if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
             {
                 string str = string.Format("{0} To {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));
                 string str1 = string.Format("{0}Data\\System\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                 XmlDocument xmlDocument = new XmlDocument();
                 transitionTable.Clear();
                 try
                 {
                     xmlDocument.Load(str1);
                     try
                     {
                         enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                         while (enumerator.MoveNext())
                         {
                             XmlElement current = (XmlElement)enumerator.Current;
                             string attribute = current.GetAttribute("Pattern");
                             string attribute1 = current.GetAttribute("MapTile");
                             string attribute2 = current.GetAttribute("StaticTile");
                             Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                             transitionTable.Add(transition1);
                         }
                     }
                     finally
                     {
                         if (enumerator is IDisposable)
                         {
                             ((IDisposable)enumerator).Dispose();
                         }
                     }
                 }
                 catch (Exception exception)
                 {
                     ProjectData.SetProjectError(exception);
                     Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                     ProjectData.ClearProjectError();
                 }
                 transitionTable.Save(string.Format("{0}.xml", str));
             }
         }
     }
 }
コード例 #2
0
 private void MenuItem5_Click(object sender, EventArgs e)
 {
     Transition transition = new Transition();
       TransitionTable transitionTable = new TransitionTable();
       if (this.Select_Group_A == null || this.Select_Group_B == null || ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, (Type) null, "Name", new object[0], (string[]) null, (bool[]) null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, (Type) null, "Name", new object[0], (string[]) null, (bool[]) null), false) == 0)
     return;
       string iDescription = string.Format("{0} To {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, (Type) null, "Name", new object[0], (string[]) null, (bool[]) null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, (Type) null, "Name", new object[0], (string[]) null, (bool[]) null)));
       string filename = string.Format("{0}Data\\System\\2Way_Template.xml", (object) AppDomain.CurrentDomain.BaseDirectory);
       XmlDocument xmlDocument = new XmlDocument();
       transitionTable.Clear();
       try
       {
     xmlDocument.Load(filename);
     try
     {
       foreach (XmlElement xmlElement in xmlDocument.SelectNodes("//Wizard/Tile"))
       {
     string attribute1 = xmlElement.GetAttribute("Pattern");
     string attribute2 = xmlElement.GetAttribute("MapTile");
     string attribute3 = xmlElement.GetAttribute("StaticTile");
     Transition iValue = new Transition(iDescription, attribute1, (ClsTerrain) this.Select_Group_A.SelectedItem, (ClsTerrain) this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute2), this.Get_StaticTiles(attribute3));
     transitionTable.Add(iValue);
       }
     }
     finally
     {
       IEnumerator enumerator;
       if (enumerator is IDisposable)
     ((IDisposable) enumerator).Dispose();
     }
       }
       catch (Exception ex)
       {
     ProjectData.SetProjectError(ex);
     int num = (int) Interaction.MsgBox((object) ex.ToString(), MsgBoxStyle.OKOnly, (object) null);
     ProjectData.ClearProjectError();
       }
       transitionTable.Save(string.Format("{0}.xml", (object) iDescription));
 }