[C#][Test]publicvoidTestPsdNet140(){// VsmsResource のサポートstringsourceFileName="EmptyRectangle.psd";stringexportPath="EmptyRectangle_changed.psd";varim=(PsdImage)Image.Load(sourceFileName);using(im){varresource=GetVsmsResource(im);// 読むif(resource.IsDisabled!=false||resource.IsInverted!=false||resource.IsNotLinked!=false||resource.Paths.Length!=7||resource.Paths[0].Type!=VectorPathType.PathFillRuleRecord||resource.Paths[1].Type!=VectorPathType.InitialFillRuleRecord||resource.Paths[2].Type!=VectorPathType.ClosedSubpathLengthRecord||resource.Paths[3].Type!=VectorPathType.ClosedSubpathBezierKnotUnlinked||resource.Paths[4].Type!=VectorPathType.ClosedSubpathBezierKnotUnlinked||resource.Paths[5].Type!=VectorPathType.ClosedSubpathBezierKnotUnlinked||resource.Paths[6].Type!=VectorPathType.ClosedSubpathBezierKnotUnlinked){thrownewException("VsmsResource was read wrong");}varpathFillRule=(PathFillRuleRecord)resource.Paths[0];varinitialFillRule=(InitialFillRuleRecord)resource.Paths[1];varsubpathLength=(LengthRecord)resource.Paths[2];// パス塗りつぶしルールには追加情報は含まれていませんif(pathFillRule.Type!=VectorPathType.PathFillRuleRecord||initialFillRule.Type!=VectorPathType.InitialFillRuleRecord||initialFillRule.IsFillStartsWithAllPixels!=false||subpathLength.Type!=VectorPathType.ClosedSubpathLengthRecord||subpathLength.IsClosed!=true||subpathLength.IsOpen!=false){thrownewException("VsmsResource paths were read wrong");}// 編集中resource.IsDisabled=true;resource.IsInverted=true;resource.IsNotLinked=true;varbezierKnot=(BezierKnotRecord)resource.Paths[3];bezierKnot.Points[0]=newPoint(0,0);bezierKnot=(BezierKnotRecord)resource.Paths[4];bezierKnot.Points[0]=newPoint(8039798,10905191);initialFillRule.IsFillStartsWithAllPixels=true;subpathLength.IsClosed=false;im.Save(exportPath);}}privateVsmsResourceGetVsmsResource(PsdImageimage){varlayer=image.Layers[1];VsmsResourceresource=null;varresources=layer.Resources;for(inti=0;i<resources.Length;i++){if(resources[i]isVsmsResource){resource=(VsmsResource)resources[i];break;}}if(resource==null){thrownewException("VsmsResource not found");}returnresource;}