Beispiel #1
0
 public static string[] GetSameFolderReferences(string assemblyPath)
 {
     using (DomainIsolator isolator = new DomainIsolator("GetSameFolderReferences"))
     {
         return(isolator.GetInstance <CustomTypeInspector>().GetSameFolderReferences(assemblyPath, false));
     }
 }
Beispiel #2
0
 private static RefInfo[] GetRefs(string[] assemPaths, string[] gacNames)
 {
     using (DomainIsolator isolator = new DomainIsolator("Inspect Custom Assembly for Refs"))
     {
         return(isolator.GetInstance <CustomTypeInspector>().GetRefs(assemPaths, gacNames));
     }
 }
Beispiel #3
0
        public static FileWithVersionInfo[] GetSameFolderAssemblyReferenceChain(IEnumerable <string> assemblyFilePaths)
        {
            string[] strArray = (from path in assemblyFilePaths
                                 where _refCache.NeedsUpdate(path)
                                 select path).ToArray <string>();
            if (strArray.Length > 0)
            {
                using (DomainIsolator isolator = new DomainIsolator("GetSameFolderAssemblyReferenceChain"))
                {
                    isolator.GetInstance <CustomTypeInspector>().UpdateSameFolderAssemblyReferenceChain(_refCache, strArray);
                }
            }
            List <FileWithVersionInfo> results      = new List <FileWithVersionInfo>();
            HashSet <string>           visitedPaths = new HashSet <string>();

            foreach (string str in assemblyFilePaths)
            {
                GetRefsWithDescendants(str, visitedPaths, results);
            }
            return((from g in from r in results group r by Path.GetFileName(r.FilePath).ToUpperInvariant()
                    select(from r in g
                           orderby r.LastWriteTimeUtc descending
                           select r).First <FileWithVersionInfo>() into r
                    orderby r.FilePath
                    select r).ToArray <FileWithVersionInfo>());
        }
Beispiel #4
0
 public static string[] GetNamespaces(string assemblyPath)
 {
     using (DomainIsolator isolator = new DomainIsolator("GetNamespaces"))
     {
         return(isolator.GetInstance <CustomTypeInspector>().GetNamespaces(assemblyPath));
     }
 }
Beispiel #5
0
 public static string[] GetTypeNames(string assemblyPath, string baseTypeName)
 {
     assemblyPath = assemblyPath.Trim();
     using (DomainIsolator isolator = new DomainIsolator("Inspect Custom Assembly"))
     {
         return(isolator.GetInstance <CustomTypeInspector>().GetTypeNames(assemblyPath, baseTypeName));
     }
 }
            private void UpdateSchema()
            {
                object obj2;

                LINQPad.Repository repository;
                lock ((obj2 = this._locker))
                {
                    if ((this._worker != Thread.CurrentThread) || this._disposed)
                    {
                        return;
                    }
                    this._status = "Populating";
                }
                this.NotifyChange();
                TempFileRef  random          = TempFileRef.GetRandom("TypedDataContext", ".dll");
                AssemblyName assemblyToBuild = new AssemblyName(Path.GetFileNameWithoutExtension(random.FileName))
                {
                    CodeBase = random.FullPath
                };

                lock ((obj2 = this._locker))
                {
                    if ((this._worker != Thread.CurrentThread) || this._disposed)
                    {
                        return;
                    }
                    repository = this._repository.Clone();
                }
                IEnumerable <ExplorerItem> enumerable = null;
                string nameSpace = "LINQPad.User";
                string typeName  = "TypedDataContext";
                IDictionary <string, object> sessionData = null;

                using (DomainIsolator isolator = new DomainIsolator(repository.DriverLoader.CreateNewDriverDomain("LINQPad Schema Generator", null, null)))
                {
                    enumerable = isolator.GetInstance <SchemaBuilder>().GetSchemaAndBuildAssembly(repository.GetStore().ToString(), assemblyToBuild, ref nameSpace, ref typeName, Program.AllowOneToOne, out sessionData);
                }
                lock ((obj2 = this._locker))
                {
                    if (this._worker == Thread.CurrentThread)
                    {
                        this._repository.AutoGenNamespace           = nameSpace;
                        this._repository.AutoGenTypeName            = typeName;
                        this._repository.IsAutoGenAssemblyAvailable = true;
                        if (sessionData != null)
                        {
                            this._repository.SessionData = sessionData;
                        }
                        this._schema       = enumerable;
                        this._assemblyPath = random;
                    }
                }
            }
Beispiel #7
0
        public static bool IsAssemblyValid(string path)
        {
            bool flag;

            using (DomainIsolator isolator = new DomainIsolator("GuineaPig"))
            {
                isolator.Domain.SetData("AssemblyToTest", path);
                try
                {
                    isolator.Domain.DoCallBack(new CrossAppDomainDelegate(UpdateAgent.TestAssembly));
                    flag = true;
                }
                catch
                {
                    flag = false;
                }
            }
            return(flag);
        }
Beispiel #8
0
 internal static string DisassembleQuery(string assemblyPath, string[] additionalReferences)
 {
     if (string.IsNullOrEmpty(assemblyPath) || (additionalReferences == null))
     {
         return("");
     }
     using (DomainIsolator isolator = new DomainIsolator("Disassembler"))
     {
         string data;
         isolator.Domain.SetData("path", assemblyPath);
         isolator.Domain.SetData("refs", additionalReferences);
         try
         {
             isolator.Domain.DoCallBack(new CrossAppDomainDelegate(Disassembler.DisassembleQuery));
             data = (string)isolator.Domain.GetData("result");
         }
         catch (FileNotFoundException exception)
         {
             data = exception.Message;
         }
         return(data ?? "");
     }
 }
 private static void CreateCache(object delay)
 {
     if (delay is int)
     {
         Thread.Sleep((int)delay);
     }
     try
     {
         if (_refLookup == null)
         {
             using (DomainIsolator isolator = new DomainIsolator("AutoRef Type Populator"))
             {
                 isolator.Domain.DoCallBack(new CrossAppDomainDelegate(Program.AddLINQPadAssemblyResolver));
                 isolator.Domain.DoCallBack(new CrossAppDomainDelegate(AutoRefManager.Populate));
             }
             PopulateFromCache();
         }
     }
     catch (Exception exception)
     {
         Log.Write(exception);
     }
 }