Esempio n. 1
0
        public ModuleInfo(Assembly _asm)
        {
            _name = _asm.GetName().Name;
            _version = DepVersion.VersionParse (_asm.GetName().Version.ToString ());

            ModuleDependencyAttribute _depAttr = ((ModuleDependencyAttribute)(_asm.GetCustomAttributes (typeof (ModuleDependencyAttribute), false)[0]));

            if (_depAttr != null) {
                DepLexer _lexer = new DepLexer (new StringReader (_depAttr.DepString));
                DepParser _parser = new DepParser (_lexer);

                // woot...lets do this!
                _dependencies = new DepNode ();

                _parser.expr (_dependencies);
            } else
                _dependencies = null;

            ModuleRoleAttribute _roleAttr = ((ModuleRoleAttribute)(_asm.GetCustomAttributes (typeof (ModuleRoleAttribute), false)[0]));

            if (_roleAttr != null) {
                _roles = _roleAttr.Roles;
            } else
                throw new ModuleInfoException (string.Format ("The module {0} has no defined roles, and is not a valid NModule module.", _asm.GetName ().Name));

            _owner = _asm;
        }
        public static void Main(string[] args)
        {
            foreach(string file in args)
            {
                DepNode root = new DepNode();

                Console.WriteLine("==== Testing Input from {0} ====", file);
                DepLexer lexer = new DepLexer(new FileStream(file, FileMode.Open));
                        DepParser parser = new DepParser(lexer);
                        parser.expr(root);
                        PrintTree(root, 0);
            }
        }
Esempio n. 3
0
        public ModuleInfo(Assembly _asm)
        {
            _name = _asm.GetName().Name;
            _version = DepVersion.VersionParse (_asm.GetName().Version.ToString ());

            ModuleDependencyAttribute _depAttr;
            ModuleRoleAttribute _roleAttr;

            try {
                _depAttr = ((ModuleDependencyAttribute)(_asm.GetCustomAttributes (typeof (ModuleDependencyAttribute), false)[0]));
            } catch (IndexOutOfRangeException) {
                _depAttr = null;
            }

            if (_depAttr != null) {
                DepLexer _lexer = new DepLexer (new StringReader (_depAttr.DepString));
                DepParser _parser = new DepParser (_lexer);

                // woot...lets do this!
                _dependencies = new DepNode ();

                _parser.expr (_dependencies);

                Console.WriteLine ("Dependency tree for {0}", _name);
                Console.WriteLine ("This should match {0}", _depAttr.DepString);
                Console.WriteLine ("----------------------------------------------------");
                PrintDepTree (_dependencies, 0);
                Console.WriteLine ("----------------------------------------------------");
                _depstring = _depAttr.DepString;
            } else
                _dependencies = null;

            try {
                _roleAttr = ((ModuleRoleAttribute)(_asm.GetCustomAttributes (typeof (ModuleRoleAttribute), false)[0]));
            } catch (IndexOutOfRangeException) {
                _roleAttr = null;
            }

            if (_roleAttr != null) {
                _roles = _roleAttr.Roles;
            } else
                throw new ModuleInfoException (string.Format ("The module {0} has no defined roles, and is not a valid NModule module.", _asm.GetName ().Name));

            _owner = _asm;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new ModuleInfo belonging to the given assembly.
        /// </summary>
        /// <remarks>None.</remarks>
        /// <param name="_asm">The owning assembly.</param>
        public ModuleInfo(Assembly _asm)
        {
            _name = _asm.GetName ().Name;
            _version = DepVersion.VersionParse (_asm.GetName().Version.ToString ());

            ModuleDependencyAttribute _depAttr;
            ModuleRoleAttribute _roleAttr;

            try {
                _depAttr = ((ModuleDependencyAttribute)(_asm.GetCustomAttributes (typeof (ModuleDependencyAttribute), false)[0]));
            } catch (IndexOutOfRangeException) {
                _depAttr = null;
            }

            if (_depAttr != null) {
                DepLexer _lexer = new DepLexer (new StringReader (_depAttr.DepString));
                DepParser _parser = new DepParser (_lexer);

                // woot...lets do this!
                _dependencies = new DepNode ();

                _parser.expr (_dependencies);
            } else
                _dependencies = null;

            try {
                _roleAttr = ((ModuleRoleAttribute)(_asm.GetCustomAttributes (typeof (ModuleRoleAttribute), false)[0]));
            } catch (IndexOutOfRangeException) {
                _roleAttr = null;
            }

            if (_roleAttr != null) {
                _roles = _roleAttr.Roles;
            } else
                _roles = null;

            _owner = _asm;
        }