Ejemplo n.º 1
0
        // Token: 0x06000280 RID: 640 RVA: 0x000128C8 File Offset: 0x00010AC8
        private static string GetFriendlyName(UCOMIMoniker mon)
        {
            object obj = null;
            string result;

            try
            {
                Guid guid = typeof(IPropertyBag).GUID;
                mon.BindToStorage(null, null, ref guid, out obj);
                IPropertyBag propertyBag = (IPropertyBag)obj;
                object       obj2        = "";
                int          num         = propertyBag.Read("FriendlyName", ref obj2, IntPtr.Zero);
                string       text        = obj2 as string;
                result = text;
            }
            catch (Exception ex)
            {
                result = null;
            }
            finally
            {
                if (obj != null)
                {
                    Marshal.ReleaseComObject(RuntimeHelpers.GetObjectValue(obj));
                }
                obj = null;
            }
            return(result);
        }
Ejemplo n.º 2
0
		private static string GetFriendlyName( UCOMIMoniker mon )
		{
			object bagObj = null;
			IPropertyBag bag = null;
			try {
				Guid bagId = typeof( IPropertyBag ).GUID;
				mon.BindToStorage( null, null, ref bagId, out bagObj );
				bag = (IPropertyBag) bagObj;
				object val = "";
				int hr = bag.Read( "FriendlyName", ref val, IntPtr.Zero );
				if( hr != 0 )
					Marshal.ThrowExceptionForHR( hr );
				string ret = val as string;
				if( (ret == null) || (ret.Length < 1) )
					throw new NotImplementedException( "Device FriendlyName" );
				return ret;
			}
			catch( Exception )
			{
				return null;
			}
			finally
			{
				bag = null;
				if( bagObj != null )
					Marshal.ReleaseComObject( bagObj ); bagObj = null;
			}
		}
Ejemplo n.º 3
0
        /// <summary> Retrieve the human-readable name of the filter </summary>
        protected string GetName(UCOMIMoniker moniker)
        {
            object bagObj = null;
            IPropertyBag bag = null;

            try
            {
                Guid bagId = typeof(IPropertyBag).GUID;
                moniker.BindToStorage(null, null, ref bagId, out bagObj);
                bag = (IPropertyBag)bagObj;
                object val = "";
                int hr = bag.Read("FriendlyName", ref val, IntPtr.Zero);

                if (hr != 0)
                    Marshal.ThrowExceptionForHR(hr);

                var ret = val as string;

                if (string.IsNullOrEmpty(ret))
                    throw new NotImplementedException("Device FriendlyName");
                return (ret);
            }
            catch (Exception)
            {
                return ("");
            }
            finally
            {
                bag = null;
                if (bagObj != null)
                    Marshal.ReleaseComObject(bagObj); bagObj = null;
            }
        }
Ejemplo n.º 4
0
        /// <summary> Получает читаемое имя фильтра с помощью его moniker</summary>
        protected string GetName(UCOMIMoniker moniker)
        {
            object       bagObj = null;
            IPropertyBag bag;

            try
            {
                Guid bagId = typeof(IPropertyBag).GUID;
                moniker.BindToStorage(null, null, ref bagId, out bagObj);
                bag = (IPropertyBag)bagObj;
                object val = "";
                int    hr  = bag.Read("FriendlyName", ref val, IntPtr.Zero);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
                string ret = val as string;
                if ((ret == null) || (ret.Length < 1))
                {
                    throw new NotImplementedException("Device FriendlyName");
                }
                return(ret);
            }
            catch (Exception)
            {
                return("");
            }
            finally
            {
                if (bagObj != null)
                {
                    Marshal.ReleaseComObject(bagObj);
                }
            }
        }
