Ejemplo n.º 1
0
        public static bool AddAssembly(String fullName, byte[] code, bool isGuiThreadExecution)
        {
            bool added = false;

            string[] tokens   = fullName.Split(',');
            String   name     = tokens[0];
            int      hashCode = GetHashCode(name);

            if (!assemblies.ContainsKey(hashCode))
            {
                MgAssembly assembly = new MgAssembly();
                assembly.FullName           = fullName;
                assembly.UseSpecificVersion = false;
                assembly.FileName           = fullName;
                assembly.Name = fullName;
                assembly.IsGuiThreadExecution = isGuiThreadExecution;
                try
                {
                    if (code != null)
                    {
                        assembly.Assembly = Assembly.Load(code);
                    }
                }
                catch (Exception) {}
                assemblies.Add(hashCode, assembly);
                added = true;
            }
            return(added);
        }
Ejemplo n.º 2
0
        /// <summary></summary>
        /// <param name="hashCode"></param>
        /// <returns></returns>
        private static bool IsGuiThreadExecution(int hashCode)
        {
            bool       result     = false;
            MgAssembly mgAssembly = null;

            if (assemblies.TryGetValue(hashCode, out mgAssembly))
            {
                result = mgAssembly.IsGuiThreadExecution;
            }
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>adds an assembly to the list of the assemblies</summary>
        /// <param name="assembly"></param>
        /// <returns></returns>
        public static bool AddAssembly(String fullName, bool useSpecific, String fileName, bool isGuiThreadExecution)
        {
            bool added = false;

            String name;
            int    hashCode = getAssemblyHashCode(fullName, out name);

            if (!assemblies.ContainsKey(hashCode))
            {
                MgAssembly assembly = new MgAssembly();
                assembly.FullName           = fullName;
                assembly.UseSpecificVersion = useSpecific;
                assembly.FileName           = fileName;
                assembly.Name = name;
                assembly.IsGuiThreadExecution = isGuiThreadExecution;
                assemblies.Add(hashCode, assembly);
                added = true;
            }

            return(added);
        }