コード例 #1
0
        public Mod(XElement x)
            : base((string)x.Element("Path"))
        {
            Destination = (ModDestinations)Enum.Parse(typeof(ModDestinations), (string)x.Element("Destination"));
            m_id        = (int)x.Element("ID");
            m_active    = (bool)x.Element("Active");
            XElement instAct = x.Element("InstallActions");

            InstallActions = new List <IFSAction>();
            foreach (XElement xe in instAct.Elements())
            {
                Type   t          = Type.GetType(xe.Name.ToString());
                Type[] paramTypes = new Type[3];
                paramTypes[0] = typeof(string);
                paramTypes[1] = typeof(string);
                paramTypes[2] = typeof(ICollection <KeyValuePair <string, string> >);
                ConstructorInfo ctor = t.GetConstructor(paramTypes);
                IFSAction       act;
                act = (IFSAction)ctor.Invoke(
                    new object[] { (string)xe.Element("source"),
                                   (string)xe.Element("target"),
                                   tags });
                InstallActions.Add(act);
            }
        }
コード例 #2
0
 public Mod(string f, int id)
     : base(f)
 {
     InstallActions = new List <IFSAction>();
     Destination    = findDestination();
     m_id           = id;
 }
コード例 #3
0
        public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            ModDestinations xitem = (item as Mod).Destination;

            //string dest = xitem.SelectSingleNode("Destination").InnerText;
            switch (xitem)
            {
            case ModDestinations.MODS:
                return(ModsTemplate);

            case ModDestinations.COMPLEX:
                return(ComplexTemplate);

            case ModDestinations.JAR:
                return(JarTemplate);

            default:
                return(null);
            }
        }