示例#1
0
文件: OleHelper.cs 项目: 15831944/WW
 public static DxfOle.Type OleItemType(DxfOle ole)
 {
     try
     {
         object o = OleHelper.smethod_0(ole);
         if (o == null)
         {
             return(DxfOle.Type.Unknown);
         }
         IntPtr iunknownForObject = Marshal.GetIUnknownForObject(o);
         if (iunknownForObject != IntPtr.Zero)
         {
             Guid   iid = new Guid("0000011d-0000-0000-C000-000000000046");
             IntPtr ppv;
             Marshal.QueryInterface(iunknownForObject, ref iid, out ppv);
             if (ppv != IntPtr.Zero)
             {
                 Marshal.Release(ppv);
                 Marshal.Release(iunknownForObject);
                 return(DxfOle.Type.Link);
             }
             OleHelper.Interface20 objectForIunknown = Marshal.GetObjectForIUnknown(iunknownForObject) as OleHelper.Interface20;
             Marshal.Release(iunknownForObject);
             uint dwStatus = 0;
             return(objectForIunknown.imethod_19(1U, ref dwStatus) == 0 && ((int)dwStatus & 8) == 0 ? DxfOle.Type.Embedded : DxfOle.Type.Static);
         }
     }
     catch (Exception ex)
     {
     }
     return(DxfOle.Type.Unknown);
 }
示例#2
0
文件: DxfOle.cs 项目: 15831944/WW
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfOle dxfOle = (DxfOle)from;

            this.qualityType_0 = dxfOle.Quality;
            this.int_0         = dxfOle.OleDataVersion;
            this.int_1         = dxfOle.UnknownLong;
            this.byte_0        = dxfOle.UnknownByte1;
            this.byte_1        = dxfOle.UnknownByte2;
            this.point3D_0     = dxfOle.UpperLeft;
            this.point3D_1     = dxfOle.UpperRight;
            this.point3D_2     = dxfOle.LowerRight;
            this.point3D_3     = dxfOle.LowerLeft;
            this.short_1       = dxfOle.HimetricWidth;
            this.short_2       = dxfOle.HimetricHeight;
            this.int_2         = dxfOle.OleItemVersion;
            this.int_3         = (int)dxfOle.Model.UniqueOleItemCounter();
            this.aspect_0      = dxfOle.AdviseType;
            this.bool_2        = dxfOle.Moniker;
            this.aspect_1      = dxfOle.DrawAspect;
            this.string_0      = dxfOle.UserType;
            this.type_0        = dxfOle.OleObjectType;
            this.dxfOleXData_0 = dxfOle.dxfOleXData_0;
            this.byte_2        = dxfOle.OleData;
        }
示例#3
0
文件: OleHelper.cs 项目: 15831944/WW
        public static Bitmap Preview(DxfOle ole, int width, int height)
        {
            object obj = OleHelper.smethod_0(ole);

            if (obj == null || width <= 0 || height <= 0)
            {
                return((Bitmap)null);
            }
            Rectangle lprcBounds = new Rectangle(0, 0, width, height);
            Bitmap    bitmap     = new Bitmap(width, height);
            int       num;

            using (Graphics graphics = Graphics.FromImage((Image)bitmap))
            {
                IntPtr hdc = graphics.GetHdc();
                try
                {
                    num = OleHelper.OleDraw(obj, (uint)ole.DrawAspect, hdc, ref lprcBounds);
                }
                finally
                {
                    Marshal.FinalReleaseComObject(obj);
                    graphics.ReleaseHdc(hdc);
                }
            }
            if (num == 0)
            {
                return(bitmap);
            }
            bitmap.Dispose();
            return((Bitmap)null);
        }
示例#4
0
文件: OleHelper.cs 项目: 15831944/WW
        private static object smethod_0(DxfOle ole)
        {
            if (ole.OleData == null)
            {
                return((object)null);
            }
            object obj;

            try
            {
                obj = OleHelper.smethod_1(ole);
            }
            catch (Exception ex)
            {
                obj = (object)null;
            }
            if (obj == null)
            {
                try
                {
                    obj = OleHelper.smethod_1(ole);
                }
                catch (Exception ex)
                {
                    obj = (object)null;
                }
            }
            return(obj);
        }
示例#5
0
文件: OleHelper.cs 项目: 15831944/WW
        public static string OleUserType(DxfOle ole)
        {
            object o = OleHelper.smethod_0(ole);

            if (o != null)
            {
                IntPtr iunknownForObject = Marshal.GetIUnknownForObject(o);
                if (iunknownForObject != IntPtr.Zero)
                {
                    OleHelper.Interface20 objectForIunknown = Marshal.GetObjectForIUnknown(iunknownForObject) as OleHelper.Interface20;
                    Marshal.Release(iunknownForObject);
                    if (objectForIunknown == null)
                    {
                        return((string)null);
                    }
                    string str = (string)null;
                    try
                    {
                        str = objectForIunknown.imethod_13(1U);
                    }
                    catch (COMException ex)
                    {
                    }
                    return(str);
                }
            }
            return((string)null);
        }
