Пример #1
0
        public void ExploreProjects(IDictionary<IProject, FileSystemPath> projects, MetadataLoader loader, IUnitTestElementsObserver observer)
        {
            var silverlightProjects = projects.Where(p => p.Key.IsSilverlight()).ToDictionary(p => p.Key, p => p.Value);

            this.metadataElementsSource.ExploreProjects(silverlightProjects, loader, observer, this.ExploreAssembly);
            observer.OnCompleted();
        }
Пример #2
0
 public void Initialize(TypeSystem system, ITypeSystemController controller)
 {
     TypeSystem = system;
     Controller = controller;
     Cache = new MetadataCache();
     Loader = new MetadataLoader(this);
     Resolver = new MetadataResolver(this);
 }
Пример #3
0
 public void ExploreProjects(
     IDictionary<IProject, FileSystemPath> projects, 
     MetadataLoader loader, 
     IUnitTestElementsObserver observer,
     CancellationToken cancellationToken)
 {
     var explorer = new FixieMetadataExplorer();
     metadataElementsSource.ExploreProjects(projects, loader, observer, explorer.ExploreAssembly, cancellationToken);
     observer.OnCompleted();
 }
        public override void TearDown()
        {
            if (loader != null)
            {
                loader.Dispose();
                loader = null;
            }

            base.TearDown();
        }
Пример #5
0
        private void LoadMetadata()
        {
            lock (metadataLoadLock)
            {
                try
                {
                    options.SPOptions.Logger?.WriteInformation("Loading metadata for federation from " + metadataLocation);
                    var metadata = MetadataLoader.LoadFederation(
                        metadataLocation,
                        SigningKeys,
                        options.SPOptions.ValidateCertificates,
                        options.SPOptions.MinIncomingSigningAlgorithm);

                    var identityProvidersMetadata = metadata.ChildEntities.Cast <EntityDescriptor>()
                                                    .Where(ed => ed.RoleDescriptors.OfType <IdpSsoDescriptor>().Any());

                    var identityProviders = new List <IdentityProvider>();

                    foreach (var idpMetadata in identityProvidersMetadata)
                    {
                        var idp = new IdentityProvider(idpMetadata.EntityId, options.SPOptions)
                        {
                            AllowUnsolicitedAuthnResponse = allowUnsolicitedAuthnResponse
                        };

                        idp.ReadMetadata(idpMetadata);
                        identityProviders.Add(idp);
                    }

                    RegisterIdentityProviders(identityProviders);

                    MetadataValidUntil = metadata.CalculateMetadataValidUntil();

                    LastMetadataLoadException = null;
                }
                catch (Exception ex)
                {
                    options.SPOptions.Logger?.WriteError("Metadata loading failed from " + metadataLocation, ex);
                    var now = DateTime.UtcNow;

                    if (MetadataValidUntil < now)
                    {
                        // If download failed, ignore the error and trigger a scheduled reload.
                        RemoveAllRegisteredIdentityProviders();
                        MetadataValidUntil = DateTime.MinValue;
                    }
                    else
                    {
                        ScheduleMetadataReload();
                    }

                    LastMetadataLoadException = ex;
                }
            }
        }
        public override Dictionary <Type, Dictionary <Guid, List <string> > > GetDynamicFieldsMapping()
        {
            var classMd    = (ClassMetadata)MetadataLoader.LoadMetadata(typeof(IEmailMessage));
            var value      = ProcessingDynamicFieldsMapping(classMd);
            var dictionary = new Dictionary <Type, Dictionary <Guid, List <string> > >
            {
                { typeof(IEmailMessageFullTextSearchObject), value }
            };

            return(dictionary);
        }
