public ModuleController()
 {
     _app_domain_map = new Hashtable ();
     _ref_counts = new Hashtable ();
     _search_path = new ArrayList ();
     _roles = new ArrayList ();
     _loader = new ModuleLoader (_search_path, this);
     _info_map = new Hashtable ();
 }
Ejemplo n.º 2
0
        protected void OpResolve(DepNode _node, ArrayList _parents, ModuleInfo _info, bool checking, DepOps _parentop)
        {
            Console.WriteLine ("-->> OpResolve called with:");
            Console.WriteLine ("---->> _node = {0}", _node == null ? "null" : "not null");
            Console.WriteLine ("---->> _node.DepOp = {0}", OpToString (_node.DepOp));
            Console.WriteLine ("---->> _parents = {0}", _parents == null ? "null" : "not null");
            Console.WriteLine ("---->> _info = {0}", _info == null ? "null" : "not null");
            Console.WriteLine ("---->> checking = {0}", checking);
            bool _ret;
            DepOps _op = _node.DepOp;

            if ((_op == DepOps.And) || (_op == DepOps.Not) || (_op == DepOps.Opt) || (_op == DepOps.Or) || (_op == DepOps.Xor)) {
                // combo-operators
                ArrayList _results = new ArrayList ();
                ArrayList _c = new ArrayList ();
                foreach (DepNode _child in _node.Children) {
                    //try {
                        OpResolve (_child, _parents, _info, checking, _op);
                        _results.Add (true);
                        _c.Add (_child.Constraint);
                    //} catch (Exception e) {
                    //	_results.Add (false);
                    //	_c.Add (_child.Constraint);
                    //}
                }

                switch (_op) {
                    case DepOps.And:
                        int r = 0;
                        if (_results == null) {
                            Console.WriteLine ("_results is NULL!");
                        }

                        foreach (bool _result in _results) {
                            if (!_result) {
                                if (_parentop != DepOps.Null && _parentop != DepOps.Opt) {
                                    throw new UnresolvedDependencyException (
                                        string.Format("The following dependency for the module {0} could not be resolved: (AND operator)\n\t{1} ({2})",
                                            _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version)
                                    );
                                }
                            }
                            r++;
                        }
                        break;
                    case DepOps.Not:
                        foreach (bool _result in _results) {
                            if (_result) {
                                if (_parentop != DepOps.Null && _parentop != DepOps.Opt) {
                                    throw new UnresolvedDependencyException (
                                        string.Format("The following dependency for the module {0} could not be resolved: (NOT operator)\n\t{1} ({2})",
                                            _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version)
                                    );
                                }
                            }
                        }
                        break;
                    case DepOps.Opt: // This is optional so stuff is true regardless
                        break;
                    case DepOps.Or:
                        _ret = false;
                        ArrayList _urexc = new ArrayList ();
                        r = 0;
                        foreach (bool _result in _results) {
                            if (_result)
                                _ret = true;
                            else {
                                _urexc.Add (string.Format("{1} ({2})", _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version));
                            }
                            r++;
                        }

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format("The following dependency for the module {0} could not be resolved: (OR operator)\n")
                            );
                            foreach (string _exc in _urexc) {
                                _sb.Append(string.Format("\t{0}\n", _exc));
                            }
                            if (_parentop != DepOps.Null && _parentop != DepOps.Opt)
                                throw new UnresolvedDependencyException (_sb.ToString ());
                        }
                        break;
                    case DepOps.Xor:
                        bool _xt = true;
                        bool _xf = true;
                        ArrayList _xexc = new ArrayList ();

                        r = 0;
                        _ret = true;

                        foreach (bool _result in _results) {
                            if (_result) {
                                _xf = false;
                                _xexc.Add (string.Format("{1} ({2}) (True)", _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version));
                            }
                            if (!_result) {
                                _xt = false;
                                _xexc.Add (string.Format("{1} ({2}) (False)", _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version));
                            }
                            r++;
                        }

                        if (_xt && _xf)
                            _ret = false;

                        if (!_xt && _xf)
                            _ret = false;

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format ("The following dependency for the module {0} could not be resolved: (XOR operator)\n")
                            );
                            foreach (string _exc in _xexc) {
                                _sb.Append (string.Format("\t{0}\n", _exc));
                            }
                            if (_parentop != DepOps.Null && _parentop != DepOps.Opt) {
                                throw new UnresolvedDependencyException (_sb.ToString ());
                            }
                        }
                        break;
                }
            } else {
                DepConstraint _constraint = _node.Constraint;

                // single operators
                if (SearchForModule (_constraint.Name) == null)
                    _ret = false;

                ModuleInfo _ninfo;

                ModuleLoader _loader = new ModuleLoader (_search_path, _controller);

                _loader.LoadModule (_parents, _constraint.Name, out _ninfo, true, true);

                bool result = true;

                Console.WriteLine ("Checking {0}'s version:  Empty {1}", _constraint.Name, IsEmptyVersion (_constraint.Version));
                Console.WriteLine ("Checking ({0} {1} {2}) Result: {3}", OpToString (_op), _ninfo.Version.ToString(), _constraint.Version.ToString(), VersionMatch (_ninfo.Version, _constraint.Version, _op));

                if (!IsEmptyVersion (_constraint.Version)) {
                    if (!VersionMatch (_ninfo.Version, _constraint.Version, _op)) {
                        result = false;
                    }
                }

                if (!result) {
                    if (_parentop != DepOps.Null && _parentop != DepOps.Opt) {
                        throw new UnresolvedDependencyException (
                                string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                    _info.Name, _constraint.Name, _constraint.Version, OpToString (_op))
                            );
                    }
                    else
                        return;
                }

                if (_controller == null)
                    Console.WriteLine ("_controller is NULL!");

                if (!checking) {
                    _controller.LoadModule (_constraint.Name);
                }

                Console.WriteLine ("Checking {0} for {1} (Result: {2})", OpToString (_op), _info.Name, result);
                // we got this far, so obviously it loaded okay
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Recursively resolves dependencies given a dependency tree.
        /// </summary>
        /// <remarks>None.</remarks>
        /// <param name="_node">The root node of the tree to resolve.</param>
        /// <param name="_parents">The parent modules to use when checking for circular dependencies.</param>
        /// <param name="_info">The <see cref="ModuleInfo" /> object representing the module to resolve dependencies for.</param>
        /// <param name="opt">Set to true if this pass is optional, otherwise set to false.</param>
        /// <exception cref="UnresolvedDependencyException">Thrown if the given dependency cannot be resolved and is not optional.</exception>
        /// <exception cref="CircularDependencyException">Thrown if two modules depend on each other.</exception>
        protected void OpResolve(DepNode _node, ArrayList _parents, ModuleInfo _info, bool checking, bool opt)
        {
            bool _ret;
            DepOps _op = _node.DepOp;

            // This is a large process.  I've chosen to use recursion here because it makes sense from a tree
            // point of view.  Our first step is to check our operator to see if its one of the "combination"
            // operators.  If it is, we simply recurse through its children and record their results in a
            // table (true if they suceeded, false if they failed).  Since we're not sure what kind of logic
            // we need (and, or, xor) we can't really make a decision at this point.  When we go through
            // the children, they simply go through this process to until we reach a bottom node, which would
            // be one of the "single" operators.  They are dealt with in the second part of this function.
            if ((_op == DepOps.And) || (_op == DepOps.Opt) || (_op == DepOps.Or) || (_op == DepOps.Xor)) {
                // This is our list of results for the children nodes.
                ArrayList _results = new ArrayList ();

                // This is a list of constraints for the children nodes so we can output sensible information.
                ArrayList _c = new ArrayList ();

                foreach (DepNode _child in _node.Children) {
                    // Try to resolve the child node, if it suceeds, store
                    // true into the results table, if an exception is thrown
                    // store false into the results table.  Store the constraints
                    // into the constraints table regardless of result so the indexes
                    // will be identical.
                    try {
                        OpResolve (_child, _parents, _info, checking, _op == DepOps.Opt ? true : false);
                        _results.Add (true);
                        _c.Add (_child.Constraint);
                    } catch (Exception e) {
                        _results.Add (false);
                        _c.Add (_child.Constraint);
                    }
                }

                // This switch statement is where we go through the results table and apply
                // the operator logic to the table to figure out if the results sastify
                // the given operator.
                switch (_op) {
                    case DepOps.And:
                        int r = 0;

                        foreach (bool _result in _results) {
                            if (!_result) {
                                if (!opt) {
                                    if (_c[r] != null) {
                                        throw new UnresolvedDependencyException (
                                            string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                                _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString(), OpToString (DepOps.And))
                                        );
                                    } else {
                                        throw new UnresolvedDependencyException (
                                            string.Format("The following dependency for the module {0} could not be resolved: ({1} operator)",
                                                _info.Name, OpToString (DepOps.And))
                                        );
                                    }
                                }
                            }
                            r++;
                        }
                        break;
                    case DepOps.Opt: // This is optional so stuff is true regardless
                        break;
                    case DepOps.Or:
                        _ret = false;
                        ArrayList _urexc = new ArrayList ();
                        r = 0;
                        foreach (bool _result in _results) {
                            if (_result)
                                _ret = true;
                            else {
                                if (_c[r] != null)
                                    _urexc.Add (string.Format("{0} ({1})", ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString()));
                            }
                            r++;
                        }

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format("The following dependency for the module {0} could not be resolved: (OR operator)\n", _info.Name)
                            );
                            foreach (string _exc in _urexc) {
                                _sb.Append(string.Format("\t{0}\n", _exc));
                            }
                            if (!opt)
                                throw new UnresolvedDependencyException (_sb.ToString ());
                        }
                        break;

                    case DepOps.Xor:
                        bool _xt = true;
                        bool _xf = true;
                        ArrayList _xexc = new ArrayList ();

                        r = 0;
                        _ret = true;

                        foreach (bool _result in _results) {
                            if (_result) {
                                _xf = false;
                                if (_c[r] != null)
                                    _xexc.Add (string.Format("{0} ({1}) (True)", ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString()));
                            }
                            if (!_result) {
                                _xt = false;
                                if (_c[r] != null)
                                    _xexc.Add (string.Format("{0} ({1}) (False)", ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString()));
                            }
                            r++;
                        }

                        // If one of these is still true, that means all of the other results are true or false.
                        if (_xt || _xf)
                            _ret = false;;

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format ("The following dependency for the module {0} could not be resolved: (XOR operator)\n", _info.Name)
                            );
                            foreach (string _exc in _xexc) {
                                _sb.Append (string.Format("\t{0}\n", _exc));
                            }
                            if (!opt) {
                                throw new UnresolvedDependencyException (_sb.ToString ());
                            }
                        }
                        break;
                }
            } else {
                DepConstraint _constraint = _node.Constraint;

                foreach (string _parent in _parents) {
                    if (_parent == _constraint.Name) {
                        throw new CircularDependencyException (string.Format ("{0} and {1} have a circular dependency on each other", _parent, _info.Name));
                    }
                }

                // single operators
                if (SearchForModule (_constraint.Name) == null)
                    _ret = false;

                ModuleInfo _ninfo = null;

                ModuleLoader _loader = new ModuleLoader (_search_path, _controller);

                try {
                    if (!_parents.Contains (_info.Name))
                        _parents.Add (_info.Name);

                    _loader.LoadModule (_parents, _constraint.Name, out _ninfo, true, true);
                } catch (CircularDependencyException ce) {
                    throw ce;
                } catch (Exception) {
                    if (!opt) {
                                throw new UnresolvedDependencyException (
                                    string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                        _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                );
                    }
                }

                if (_op == DepOps.Equal || _op == DepOps.GreaterThan || _op == DepOps.GreaterThanEqual || _op == DepOps.LessThan || _op == DepOps.LessThanEqual || _op == DepOps.NotEqual) {
                    if (!IsEmptyVersion (_constraint.Version)) {
                        if (!VersionMatch (_ninfo.Version, _constraint.Version, _op)) {
                            if (!opt) {
                                throw new UnresolvedDependencyException (
                                    string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                        _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                );
                            }
                        }
                    }

                    if (!checking) {
                        _controller.LoadModule (_constraint.Name);

                        _parents.Sort ();

                        ArrayList _seen = new ArrayList ();
                        _seen.Add (_info.Name);
                        _seen.Add (_constraint.Name);
                        foreach (string _p in _parents) {
                            if (!_seen.Contains (_p)) {
                                _controller.IncRef (_constraint.Name);
                                _seen.Add (_p);
                            }
                        }
                    }
                }

                if (_op == DepOps.Loaded) {
                    if (_controller.Loader.SearchForModule (_constraint.Name) == null)
                    {
                        if (!opt) {
                            throw new UnresolvedDependencyException (
                                        string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                            _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                    );
                        }
                    }

                    if (!checking) {
                        _controller.LoadModule (_constraint.Name);

                        _parents.Sort ();

                        ArrayList _seen = new ArrayList ();
                        _seen.Add (_info.Name);
                        _seen.Add (_constraint.Name);
                        foreach (string _p in _parents) {
                            if (!_seen.Contains (_p)) {
                                _controller.IncRef (_constraint.Name);
                                _seen.Add (_p);
                            }
                        }
                    }
                }

                if (_op == DepOps.NotLoaded) {
                    if (_controller.IsLoaded (_constraint.Name)) {
                        if (_controller.RefCount (_constraint.Name) > 1) {
                            if (!opt) {
                                throw new UnresolvedDependencyException (
                                        string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                            _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                    );
                            }
                        }
                        if (!checking) {
                            _controller.UnloadModule (_constraint.Name);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected void OpResolve(DepNode _node, ArrayList _parents, ModuleInfo _info, bool checking, DepOps _parentop)
        {
            bool _ret;
            DepOps _op = _node.DepOp;

            if ((_op == DepOps.And) || (_op == DepOps.Opt) || (_op == DepOps.Or) || (_op == DepOps.Xor)) {
                // combo-operators
                ArrayList _results = new ArrayList ();
                ArrayList _c = new ArrayList ();
                foreach (DepNode _child in _node.Children) {
                    try {
                        OpResolve (_child, _parents, _info, checking, _op);
                        _results.Add (true);
                        _c.Add (_child.Constraint);
                    } catch (Exception e) {
                        _results.Add (false);
                        _c.Add (_child.Constraint);
                    }
                }

                switch (_op) {
                    case DepOps.And:
                        int r = 0;

                        foreach (bool _result in _results) {
                            if (!_result) {
                                if (_parentop != DepOps.Opt) {
                                    if (_c[r] != null) {
                                        throw new UnresolvedDependencyException (
                                            string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                                _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString(), OpToString (DepOps.And))
                                        );
                                    } else {
                                        throw new UnresolvedDependencyException (
                                            string.Format("The following dependency for the module {0} could not be resolved: ({1} operator)",
                                                _info.Name, OpToString (DepOps.And))
                                        );
                                    }
                                }
                            }
                            r++;
                        }
                        break;
                    case DepOps.Opt: // This is optional so stuff is true regardless
                        break;
                    case DepOps.Or:
                        _ret = false;
                        ArrayList _urexc = new ArrayList ();
                        r = 0;
                        foreach (bool _result in _results) {
                            if (_result)
                                _ret = true;
                            else {
                                if (_c[r] != null)
                                    _urexc.Add (string.Format("{0} ({1})", ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString()));
                            }
                            r++;
                        }

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format("The following dependency for the module {0} could not be resolved: (OR operator)\n", _info.Name)
                            );
                            foreach (string _exc in _urexc) {
                                _sb.Append(string.Format("\t{0}\n", _exc));
                            }
                            if (_parentop != DepOps.Opt)
                                throw new UnresolvedDependencyException (_sb.ToString ());
                        }
                        break;

                    case DepOps.Xor:
                        bool _xt = true;
                        bool _xf = true;
                        ArrayList _xexc = new ArrayList ();

                        r = 0;
                        _ret = true;

                        foreach (bool _result in _results) {
                            if (_result) {
                                _xf = false;
                                if (_c[r] != null)
                                    _xexc.Add (string.Format("{0} ({1}) (True)", ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString()));
                            }
                            if (!_result) {
                                _xt = false;
                                if (_c[r] != null)
                                    _xexc.Add (string.Format("{0} ({1}) (False)", ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version.ToString()));
                            }
                            r++;
                        }

                        // If one of these is still true, that means all of the other results are true or false.
                        if (_xt || _xf)
                            _ret = false;;

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format ("The following dependency for the module {0} could not be resolved: (XOR operator)\n", _info.Name)
                            );
                            foreach (string _exc in _xexc) {
                                _sb.Append (string.Format("\t{0}\n", _exc));
                            }
                            if (_parentop != DepOps.Opt) {
                                throw new UnresolvedDependencyException (_sb.ToString ());
                            }
                        }
                        break;
                }
            } else {
                DepConstraint _constraint = _node.Constraint;

                foreach (string _parent in _parents) {
                    if (_parent == _constraint.Name) {
                        throw new CircularDependencyException (string.Format ("{0} and {1} have a circular dependency on each other", _parent, _info.Name));
                    }
                }

                // single operators
                if (SearchForModule (_constraint.Name) == null)
                    _ret = false;

                ModuleInfo _ninfo = null;

                ModuleLoader _loader = new ModuleLoader (_search_path, _controller);

                try {
                    if (!_parents.Contains (_info.Name))
                        _parents.Add (_info.Name);

                    _loader.LoadModule (_parents, _constraint.Name, out _ninfo, true, true);
                } catch (CircularDependencyException ce) {
                    throw ce;
                } catch (Exception) {
                    if (_parentop != DepOps.Opt) {
                                throw new UnresolvedDependencyException (
                                    string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                        _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                );
                    }
                }

                if (_op == DepOps.Equal || _op == DepOps.GreaterThan || _op == DepOps.GreaterThanEqual || _op == DepOps.LessThan || _op == DepOps.LessThanEqual || _op == DepOps.NotEqual) {
                    if (!IsEmptyVersion (_constraint.Version)) {
                        if (!VersionMatch (_ninfo.Version, _constraint.Version, _op)) {
                            if (_parentop != DepOps.Opt) {
                                throw new UnresolvedDependencyException (
                                    string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                        _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                );
                            }
                        }
                    }

                    if (!checking) {
                        _controller.LoadModule (_constraint.Name);

                        _parents.Sort ();

                        ArrayList _seen = new ArrayList ();
                        _seen.Add (_info.Name);
                        _seen.Add (_constraint.Name);
                        foreach (string _p in _parents) {
                            if (!_seen.Contains (_p)) {
                                _controller.IncRef (_constraint.Name);
                                _seen.Add (_p);
                            }
                        }
                    }
                }

                if (_op == DepOps.Loaded) {
                    if (_controller.Loader.SearchForModule (_constraint.Name) == null)
                    {
                        if (_parentop != DepOps.Opt) {
                            throw new UnresolvedDependencyException (
                                        string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                            _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                    );
                        }
                    }

                    if (!checking) {
                        _controller.LoadModule (_constraint.Name);

                        _parents.Sort ();

                        ArrayList _seen = new ArrayList ();
                        _seen.Add (_info.Name);
                        _seen.Add (_constraint.Name);
                        foreach (string _p in _parents) {
                            if (!_seen.Contains (_p)) {
                                _controller.IncRef (_constraint.Name);
                                _seen.Add (_p);
                            }
                        }
                    }
                }

                if (_op == DepOps.NotLoaded) {
                    if (_controller.IsLoaded (_constraint.Name)) {
                        if (_controller.RefCount (_constraint.Name) > 1) {
                            if (_parentop != DepOps.Opt) {
                                throw new UnresolvedDependencyException (
                                        string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                            _info.Name, _constraint.Name, _constraint.Version.ToString(), OpToString (_op))
                                    );
                            }
                        }
                        if (!checking) {
                            _controller.UnloadModule (_constraint.Name);
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected void OpResolve(DepNode _node, ArrayList _parents, ModuleInfo _info, bool checking)
        {
            bool _ret;
            DepOps _op = _node.DepOp;
            DepConstraint _constraint = _node.Constraint;
            if ((_op == DepOps.And) || (_op == DepOps.Not) || (_op == DepOps.Opt) || (_op == DepOps.Or) || (_op == DepOps.Xor)) {
                // combo-operators
                ArrayList _results = new ArrayList ();
                ArrayList _c = new ArrayList ();
                foreach (DepNode _child in _node.Children) {
                    try {
                        OpResolve (_child, _parents, _info, checking);
                        _results.Add (true);
                        _c.Add (_child.Constraint);
                    } catch (Exception e) {
                        _results.Add (false);
                        _c.Add (_child.Constraint);
                    }
                }

                switch (_op) {
                    case DepOps.And:
                        int r = 0;
                        foreach (bool _result in _results) {
                            if (!_result) {
                                throw new UnresolvedDependencyException (
                                    string.Format("The following dependency for the module {0} could not be resolved: (AND operator)\n\t{1} ({2})",
                                        _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version)
                                );
                            }
                            r++;
                        }
                        break;
                    case DepOps.Not:
                        foreach (bool _result in _results) {
                            if (_result)
                                throw new UnresolvedDependencyException (
                                    string.Format("The following dependency for the module {0} could not be resolved: (NOT operator)\n\t{1} ({2})",
                                        _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version)
                                );
                        }
                        break;
                    case DepOps.Opt: // This is optional so stuff is true regardless
                        break;
                    case DepOps.Or:
                        _ret = false;
                        ArrayList _urexc = new ArrayList ();
                        r = 0;
                        foreach (bool _result in _results) {
                            if (_result)
                                _ret = true;
                            else {
                                _urexc.Add (string.Format("{1} ({2})", _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version));
                            }
                            r++;
                        }

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format("The following dependency for the module {0} could not be resolved: (OR operator)\n")
                            );
                            foreach (string _exc in _urexc) {
                                _sb.Append(string.Format("\t{0}\n", _exc));
                            }
                            throw new UnresolvedDependencyException (_sb.ToString ());
                        }
                        break;
                    case DepOps.Xor:
                        bool _xt = true;
                        bool _xf = true;
                        ArrayList _xexc = new ArrayList ();

                        r = 0;
                        _ret = true;

                        foreach (bool _result in _results) {
                            if (_result) {
                                _xf = false;
                                _xexc.Add (string.Format("{1} ({2}) (True)", _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version));
                            }
                            if (!_result) {
                                _xt = false;
                                _xexc.Add (string.Format("{1} ({2}) (False)", _info.Name, ((DepConstraint)_c[r]).Name, ((DepConstraint)_c[r]).Version));
                            }
                            r++;
                        }

                        if (_xt || _xf)
                            _ret = false;

                        if (!_ret) {
                            StringBuilder _sb = new StringBuilder (
                                string.Format ("The following dependency for the module {0} could not be resolved: (XOR operator)\n")
                            );
                            foreach (string _exc in _xexc) {
                                _sb.Append (string.Format("\t{0}\n", _exc));
                            }
                            throw new UnresolvedDependencyException (_sb.ToString ());
                        }
                        break;
                }
            } else {
                // single operators
                if (SearchForModule (_constraint.Name) == null)
                    _ret = false;

                ModuleInfo _ninfo;

                ModuleLoader _loader = new ModuleLoader (_search_path, this);

                _loader.LoadModule (_parents, _constraint.Name, out _ninfo, true);

                if ((_op == DepOps.Equal) || (_op == DepOps.GreaterThan) || (_op == DepOps.GreaterThanEqual) || (_op == DepOps.LessThan)
                    || (_op == DepOps.LessThanEqual) || (_op == DepOps.NotEqual)) {
                    if (!IsEmptyVersion (_constraint.Version)) {
                        if (!VersionMatch (_constraint.Version, _ninfo.Version, _op)) {
                            throw new UnresolvedDependencyException (
                                string.Format("The following dependency for the module {0} could not be resolved: ({3} operator)\n\t{1} ({2})",
                                    _info.Name, _constraint.Name, _constraint.Version, OpToString (_op))
                            );
                        }
                    }
                    if (!checking) {
                        _controller.LoadModule (_constraint.Name);
                    }
                }
                // we got this far, so obviously it loaded okay
            }
        }