示例#6
0
文件: OleHelper.cs 项目: 15831944/WW
        public static void FinishCreate(DxfOle ole)
        {
            object pUnk = OleHelper.smethod_0(ole);

            if (pUnk == null)
            {
                return;
            }
            OleHelper.OleSetContainedObject(pUnk, true);
        }
示例#7
0
文件: DxfOle.cs 项目: 15831944/WW
        public override IGraphCloneable Clone(CloneContext cloneContext)
        {
            DxfOle dxfOle = (DxfOle)cloneContext.GetExistingClone((IGraphCloneable)this);

            if (dxfOle == null)
            {
                dxfOle = new DxfOle();
                cloneContext.RegisterClone((IGraphCloneable)this, (IGraphCloneable)dxfOle);
                dxfOle.CopyFrom((DxfHandledObject)this, cloneContext);
            }
            return((IGraphCloneable)dxfOle);
        }
示例#8
0
文件: OleHelper.cs 项目: 15831944/WW
        public static string OleLinkPath(DxfOle ole)
        {
            object o = OleHelper.smethod_0(ole);

            if (o != null)
            {
                IntPtr iunknownForObject = Marshal.GetIUnknownForObject(o);
                if (iunknownForObject != IntPtr.Zero)
                {
                    OleHelper.Interface21 objectForIunknown = Marshal.GetObjectForIUnknown(iunknownForObject) as OleHelper.Interface21;
                    Marshal.Release(iunknownForObject);
                    return(objectForIunknown?.imethod_5());
                }
            }
            return((string)null);
        }
示例#9
0
文件: OleHelper.cs 项目: 15831944/WW
        private static object smethod_1(DxfOle ole)
        {
            int length = ole.OleData.Length;

            if (length == 0)
            {
                return((object)null);
            }
            IntPtr num = OleHelper.GlobalAlloc(34, length);

            if (num == IntPtr.Zero)
            {
                return((object)null);
            }
            object ppvObj;

            try
            {
                IntPtr destination = OleHelper.GlobalLock(num);
                if (destination == IntPtr.Zero)
                {
                    return((object)null);
                }
                Marshal.Copy(ole.OleData, 0, destination, ole.OleData.Length);
                OleHelper.GlobalUnlock(num);
                OleHelper.Interface17 ppLkbyt;
                OleHelper.Interface19 ppstgOpen;
                if (OleHelper.CreateILockBytesOnHGlobal(num, true, out ppLkbyt) != 0 || OleHelper.StgOpenStorageOnILockBytes(ppLkbyt, (OleHelper.Interface19)null, 16U, IntPtr.Zero, 0U, out ppstgOpen) != 0)
                {
                    return((object)null);
                }
                if (OleHelper.OleLoad(ppstgOpen, ref OleHelper.guid_0, (OleHelper.Interface16)null, out ppvObj) != 0)
                {
                    return((object)null);
                }
            }
            finally
            {
                OleHelper.GlobalFree(num);
            }
            return(ppvObj);
        }
示例#10
0
文件: OleHelper.cs 项目: 15831944/WW
        public static void OleHiMetrics(DxfOle ole, out int width, out int height)
        {
            width  = 1000;
            height = 1000;
            object o = OleHelper.smethod_0(ole);

            if (o == null)
            {
                return;
            }
            IntPtr iunknownForObject = Marshal.GetIUnknownForObject(o);

            if (!(iunknownForObject != IntPtr.Zero))
            {
                return;
            }
            OleHelper.Interface20 objectForIunknown = Marshal.GetObjectForIUnknown(iunknownForObject) as OleHelper.Interface20;
            Marshal.Release(iunknownForObject);
            if (objectForIunknown == null)
            {
                return;
            }
            if (ole.OleObjectType == DxfOle.Type.Link && objectForIunknown.imethod_11() == 0U)
            {
                objectForIunknown.imethod_10();
            }
            if (ole.OleObjectType == DxfOle.Type.Static)
            {
                return;
            }
            Size psizel = new Size();

            objectForIunknown.imethod_15((uint)ole.DrawAspect, ref psizel);
            width  = psizel.Width;
            height = psizel.Height;
        }
示例#11
0
 public virtual void Visit(DxfOle ole)
 {
 }
示例#12
0
 public DxfOleXData(DxfOle ole)
 {
     this.dxfOle_0 = ole;
 }
示例#13
0
 public virtual void Visit(DxfOle ole)
 {
     this.VisitEntity((DxfEntity)ole);
 }