Beispiel #1
0
 public bool isEqual(MangaChapter other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.MyGetHashCode() == other.MyGetHashCode());
 }
Beispiel #2
0
        public List <MangaChapter> getChapters(DirectoryInfo di, bool subFodlers, float pageCutoff, bool RTL,
                                               Func <FileSystemInfo, object> orderFunc, List <FileImporterError> errorPages, Action <string, int> updateFunc = null)
        {
            List <MangaChapter> result = new List <MangaChapter>();

            if (di.Exists)
            {
                MangaChapter ch = new MangaChapter()
                {
                    Name              = di.Name, ParentName = (di.Parent?.Name ?? ""),
                    IsRTL             = RTL,
                    autoPageNumbering = false
                };

                foreach (FileInfo fi in di.EnumerateFiles("*.*").OrderBy(orderFunc))
                {
                    if (!checkFileSupported(fi, errorPages))
                    {
                        continue;
                    }

                    updateFunc?.Invoke(fi.Directory.Name + "/" + fi.Name, 0);
                    try
                    {
                        var page = getMangaPageFromPath(fi, pageCutoff, errorPages);
                        if (page != null)
                        {
                            ch.Pages.Add(page);
                        }
                    }
                    catch (Exception ex) { Debug.Print(ex.ToString()); }
                }

                ch.autoPageNumbering = true;
                ch.updateChapterStats();

                if (ch.Pages.Count > 0)
                {
                    result.Add(ch);
                }


                if (subFodlers)
                {
                    foreach (DirectoryInfo subdi in di.EnumerateDirectories().OrderBy(orderFunc))
                    {
                        List <MangaChapter> subdiChapters = getChapters(subdi, subFodlers, pageCutoff, RTL, orderFunc, errorPages, updateFunc);
                        result.AddRange(subdiChapters);
                    }
                }
            }

            return(result);
        }
Beispiel #3
0
        public static T Extend <T>(MangaChapter input) where T : MangaChapter, new()
        {
            T result = new T();

            result.autoPageNumbering = input.autoPageNumbering;
            result.IsRTL             = input.IsRTL;
            result.Name       = input.Name;
            result.ParentName = input.ParentName;
            result.Pages      = input.Pages;

            return(result);
        }