コード例 #1
0
        internal RarImporterHelper(SevenZipExtractor Sex)
        {
            string FileName = Sex.FileName;
            _DP = Path.GetFileName(FileName);

            StringAlbumParser sa = null;
            _RootDir = Sex.GetRootDir();

            if (_RootDir != null)
            {
                sa = StringAlbumParser.FromDirectoryHelper(_RootDir);
                _RootLength = _RootDir.Path.Length;
            }

            if ((sa == null) || (sa.FounSomething == false))
                sa = StringAlbumParser.FromRarZipName(FileName);

            _Album = sa.AlbumName;
            _Artist = sa.AlbumAuthor;
            _Year = sa.AlbumYear;

            _MaxLengthWithoutRoot = (from path in Sex.SafeArchiveFileNames() let npath = ConvertFileName(path) let len = (npath == null) ? 0 : npath.Length select len).Max();
            _MaxLengthFlat = (from path in Sex.ArchiveFileData let npath = Path.GetFileName(path.SafePath()) where (!path.IsDirectory) select npath.Length).Max();
            _MaxLengthBasic = (from path in Sex.SafeArchiveFileNames() select path.Length).Max();

            if (_MaxLengthFlat > _MaxLengthWithoutRoot)
                throw new Exception("Algo Error");

            if (_MaxLengthWithoutRoot > _MaxLengthBasic)
                throw new Exception("Algo Error");
        }