Пример #7
0
 /**
  * Creates a new MetadataLoader in this object's loader map, if required.
  * @param pLoaderName Name of loader to create.
  */
 private void createLoaderIfUndefined(string pLoaderName)
 {
     //Check this is not a duplicate definition or a built-in definition
     if (!mLoaderMap.ContainsKey(pLoaderName) && BuiltInLoader.getBuiltInLoaderOrNull(pLoaderName) == null)
     {
         //Construct the loader
         MetadataLoader lLoader = new MetadataLoader(pLoaderName);
         //Register in this parser's map
         mLoaderMap.Add(pLoaderName, lLoader);
     }
 }
        /// <summary>
        /// Generate the serialized module metadata for a given module.
        /// </summary>
        public void SerializeModule()
        {
            var serializedCmdletsDirectory = _fileHelper.SerializedCmdletsDirectory;
            var moduleName = _fileHelper.ModuleName;

            var newModuleMetadata    = MetadataLoader.GetModuleMetadata(moduleName);
            var serializedCmdletName = $"{moduleName}.json";
            var serializedCmdletFile = Path.Combine(serializedCmdletsDirectory, serializedCmdletName);

            SerializeCmdlets(serializedCmdletFile, newModuleMetadata);
        }
Пример #9
0
        // [Test]
        public async Task Test()
        {
            var metadata = MetadataLoader.Load(@"testfiles\A Storm of Swords - George R. R. Martin.mobi");
            var book     = new BookInfo(metadata, "https://www.goodreads.com/book/show/62291.A_Storm_of_Swords");
            var authorProfileResponse = await _authorProfileGenerator.GenerateAsync(new AuthorProfileGenerator.Request
            {
                Book     = book,
                Settings = new AuthorProfileGenerator.Settings
                {
                    AmazonTld     = "com",
                    SaveBio       = false,
                    UseNewVersion = true,
                    EditBiography = false,
                    SaveHtml      = false
                }
            }, CancellationToken.None);

            var endActionsDataGenerator = new EndActionsDataGenerator(_logger, _httpClient, _amazonClient, _amazonInfoParser, null);

            var settings = new EndActionsDataGenerator.Settings
            {
                AmazonTld         = "com",
                EstimatePageCount = false,
                PromptAsin        = false,
                SaveHtml          = false,
                UseNewVersion     = true
            };

            var endActionsResponse = await endActionsDataGenerator.GenerateNewFormatData(book, settings, _secondarySourceGoodreads, authorProfileResponse, null, metadata, null, CancellationToken.None);

            Assert.NotNull(endActionsResponse);

            var content = _endActionsArtifactService.GenerateNew(new EndActionsArtifactService.Request(
                                                                     bookAsin: endActionsResponse.Book.Asin,
                                                                     bookImageUrl: endActionsResponse.Book.ImageUrl,
                                                                     bookDatabaseName: endActionsResponse.Book.Databasename,
                                                                     bookGuid: endActionsResponse.Book.Guid,
                                                                     bookErl: metadata.RawMlSize,
                                                                     bookAmazonRating: endActionsResponse.Book.AmazonRating,
                                                                     bookSeriesInfo: endActionsResponse.Book.Series,
                                                                     author: authorProfileResponse.Name,
                                                                     authorAsin: authorProfileResponse.Asin,
                                                                     authorImageUrl: authorProfileResponse.ImageUrl,
                                                                     authorBiography: authorProfileResponse.Biography,
                                                                     authorOtherBooks: authorProfileResponse.OtherBooks,
                                                                     userPenName: "Anonymous",
                                                                     userRealName: "Anonymous",
                                                                     customerAlsoBought: endActionsResponse.CustomerAlsoBought));

            var expected = File.ReadAllText(@"testfiles\EndActions.data.B000FBFN1U.asc", Encoding.UTF8);

            File.WriteAllText(@"testfiles\sampleendactions.txt", content);
            Assert.AreEqual(expected, content);
        }
        protected override void ProcessProject(
            MetadataLoader loader,
            IUnitTestElementObserver observer,
            CancellationToken token)
        {
            MetadataElementsSource.ExploreProject(observer.Source.Project, observer.Source.Output, loader, logger, token, assembly =>
            {
                var explorer = new MspecTestMetadataExplorer(observer);

                explorer.ExploreAssembly(assembly, token);
            });
        }
        public MetadataMethodInfoAdapterTest()
        {
            lifetimeDefinition = Lifetimes.Define(EternalLifetime.Instance);

            var lifetime    = lifetimeDefinition.Lifetime;
            var gacResolver = GacAssemblyResolver.CreateOnCurrentRuntimeGac(GacAssemblyResolver.GacResolvePreferences.MatchSameOrNewer);
            var resolver    = new CombiningAssemblyResolver(gacResolver, new LoadedAssembliesResolver(lifetime, true));

            loader = new MetadataLoader(resolver);

            lifetime.AddDispose(loader);
        }
