示例#1
0
        private Uri ReadAboluteUri(PsdReader reader)
        {
            IProperties props = new DescriptorStructure(reader);

            if (props.Contains("fullPath") == true)
            {
                Uri absoluteUri = new Uri(props["fullPath"] as string);
                if (File.Exists(absoluteUri.LocalPath) == true)
                {
                    return(absoluteUri);
                }
            }

            if (props.Contains("relPath") == true)
            {
                string relativePath = props["relPath"] as string;
                Uri    absoluteUri  = reader.Resolver.ResolveUri(reader.Uri, relativePath);
                if (File.Exists(absoluteUri.LocalPath) == true)
                {
                    return(absoluteUri);
                }
            }

            if (props.Contains("Nm") == true)
            {
                string name        = props["Nm"] as string;
                Uri    absoluteUri = reader.Resolver.ResolveUri(reader.Uri, name);
                if (File.Exists(absoluteUri.LocalPath) == true)
                {
                    return(absoluteUri);
                }
            }

            if (props.Contains("fullPath") == true)
            {
                return(new Uri(props["fullPath"] as string));
            }

            return(null);
        }