Ejemplo n.º 5
0
        // Get filter name represented by the moniker
        private string GetName(UCOMIMoniker moniker)
        {
            Object       bagObj = null;
            IPropertyBag bag    = null;

            try
            {
                Guid bagId = typeof(IPropertyBag).GUID;
                // get property bag of the moniker
                moniker.BindToStorage(null, null, ref bagId, out bagObj);
                bag = (IPropertyBag)bagObj;

                // read FriendlyName
                object val = "";
                int    hr  = bag.Read("FriendlyName", ref val, IntPtr.Zero);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                // get it as string
                string ret = val as string;
                if ((ret == null) || (ret.Length < 1))
                {
                    throw new ApplicationException();
                }

                return(ret);
            }
            catch (Exception)
            {
                return("");
            }
            finally
            {
                // release all COM objects
                bag = null;
                if (bagObj != null)
                {
                    Marshal.ReleaseComObject(bagObj);
                    bagObj = null;
                }
            }
        }
Ejemplo n.º 6
0
		// Get filter name represented by the moniker
		private string GetName(UCOMIMoniker moniker)
		{
			Object			bagObj = null;
			IPropertyBag	bag = null;

			try
			{
				Guid bagId = typeof(IPropertyBag).GUID;
				// get property bag of the moniker
				moniker.BindToStorage(null, null, ref bagId, out bagObj);
				bag = (IPropertyBag) bagObj;

				// read FriendlyName
				object val = "";
				int hr = bag.Read("FriendlyName", ref val, IntPtr.Zero);
				if (hr != 0)
					Marshal.ThrowExceptionForHR(hr);

				// get it as string
				string ret = val as string;
				if ((ret == null) || (ret.Length < 1))
					throw new ApplicationException();

				return ret;
			}	
			catch (Exception)
			{
				return "";
			}
			finally
			{
				// release all COM objects
				bag = null;
				if (bagObj != null)
				{
					Marshal.ReleaseComObject(bagObj);
					bagObj = null;
				}
			}
		}
Ejemplo n.º 7
0
        private static string GetFriendlyName(UCOMIMoniker mon)
        {
            object       ppvObj = null;
            IPropertyBag bag    = null;
            string       str2;

            try
            {
                Guid gUID = typeof(IPropertyBag).GUID;
                mon.BindToStorage(null, null, ref gUID, out ppvObj);
                bag = (IPropertyBag)ppvObj;
                object pVar      = "";
                int    errorCode = bag.Read("FriendlyName", ref pVar, IntPtr.Zero);
                if (errorCode != 0)
                {
                    Marshal.ThrowExceptionForHR(errorCode);
                }
                string str = pVar as string;
                if ((str == null) || (str.Length < 1))
                {
                    throw new NotImplementedException("Device FriendlyName");
                }
                str2 = str;
            }
            catch (Exception)
            {
                str2 = null;
            }
            finally
            {
                bag = null;
                if (ppvObj != null)
                {
                    Marshal.ReleaseComObject(ppvObj);
                }
                ppvObj = null;
            }
            return(str2);
        }
Ejemplo n.º 8
0
 protected string getName(UCOMIMoniker moniker)
 {
     object ppvObj = null;
     IPropertyBag bag = null;
     string str2;
     try
     {
         Guid gUID = typeof(IPropertyBag).GUID;
         moniker.BindToStorage(null, null, ref gUID, out ppvObj);
         bag = (IPropertyBag) ppvObj;
         object pVar = "";
         int errorCode = bag.Read("FriendlyName", ref pVar, IntPtr.Zero);
         if (errorCode != 0)
         {
             Marshal.ThrowExceptionForHR(errorCode);
         }
         string str = pVar as string;
         if ((str == null) || (str.Length < 1))
         {
             throw new NotImplementedException("Device FriendlyName");
         }
         str2 = str;
     }
     catch (Exception)
     {
         str2 = "";
     }
     finally
     {
         bag = null;
         if (ppvObj != null)
         {
             Marshal.ReleaseComObject(ppvObj);
         }
         ppvObj = null;
     }
     return str2;
 }