Example #1
0
        internal ServerFileInfos GetFileNames(Schema.Library library, string environment)
        {
            ServerFileInfos fileInfos = new ServerFileInfos();

            Schema.Libraries libraries = new Schema.Libraries();
            libraries.Add(library);

            while (libraries.Count > 0)
            {
                Schema.Library localLibrary = libraries[0];
                libraries.RemoveAt(0);

                foreach (Schema.FileReference reference in library.Files)
                {
                    if (reference.Environments.Contains(environment) && !fileInfos.Contains(reference.FileName))
                    {
                        string fullFileName = GetFullFileName(library, reference.FileName);
                        fileInfos.Add
                        (
                            new ServerFileInfo
                        {
                            LibraryName      = library.Name,
                            FileName         = reference.FileName,
                            FileDate         = File.GetLastWriteTimeUtc(fullFileName),
                            IsDotNetAssembly = FileUtility.IsAssembly(fullFileName),
                            ShouldRegister   = reference.IsAssembly
                        }
                        );
                    }
                }

                foreach (Schema.LibraryReference reference in localLibrary.Libraries)
                {
                    if (!libraries.Contains(reference.Name))
                    {
                        libraries.Add(Catalog.Libraries[reference.Name]);
                    }
                }
            }

            return(fileInfos);
        }
        public ServerFileInfo[] GetFileNames(string className, string environment)
        {
            Schema.RegisteredClass classValue = _serverProcess.ServerSession.Server.Catalog.ClassLoader.Classes[className];

            List <string> libraryNames      = new List <string>();
            List <string> fileNames         = new List <string>();
            List <string> assemblyFileNames = new List <string>();
            ArrayList     fileDates         = new ArrayList();

            // Build the list of all files required to load the assemblies in all libraries required by the library for the given class
            Schema.Library  library   = _serverProcess.ServerSession.Server.Catalog.Libraries[classValue.Library.Name];
            ServerFileInfos fileInfos = _session.Server.Server.GetFileNames(library, environment);

            // Return the results in reverse order to ensure that dependencies are loaded in the correct order
            ServerFileInfo[] results = new ServerFileInfo[fileInfos.Count];
            for (int index = fileInfos.Count - 1; index >= 0; index--)
            {
                results[fileInfos.Count - index - 1] = fileInfos[index];
            }

            return(results);
        }