Пример #1
0
        public void RemoveItem(IStyleGalleryItem istyleGalleryItem_0)
        {
            Guid   guid;
            object obj;

            if (this.string_0 != "")
            {
                string str = this.method_2(istyleGalleryItem_0);
                if (str.Length != 0 && istyleGalleryItem_0.ID != -1)
                {
                    IPersistStream    item = (IPersistStream)istyleGalleryItem_0.Item;
                    IMemoryBlobStream memoryBlobStreamClass = new MemoryBlobStream();
                    (new ObjectStream()).Stream = memoryBlobStreamClass;
                    item.GetClassID(out guid);
                    item.Save(memoryBlobStreamClass, 1);
                    ((IMemoryBlobStreamVariant)memoryBlobStreamClass).ExportToVariant(out obj);
                    Array  arrays   = (Array)obj;
                    byte[] numArray = new byte[arrays.Length + 16];
                    guid.ToByteArray().CopyTo(numArray, 0);
                    arrays.CopyTo(numArray, 16);
                    obj = numArray;
                    OleDbConnection oleDbConnection =
                        new OleDbConnection(string.Concat("Provider=Microsoft.Jet.OLEDB.4.0;Data source= ",
                                                          this.string_0));
                    oleDbConnection.Open();
                    OleDbCommand d = this.method_7(str, oleDbConnection);
                    d.Parameters["ID"].Value = istyleGalleryItem_0.ID;
                    d.ExecuteNonQuery();
                    oleDbConnection.Close();
                }
            }
        }
Пример #2
0
        void TestGetClassID()
        {
            int  hr;
            Guid Clsid;

            hr = m_ips.GetClassID(out Clsid);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(Clsid == typeof(DVDState).GUID, "GetClassID");
        }
Пример #3
0
 public object GetObjectToSerialize(object obj, Type targetType)
 {
     if ((targetType == typeof(object)) || targetType.IsInterface)
     {
         IPersistStream persistableObject = obj as IPersistStream;
         if (persistableObject != null)
         {
             PersistStreamTypeWrapper wrapper = new PersistStreamTypeWrapper();
             persistableObject.GetClassID(out wrapper.clsid);
             wrapper.dataStream = PersistHelper.PersistIPersistStreamToByteArray(persistableObject);
             return(wrapper);
         }
         if (targetType.IsInterface)
         {
             throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("TargetObjectDoesNotSupportIPersistStream")));
         }
     }
     return(obj);
 }
 public object GetObjectToSerialize(object obj, Type targetType)
 {
     if (targetType == typeof(object) || (targetType.IsInterface))
     {
         IPersistStream streamableObject = obj as IPersistStream;
         if (null != streamableObject)
         {
             PersistStreamTypeWrapper objToSerialize = new PersistStreamTypeWrapper();
             streamableObject.GetClassID(out objToSerialize.clsid);
             objToSerialize.dataStream = PersistHelper.PersistIPersistStreamToByteArray(streamableObject);
             return(objToSerialize);
         }
         if (targetType.IsInterface)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.TargetObjectDoesNotSupportIPersistStream)));
         }
         return(obj);
     }
     return(obj);
 }