Exemple #1
0
        public PageFile(StorageFile asFileName, String asSeries, String asSeriesNumber, int aiNumber, Book abParent, PageFile apPrev)
            : base()
        {
            UniqueId = asFileName.Path;

            File = asFileName;

            Book     = abParent;
            Previous = abParent.Last;
            if (Previous == null)
            {
                Current  = 1;
                Previous = apPrev;
            }
            else
            {
                Current = Previous.Current + 1;
                Debug.Assert(apPrev == Previous);
            }

            if (Previous != null)
            {
                Previous.Next = this;
            }
            abParent.Last = this;

            Series          = asSeries;
            SeriesNumberTag = asSeriesNumber;
            Number          = aiNumber;
        }
Exemple #2
0
 public Book(string sSeriesNumber, string sSeriesName, Series sLocation, Book previous)
     : base()
 {
     UniqueId = sLocation.UniqueId + "+" + sSeriesNumber;
     Number   = sSeriesNumber;
     Name     = sSeriesName;
     Series   = sLocation;
     Previous = previous;
     mpfFirst = mpfLast = null;
 }
Exemple #3
0
        public static async Task FolderInSeries(StorageFolder sfFolder, bool bReload = false)
        {
            if (!bReload && mlsSeries.ContainsKey(sfFolder.Path))
            {
                return;
            }

            BookShelf spWork = new BookShelf(_Series, sfFolder.Path);

            mlsSeries[sfFolder.Path] = spWork;
            List <string> fileTypeFilter = new List <string>();

            fileTypeFilter.Add(".jpeg");
            fileTypeFilter.Add(".jpg");
            fileTypeFilter.Add(".png");
            fileTypeFilter.Add(".bmp");
            fileTypeFilter.Add(".gif");
            fileTypeFilter.Add(".tif");

            QueryOptions queryOptions = new QueryOptions(CommonFileQuery.OrderByName, fileTypeFilter);

            queryOptions.FolderDepth = FolderDepth.Shallow;
            string sPrevSeries = "some series name you'll never expect to see", sPrevBook = "some series number tag you'll never expect to see";
            StorageFileQueryResult queryResults = sfFolder.CreateFileQueryWithOptions(queryOptions);
            //IReadOnlyList<StorageFile> lsFiles = await queryResults.GetFilesAsync();

            string   sSeries, sBook;
            Series   seriesThis = null;
            Book     bkThis     = null;
            PageFile pfLast     = null;
            int      iNumber    = 0;

            foreach (StorageFile fiFile in await queryResults.GetFilesAsync()) // int ifile = 0; ifile < lsFiles.Count; ifile++)
            {
                //StorageFile fiFile = lsFiles[ifile];
                string sName = fiFile.Name;         // fiFile.Path.Substring(sfFolder.Path.Length);
                ParseName(sName, out sSeries, out sBook, out iNumber);

                if (String.Compare(sSeries, sPrevSeries, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    seriesThis      = new Series(sSeries, spWork, seriesThis);
                    spWork[sSeries] = seriesThis;
                }

                if (String.Compare(sSeries, sPrevSeries, StringComparison.OrdinalIgnoreCase) != 0 ||
                    String.Compare(sBook, sPrevBook, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    bkThis = new Book(sSeries, sBook, spWork[sSeries], bkThis);
                    spWork[sSeries][sBook] = bkThis;
                    sPrevSeries            = sSeries;
                    sPrevBook = sBook;
                }

                PageFile pcfFile = new PageFile(fiFile, sSeries, sBook, iNumber, bkThis, pfLast);
                pfLast = pcfFile;
                //    sPrevSeries = sSeries;
                //    sPrevSeriesNumber = sSeriesNumber;
                //    int iTotal = 0;

                //    while (true)
                //    {
                //        iTotal++;
                //        if (ifile + iTotal < lsFiles.Count)
                //        {
                //            fiFile = fiFile = lsFiles[ifile + iTotal];
                //            sName = fiFile.Path.Substring(sfFolder.Path.Length);
                //            ParseName(sName, out sSeries, out sSeriesNumber, out iNumber[ifile + iTotal]);

                //            if (String.Compare(sSeries, sPrevSeries, StringComparison.OrdinalIgnoreCase) != 0 ||
                //                String.Compare(sSeriesNumber, sPrevSeriesNumber, StringComparison.OrdinalIgnoreCase) != 0)
                //                break;
                //        }
                //        else
                //            break;
                //    };

                //    PictureFile pcfFile = new PictureFile(lsFiles[ifile], FileNodeEnum.File, sPrevSeries, sPrevSeriesNumber, iNumber[ifile], 1, iTotal);
                //    pfLast = new PictureFile(sPrevSeriesNumber);
                //    pfLast.Add(pcfFile);

                //    for (int iPic = 2; iPic <= iTotal; iPic++)
                //    {
                //        pcfFile = new PictureFile(lsFiles[ifile + iPic - 1], FileNodeEnum.File, sPrevSeries, sPrevSeriesNumber, iNumber[ifile + iPic - 1], iPic, iTotal);
                //        pfLast.Add(pcfFile);
                //    }


                //    if (spLast == null || String.Compare(spLast.Name, sSeries) != 0)
                //    {
                //        if (spLast != null)
                //            mlsSeries[sfFolder.Path].Add(spLast);
                //        spLast = new SeriesPictures(sPrevSeries, sfFolder, sPrevSeriesNumber, pfLast);
                //    }
                //    else
                //        spLast.AddPictures(sPrevSeriesNumber, pfLast);
                //    ifile += iTotal;
                //}

                //if (spLast != null)
                //    mlsSeries[sfFolder.Path].Add(spLast);
            }
        }