Exemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////

        private void LoadImageResources(PsdBinaryReader reader)
        {
            Util.DebugMessage(reader.BaseStream, "Load, Begin, ImageResources");

            var imageResourcesLength = reader.ReadUInt32();

            if (imageResourcesLength <= 0)
            {
                return;
            }

            var startPosition = reader.BaseStream.Position;
            var endPosition   = startPosition + imageResourcesLength;

            while (reader.BaseStream.Position < endPosition)
            {
                var imageResource = ImageResourceFactory.CreateImageResource(reader);
                ImageResources.Add(imageResource);
            }

            Util.DebugMessage(reader.BaseStream, "Load, End, ImageResources");

            //-----------------------------------------------------------------------
            // make sure we are not on a wrong offset, so set the stream position
            // manually
            reader.BaseStream.Position = startPosition + imageResourcesLength;
        }
Exemplo n.º 2
0
        public PsdFile(PsdFileVersion version = PsdFileVersion.Psd)
        {
            Version = version;

            BaseLayer      = new Layer(this);
            ImageResources = new ImageResources();
            Layers         = new List <Layer>();
            AdditionalInfo = new List <LayerInfo>();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Set the VersionInfo resource on the file.
        /// </summary>
        public void SetVersionInfo()
        {
            var versionInfo = (VersionInfo)ImageResources.Get(ResourceID.VersionInfo);

            if (versionInfo == null)
            {
                versionInfo = new VersionInfo();
                ImageResources.Set(versionInfo);

                // Get the version string.  We don't use the fourth part (revision).
                var assembly      = System.Reflection.Assembly.GetExecutingAssembly();
                var version       = assembly.GetName().Version;
                var versionString = version.Major + "." + version.Minor + "." + version.Build;

                // Strings are not localized since they are not shown to the user.
                versionInfo.Version           = 1;
                versionInfo.HasRealMergedData = true;
                versionInfo.ReaderName        = "Paint.NET PSD Plugin";
                versionInfo.WriterName        = "Paint.NET PSD Plugin " + versionString;
                versionInfo.FileVersion       = 1;
            }
        }