Ejemplo n.º 1
0
 /// <seealso cref="Parser.GetModDependencies()"/>
 public override CompositeDependency GetModDependencies()
 {
     CompositeDependency cpdDependency = new CompositeDependency(DependencyOperator.And);
     XmlNodeList xnlDependencies = XmlConfig.SelectNodes("/config/moduleDependencies/*");
     foreach (XmlNode xndDependency in xnlDependencies)
     {
         switch (xndDependency.Name)
         {
             case "falloutDependency":
                 Version verMinFalloutVersion = new Version(xndDependency.Attributes["version"].InnerText);
                 cpdDependency.Dependencies.Add(new GameVersionDependency(StateManager, verMinFalloutVersion));
                 break;
             case "fommDependency":
                 Version verMinFommVersion = new Version(xndDependency.Attributes["version"].InnerText);
                 cpdDependency.Dependencies.Add(new FommDependency(StateManager, verMinFommVersion));
                 break;
             case "fileDependency":
                 string strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                 cpdDependency.Dependencies.Add(new FileDependency(strDependency, ModFileState.Active, StateManager));
                 break;
             default:
                 IDependency dpnExtensionDependency = ParserExtension.ParseDependency(xndDependency, StateManager);
                 if (dpnExtensionDependency != null)
                     cpdDependency.Dependencies.Add(dpnExtensionDependency);
                 else
                     throw new ParserException("Invalid dependency node: " + xndDependency.Name + ". At this point the config file has been validated against the schema, so there's something wrong with the parser.");
                 break;
         }
     }
     return cpdDependency;
 }
