Class LiFeDataSource

LiFeDataSource class

외부 링크 파일에 대한 정보를 포함하는 LnkeDataSource 클래스를 정의합니다. Adobe® Photoshop® 파일을 수정하는 데 도움이 되는 PSD 파일 형식 조작 API의 일부입니다.

public class LiFeDataSource : LinkDataSource

생성자

이름설명
LiFeDataSource()의 새 인스턴스를 초기화합니다.LiFeDataSource 클래스.
LiFeDataSource(int, Guid, string, string, string)의 새 인스턴스를 초기화합니다.LiFeDataSource 클래스.

속성

이름설명
AdobeStockId { get; set; }Adobe® Photoshop® CC 라이브러리용 그래픽 라이브러리 AdobeStockId를 가져오거나 설정합니다.
AdobeStockLicenseState { get; }Adobe® Photoshop® CC 라이브러리에 대해 사용 가능한 경우 Adobe Stock 라이선스의 상태를 가져옵니다.
AssetLockedState { get; set; }PSD 자산이 잠겨 있는지 여부를 나타내는 값을 가져오거나 설정합니다. Adobe® Photoshop® СС 라이브러리 자산에 대한 자산 잠금 상태입니다.
AssetModTime { get; set; }Adobe® Photoshop® СС 라이브러리 자산에 대한 자산 수정 시간을 가져오거나 설정합니다.
ChildDocId { get; set; }Lnk2 / LnkE Adobe® Photoshop® 리소스의 liFE 또는 liFD 데이터 소스에서 하위 문서 식별자를 가져오거나 설정합니다.
CompId { get; set; }자식 문서에 대해 현재 선택된 구성 요소의 ID를 가져오거나 설정합니다. 아무것도 선택하지 않으면 -1이 됩니다. 구성 요소는 디자이너가 만들 수 있는 페이지 레이아웃의 구성 요소입니다. 레이어 구성 요소를 사용하면 단일 Adobe® Photoshop® 파일에서 레이아웃의 여러 버전 을 만들고 관리하고 볼 수 있습니다. 레이어 구성 요소는 레이어 패널 상태의 스냅샷입니다. 레이어 구성 요소는 세 가지 유형의 레이어 옵션을 저장하지만 이 속성은 고급 개체에 대한 레이어 구성 요소 선택 식별자를 가져옵니다. 스마트 오브젝트의 레이어 구성 요소
Date { get; set; }PSD LnkE 리소스의 LiFE 데이터 소스에서 외부 파일의 마지막 쓰기 날짜 및 시간을 가져오거나 설정합니다.
ElementName { get; set; }Adobe® Photoshop® CC 라이브러리에 대한 그래픽 라이브러리 요소 이름을 가져오거나 설정합니다.
ElementRef { get; set; }Adobe® Photoshop® CC 라이브러리에 대한 그래픽 라이브러리 요소 참조를 가져오거나 설정합니다.
FileCreator { get; set; }PSD 형식의 파일 작성자를 가져오거나 설정합니다. LnkE / Lnk2 리소스.
FileName { get; set; }PSD 링크 리소스 . 에 있는 외부 또는 포함된 파일의 이름을 가져오거나 설정합니다.
FileSize { get; set; }PSD LnkE 리소스의 LiFE 데이터 소스에 있는 외부 파일의 크기를 가져오거나 설정합니다.
FileType { get; set; }Adobe® Photoshop® Lnk2 / LnkE 리소스가 포함하거나 링크하는 내장 또는 외부 파일의 유형을 가져오거나 설정합니다.
FullPath { get; set; }PSD LnkE 리소스의 LiFE 데이터 소스에 있는 외부 파일의 전체 경로를 가져오거나 설정합니다.
HasFileOpenDescriptor { get; set; }이 링크 데이터 원본에 파일 열기 설명자(CompId 및 OriginalCompId. )가 있는지 여부를 나타내는 값을 가져오거나 설정합니다.
IsLibraryLink { get; }이 PSD 링크 데이터 소스가 Adobe® Photoshop® СС 라이브러리 항목에 연결되는지 여부를 나타내는 값을 가져옵니다.
Length { get; }링크 데이터 소스 길이를 바이트 단위로 가져옵니다.
OriginalCompId { get; }하위 문서에 대해 현재 선택한 Comp의 원래 ID를 가져옵니다. 아무것도 선택하지 않으면 -1이 됩니다. 이 속성은 스마트 개체에 대한 원래 레이어 Comp 선택 식별자를 가져옵니다. 스마트 오브젝트의 레이어 구성 요소
OriginalFileName { get; }Adobe® Photoshop® 글로벌 링크 리소스에서 데이터 소스의 원래 파일 이름을 가져옵니다.
RelativePath { get; set; }PSD LnkE 리소스의 LiFE 데이터 소스에 있는 외부 파일의 상대 경로를 가져오거나 설정합니다.
Type { get; }Adobe® Photoshop® 글로벌 링크 데이터 소스 유형을 가져오거나 다음 중 하나가 아닐 수 있습니다.
UniqueId { get; }PSD 링크 리소스에서 데이터 소스의 전역 고유 식별자를 가져옵니다.
Version { get; }PSD LnkE/Lnk2 리소스에서 데이터 소스의 버전을 가져옵니다.

