Esempio n. 1
0
        private static string GetKey(ScriptAssembly assembly)
        {
            if (assembly == null)
            {
                return(null);
            }

            return(GetKey(assembly._cciAssembly.AssemblyIdentity));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new instance of the class.
        /// </summary>
        /// <param name="container">The containing assembly.</param>
        /// <param name="typeDef">The CCI type definition.</param>
        internal ScriptType(ScriptAssembly container, INamedTypeDefinition typeDef)
        {
            if (container == null || typeDef == null)
            {
                throw new InvalidOperationException();
            }

            _container = container;
            _cciType   = typeDef;
            _id        = GetKey(this);
        }
Esempio n. 3
0
        private static byte[] GetResourceData(ScriptAssembly assembly, string name)
        {
            if (assembly == null || String.IsNullOrEmpty(name))
            {
                return(null);
            }

            var target = assembly._cciAssembly.Resources
                         .SingleOrDefault(r => r.Name.Value == name);

            if (target == null || target.Resource == null)
            {
                return(null);
            }

            return(target.Resource.Data.ToArray());
        }
Esempio n. 4
0
        private static void CreateDependencyChain(ScriptAssembly target, List <ScriptAssembly> list)
        {
            foreach (var item in target.GetReferencedAssemblies())
            {
                if (!list.Contains(item))
                {
                    list.Add(item);
                    CreateDependencyChain(item, list);
                }
                else
                {
                    // this effectively sorts the list
                    var itemIdx   = list.IndexOf(item);
                    var targetIdx = list.IndexOf(target);

                    if (itemIdx < targetIdx)
                    {
                        list.RemoveAt(itemIdx);
                        list.Insert(targetIdx, item);
                    }
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Creates a new instance of the class.
 /// </summary>
 /// <param name="container">The containing assembly.</param>
 /// <param name="typeDef">The CCI type definition.</param>
 internal ScriptType(ScriptAssembly container, INamedTypeDefinition typeDef)
 {
     if (container == null || typeDef == null)
         throw new InvalidOperationException();
     
     _container = container;
     _cciType = typeDef;
     _id = GetKey(this);
 }
Esempio n. 6
0
        private static string GetKey(ScriptAssembly assembly)
        {
            if (assembly == null)
                return null;

            return GetKey(assembly._cciAssembly.AssemblyIdentity);
        }
Esempio n. 7
0
        private static void CreateDependencyChain(ScriptAssembly target, List<ScriptAssembly> list)
        {
            foreach (var item in target.GetReferencedAssemblies())
            {
                if (!list.Contains(item))
                {
                    list.Add(item);
                    CreateDependencyChain(item, list);
                }
                else
                {
                    // this effectively sorts the list
                    var itemIdx = list.IndexOf(item);
                    var targetIdx = list.IndexOf(target);

                    if (itemIdx < targetIdx)
                    {
                        list.RemoveAt(itemIdx);
                        list.Insert(targetIdx, item);
                    }
                }
            }
        }
Esempio n. 8
0
        private static byte[] GetResourceData(ScriptAssembly assembly, string name)
        {
            if (assembly == null || String.IsNullOrEmpty(name))
                return null;

            var target = assembly._cciAssembly.Resources
                .SingleOrDefault(r => r.Name.Value == name);

            if (target == null || target.Resource == null)
                return null;

            return target.Resource.Data.ToArray();
        }