Ejemplo n.º 2
0
        /// <summary>
        ///   Reads the dependency information from the given node.
        /// </summary>
        /// <param name="p_xndCompositeDependency">The node from which to load the dependency information.</param>
        /// <returns>A <see cref="CompositeDependency" /> representing the dependency described in the given node.</returns>
        protected virtual CompositeDependency loadDependency(XmlNode p_xndCompositeDependency)
        {
            var dopOperator =
                (DependencyOperator)
                Enum.Parse(typeof(DependencyOperator), p_xndCompositeDependency.Attributes["operator"].InnerText);
            var cpdDependency   = new CompositeDependency(dopOperator);
            var xnlDependencies = p_xndCompositeDependency.ChildNodes;

            foreach (XmlNode xndDependency in xnlDependencies)
            {
                switch (xndDependency.Name)
                {
                case "dependancies":
                    cpdDependency.Dependencies.Add(loadDependency(xndDependency));
                    break;

                case "dependancy":
                    var strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                    var mfsModState   =
                        (ModFileState)Enum.Parse(typeof(ModFileState), xndDependency.Attributes["state"].InnerText);
                    cpdDependency.Dependencies.Add(new FileDependency(strDependency, mfsModState, StateManager));
                    break;
                }
            }
            return(cpdDependency);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Reads the dependency information from the given node.
        /// </summary>
        /// <param name="p_xndCompositeDependency">The node from which to load the dependency information.</param>
        /// <returns>A <see cref="CompositeDependency" /> representing the dependency described in the given node.</returns>
        protected override CompositeDependency loadDependency(XmlNode p_xndCompositeDependency)
        {
            if (p_xndCompositeDependency == null)
            {
                return(null);
            }
            var dopOperator =
                (DependencyOperator)
                Enum.Parse(typeof(DependencyOperator), p_xndCompositeDependency.Attributes["operator"].InnerText);
            var cpdDependency   = new CompositeDependency(dopOperator);
            var xnlDependencies = p_xndCompositeDependency.ChildNodes;

            foreach (XmlNode xndDependency in xnlDependencies)
            {
                switch (xndDependency.Name)
                {
                case "dependencies":
                    cpdDependency.Dependencies.Add(loadDependency(xndDependency));
                    break;

                case "fileDependency":
                    var strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                    var mfsModState   =
                        (ModFileState)Enum.Parse(typeof(ModFileState), xndDependency.Attributes["state"].InnerText);
                    cpdDependency.Dependencies.Add(new FileDependency(strDependency, mfsModState, StateManager));
                    break;

                case "flagDependency":
                    var strFlagName = xndDependency.Attributes["flag"].InnerText;
                    var strValue    = xndDependency.Attributes["value"].InnerText;
                    cpdDependency.Dependencies.Add(new FlagDependency(strFlagName, strValue, StateManager));
                    break;

                case "falloutDependency":
                    var verMinFalloutVersion = new Version(xndDependency.Attributes["version"].InnerText);
                    cpdDependency.Dependencies.Add(new GameVersionDependency(StateManager, verMinFalloutVersion));
                    break;

                case "fommDependency":
                    var verMinFommVersion = new Version(xndDependency.Attributes["version"].InnerText);
                    cpdDependency.Dependencies.Add(new FommDependency(StateManager, verMinFommVersion));
                    break;

                default:
                    var dpnExtensionDependency = ParserExtension.ParseDependency(xndDependency, StateManager);
                    if (dpnExtensionDependency != null)
                    {
                        cpdDependency.Dependencies.Add(dpnExtensionDependency);
                    }
                    else
                    {
                        throw new ParserException("Invalid dependency node: " + xndDependency.Name +
                                                  ". At this point the config file has been validated against the schema, so there's something wrong with the parser.");
                    }
                    break;
                }
            }
            return(cpdDependency);
        }
Ejemplo n.º 4
0
 /// <summary>
 ///   Reads the dependency information from the given node.
 /// </summary>
 /// <param name="p_xndCompositeDependency">The node from which to load the dependency information.</param>
 /// <returns>A <see cref="CompositeDependency" /> representing the dependency described in the given node.</returns>
 protected override CompositeDependency loadDependency(XmlNode p_xndCompositeDependency)
 {
   if (p_xndCompositeDependency == null)
   {
     return null;
   }
   var dopOperator =
     (DependencyOperator)
       Enum.Parse(typeof (DependencyOperator), p_xndCompositeDependency.Attributes["operator"].InnerText);
   var cpdDependency = new CompositeDependency(dopOperator);
   var xnlDependencies = p_xndCompositeDependency.ChildNodes;
   foreach (XmlNode xndDependency in xnlDependencies)
   {
     switch (xndDependency.Name)
     {
       case "dependencies":
         cpdDependency.Dependencies.Add(loadDependency(xndDependency));
         break;
       case "fileDependency":
         var strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
         var mfsModState =
           (ModFileState) Enum.Parse(typeof (ModFileState), xndDependency.Attributes["state"].InnerText);
         cpdDependency.Dependencies.Add(new FileDependency(strDependency, mfsModState, StateManager));
         break;
       case "flagDependency":
         var strFlagName = xndDependency.Attributes["flag"].InnerText;
         var strValue = xndDependency.Attributes["value"].InnerText;
         cpdDependency.Dependencies.Add(new FlagDependency(strFlagName, strValue, StateManager));
         break;
       case "gameDependency":
         var verMinFalloutVersion = new Version(xndDependency.Attributes["version"].InnerText);
         cpdDependency.Dependencies.Add(new GameVersionDependency(StateManager, verMinFalloutVersion));
         break;
       case "fommDependency":
         var verMinFommVersion = new Version(xndDependency.Attributes["version"].InnerText);
         cpdDependency.Dependencies.Add(new FommDependency(StateManager, verMinFommVersion));
         break;
       default:
         var dpnExtensionDependency = ParserExtension.ParseDependency(xndDependency, StateManager);
         if (dpnExtensionDependency != null)
         {
           cpdDependency.Dependencies.Add(dpnExtensionDependency);
         }
         else
         {
           throw new ParserException("Invalid dependency node: " + xndDependency.Name +
                                     ". At this point the config file has been validated against the schema, so there's something wrong with the parser.");
         }
         break;
     }
   }
   return cpdDependency;
 }
 private void CreateDependency(CompositeDependency param)
 {
     if (param == null && CompositeDependency == null)
     {
         CompositeDependency = CompositeDependency.Create();
     }
     else
     {
         if (param != null)
         {
             param.Dependencies = CompositeDependency.Create();
         }
         else
         {
             throw new ArgumentException();
         }
     }
 }
 private void RemoveDependency(CompositeDependency param)
 {
     if (param.Parent == null && CompositeDependency != null)
     {
         CompositeDependency = null;
     }
     else
     {
         if (param.Parent != null)
         {
             param.Parent.Dependencies = null;
         }
         else
         {
             throw new ArgumentException();
         }
     }
 }
Ejemplo n.º 7
0
        /// <seealso cref="Parser.GetModDependencies()" />
        public override CompositeDependency GetModDependencies()
        {
            var cpdDependency   = new CompositeDependency(DependencyOperator.And);
            var xnlDependencies = XmlConfig.SelectNodes("/config/moduleDependancies/*");

            foreach (XmlNode xndDependency in xnlDependencies)
            {
                switch (xndDependency.Name)
                {
                case "falloutDependancy":
                    var verMinFalloutVersion = new Version(xndDependency.Attributes["version"].InnerText);
                    cpdDependency.Dependencies.Add(new GameVersionDependency(StateManager, verMinFalloutVersion));
                    break;

                case "fommDependancy":
                    var verMinFommVersion = new Version(xndDependency.Attributes["version"].InnerText);
                    cpdDependency.Dependencies.Add(new FommDependency(StateManager, verMinFommVersion));
                    break;

                case "fileDependancy":
                    var strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                    cpdDependency.Dependencies.Add(new FileDependency(strDependency, ModFileState.Active, StateManager));
                    break;

                default:
                    var dpnExtensionDependency = ParserExtension.ParseDependency(xndDependency, StateManager);
                    if (dpnExtensionDependency != null)
                    {
                        cpdDependency.Dependencies.Add(dpnExtensionDependency);
                    }
                    else
                    {
                        throw new ParserException("Invalid dependency node: " + xndDependency.Name +
                                                  ". At this point the config file has been validated against the schema, so there's something wrong with the parser.");
                    }
                    break;
                }
            }
            return(cpdDependency);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///   Reads the dependency information from the given node.
        /// </summary>
        /// <param name="p_xndCompositeDependency">The node from which to load the dependency information.</param>
        /// <returns>A <see cref="CompositeDependency" /> representing the dependency described in the given node.</returns>
        protected override CompositeDependency loadDependency(XmlNode p_xndCompositeDependency)
        {
            var dopOperator =
                (DependencyOperator)
                Enum.Parse(typeof(DependencyOperator), p_xndCompositeDependency.Attributes["operator"].InnerText);
            var cpdDependency   = new CompositeDependency(dopOperator);
            var xnlDependencies = p_xndCompositeDependency.ChildNodes;

            foreach (XmlNode xndDependency in xnlDependencies)
            {
                switch (xndDependency.Name)
                {
                case "dependencies":
                    cpdDependency.Dependencies.Add(loadDependency(xndDependency));
                    break;

                case "fileDependency":
                    var strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                    var mfsModState   =
                        (ModFileState)Enum.Parse(typeof(ModFileState), xndDependency.Attributes["state"].InnerText);
                    cpdDependency.Dependencies.Add(new FileDependency(strDependency, mfsModState, StateManager));
                    break;

                case "flagDependency":
                    var strFlagName = xndDependency.Attributes["flag"].InnerText;
                    var strValue    = xndDependency.Attributes["value"].InnerText;
                    cpdDependency.Dependencies.Add(new FlagDependency(strFlagName, strValue, StateManager));
                    break;

                default:
                    throw new ParserException("Invalid plugin dependency node: " + xndDependency.Name +
                                              ". At this point the config file has been validated against the schema, so there's something wrong with the parser.");
                }
            }
            return(cpdDependency);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Reads the dependency information from the given node.
 /// </summary>
 /// <param name="p_xndCompositeDependency">The node from which to load the dependency information.</param>
 /// <returns>A <see cref="CompositeDependency"/> representing the dependency described in the given node.</returns>
 protected override CompositeDependency loadDependency(XmlNode p_xndCompositeDependency)
 {
     DependencyOperator dopOperator = (DependencyOperator)Enum.Parse(typeof(DependencyOperator), p_xndCompositeDependency.Attributes["operator"].InnerText);
     CompositeDependency cpdDependency = new CompositeDependency(dopOperator);
     XmlNodeList xnlDependencies = p_xndCompositeDependency.ChildNodes;
     foreach (XmlNode xndDependency in xnlDependencies)
     {
         switch (xndDependency.Name)
         {
             case "dependencies":
                 cpdDependency.Dependencies.Add(loadDependency(xndDependency));
                 break;
             case "fileDependency":
                 string strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                 ModFileState mfsModState = (ModFileState)Enum.Parse(typeof(ModFileState), xndDependency.Attributes["state"].InnerText);
                 cpdDependency.Dependencies.Add(new FileDependency(strDependency, mfsModState, StateManager));
                 break;
             case "flagDependency":
                 string strFlagName = xndDependency.Attributes["flag"].InnerText;
                 string strValue = xndDependency.Attributes["value"].InnerText;
                 cpdDependency.Dependencies.Add(new FlagDependency(strFlagName, strValue, StateManager));
                 break;
             default:
                 throw new ParserException("Invalid plugin dependency node: " + xndDependency.Name + ". At this point the config file has been validated against the schema, so there's something wrong with the parser.");
         }
     }
     return cpdDependency;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Reads the dependency information from the given node.
 /// </summary>
 /// <param name="p_xndCompositeDependency">The node from which to load the dependency information.</param>
 /// <returns>A <see cref="CompositeDependency"/> representing the dependency described in the given node.</returns>
 protected virtual CompositeDependency loadDependency(XmlNode p_xndCompositeDependency)
 {
     DependencyOperator dopOperator = (DependencyOperator)Enum.Parse(typeof(DependencyOperator), p_xndCompositeDependency.Attributes["operator"].InnerText);
     CompositeDependency cpdDependency = new CompositeDependency(dopOperator);
     XmlNodeList xnlDependencies = p_xndCompositeDependency.ChildNodes;
     foreach (XmlNode xndDependency in xnlDependencies)
     {
         switch (xndDependency.Name)
         {
             case "dependancies":
                 cpdDependency.Dependencies.Add(loadDependency(xndDependency));
                 break;
             case "dependancy":
                 string strDependency = xndDependency.Attributes["file"].InnerText.ToLower();
                 ModFileState mfsModState = (ModFileState)Enum.Parse(typeof(ModFileState), xndDependency.Attributes["state"].InnerText);
                 cpdDependency.Dependencies.Add(new FileDependency(strDependency, mfsModState, StateManager));
                 break;
         }
     }
     return cpdDependency;
 }