Пример #1
0
        private static string GetKey(ScriptAssembly assembly)
        {
            if (assembly == null)
            {
                return(null);
            }

            return(GetKey(assembly._cciAssembly.AssemblyIdentity));
        }
Пример #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);
        }
Пример #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());
        }
Пример #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);
                    }
                }
            }
        }
Пример #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);
 }
Пример #6
0
        private static string GetKey(ScriptAssembly assembly)
        {
            if (assembly == null)
                return null;

            return GetKey(assembly._cciAssembly.AssemblyIdentity);
        }
Пример #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);
                    }
                }
            }
        }
Пример #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();
        }