Пример #1
0
        internal static void MarshalTo(GdipImageCodecInfo gdipcodec, ImageCodecInfo codec)
        {
            codec.CodecName         = Marshal.PtrToStringUni(gdipcodec.CodecName);
            codec.DllName           = Marshal.PtrToStringUni(gdipcodec.DllName);
            codec.FormatDescription = Marshal.PtrToStringUni(gdipcodec.FormatDescription);
            codec.FilenameExtension = Marshal.PtrToStringUni(gdipcodec.FilenameExtension);
            codec.MimeType          = Marshal.PtrToStringUni(gdipcodec.MimeType);
            codec.Clsid             = gdipcodec.Clsid;
            codec.FormatID          = gdipcodec.FormatID;
            codec.Flags             = gdipcodec.Flags;
            codec.Version           = gdipcodec.Version;
            codec.SignatureMasks    = new byte[gdipcodec.SigCount][];
            codec.SignaturePatterns = new byte[gdipcodec.SigCount][];
            IntPtr p = gdipcodec.SigPattern;
            IntPtr m = gdipcodec.SigMask;

            for (int i = 0; i < gdipcodec.SigCount; i++)
            {
                codec.SignatureMasks[i] = new byte[gdipcodec.SigSize];
                Marshal.Copy(m, codec.SignatureMasks[i], 0, gdipcodec.SigSize);
                m = new IntPtr(m.ToInt64() + gdipcodec.SigSize);
                codec.SignaturePatterns[i] = new byte[gdipcodec.SigSize];
                Marshal.Copy(p, codec.SignaturePatterns[i], 0, gdipcodec.SigSize);
                p = new IntPtr(p.ToInt64() + gdipcodec.SigSize);
            }
        }
Пример #2
0
		internal static void MarshalTo (GdipImageCodecInfo gdipcodec, ImageCodecInfo codec)
		{	
			codec.CodecName = Marshal.PtrToStringUni (gdipcodec.CodecName);  			    			
			codec.DllName = Marshal.PtrToStringUni (gdipcodec.DllName);
			codec.FormatDescription = Marshal.PtrToStringUni (gdipcodec.FormatDescription);
			codec.FilenameExtension = Marshal.PtrToStringUni (gdipcodec.FilenameExtension);
			codec.MimeType = Marshal.PtrToStringUni (gdipcodec.MimeType);
			codec.Clsid = gdipcodec.Clsid;
			codec.FormatID = gdipcodec.FormatID;			
			codec.Flags = gdipcodec.Flags;
			codec.Version = gdipcodec.Version;
			codec.SignatureMasks = new byte [gdipcodec.SigCount][];
			codec.SignaturePatterns = new byte [gdipcodec.SigCount][];
			IntPtr p = gdipcodec.SigPattern;
			IntPtr m = gdipcodec.SigMask;
			for (int i=0; i < gdipcodec.SigCount; i++) {
				codec.SignatureMasks[i] = new byte [gdipcodec.SigSize];
				Marshal.Copy (m, codec.SignatureMasks[i], 0, gdipcodec.SigSize);
				m = new IntPtr (m.ToInt64 () + gdipcodec.SigSize);
				codec.SignaturePatterns[i] = new byte [gdipcodec.SigSize];
				Marshal.Copy (p, codec.SignaturePatterns[i], 0, gdipcodec.SigSize);
				p = new IntPtr (p.ToInt64 () + gdipcodec.SigSize);
			}
		}