Exemple #1
0
        private static void CreateImageReferenceMapHelper(PastePackage pastePackage, SceneViewModel viewModel, Dictionary <DocumentNode, string> candidateNodes, DocumentNode descendant)
        {
            DocumentPrimitiveNode documentPrimitiveNode = descendant as DocumentPrimitiveNode;

            if (documentPrimitiveNode == null)
            {
                return;
            }
            Uri uriValue = documentPrimitiveNode.GetUriValue();

            if (uriValue == (Uri)null)
            {
                return;
            }
            foreach (KeyValuePair <string, KeyValuePair <Uri, string> > keyValuePair in pastePackage.ImageReferences)
            {
                if (keyValuePair.Key == uriValue.OriginalString)
                {
                    Uri          key1 = keyValuePair.Value.Key;
                    DocumentNode key2 = (DocumentNode)viewModel.Document.DocumentContext.CreateNode((ITypeId)documentPrimitiveNode.Type, (IDocumentNodeValue) new DocumentNodeStringValue(key1.OriginalString));
                    if (documentPrimitiveNode.IsProperty)
                    {
                        documentPrimitiveNode.Parent.Properties[(IPropertyId)documentPrimitiveNode.SitePropertyKey] = key2;
                    }
                    else
                    {
                        documentPrimitiveNode.Parent.Children[documentPrimitiveNode.SiteChildIndex] = key2;
                    }
                    candidateNodes.Add(key2, keyValuePair.Key);
                }
            }
        }