Exemplo n.º 1
0
 void LoadData()
 {
     string[,] data = WikiConf.LoadPair(conf.PathReplaces);
     lbFrom.Items.Clear();
     lbTo.Items.Clear();
     for (int i = 0; i < data.GetLength(0); i++)
     {
         lbFrom.Items.Add(data[i, 0]);
         lbTo.Items.Add(data[i, 1]);
     }
 }
Exemplo n.º 2
0
        void ProcessPagesToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (!Login())
            {
                return;
            }
            meOut.Clear();
            DialogResult res = WikiTools.pageProcessForm.ShowDialog();

            if ((res == DialogResult.Yes) || (res == DialogResult.No))
            {
                string[] pages = WikiTools.pageProcessForm.getPages();
                string[] opers = WikiTools.pageProcessForm.getOpers();

                string[,] mappingList = WikiConf.LoadPair(conf.PathMapping);
                string[,] replaces    = WikiConf.LoadPair(conf.PathReplaces);

                string[] emptyAlias = WikiConf.LoadList(conf.PathAlias);

                string[] blacklist = WikiConf.LoadList(conf.PathBlackList);
                string[] whitelist = WikiConf.LoadList(conf.PathWhiteList);

                object[,] mapping = new object[mappingList.GetLength(0), 2];
                for (int i = 0; i < mappingList.GetLength(0); i++)
                {
                    mapping[i, 0] = mappingList[i, 0];
                    mapping[i, 1] = WikiConf.LoadPair(mappingList[i, 1]);
                }
                ;
                bool preview = false;
                bool save    = false;
                if (res == DialogResult.Yes)
                {
                    save = true;
                }
                else if (res == DialogResult.No)
                {
                    preview = true;
                }
                WikiFixUp[] fixes = new WikiFixUp[3 + mapping.GetLength(0)];
                fixes[0] = new FixUpObj();
                fixes[1] = new FixUpSummary();
                fixes[2] = new FixUpContact();
                for (int i = 0; i < mappingList.GetLength(0); i++)
                {
                    fixes[i + 3] = new FixUpMapping((string)mapping[0, 0], (string[, ])mapping[0, 1]);
                }
                WikiErrorCheck[] checks = new WikiErrorCheck[] {
                    new CheckInvalidParagraph(blacklist),
                    new CheckMissingParagraph(whitelist),
                    new CheckContact()
                };
                WikiProcessor[] procs = new WikiProcessor[] {
                    new ProcessorStandardEmpty(emptyAlias),
                    new ProcessorRemoveEmpty(),
                    new ProcessorTemplateObj(fixes),
                    new ProcessorStandardEmpty(emptyAlias),
                    new ProcessorRemoveEmpty()
                };
                wiki.Process(pages, replaces, procs, checks, preview, save, Print);
            }
        }