Beispiel #1
0
        public static Dumper CreateHtmlGenerater(string bzipPath, bool isJapanese, DirectoryInfoCache result, PerfCounter counter)
        {
            DumpAction  htmlAction = DumpAction.CreateHtmlGeneraterAction(bzipPath, result.Item);
            var         dumper     = new Dumper(bzipPath, htmlAction, counter);
            SplitFolder sf         = CreateSplitFolder(isJapanese, result);

            PostCreate(dumper, isJapanese, sf);
            return(dumper);
        }
Beispiel #2
0
        public static Dumper CreateRawDumper(string bzipPath, bool isJapanese, DirectoryInfoCache result, PerfCounter counter)
        {
            DumpAction  rawDump = DumpAction.CreateRawDumpAction(bzipPath, result.Item);
            Dumper      dumper  = new Dumper(bzipPath, rawDump, counter);
            SplitFolder sf      = CreateSplitFolder(isJapanese, result);

            // not DRY!
            sf.InterestedFilePattern = "*.wiki";
            PostCreate(dumper, isJapanese, sf);
            return(dumper);
        }
Beispiel #3
0
        private static void PostCreate(Dumper dumper, bool isJapanese, SplitFolder sf)
        {
            dumper._bzipReader.EnableYomi = isJapanese;
            dumper.SetSplitFolder(sf, Properties.Settings.Default.StartSplitLimit);
            // for debug

            /*
             * sf.MaxFileNum = 2;
             * dumper.SetSplitFolder(sf, 10);
             * */
        }
Beispiel #4
0
        private void Split()
        {
            Counter.Start("Split");
            int count = 0;

            SplitFolder.StartSplit();
            while (SplitFolder.IsRunning)
            {
                SplitFolder.SplitOne();
                ReportProgress(0, DecodingProgress.State.Running, "split: " + count++ + " :" + SplitFolder.Current.Item.FullName);
            }
            Counter.Stop("Split");
        }
Beispiel #5
0
 public void SetSplitFolder(SplitFolder splitFolder, int startSplitLimit)
 {
     _bzipReader.SplitFolder = splitFolder;
     _bzipReader.StartSplitLimit = startSplitLimit;
 }
        public void TestGetMatchedSubdirectoryPath_SecondLevel()
        {
            string expected = @"I:\hoge\i\k";
            SplitFolder sf = new SplitFolder(new DirectoryInfo(@"I:\hoge"));
            sf.Current = CreateDIC(sf.StartDirectory, @"I:\hoge\i");
            string actual = sf.GetMatchedSubdirectoryPath(new FileInfo(@"I:\hoge\ika.txt"));

            Assert.AreEqual(expected, actual);
        }
 public void TestGetMatchedSubdirectoryPath_Root()
 {
     string expected = @"I:\hoge\i";
     SplitFolder sf = new SplitFolder(new DirectoryInfo(@"I:\hoge"));
     string actual = sf.GetMatchedSubdirectoryPath(new FileInfo(@"I:hoge\ika.txt"));
     Assert.AreEqual(expected, actual);
 }
        public void TestGetMatchedSubdirectoryPath_CantMoveMore()
        {
            string expected = @"I:\hoge\a";
            SplitFolder sf = new SplitFolder(new DirectoryInfo(@"I:\hoge"));
            sf.Current = new DirectoryInfoCache(sf.StartDirectory, new DirectoryInfo(@"I:\hoge\a"));
            string actual = sf.GetMatchedSubdirectoryPath(new FileInfo(@"I:\hoge\a.html"));

            Assert.AreEqual(expected, actual);
        }
 public void TestFileNameHeadUntilCurrent_Root()
 {
     string expected = "";
     SplitFolder sf = new SplitFolder(new DirectoryInfo(@"I:\hoge"));
     string actual = sf.FileNameHeadUntilCurrent;
     Assert.AreEqual(expected, actual);
 }
 SplitFolder CreateSplitFolder(DirectoryInfoCache baseDIC, DirectoryInfoCache curDIC, ISplitTactics tactics)
 {
     var sf = new SplitFolder(baseDIC, tactics);
     sf.Current = curDIC;
     return sf;
 }
 private static void VerifyLookupSortCharJP(string input, int start, string expected)
 {
     var di = new DirectoryInfo("./");
     var folder = new SplitFolder(di, new JapaneseTactics());
     string actual = folder.LookupSortChar(input, start);
     Assert.AreEqual(expected, actual);
 }
 private static void VerifyFileNameToSortKeyGeneric(string input, string expected, bool japanese)
 {
     var di = new DirectoryInfo("./");
     SplitFolder folder;
     if (japanese)
         folder = new SplitFolder(di, new JapaneseTactics());
     else
         folder = new SplitFolder(di);
     string actual = folder.FileNameToSortKey(new FileInfo(input));
     Assert.AreEqual(expected, actual);
 }
 private static SplitFolder CreateDefaultSplitFolder()
 {
     var split = new SplitFolder(new DirectoryInfo("C:\\hoge"));
     return split;
 }
Beispiel #14
0
        private static SplitFolder CreateSplitFolder(bool isJapanese, DirectoryInfoCache result)
        {
            SplitFolder sf = new SplitFolder(result, GetTactics(isJapanese));

            return(sf);
        }
Beispiel #15
0
 private static SplitFolder CreateSplitFolder(bool isJapanese, DirectoryInfoCache result)
 {
     SplitFolder sf = new SplitFolder(result, GetTactics(isJapanese));
     return sf;
 }
 SplitFolder CreateSplitFolder(DirectoryInfo baseDi, DirectoryInfo curDi)
 {
     var sf = new SplitFolder(baseDi);
     var cur = new DirectoryInfoCache(null, curDi);
     sf.Current = cur;
     // setup parent
     var baseDIC = sf.StartDirectory;
     cur = SetupDICParent(baseDIC, cur);
     Assert.AreEqual(sf.StartDirectory, cur);
     return sf;
 }
Beispiel #17
0
 private static void PostCreate(Dumper dumper, bool isJapanese, SplitFolder sf)
 {
     dumper._bzipReader.EnableYomi = isJapanese;
     dumper.SetSplitFolder(sf, Properties.Settings.Default.StartSplitLimit);
     // for debug
     /*
     sf.MaxFileNum = 2;
     dumper.SetSplitFolder(sf, 10);
      * */
 }
Beispiel #18
0
 public void SetSplitFolder(SplitFolder splitFolder, int startSplitLimit)
 {
     _bzipReader.SplitFolder     = splitFolder;
     _bzipReader.StartSplitLimit = startSplitLimit;
 }