Пример #12
0
        private void LoadMetadataIntoForm(FileSystemInfo metadataFile, Action errorAction)
        {
            try
            {
                ArchiveMetadata metadata = MetadataLoader.Load(metadataFile.FullName);

                FillForm(metadata);
            }
            catch
            {
                errorAction.Invoke();
            }
        }
        public override FilterList GetFilterFields(Type cardType, FullTextSearchResultModel searchModel)
        {
            if (cardType == null || typeof(IEmailMessageFullTextSearchObject) != cardType)
            {
                return(new FilterList());
            }
            var filterList = new FilterList();
            var emailMessageFullTextSearchResultModel = searchModel as EmailMessageFullTextSearchResultModel;

            if (emailMessageFullTextSearchResultModel != null && emailMessageFullTextSearchResultModel.TypeUid != Guid.Empty)
            {
                var classMetadata = MetadataLoader.LoadMetadata(emailMessageFullTextSearchResultModel.TypeUid) as ClassMetadata;
                if (classMetadata != null)
                {
                    var list = (from c in MetadataLoader.GetChildClasses(classMetadata)
                                where c != null
                                select c).ToList();
                    list.Add(classMetadata);
                    var list2 = new List <object>();
                    list2.AddRange(from c in list
                                   select c.Uid.ToString("n"));
                    filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.TypeUid), list2, FilterListItemType.Must, FullTextFieldType.String));
                }
            }

            var emailMessageFullTextSearchResultModel2 = searchModel as EmailMessageFullTextSearchResultModel;

            if (emailMessageFullTextSearchResultModel2?.Contractor != null)
            {
                var contractorId = emailMessageFullTextSearchResultModel2.Contractor.Id;
                filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Contractors), new List <object>()
                {
                    contractorId
                }, FilterListItemType.Must, FullTextFieldType.Long));
            }
            if (emailMessageFullTextSearchResultModel2?.Contact != null)
            {
                var contactId = emailMessageFullTextSearchResultModel2.Contact.Id;
                filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Contacts), new List <object>()
                {
                    contactId
                }, FilterListItemType.Must, FullTextFieldType.Long));
            }

            filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.IsDeleted), new List <object>
            {
                "false"
            }, FilterListItemType.Must, FullTextFieldType.String));

            return(filterList);
        }
        private void LoadCodelistCodes(string webserviceId, string dsd_id, TreeNode treeNodeSecLevel)
        {
            try
            {
                List <BaseArtefactInfo> dsList;
                bool raiseError = false;
                CommonItem.WaitOn();


                MetadataLoader mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(webserviceId)));

                string[] ident = CommonConstant.splitGlobalID(dsd_id);
                dsList = mtl.LoadCodelistCodes21(ident[0], ident[1], ident[2]);

                //Visit components

                foreach (BaseComponentInfo compInfo in dsList[0].DataStructureDetails.Components)
                {
                    string text;
                    if (switchTreeView.isCode())
                    {
                        text = compInfo.vtlId;
                    }
                    else
                    if (compInfo.name.Count == 0)
                    {
                        raiseError = true;
                        text       = compInfo.vtlId;
                    }
                    else
                    {
                        text = compInfo.name[0].value.ToString();
                    }

                    TreeNode tmp = treeNodeSecLevel.Nodes.Add(compInfo.vtlId, text);
                    tmp.ForeColor = Color.Gray;
                    tmp.Tag       = new ArtefactNodeInfo(webserviceId, compInfo, ArtefactNodeInfo.ArtefactType.DataStructureComponents);
                }

                CommonItem.WaitOff();
                if (raiseError)
                {
                    MessageBox.Show("The description is not available for one or more items.The ID will be shown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }
Пример #15
0
        private void LoadMetadata()
        {
            lock (metadataLoadLock)
            {
                try
                {
                    var metadata = MetadataLoader.LoadFederation(metadataLocation);

                    var identityProvidersMetadata = metadata.ChildEntities.Cast <ExtendedEntityDescriptor>()
                                                    .Where(ed => ed.RoleDescriptors.OfType <IdentityProviderSingleSignOnDescriptor>().Any());

                    var identityProviders = new List <IdentityProvider>();

                    foreach (var idpMetadata in identityProvidersMetadata)
                    {
                        var idp = new IdentityProvider(idpMetadata.EntityId, options.SPOptions)
                        {
                            AllowUnsolicitedAuthnResponse = allowUnsolicitedAuthnResponse
                        };

                        idp.ReadMetadata(idpMetadata);
                        identityProviders.Add(idp);
                    }

                    RegisterIdentityProviders(identityProviders);

                    MetadataValidUntil = metadata.CalculateMetadataValidUntil();

                    LastMetadataLoadException = null;
                }
                catch (WebException ex)
                {
                    var now = DateTime.UtcNow;

                    if (MetadataValidUntil < now)
                    {
                        // If download failed, ignore the error and trigger a scheduled reload.
                        RemoveAllRegisteredIdentityProviders();
                        MetadataValidUntil = DateTime.MinValue;
                    }
                    else
                    {
                        ScheduleMetadataReload();
                    }

                    LastMetadataLoadException = ex;
                }
            }
        }
Пример #16
0
        public void Run(CommandLineOptions options)
        {
            try
            {
                var arkade = new Core.Base.Arkade();

                var fileInfo = new FileInfo(options.Archive);
                Log.Information($"Processing archive: {fileInfo.FullName}");

                if (!Enum.TryParse(options.ArchiveType, true, out ArchiveType archiveType))
                {
                    Log.Error("Unknown archive type");
                    throw new ArgumentException("unknown archive type");
                }

                if (archiveType == ArchiveType.Noark4)
                {
                    Log.Error("Archive type Noark 4 is currently not supported");
                    throw new ArgumentException("unsupported archive type");
                }

                TestSession testSession = CreateTestSession(options, arkade, archiveType);

                if (!TestingIsSkipped(options))
                {
                    arkade.RunTests(testSession);
                    SaveTestReport(arkade, testSession, options);
                }

                if (!PackingIsSkipped(options))
                {
                    ArchiveMetadata archiveMetadata = MetadataLoader.Load(options.MetadataFile);

                    archiveMetadata.PackageType = options.InformationPackageType != null &&
                                                  options.InformationPackageType.Equals("AIP")
                        ? PackageType.ArchivalInformationPackage
                        : PackageType.SubmissionInformationPackage;

                    testSession.ArchiveMetadata    = archiveMetadata;
                    testSession.ArchiveMetadata.Id = $"UUID:{testSession.Archive.Uuid}";

                    arkade.CreatePackage(testSession, options.OutputDirectory);
                }
            }
            finally
            {
                ArkadeProcessingArea.CleanUp();
            }
        }
        public override void ProcessProject(
            IProject project,
            FileSystemPath assemblyPath,
            MetadataLoader loader,
            IUnitTestElementsObserver observer,
            CancellationToken token)
        {
            var factory  = new UnitTestElementFactory(_serviceProvider, observer.TargetFrameworkId);
            var explorer = new MspecTestMetadataExplorer(factory, observer);

            MetadataElementsSource.ExploreProject(project, assemblyPath, loader, observer, _logger, token,
                                                  assembly => explorer.ExploreAssembly(project, assembly, token));

            observer.OnCompleted();
        }
Пример #18
0
        private async Task Load(object parm)
        {
            await RunCommand(() => this.LoginIsRuning, async() =>
            {
                IoCConteiner.Get <ApplicationViewModel>().ServicesListVisible = false;

                await Task.Delay(1000);
                var metadataLoader = new MetadataLoader(new MetadataSetCreator(HostAddress));
                ServiceProxyGenerator proxyGenerator = new ServiceProxyGenerator(metadataLoader);

                IoCConteiner.Get <ApplicationViewModel>().Services = proxyGenerator.CreateGenerator();
                IoCConteiner.Get <ApplicationViewModel>().HostAddressControlVisible = false;
                IoCConteiner.Get <ApplicationViewModel>().ServicesListVisible       = true;
            });
        }
Пример #19
0
 void ReloadMetadata()
 {
     if (_targetExe == null || !File.Exists(_targetExe))
     {
         return;
     }
     try
     {
         _textBuffer.Properties[typeof(Metadata)] = MetadataLoader.LoadMetadata(_targetExe);
     }
     catch (Exception e)
     {
         //TODO: Log
     }
 }
Пример #20
0
        public void Federation_LoadSambiTestMetadata()
        {
            // Sambi is the Swedish health care federation. To test that AuthServices
            // handles some real world metadata, the metadadata from Sambi's test
            // environment is used.

            using (var stream = new FileStream("SambiMetadata.xml", FileMode.Open))
            {
                var metadata = (EntitiesDescriptor)MetadataLoader.Load(stream);

                Action a = () => new Federation(metadata, true);

                a.ShouldNotThrow();
            }
        }
Пример #21
0
        public void LoadDefaultMinSize()
        {
            OcTree <CubeBounds> ocTree;

            using (Stream metadataStream = new FileStream(".\\data\\validdataset1\\v1\\metadata.json", FileMode.Open, FileAccess.Read))
            {
                ocTree = MetadataLoader.Load(metadataStream, "L1", new Vector3(1, 1, 1));
            }

            ocTree.UpdateTree();
            Assert.IsNotNull(ocTree);
            Assert.IsTrue(ocTree.HasChildren);

            OcTreeUtilities.Dump(ocTree);
        }
Пример #22
0
        public void LoadLargeSet()
        {
            OcTree <CubeBounds> ocTree = new OcTree <CubeBounds>(new BoundingBox(Vector3.Zero, Vector3.Zero), new CubeBounds[] { }, 2);

            using (Stream metadataStream = new FileStream(".\\data\\validdataset2\\v1\\metadata.json", FileMode.Open, FileAccess.Read))
            {
                ocTree = MetadataLoader.Load(metadataStream, ocTree, "L1", new Vector3(1, 1, 1));
            }

            ocTree.UpdateTree();
            Assert.AreEqual(2, ocTree.MinimumSize);
            Assert.IsNotNull(ocTree);
            Assert.IsTrue(ocTree.HasChildren);

            OcTreeUtilities.Dump(ocTree);
        }
Пример #23
0
 public override void ProcessProject(
     [NotNull] IProject project,
     [NotNull] FileSystemPath assemblyPath,
     [NotNull] MetadataLoader loader,
     [NotNull] IUnitTestElementsObserver observer,
     CancellationToken token)
 {
     MetadataElementsSource.ExploreProject(
         project,
         assemblyPath,
         loader,
         observer,
         _logger,
         token,
         metadataAssembly => _testMetadataExplorer.Explore(project, metadataAssembly, observer, token));
     observer.OnCompleted();
 }
Пример #24
0
        public void LoadForeignKeys(IDbConnection connection, Metadatas metadata, string serverId, string database)
        {
            using (var cmd = connection.CreateCommand())
            {
                cmd.CommandText = SqlGetForeignKeys;

                var p = cmd.CreateParameter();
                p.ParameterName = SqlWriter.NamedParamPrefix + "DATABASE";
                p.Value         = database;
                cmd.Parameters.Add(p);

                connection.Open();
                using (var r = cmd.ExecuteReader())
                    MetadataLoader.LoadForeignKeys(r, metadata, serverId, database);
                connection.Close();
            }
        }
        protected virtual ICollection<IUnitTestElement> GetUnitTestElements(IProject testProject, string assemblyLocation)
        {
            var observer = new TestUnitTestElementObserver();

            var resolver = new DefaultAssemblyResolver();
            resolver.AddPath(FileSystemPath.Parse(assemblyLocation).Directory);

            using (var loader = new MetadataLoader(resolver))
            {
                MetadataExplorer.ExploreProjects(
                    new Dictionary<IProject, FileSystemPath>
                    {
                        {testProject, FileSystemPath.Parse(assemblyLocation)}
                    },
                    loader, observer, CancellationToken.None);
            }
            return observer.Elements;
        }
Пример #26
0
        public static async Task <IEnumerable <GeneratedObject> > BuildObjectModelAsync(
            IEnumerable <SObjectDescription> sObjects,
            DesignTimeAuthentication authentication,
            GeneratedService generatedService,
            ConnectedServiceLogger logger)
        {
            IEnumerable <SObjectDescription> sObjectsWithDetails = await MetadataLoader.LoadObjectDetailsAsync(sObjects, authentication);

            IEnumerable <GeneratedObject> generatedObjects = sObjectsWithDetails
                                                             .Select(o => new GeneratedObject()
            {
                Model             = o,
                Service           = generatedService,
                StorageProperties = CodeModelBuilder.BuildStorageProperties(o, logger)
            })
                                                             .ToArray();

            return(generatedObjects);
        }
Пример #27
0
        protected virtual ICollection <IUnitTestElement> GetUnitTestElements(IProject testProject, string assemblyLocation)
        {
            var observer = new TestUnitTestElementObserver();

            var resolver = new DefaultAssemblyResolver();

            resolver.AddPath(FileSystemPath.Parse(assemblyLocation).Directory);

            using (var loader = new MetadataLoader(resolver))
            {
                MetadataExplorer.ExploreProjects(
                    new Dictionary <IProject, FileSystemPath>
                {
                    { testProject, FileSystemPath.Parse(assemblyLocation) }
                },
                    loader, observer, CancellationToken.None);
            }
            return(observer.Elements);
        }
Пример #28
0
        private void DoLoadMetadata()
        {
            lock (metadataLoadLock)
            {
                try
                {
                    var metadata = MetadataLoader.LoadIdp(
                        MetadataLocation,
                        spOptions.Compatibility.UnpackEntitiesDescriptorInIdentityProviderMetadata);

                    ReadMetadata(metadata);
                }
                catch (WebException)
                {
                    MetadataValidUntil = DateTime.MinValue;
                    throw;
                }
            }
        }
        protected override JetHostItems.Packages CreateJetHostPackages(JetHostItems.Engine engine)
        {
            var mainAssembly       = GetType().Assembly;
            var productBinariesDir = mainAssembly.GetPath().Parent;

            TestUtil.SetHomeDir(mainAssembly);

            Lazy <ProductBinariesDirArtifact> productBinariesDirArtifact =
                Lazy.Of(() => new ProductBinariesDirArtifact(mainAssembly.GetPath().Directory));
            var jethostitempackages = new JetHostItems.Packages(engine.Items.Concat(
                                                                    new CollectProductPackagesInDirectoryFlatNoCachingHostMixin(productBinariesDirArtifact,
                                                                                                                                allass => new[] { allass.FindSubplatformOfAssembly(mainAssembly.GetNameInfo(), OnError.Throw) },
                                                                                                                                packages =>
            {
                var packageFiles = new HashSet <ApplicationPackageFile>(
                    EqualityComparer.Create <ApplicationPackageFile>(
                        (file1, file2) => file1.LocalInstallPath == file2.LocalInstallPath,
                        file => file.LocalInstallPath.GetHashCode())
                    );

                var packageReferences = new HashSet <ApplicationPackageReference>(
                    EqualityComparer.Create <ApplicationPackageReference>(
                        (reference1, reference2) => string.Equals(reference1.PackageId, reference2.PackageId,
                                                                  StringComparison.OrdinalIgnoreCase),
                        reference => reference.PackageId.GetHashCode())
                    );

                var assemblyNameInfo = AssemblyNameInfo.Parse(mainAssembly.FullName);
                using (var loader = new MetadataLoader(productBinariesDir))
                {
                    ProcessAssembly(packages, productBinariesDir, loader, assemblyNameInfo, packageFiles,
                                    packageReferences);
                }

                var packageArtifact = new ApplicationPackageArtifact(new SubplatformName(assemblyNameInfo.Name),
                                                                     new JetSemanticVersion(assemblyNameInfo.Version), CompanyInfo.Name, CompanyInfo.NameWithInc,
                                                                     DateTime.UtcNow, null, null, packageFiles, packageReferences);
                return(new AllAssembliesOnPackages(packages.Subplatforms
                                                   .Concat(new SubplatformOnPackage(packageArtifact, null, null)).AsCollection()));
            })));

            return(base.CreateJetHostPackages(engine));
        }
        public override void SetUp()
        {
            base.SetUp();
            WrapperAssert.SupportsSpecialFeatures = false;
#if RESHARPER_31
            WrapperAssert.SupportsNestedGenericTypes = false;
#endif

            loader = new MetadataLoader(BuiltInMetadataAssemblyResolver.Instance);

            Assembly assembly = GetType().Assembly;
#if RESHARPER_50_OR_NEWER
            IMetadataAssembly metadataAssembly = loader.Load(new AssemblyNameInfo(assembly.GetName().FullName), delegate { return(true); });
#else
            IMetadataAssembly metadataAssembly = loader.Load(assembly.GetName(), delegate { return(true); });
#endif

            reflectionPolicy = new MetadataReflectionPolicy(metadataAssembly, null);
        }
        public override void SetUp()
        {
            base.SetUp();
            WrapperAssert.SupportsSpecialFeatures = false;
#if RESHARPER_31
            WrapperAssert.SupportsNestedGenericTypes = false;
#endif

            loader = new MetadataLoader(BuiltInMetadataAssemblyResolver.Instance);

            Assembly assembly = GetType().Assembly;
#if RESHARPER_50_OR_NEWER
            IMetadataAssembly metadataAssembly = loader.Load(new AssemblyNameInfo(assembly.GetName().FullName), delegate { return true; });
#else
            IMetadataAssembly metadataAssembly = loader.Load(assembly.GetName(), delegate { return true; });
#endif

            reflectionPolicy = new MetadataReflectionPolicy(metadataAssembly, null);
        }
Пример #32
0
        private void btnUnpack_Click(object sender, EventArgs e)
        {
            //Check current settings
            if (!File.Exists(txtMobi.Text))
            {
                MessageBox.Show(@"Specified book was not found.", @"Book Not Found");
                return;
            }
            if (!Directory.Exists(_settings.outDir))
            {
                MessageBox.Show(@"Specified output directory does not exist.\r\nPlease review the settings page.", @"Output Directory Not found");
                return;
            }

            _logger.Log("Extracting raw markup...");
            using var metadata = MetadataLoader.Load(txtMobi.Text);
            var rawMlPath = UIFunctions.RawMlPath(Path.GetFileNameWithoutExtension(txtMobi.Text));

            metadata.SaveRawMl(rawMlPath);
            _logger.Log($"Extracted to {rawMlPath}!\r\n");
        }
Пример #33
0
        private void FWithDelta(ProjectModelChange obj)
        {
            var reference = obj as ProjectReferenceTargetChange;

            if (reference != null)
            {
                var assembly = reference.NewReferenceTarget as IAssembly;
                if (assembly != null)
                {
                    var projectElement = reference.ProjectModelElement as IProjectElement;
                    if (projectElement == null)
                    {
                        return;
                    }

                    var project = GetProject(projectElement.GetProject());

                    project.Data = null;

                    using (var loader = new MetadataLoader())
                    {
                        var path = assembly.GetFiles().First().Location;
                        project._libs.Add(new FileLibReference(path.ToString()));
                        var metadataAssembly = loader.LoadFrom(path, x => true);
                        foreach (var a in metadataAssembly.CustomAttributesTypeNames)
                        {
                            if (a.FullName.EqualTo("Nitra.GrammarsAttribute"))
                            {
                                project.TryAddNitraExtensionAssemblyReference(path);
                            }
                        }
                    }

                    if (IsOpened)
                    {
                        project.UpdateProperties();
                    }
                }
            }
        }
Пример #34
0
        public void ComposeStandardLabelTest()
        {
            // All parts provided
            MetadataLoader.ComposeStandardLabel(_metadata.System.Name, _metadata.StartDate, _metadata.EndDate)
            .Should().Be("Some system name (1970 - 2000)");

            // System name missing
            MetadataLoader.ComposeStandardLabel(null, _metadata.StartDate, _metadata.EndDate)
            .Should().Be("(1970 - 2000)");

            // Start-date missing
            MetadataLoader.ComposeStandardLabel(_metadata.System.Name, null, _metadata.EndDate)
            .Should().Be("Some system name");

            // End-date missing
            MetadataLoader.ComposeStandardLabel(_metadata.System.Name, _metadata.StartDate, null)
            .Should().Be("Some system name");

            // No parts provided
            MetadataLoader.ComposeStandardLabel(null, null, null)
            .Should().Be("");
        }
        private static void ProcessAssembly(AllAssemblies allAssemblies, FileSystemPath productBinariesDir,
                                            MetadataLoader metadataLoader, AssemblyNameInfo assemblyNameInfo,
                                            HashSet <ApplicationPackageFile> packageFiles, HashSet <ApplicationPackageReference> packageReferences)
        {
            var assembly = metadataLoader.TryLoad(assemblyNameInfo, JetFunc <AssemblyNameInfo> .False, false);

            if (assembly == null)
            {
                return;
            }

            var subplatformOfAssembly = allAssemblies.FindSubplatformOfAssembly(assemblyNameInfo, OnError.Ignore);

            if (subplatformOfAssembly != null)
            {
                var subplatformReference = new ApplicationPackageReference(subplatformOfAssembly.Name,
                                                                           subplatformOfAssembly.GetCompanyNameHuman());
                packageReferences.Add(subplatformReference);
                return;
            }

            if (assembly.AssemblyName?.Name.Contains("Microsoft.CodeAnalysis") == true)
            {
                return;
            }
            if (!packageFiles.Add(new ApplicationPackageFile(assembly.Location.MakeRelativeTo(productBinariesDir),
                                                             assemblyNameInfo)))
            {
                return;
            }

            foreach (var referencedAssembly in assembly.ReferencedAssembliesNames)
            {
                ProcessAssembly(allAssemblies, productBinariesDir, metadataLoader, referencedAssembly, packageFiles,
                                packageReferences);
            }
        }
Пример #36
0
        private void DoLoadMetadata()
        {
            if (LoadMetadata)
            {
                lock (metadataLoadLock)
                {
                    try
                    {
                        spOptions.Logger?.WriteInformation("Loading metadata for idp " + EntityId.Id);
                        var metadata = MetadataLoader.LoadIdp(
                            MetadataLocation,
                            spOptions.Compatibility.UnpackEntitiesDescriptorInIdentityProviderMetadata);

                        ReadMetadata(metadata);
                    }
                    catch (WebException ex)
                    {
                        spOptions.Logger?.WriteError("Failed to load metadata for idp " + EntityId.Id, ex);
                        MetadataValidUntil = DateTime.MinValue;
                        throw;
                    }
                }
            }
        }
 public MetadataAssemblyInfoAdapterTest()
 {
     metadataLoader = new MetadataLoader();
 }
Пример #38
0
 public void ExploreProjects(IDictionary<IProject, FileSystemPath> projects, MetadataLoader loader, IUnitTestElementsObserver observer, CancellationToken cancellationToken)
 {
     _metadataElementsSource.ExploreProjects(projects, loader, observer, _testMetadataExplorer.Explore, cancellationToken);
       observer.OnCompleted();
 }
 public void ExploreProjects(IDictionary<IProject, FileSystemPath> projects, MetadataLoader loader, IUnitTestElementsObserver observer)
 {
     var explorer = new MSpecTestMetadataExplorer(_provider, _assemblyExplorer);
     _metadataElementsSource.ExploreProjects(projects, loader, observer, explorer.ExploreAssembly);
     observer.OnCompleted();
 }
Пример #40
0
    private void FWithDelta(ProjectModelChange obj)
    {
      var reference = obj as ProjectReferenceTargetChange;
      if (reference != null)
      {
        var assembly = reference.NewReferenceTarget as IAssembly;
        if (assembly != null)
        {
          var projectElement = reference.ProjectModelElement as IProjectElement;
          if (projectElement == null)
            return;

          var project = GetProject(projectElement.GetProject());

          project.Data = null;

          using (var loader = new MetadataLoader())
          {
            var path = assembly.GetFiles().First().Location;
            project._libs.Add(new FileLibReference(path.ToString()));
            var metadataAssembly = loader.LoadFrom(path, x => true);
            foreach (var a in metadataAssembly.CustomAttributesTypeNames)
              if (a.FullName.EqualTo("Nitra.GrammarsAttribute"))
                project.TryAddNitraExtensionAssemblyReference(path);
          }

          if (IsOpened)
            project.UpdateProperties();
        }
      }
    }
 public MetadataAttributeInfoAdapterTest()
 {
     metadataLoader = new MetadataLoader();
 }