コード例 #1
0
        public ResourceFileSystem(AssemblyWithSourceInfo assemblyInfo) : base(new FileProviderFileSystemParams(new ManifestEmbeddedFileProvider(assemblyInfo.Assembly)))
        {
            this.AssemblyInfo = assemblyInfo;

            List <DirectoryPath> resourceRootList = new List <DirectoryPath>();

            // List all ResourcRoot directories (which contains the 'resource_root' file)
            foreach (DirectoryPath srcRootPath in this.AssemblyInfo.SourceRootList)
            {
                try
                {
                    foreach (FileSystemEntity entity in srcRootPath.EnumDirectory(true, EnumDirectoryFlags.NoGetPhysicalSize))
                    {
                        if (entity.IsCurrentOrParentDirectory == false && entity.IsDirectory)
                        {
                            DirectoryPath subDir = new DirectoryPath(entity.FullPath);
                            try
                            {
                                if (subDir.GetFiles().Where(x => x.GetFileName()._IsSamei(Consts.FileNames.RootMarker_Resource)).Any())
                                {
                                    resourceRootList.Add(subDir);
                                }
                            }
                            catch { }
                        }
                    }
                }
                catch { }
            }

            this.ResourceRootSourceDirectoryList = resourceRootList;

            this.Params.EasyAccessPathFindMode.Set(EasyAccessPathFindMode.MostMatch);
        }
コード例 #2
0
        public override bool Equals(object?obj)
        {
            obj._NullCheck();

            AssemblyWithSourceInfo other = (AssemblyWithSourceInfo)obj;

            if (this.Assembly.Equals(other.Assembly) == false)
            {
                return(false);
            }

            string thisSourceListConcat  = this.SourceRootList.Select(x => x.PathString).OrderBy(x => x)._Combine(",");
            string otherSourceListConcat = other.SourceRootList.Select(x => x.PathString).OrderBy(x => x)._Combine(",");

            if (thisSourceListConcat != otherSourceListConcat)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
 public static ResourceFileSystem CreateOrGet(AssemblyWithSourceInfo assembly) => Singleton.CreateOrGet(assembly);