Example #1
0
 public Dumper(string bzipPath, DumpAction act, PerfCounter counter)
 {
     _action = act;
     _bzipReader = new BzipReader(bzipPath, _action, counter);
     _action.Decoder = _bzipReader;
     _action._notify = _bzipReader;
 }
Example #2
0
        public void TestIsSkipCandidate_Redirect_lower()
        {
            bool expected = true;
            bool actual   = DumpAction.IsSkipCandidate("dummy", "#redirect hoge");

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void TestIsSkipCandidate_BeginWithCategoryButNormal()
        {
            bool expected = false;
            bool actual   = DumpAction.IsSkipCandidate("Category Theory", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void TestIsSkipCandidate_Not()
        {
            bool expected = false;
            bool actual   = DumpAction.IsSkipCandidate("dummy", "here is normal content #hoge");

            Assert.AreEqual(expected, actual);
        }
Example #5
0
        public void TestIsSkipCandidate_FileDesc()
        {
            bool expected = true;
            bool actual   = DumpAction.IsSkipCandidate("ファイル:", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #6
0
        public void TestIsSkipCandidate_Category()
        {
            bool expected = true;
            bool actual   = DumpAction.IsSkipCandidate("Category:007シリーズ (映画)のスタッフ.wiki", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #7
0
        public void TestIsSkipCandidate_BeginWithTemplateButNormal()
        {
            bool expected = false;
            bool actual   = DumpAction.IsSkipCandidate("Template Methodパターン", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #8
0
        public void TestIsSkipCandidate_TemplateFile()
        {
            bool expected = true;
            bool actual   = DumpAction.IsSkipCandidate("Template:010号線 (チェコ)", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #9
0
        public void TestIsSkipCandidate_NormalWikipedia()
        {
            bool expected = false;
            bool actual   = DumpAction.IsSkipCandidate("Wikipedia:FAQ", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #10
0
        public void TestIsSkipCandidate_SakujoIrai()
        {
            bool expected = true;
            bool actual   = DumpAction.IsSkipCandidate("Wikipedia:削除依頼/Ugg", "normal content");

            Assert.AreEqual(expected, actual);
        }
Example #11
0
        /// <summary>
        /// Registers a new dump action for the dump command
        /// </summary>
        /// <param name="id">The id to use for the dump command argument</param>
        /// <param name="action">The dump action to run</param>
        /// <returns>True if registered succesfully, false otherwise</returns>
        public static bool RegisterDumpAction(string id, DumpAction action)
        {
            if (dumpActions.ContainsKey(id.Replace(" ", string.Empty)))
            {
                LogWarning($"Trying to register dump action with id '<color=white>{id.Replace(" ", string.Empty)}</color>' but the ID is already registered!");
                return(false);
            }

            dumpActions.Add(id.Replace(" ", string.Empty), action);
            return(true);
        }
Example #12
0
        /// <summary>
        /// Registers a new dump action for the console
        /// </summary>
        /// <param name="id">The id for this dump action</param>
        /// <param name="action">The dump action to run</param>
        /// <param name="replace">Set to true to replace the dump action if it already exists</param>
        /// <returns>True if registered, false otherwise</returns>
        public static bool RegisterDumpAction(string id, DumpAction action, bool replace = false)
        {
            if (dumpActions.ContainsKey(id) && !replace)
            {
                (Loader.ModLoader.Context == null ? GuuCore.LOGGER : Loader.ModLoader.Context.Logger)
                .LogWarning($"Failed to register command '<color=white>{id}</color>', it is already registered!");
                return(false);
            }

            if (replace)
            {
                dumpActions[id] = action;
            }
            else
            {
                dumpActions.Add(id, action);
            }

            return(true);
        }
Example #13
0
        private static void VerifyWikinameToFileBaseName(string expect, string input)
        {
            string actual = DumpAction.WikiNameToFileBaseName(input);

            Assert.AreEqual(expect, actual);
        }