Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileDescriptorRepository"/> class.
        /// </summary>
        public FileDescriptorRepository(String fileName, IEnumerable <Assembly> assemblies = null)
        {
            Assume.NotNull(fileName, nameof(fileName));
            Assume.FileExists(fileName, nameof(fileName));

            serializer           = new DataContractJsonSerializer(typeof(DescriptorModel));
            combinators          = new List <CombinatorDescriptor>();
            selectors            = new List <SelectorDescriptor>();
            modifiers            = new List <ModifierDescriptor>();
            commandDescriptors   = new List <CommandDescriptor>();
            predefinedAssemblies = new[] { Assembly.Load("mscorlib") };

            this.assemblies = assemblies ?? new[] { Assembly.GetExecutingAssembly() };

            loadFromFile(fileName);
        }