Ejemplo n.º 1
0
        public static CSharpReference Parse(XmlNode node)
        {
            CSharpReference ret = new CSharpReference();

            if (node.Name == "PackageReference")
            {
                ret.ReferenceType = CSharpReferenceType.PackageReference;
            }

            if (node.Name == "ProjectReference")
            {
                ret.ReferenceType = CSharpReferenceType.ProjectReference;
            }

            if (node.Name == "EmbeddedResource")
            {
                ret.ReferenceType = CSharpReferenceType.EmbeddedResource;
            }

            ret.internalAttributes = new List <SerializableKeyValuePair <string, string> >();
            List <XmlAttribute> attribs = CSharpProject.GetAttributes(node);

            foreach (XmlAttribute xmlAttribute in attribs)
            {
                ret.internalAttributes.Add(
                    new SerializableKeyValuePair <string, string>
                {
                    Key   = xmlAttribute.Name,
                    Value = xmlAttribute.Value
                }
                    );
            }

            return(ret);
        }
Ejemplo n.º 2
0
        private static CSharpReference PrepareForTransfer(CSharpReference reference, ModuleDefinition original)
        {
            List <SerializableKeyValuePair <string, string> > attribs = reference.internalAttributes;

            for (int i = 0; i < attribs.Count; i++)
            {
                if (attribs[i].Key == "Include")
                {
                    SerializableKeyValuePair <string, string> serializableKeyValuePair = attribs[i];
                    serializableKeyValuePair.Value = Path.GetFullPath(Path.Combine(original.RootDirectory,
                                                                                   reference.internalAttributes[i].Value));
                    attribs[i] = serializableKeyValuePair;
                }
            }

            reference.internalAttributes = attribs;
            return(reference);
        }