コード例 #1
0
 /// <summary>
 /// Try to get the unique implementation id of this element.
 /// This is NOT a hash value of the object. It only gives a hint if
 /// objects are of the same object type!! Similar object types should
 /// result in the same implementation id.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <returns>the runtime unique implementation id byte array for this OpenOffice object</returns>
 public static byte[] GetImplementationId(XTypeProvider element)
 {
     byte[] id = new byte[0];
     if (element != null)
     {
         id = element.getImplementationId();
     }
     return(id);
 }
コード例 #2
0
        /// <summary>
        /// Gets all interfaces of the object.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="debug">if set to <c>true</c> the interfaces will be printed
        /// to the System.Diagnostics.Debug output.</param>
        /// <returns></returns>
        public static Type[] GetAllInterfacesOfObject(Object obj, bool debug = true)
        {
            String output = "";

            if (obj != null)
            {
                try
                {
                    XTypeProvider tp = obj as XTypeProvider;


                    if (tp != null)
                    {
                        var interfaces = tp.getTypes();

                        if (debug)
                        {
                            output += (interfaces.Length + "\tTypes:");

                            foreach (var item in interfaces)
                            {
                                output += "\n" + "\tType: " + item;
                            }
                        }
                        System.Diagnostics.Debug.WriteLine(output);
                        return(interfaces);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Can't get interfaces of Object: " + obj);
                    }
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine("Can't get interfaces of Object: " + e);
                }
            }
            return(new Type[0]);
        }
コード例 #3
0
 /// <summary>
 /// Try to get the unique implementation id of this element.
 /// This is NOT a hash value of the object. It only gives a hint if 
 /// objects are of the same object type!! Similar object types should 
 /// result in the same implementation id.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <returns>the runtime unique implementation id byte array for this OpenOffice object</returns>
 public static byte[] GetImplementationId(XTypeProvider element)
 {
     byte[] id = new byte[0];
     if (element != null)
     {
         id = element.getImplementationId();
     }
     return id;
 }