이 예제는 Psd LnkE 리소스의 속성을 가져오고 설정하는 방법을 보여줍니다.

[C#]

string message = "The example works incorrectly.";
void AssertAreEqual(object actual, object expected)
{
    if (!object.Equals(actual, expected))
    {
        throw new FormatException(message);
    }
}

// 이 예제는 외부 링크 파일에 대한 정보가 포함된 Psd LnkE 리소스의 속성을 가져오고 설정하는 방법을 보여줍니다.
void ExampleOfLnkEResourceSupport(
    string fileName,
    int length,
    int length2,
    int length3,
    int length4,
    string fullPath,
    string date,
    double assetModTime,
    string childDocId,
    bool locked,
    string uid,
    string name,
    string originalFileName,
    string fileType,
    long size,
    int version)
{
    string outputPath = fileName;
    using (PsdImage image = (PsdImage)Image.Load(fileName))
    {
        LnkeResource lnkeResource = null;
        foreach (var resource in image.GlobalLayerResources)
        {
            lnkeResource = resource as LnkeResource;
            if (lnkeResource != null)
            {
                LiFeDataSource lifeSource = lnkeResource[0];
                AssertAreEqual(lnkeResource.Length, length);
                AssertAreEqual(lifeSource.UniqueId, new Guid(uid));
                AssertAreEqual(lifeSource.FullPath, fullPath);
                AssertAreEqual(lifeSource.Date.ToString(CultureInfo.InvariantCulture), date);
                AssertAreEqual(lifeSource.AssetModTime, assetModTime);
                AssertAreEqual(lifeSource.FileName, name);
                AssertAreEqual(lifeSource.FileSize, size);
                AssertAreEqual(lifeSource.ChildDocId, childDocId);
                AssertAreEqual(lifeSource.Version, version);
                AssertAreEqual(lifeSource.FileType.TrimEnd(' '), fileType);
                AssertAreEqual(lifeSource.FileCreator.TrimEnd(' '), string.Empty);
                AssertAreEqual(lifeSource.OriginalFileName, originalFileName);
                AssertAreEqual(false, lnkeResource.IsEmpty);
                AssertAreEqual(true, lifeSource.Type == LinkDataSourceType.liFE);
                if (version == 7)
                {
                    AssertAreEqual(lifeSource.AssetLockedState, locked);
                }

                if (lifeSource.HasFileOpenDescriptor)
                {
                    AssertAreEqual(lifeSource.CompId, -1);
                    AssertAreEqual(lifeSource.OriginalCompId, -1);
                }

                lifeSource.FullPath =
                    @"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Images/Psd/SmartObjects/rgb8_2x2.png";
                AssertAreEqual(lnkeResource.Length, length2);
                lifeSource.FileName = "rgb8_2x23.png";
                AssertAreEqual(lnkeResource.Length, length3);
                lifeSource.ChildDocId = Guid.NewGuid().ToString();
                AssertAreEqual(lnkeResource.Length, length4);
                lifeSource.Date = DateTime.Now;
                lifeSource.AssetModTime = double.MaxValue;
                lifeSource.FileSize = long.MaxValue;
                lifeSource.FileType = "test";
                lifeSource.FileCreator = "file";
                lifeSource.CompId = int.MaxValue;
                break;
            }
        }

        AssertAreEqual(true, lnkeResource != null);

        image.Save(outputPath, new PsdOptions(image));
    }
}

// 이 예제는 외부 연결된 JPEG 파일에 대한 정보를 포함하는 Psd LnkeResource의 속성을 가져오고 설정하는 방법을 보여줍니다.
ExampleOfLnkEResourceSupport(
    @"photooverlay_5_new.psd",
    0x21c,
    0x26c,
    0x274,
    0x27c,
    @"file:///C:/Users/cvallejo/Desktop/photo.jpg",
    "05/09/2017 22:24:51",
    0,
    "F062B9DB73E8D124167A4186E54664B0",
    false,
    "02df245c-36a2-11e7-a9d8-fdb2b61f07a7",
    "photo.jpg",
    "photo.jpg",
    "JPEG",
    0x1520d,
    7);

// 이 예제는 외부 링크된 PNG 파일에 대한 정보가 포함된 PSD LnkeResource의 속성을 가져오고 설정하는 방법을 보여줍니다.
ExampleOfLnkEResourceSupport(
    "rgb8_2x2_linked.psd",
    0x284,
    0x290,
    0x294,
    0x2dc,
    @"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Issues/PSDNET-491/rgb8_2x2.png",
    "04/14/2020 14:23:44",
    0,
    string.Empty,
    false,
    "5867318f-3174-9f41-abca-22f56a75247e",
    "rgb8_2x2.png",
    "rgb8_2x2.png",
    "png",
    0x53,
    7);

// 이 예제는 두 개의 외부 연결된 PNG 및 PSD 파일에 대한 정보가 포함된 PSD LnkeResource의 속성을 가져오고 설정하는 방법을 보여줍니다.
ExampleOfLnkEResourceSupport(
    "rgb8_2x2_linked2.psd",
    0x590,
    0x580,
    0x554,
    0x528,
    @"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Images/Psd/AddColorBalanceAdjustmentLayer.psd",
    "01/15/2020 13:02:00",
    0,
    "adobe:docid:photoshop:9312f484-3403-a644-8973-e725abc95fb7",
    false,
    "78a5b588-364f-0940-a2e5-a450a031aa48",
    "AddColorBalanceAdjustmentLayer.psd",
    "AddColorBalanceAdjustmentLayer.psd",
    "8BPS",
    0x4aea,
    7);

// 이 예제는 연결된 외부 CC Libraries 자산에 대한 정보가 포함된 Photoshop Psd LnkeResource의 속성을 가져오고 설정하는 방법을 보여줍니다.
ExampleOfLnkEResourceSupport(
    "rgb8_2x2_asset_linked.psd",
    0x398,
    0x38c,
    0x388,
    0x3d0,
    @"CC Libraries Asset “rgb8_2x2_linked/rgb8_2x2” (Feature is available in Photoshop CC 2015)",
    "01/01/0001 00:00:00",
    1588890915488.0d,
    string.Empty,
    false,
    "ec15f0a8-7f13-a640-b928-7d29c6e9859c",
    "rgb8_2x2_linked",
    "rgb8_2x2.png",
    "png",
    0,
    7);

다음 코드는 LnkeResource 리소스의 지원을 보여줍니다.

[C#]

void AssertIsTrue(bool condition)
{
    if (!condition)
    {
        throw new FormatException(string.Format("Expected true"));
    }
}

void AssertAreEqual(object actual, object expected)
{
    if (!object.Equals(actual, expected))
    {
        throw new FormatException(string.Format("Actual value {0} are not equal to expected {1}.", actual, expected));
    }
}

object[] ComplexLnkEResourceSupportCases = new object[]
{
    new object[]
    {
        "10fc87d0-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/or hdr btns” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633541.0d,
        "uuid:8485ca8d-9496-7f4d-9ef7-4243a00d4161",
        "OneReview-InDesign-InContextTranslation",
        "or hdr btns.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x3b4
    },
    new object[]
    {
        "10fc87cc-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/cs Id icon” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633512.0d,
        "uuid:c18be832-adf7-4b43-8223-a9740807a66c",
        "OneReview-InDesign-InContextTranslation",
        "cs Id icon.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x3b0
    },
    new object[]
    {
        "10fef79c-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/pointer cursor” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633570.0d,
        "uuid:9d7ccaac-f094-214b-8721-1a07ae8700a9",
        "OneReview-InDesign-InContextTranslation",
        "pointer cursor.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x03c0
    },
    new object[]
    {
        "10fef79a-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/x” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633555.0d,
        "uuid:b28aa699-21d6-2d4d-a4c7-790234c1b6ba",
        "OneReview-InDesign-InContextTranslation",
        "x.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x38c
    },
    new object[]
    {
        "10fef79b-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/modal btns” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633562.0d,
        "uuid:1bd42767-058d-da44-bdee-eada3b9d40a5",
        "OneReview-InDesign-InContextTranslation",
        "modal btns.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x3b0
    },
    new object[]
    {
        "10fc87cd-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/cs ppt icon” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633519.0d,
        "uuid:215499ac-ac44-b44d-894b-9ff2c7008d9d",
        "OneReview-InDesign-InContextTranslation",
        "cs ppt icon.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x3b4
    },
    new object[]
    {
        "10fc87cf-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/cs AI icon” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633534.0d,
        "uuid:a67964d4-8682-d649-8118-474cb1776264",
        "OneReview-InDesign-InContextTranslation",
        "cs AI icon.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x3b0
    },
    new object[]
    {
        "10fc87ce-688f-1179-9685-9d0a040abdc3",
        @"CC Libraries Asset “OneReview-InDesign-InContextTranslation/cs PSD icon” (Feature is available in Photoshop CC 2015)",
        "01/01/0001 00:00:00",
        1463698633527.0d,
        "uuid:8e9d5745-9f23-6f49-968e-647a45811bcb",
        "OneReview-InDesign-InContextTranslation",
        "cs PSD icon.ai",
        0L,
        "",
        6,
        "unlicensed",
        false,
        0x3b4
    },
};

void ExampleOfComplexLnkEResourceSupport(string filePath, int length, int length2, object[] dataSourceExpectedValues)
{
    filePath = "PSDNET652_1" + Path.DirectorySeparatorChar + filePath;
    string fileName = Path.GetFileName(filePath);
    using (PsdImage image = (PsdImage)Image.Load(filePath))
    {
        LnkeResource lnkeResource = null;
        foreach (var resource in image.GlobalLayerResources)
        {
            lnkeResource = resource as LnkeResource;
            if (lnkeResource != null)
            {
                AssertAreEqual(lnkeResource.DataSourceCount, 8);
                AssertAreEqual(lnkeResource.Length, length);
                AssertAreEqual(lnkeResource.IsEmpty, false);

                for (int i = 0; i < lnkeResource.DataSourceCount; i++)
                {
                    LiFeDataSource liFeSource = lnkeResource[i];
                    object[] expected = (object[])dataSourceExpectedValues[i];
                    AssertAreEqual(liFeSource.Type, LinkDataSourceType.liFE);
                    AssertAreEqual(liFeSource.UniqueId, new Guid((string)expected[0]));
                    AssertAreEqual(liFeSource.FullPath, expected[1]);
                    AssertAreEqual(liFeSource.Date.ToString(CultureInfo.InvariantCulture), expected[2]);
                    AssertAreEqual(liFeSource.AssetModTime, expected[3]);
                    AssertAreEqual(liFeSource.ChildDocId, expected[4]);
                    AssertAreEqual(liFeSource.FileName, expected[5]);
                    AssertAreEqual(liFeSource.OriginalFileName, expected[6]);
                    AssertAreEqual(liFeSource.FileSize, expected[7]);
                    AssertAreEqual(liFeSource.FileType, expected[8]);
                    AssertAreEqual(liFeSource.FileCreator.TrimEnd(' '), string.Empty);
                    AssertAreEqual(liFeSource.Version, expected[9]);
                    AssertAreEqual(liFeSource.AdobeStockLicenseState, expected[10]);
                    AssertAreEqual(liFeSource.HasFileOpenDescriptor, (bool)expected[11]);

                    if (liFeSource.HasFileOpenDescriptor)
                    {
                        AssertAreEqual(liFeSource.CompId, -1);
                        AssertAreEqual(liFeSource.OriginalCompId, -1);
                        liFeSource.CompId = int.MaxValue;
                    }

                    liFeSource.FullPath = @"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Images/Psd/SmartObjects/rgb8_2x2.png";
                    liFeSource.FileName = "rgb8_2x23.png";
                    liFeSource.ChildDocId = Guid.NewGuid().ToString();
                    liFeSource.Date = DateTime.Now;
                    liFeSource.AssetModTime = double.MaxValue;
                    liFeSource.FileSize = long.MaxValue;
                    liFeSource.FileType = "test";
                    liFeSource.FileCreator = "file";
                    AssertAreEqual((int)liFeSource.Length, expected[12]);
                }

                AssertAreEqual(lnkeResource.Length, length2);
                break;
            }
        }

        AssertIsTrue(lnkeResource != null);
    }
}

ExampleOfComplexLnkEResourceSupport(
    "OneReview-InDesign-RefreshPreviewIxD(2).psd",
    0x21ac,
    0x1db8,
    ComplexLnkEResourceSupportCases);

또한보십시오