コード例 #1
0
        public static List <string> GetProjectLanguages(ProjectEnum project)
        {
            switch (project)
            {
            case ProjectEnum.wikipedia:
            case ProjectEnum.meta:
            case ProjectEnum.commons:
            case ProjectEnum.species:
                return(WikipediaLanguages);

            case ProjectEnum.wiktionary:
                return(WiktionaryLanguages);

            case ProjectEnum.wikisource:
                return(WikisourceLanguages);

            case ProjectEnum.wikibooks:
                return(WikibooksLanguages);

            case ProjectEnum.wikinews:
                return(WikinewsLanguages);

            case ProjectEnum.wikiquote:
                return(WikiquoteLanguages);

            case ProjectEnum.wikiversity:
                return(WikiversityLanguages);

            default:
                return(new List <string>());
            }
        }
コード例 #2
0
        private void cmboProject_SelectedIndexChanged(object sender, EventArgs e)
        {
            //disable language selection for single language projects
            cmboLang.Enabled = ((ProjectEnum)cmboProject.SelectedItem <= ProjectEnum.species);

            lblPostfix.Text = "";
            ProjectEnum prj = (ProjectEnum)Enum.Parse(typeof(ProjectEnum), cmboProject.SelectedItem.ToString());

            if (prj == ProjectEnum.custom || prj == ProjectEnum.wikia)
            {
                cmboCustomProject.Visible = true;
                cmboLang.Visible          = false;
                lblLang.Text = "http://";
                if (prj == ProjectEnum.wikia)
                {
                    lblPostfix.Text = ".wikia.com";
                }
                cmboCustomProjectChanged(null, null);

                chkSupressAWB.Enabled = true;
            }
            else
            {
                cmboCustomProject.Visible = false;
                cmboLang.Visible          = true;
                lblLang.Text          = "Language:";
                btnOK.Enabled         = true;
                chkSupressAWB.Enabled = false;
            }
        }
コード例 #3
0
 /// <summary>
 /// Returns true if given project belongs to Wikimedia
 /// </summary>
 public static bool IsWikimediaProject(ProjectEnum p)
 {
     return(p == ProjectEnum.commons || p == ProjectEnum.meta || p == ProjectEnum.species ||
            p == ProjectEnum.wikibooks || p == ProjectEnum.wikinews || p == ProjectEnum.wikipedia ||
            p == ProjectEnum.wikiquote || p == ProjectEnum.wikisource || p == ProjectEnum.wikiversity ||
            p == ProjectEnum.wiktionary);
 }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="proj"></param>
        /// <param name="customproj"></param>
        /// <param name="protocol"></param>
        public MyPreferences(string lang, ProjectEnum proj, string customproj, string protocol)
        {
            InitializeComponent();

            foreach (ProjectEnum l in Enum.GetValues(typeof(ProjectEnum)))
            {
                cmboProject.Items.Add(l);
            }

            cmboProject.SelectedItem = proj;

            cmboProject_SelectedIndexChanged(null, null);

            cmboLang.SelectedItem = lang.ToLower();

            cmboCustomProject.Items.Clear();
            foreach (string s in Properties.Settings.Default.CustomWikis.Split('|').Where(s => !cmboCustomProject.Items.Contains(s)))
            {
                cmboCustomProject.Items.Add(s);
            }

            cmboCustomProject.Text = customproj;

            chkSupressAWB.Enabled = (cmboProject.Text == "custom" || cmboProject.Text == "wikia");

            chkAlwaysConfirmExit.Checked = Properties.Settings.Default.AskForTerminate;
            chkPrivacy.Checked           = !Properties.Settings.Default.Privacy;

            if (Globals.UsingMono)
            {
                chkFlash.Enabled = false;
                chkFlash.Checked = false;
            }
            cmboProtocol.SelectedIndex = (protocol == "http://") ? 0 : 1;
        }
コード例 #5
0
ファイル: Preferences.cs プロジェクト: reedy/AutoWikiBrowser
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="proj"></param>
        /// <param name="customproj"></param>
        /// <param name="protocol"></param>
        public MyPreferences(string lang, ProjectEnum proj, string customproj, string protocol)
        {
            InitializeComponent();

            foreach (ProjectEnum l in Enum.GetValues(typeof(ProjectEnum)))
            {
                cmboProject.Items.Add(l);
            }

            cmboProject.SelectedItem = proj;

            cmboProject_SelectedIndexChanged(null, null);

            cmboLang.SelectedItem = lang.ToLower();

            cmboCustomProject.Items.Clear();
            foreach (string s in Properties.Settings.Default.CustomWikis.Split('|').Where(s => !cmboCustomProject.Items.Contains(s)))
            {
                cmboCustomProject.Items.Add(s);
            }

            cmboCustomProject.Text = customproj;

            chkSupressAWB.Enabled = (cmboProject.Text == "custom" || cmboProject.Text == "wikia");

            chkAlwaysConfirmExit.Checked = Properties.Settings.Default.AskForTerminate;
            chkPrivacy.Checked = !Properties.Settings.Default.Privacy;

            if (Globals.UsingMono)
            {
                chkFlash.Enabled = false;
                chkFlash.Checked = false;
            }
            cmboProtocol.SelectedIndex = (protocol == "http://") ? 0 : 1;
        }
コード例 #6
0
        public MyPreferences(LangCodeEnum lang, ProjectEnum proj, string customproj,
                             Font textFont, bool lowPriority, bool flash, bool beep, bool minimize,
                             bool saveArticleList, decimal timeOut, bool autoSaveEditBox,
                             string autoSaveEditBoxFile, decimal autoSaveEditBoxPeriod, bool suppressUsingAWB)
        {
            InitializeComponent();

            foreach (LangCodeEnum l in Enum.GetValues(typeof(LangCodeEnum)))
            {
                cmboLang.Items.Add(l.ToString().ToLower());
            }

            foreach (ProjectEnum l in Enum.GetValues(typeof(ProjectEnum)))
            {
                cmboProject.Items.Add(l);
            }

            cmboLang.SelectedItem    = lang.ToString().ToLower();
            cmboProject.SelectedItem = proj;

            cmboCustomProject.Items.Clear();
            foreach (string s in Properties.Settings.Default.CustomWikis.Split('|'))
            {
                if (!cmboCustomProject.Items.Contains(s))
                {
                    cmboCustomProject.Items.Add(s);
                }
            }

            cmboCustomProject.Text = customproj;

            TextBoxFont         = textFont;
            LowThreadPriority   = lowPriority;
            PerfFlash           = flash;
            PerfBeep            = beep;
            PerfMinimize        = minimize;
            PerfSaveArticleList = saveArticleList;
            PerfTimeOutLimit    = timeOut;

            PerfAutoSaveEditBoxEnabled = autoSaveEditBox;
            PerfAutoSaveEditBoxFile    = autoSaveEditBoxFile;
            PerfAutoSaveEditBoxPeriod  = autoSaveEditBoxPeriod;

            chkSupressAWB.Enabled = (cmboProject.Text == "custom" || cmboProject.Text == "wikia");
            if (chkSupressAWB.Enabled)
            {
                chkSupressAWB.Checked = suppressUsingAWB;
            }
            else
            {
                chkSupressAWB.Checked = false;
            }

            cmboProject_SelectedIndexChanged(null, null);

            chkAlwaysConfirmExit.Checked = Properties.Settings.Default.DontAskForTerminate;
            PrivacyCheckBox.Checked      = !Properties.Settings.Default.Privacy;
        }
コード例 #7
0
        public void Info(ProjectEnum project, string message)
        {
            string Source = project.ToString();

            using (var log = GetLogOver(connectionStringLogginDb, loggingTable))
            {
                log.Information(string.Format("Owner:{0}-Message:{1}", Source, message));
            }
        }
コード例 #8
0
 public ProjectPara()
 {
     ProjectVisionNames = new List <ProjectVisionEnum>();
     VisionParas        = new List <VisionPara>();
     ProjectVisionNames.Add(ProjectVisionEnum.ProjectVision0);
     VisionParas.Add(new VisionPara());
     //ProjectVisionNames.Add(ProjectVisionEnum.ProjectVision0);
     //VisionParas.Add(new VisionPara());
     ProjectName = ProjectEnum.PinLocal0;
 }
コード例 #9
0
        private static void SetDefaults()
        {
            mProject    = ProjectEnum.wikipedia;
            mLangCode   = LangCodeEnum.en;
            mSummaryTag = " using ";
            strWPAWB    = "[[Project:AWB|AWB]]";

            Namespaces.Clear();
            SetToEnglish();
        }
コード例 #10
0
        public MyPreferences(LangCodeEnum lang, ProjectEnum proj, string customproj,
                             Font textFont, bool lowPriority, bool flash, bool beep, bool minimize,
                             bool saveArticleList, decimal timeOut, bool autoSaveEditBox,
                             string autoSaveEditBoxFile, decimal autoSaveEditBoxPeriod, bool suppressUsingAWB,
                             bool addUsingAWBOnArticleAction, bool ignoreNoBots, bool showTimer, bool usePHP5)
        {
            InitializeComponent();

            foreach (ProjectEnum l in Enum.GetValues(typeof(ProjectEnum)))
            {
                cmboProject.Items.Add(l);
            }

            cmboProject.SelectedItem = proj;

            cmboProject_SelectedIndexChanged(null, null);

            cmboLang.SelectedItem = lang.ToString().ToLower();

            cmboCustomProject.Items.Clear();
            foreach (string s in Properties.Settings.Default.CustomWikis.Split('|'))
            {
                if (!cmboCustomProject.Items.Contains(s))
                {
                    cmboCustomProject.Items.Add(s);
                }
            }

            cmboCustomProject.Text = customproj;

            chkPHP5Ext.Checked = usePHP5;

            TextBoxFont         = textFont;
            LowThreadPriority   = lowPriority;
            PrefFlash           = flash;
            PrefBeep            = beep;
            PrefMinimize        = minimize;
            PrefSaveArticleList = saveArticleList;
            PrefTimeOutLimit    = timeOut;

            PrefAutoSaveEditBoxEnabled = autoSaveEditBox;
            PrefAutoSaveEditBoxFile    = autoSaveEditBoxFile;
            PrefAutoSaveEditBoxPeriod  = autoSaveEditBoxPeriod;
            PrefIgnoreNoBots           = ignoreNoBots;
            PrefShowTimer = showTimer;
            PrefAddUsingAWBOnArticleAction = addUsingAWBOnArticleAction;

            chkSupressAWB.Enabled = (cmboProject.Text == "custom" || cmboProject.Text == "wikia");

            PrefSuppressUsingAWB = chkSupressAWB.Enabled && suppressUsingAWB;

            chkAlwaysConfirmExit.Checked = Properties.Settings.Default.AskForTerminate;
            chkPrivacy.Checked           = !Properties.Settings.Default.Privacy;
        }
コード例 #11
0
        public MyPreferences(LangCodeEnum lang, ProjectEnum proj, string customproj,
            Font textFont, bool lowPriority, bool flash, bool beep, bool minimize,
            bool saveArticleList, decimal timeOut, bool autoSaveEditBox,
            string autoSaveEditBoxFile, decimal autoSaveEditBoxPeriod, bool suppressUsingAWB,
            bool addUsingAWBOnArticleAction, bool ignoreNoBots, bool falsePositives, 
            bool showTimer)
        {
            InitializeComponent();

            foreach (LangCodeEnum l in Enum.GetValues(typeof(LangCodeEnum)))
                cmboLang.Items.Add(l.ToString().ToLower());

            foreach (ProjectEnum l in Enum.GetValues(typeof(ProjectEnum)))
                cmboProject.Items.Add(l);

            cmboLang.SelectedItem = lang.ToString().ToLower();
            cmboProject.SelectedItem = proj;

            cmboCustomProject.Items.Clear();
            foreach (string s in Properties.Settings.Default.CustomWikis.Split('|'))
            {
                if (!cmboCustomProject.Items.Contains(s))
                    cmboCustomProject.Items.Add(s);
            }

            cmboCustomProject.Text = customproj;

            TextBoxFont = textFont;
            LowThreadPriority = lowPriority;
            PrefFlash = flash;
            PrefBeep = beep;
            PrefMinimize = minimize;
            PrefSaveArticleList = saveArticleList;
            PrefTimeOutLimit = timeOut;

            PrefAutoSaveEditBoxEnabled = autoSaveEditBox;
            PrefAutoSaveEditBoxFile = autoSaveEditBoxFile;
            PrefAutoSaveEditBoxPeriod = autoSaveEditBoxPeriod;
            PrefIgnoreNoBots = ignoreNoBots;
            PrefFalsePositives = falsePositives;
            PrefShowTimer = showTimer;
            PrefAddUsingAWBOnArticleAction = addUsingAWBOnArticleAction;

            chkSupressAWB.Enabled = (cmboProject.Text == "custom" || cmboProject.Text == "wikia");
            if (chkSupressAWB.Enabled)
                PrefSuppressUsingAWB = suppressUsingAWB;
            else
                PrefSuppressUsingAWB = false;

            cmboProject_SelectedIndexChanged(null, null);

            chkAlwaysConfirmExit.Checked = Properties.Settings.Default.AskForTerminate;
            chkPrivacy.Checked = !Properties.Settings.Default.Privacy;
        }
コード例 #12
0
        private void cmboCustomProjectChanged(object sender, EventArgs e)
        {
            ProjectEnum prj = (ProjectEnum)Enum.Parse(typeof(ProjectEnum), cmboProject.SelectedItem.ToString());

            if (prj == ProjectEnum.custom || prj == ProjectEnum.wikia)
            {
                btnOK.Enabled = (!string.IsNullOrEmpty(cmboCustomProject.Text));
            }
            else
            {
                btnOK.Enabled = true;
            }
        }
コード例 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ProjectNum"></param>
        /// <returns></returns>
        public ProjectPara GetProjectPara(int ProjectNum)
        {
            ProjectEnum NowProject = (ProjectEnum)Enum.Parse(typeof(ProjectEnum), ProjectNum.ToString(), false);

            return(this.ProjectParaList[ProjectNum]);

            foreach (ProjectPara item in ProjectParaList)
            {
                if (item.ProjectName == NowProject)
                {
                    return(item);
                }
            }
            return(new ProjectPara());
        }
コード例 #14
0
        public ProjectPara(ProjectModelEnum ProjectModel)
        {
            ProjectVisionNames = new List <ProjectVisionEnum>();
            VisionParas        = new List <VisionPara>();
            ProjectName        = ProjectEnum.PinLocal0;
            ProjectVisionNames.Add(ProjectVisionEnum.ProjectVision0);
            VisionParas.Add(new VisionPara());
            switch (ProjectModel)
            {
            case ProjectModelEnum.SingleCamLocal:
                ProjectName = ProjectEnum.PinLocal0;
                break;

            case ProjectModelEnum.TwoCamLocal:
                ProjectVisionNames.Add(ProjectVisionEnum.ProjectVision0);
                VisionParas.Add(new VisionPara());
                ProjectName = ProjectEnum.FofOffSet;
                break;
            }
        }
コード例 #15
0
ファイル: MockVsSolution.cs プロジェクト: yazici/PTVS
        public int GetProjectEnum(uint grfEnumFlags, ref Guid rguidEnumOnlyThisType, out IEnumHierarchies ppenum)
        {
            __VSENUMPROJFLAGS flags = (__VSENUMPROJFLAGS)grfEnumFlags;

            ProjectInfo[] projects;
            if (flags.HasFlag(__VSENUMPROJFLAGS.EPF_MATCHTYPE))
            {
                var guid = rguidEnumOnlyThisType;
                projects = _projects.Values.Where(x => x.ProjectGuid == guid).ToArray();
            }
            else if (flags.HasFlag(__VSENUMPROJFLAGS.EPF_ALLPROJECTS))
            {
                projects = _projects.Values.ToArray();
            }
            else
            {
                throw new NotImplementedException();
            }

            ppenum = new ProjectEnum(projects);
            return(VSConstants.S_OK);
        }
コード例 #16
0
        public int GetProjectEnum(uint grfEnumFlags, ref Guid rguidEnumOnlyThisType, out IEnumHierarchies ppenum) {
            __VSENUMPROJFLAGS flags = (__VSENUMPROJFLAGS)grfEnumFlags;

            ProjectInfo[] projects;
            if (flags.HasFlag(__VSENUMPROJFLAGS.EPF_MATCHTYPE)) {
                var guid = rguidEnumOnlyThisType;
                projects = _projects.Values.Where(x => x.ProjectGuid == guid).ToArray();
            } else if (flags.HasFlag(__VSENUMPROJFLAGS.EPF_ALLPROJECTS)) {
                projects = _projects.Values.ToArray();
            } else {
                throw new NotImplementedException();
            }

            ppenum = new ProjectEnum(projects);
            return VSConstants.S_OK;
        }
コード例 #17
0
 public int Clone(out IEnumHierarchies ppenum) {
     ppenum = new ProjectEnum(_projects);
     return VSConstants.S_OK;
 }
コード例 #18
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        /// <param name="usingSecure"></param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject, bool usingSecure)
        {
            TryLoadingAgainAfterLogin = false;
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();
            WikiRegexes.TemplateRedirects.Clear();

            Project       = projectName;
            LangCode      = langCode;
            CustomProject = customProject;
            UsingSecure   = usingSecure;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[^{}|]*?[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub      = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            if (IsCustomProject)
            {
                LangCode = "en";
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd        = customProject.Substring(x, customProject.Length - x);
                    CustomProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
            {
                URL       = "http://" + LangCode + "." + Project + ".org";
                URLSecure = "https://secure.wikimedia.org/";
                if (IsWikimediaMonolingualProject)
                {
                    URLSecure += "wikipedia/" + Project;
                }
                else
                {
                    URLSecure += Project + "/" + LangCode; //https://secure.wikimedia.org/wikipedia/en
                }
            }

            // HACK:
            switch (projectName)
            {
            case ProjectEnum.wikipedia:
            case ProjectEnum.wikinews:
            case ProjectEnum.wikisource:
            case ProjectEnum.wikibooks:
            case ProjectEnum.wikiquote:
            case ProjectEnum.wiktionary:
            case ProjectEnum.wikiversity:
                switch (langCode)
                {
                case "en":
                    if (projectName == ProjectEnum.wikipedia)
                    {
                        SetToEnglish();
                    }
                    break;

                case "ar":
                    mSummaryTag    = " ";
                    WPAWB          = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                    TypoSummaryTag = ".الأخطاء المصححة: ";
                    break;

                case "bg":
                    mSummaryTag = " редактирано с ";
                    WPAWB       = "AWB";
                    break;

                case "ca":
                    mSummaryTag = " ";
                    WPAWB       = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                    break;

                case "da":
                    mSummaryTag = " ved brug af ";
                    WPAWB       = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                    break;

                case "de":
                    mSummaryTag    = " mit ";
                    TypoSummaryTag = ", Schreibweise:";
                    break;

                case "el":
                    mSummaryTag = " με τη χρήση ";
                    WPAWB       = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
                    break;

                case "eo":
                    mSummaryTag = " ";
                    WPAWB       = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                    break;

                case "he":
                    mSummaryTag = " באמצעות ";
                    break;

                case "hu":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "ku":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                    break;

                case "ms":
                    mSummaryTag = "menggunakan";
                    break;

                case "nl":
                    mSummaryTag = " met ";
                    break;

                case "pl":
                    SectStub      = @"\{\{[Ss]ek";
                    SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                    break;

                case "pt":
                    mSummaryTag = " utilizando ";
                    break;

                case "ru":
                    mSummaryTag = " с помощью ";
                    Stub        = "[^{}]*?(?:[Ss]tub|[Зз]аготовка)";
                    break;

                case "sk":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "sl":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                    Stub        = "(?:[^{}]*?[Ss]tub|[Šš]krbina[^{}]*?)";
                    break;

                case "uk":
                    Stub        = ".*?(?:[Ss]tub|[Дд]оробити)";
                    mSummaryTag = " за допомогою ";
                    WPAWB       = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                    break;

                // case "xx:
                // strsummarytag = " ";
                // strWPAWB = "";
                // break;

                default:
                    break;
                }
                break;

            case ProjectEnum.commons:
                URL      = "http://commons.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.meta:
                URL      = "http://meta.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.mediawiki:
                URL      = "http://www.mediawiki.org";
                LangCode = "en";
                break;

            case ProjectEnum.species:
                URL      = "http://species.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.wikia:
                URL    = "http://" + customProject + ".wikia.com";
                URLEnd = "/";
                break;

            case ProjectEnum.custom:
                //URLEnd = "";
                break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                try
                {
                    if (!MainForm.TheSession.UpdateProject(false))
                    {
                        LangCode = "en";
                        Project  = ProjectEnum.wikipedia;
                        SetToEnglish();
                    }
                }
                catch (ReadApiDeniedException)
                {
                    TryLoadingAgainAfterLogin = true;
                    ReloadProjectSettings     = new ProjectHoldArea
                    {
                        projectName   = projectName,
                        customProject = customProject,
                        langCode      = langCode,
                        usingSecure   = usingSecure
                    };
                    return;
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");

            if (projectName.Equals(ProjectEnum.wiktionary))
            {
                CapitalizeFirstLetter = false;
            }
        }
コード例 #19
0
 public void Info(ProjectEnum project, string message)
 {
     logger.Info(string.Format("Owner:{0},Message{1}", project.ToString(), message));
 }
コード例 #20
0
        /// <summary>
        /// Sets the language specific values: summary tag, stub regex, AWB project link
        /// </summary>
        /// <param name='langCode'>
        /// Language code of wiki.
        /// </param>
        /// <param name='projectName'>
        /// Project name of wiki.
        /// </param>
        private static void SetLanguageSpecificValues(string langCode, ProjectEnum projectName)
        {
            switch (langCode)
            {
            case "en":
                if (projectName == ProjectEnum.wikipedia)
                {
                    SetToEnglish();
                }
                TypoSummaryTag = @"[[WP:AWB/T|typo(s) fixed]]: ";
                break;

            case "ar":
                mSummaryTag    = "";
                WPAWB          = "باستخدام [[Project:أوب|أوب]]";
                Stub           = @"[^{}|]*?(?:[Ss]tub|بذرة|بذور)[^{}]*?";
                TypoSummaryTag = "الأخطاء المصححة: ";
                break;

            case "arz":
                mSummaryTag    = "";
                WPAWB          = "عن طريق [[Project:AWB|اوب]]";
                Stub           = @"[^{}|]*?(?:[Ss]tub|تقاوى|بذرة)[^{}]*?";
                TypoSummaryTag = "الأخطاء المصححة: ";
                break;

            case "bg":
                mSummaryTag = "редактирано с";
                WPAWB       = "AWB";
                break;

            case "ca":
                mSummaryTag = "";
                WPAWB       = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                break;

            case "cs":
                mSummaryTag = "za použití";
                WPAWB       = "[[Wikipedie:AutoWikiBrowser|AWB]]";
                Stub        = @"[^{}|]*?([Pp]ahýl)";
                break;

            case "cy":
                Stub = @"[^{}|]*?([Ss]tub|[Εe]ginyn[^{}]*?)";
                break;

            case "da":
                mSummaryTag = "ved brug af";
                WPAWB       = "[[en:WP:AWB|AWB]]";
                break;

            case "de":
                mSummaryTag    = "mit";
                TypoSummaryTag = "Schreibweise: ";
                break;

            case "el":
                mSummaryTag   = "με τη χρήση";
                WPAWB         = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
                Stub          = @"[^{}|]*?([Ss]tub|[Εε]πέκταση)";
                SectStub      = @"\{\{θέματος";
                SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                break;

            case "eo":
                mSummaryTag    = "per";
                WPAWB          = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                TypoSummaryTag = "Skribmaniero: ";
                break;

            case "fa":
                mSummaryTag = "";
                WPAWB       = "با استفاده از [[Project:AutoWikiBrowser|AWB]]";
                break;

            case "fr":
                mSummaryTag = "avec";
                WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                break;

            case "he":
                mSummaryTag = "באמצעות";
                WPAWB       = "[[ויקיפדיה:AutoWikiBrowser|AWB]]";
                break;

            case "hi":
                mSummaryTag = "";
                WPAWB       = "[[विकिपीडिया:ऑटोविकिब्राउज़र|AWB]] के साथ";
                break;

            case "hu":
                mSummaryTag = "";
                WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                break;

            case "hy":
                mSummaryTag = "oգտվելով";
                WPAWB       = "[[Վիքիպեդիա:ԱվտոՎիքիԲրաուզեր|ԱՎԲ]]";
                Stub        = @"[^{}|]*?([Ss]tub|Անավարտ|Զարգացնել[^{}]*?)";
                break;

            case "ku":
                mSummaryTag = "";
                WPAWB       = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                break;

            case "ms":
                mSummaryTag = "menggunakan";
                break;

            case "ne":
                mSummaryTag = "";
                WPAWB       = "स्वतःविकी ब्राउजर प्रयोग गर्दै";
                break;

            case "nl":
                mSummaryTag = "met";
                break;

            case "pl":
                mSummaryTag   = "przy użyciu";
                SectStub      = @"\{\{[Ss]ek";
                SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                break;

            case "pt":
                mSummaryTag = "utilizando";
                WPAWB       = "[[Project:AutoWikiBrowser|AWB]]";
                break;

            case "ru":
                mSummaryTag = "с помощью";
                Stub        = "[^{}]*?(?:[Ss]tub|[Зз]аготовка)";
                break;

            case "sk":
                mSummaryTag = "";
                WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                break;

            case "sl":
                mSummaryTag = "";
                WPAWB       = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                Stub        = "(?:[^{}]*?[Ss]tub|[Šš]krbina[^{}]*?)";
                break;

            case "sv":
                mSummaryTag    = "med";
                TypoSummaryTag = "rättar stavfel: ";
                Stub           = @"(?:[^{}]*?[Ss]tub|[^{}]+?stub(?:[ \-][^{}]+)?)(?<![Ss]tubbmall|[Ss]ubstub|[Ss]tubavsnitt|[Uu]ncategorized stub)";
                break;

            case "tr":
                mSummaryTag    = "";
                WPAWB          = "[[Vikipedi:AWB|AWB]] ile ";
                TypoSummaryTag = "yazış şekli: ";
                break;

            case "uk":
                Stub        = ".*?(?:[Ss]tub|[Дд]оробити)";
                mSummaryTag = "за допомогою";
                WPAWB       = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                break;

            case "zh":
                mSummaryTag = "由";
                WPAWB       = "[[维基百科:自动维基浏览器|自动维基浏览器]]协助";
                break;

            case "zh-classical":
                mSummaryTag = "藉";
                WPAWB       = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]之助";
                break;

            case "zh-yue":
                mSummaryTag = "由";
                WPAWB       = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]協助";
                break;

                // case "xx:
                // strsummarytag = " ";
                // strWPAWB = "";
                // break;
            }
        }
コード例 #21
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is English Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 /// <remarks>Do not use this outside unit tests</remarks>
 public static void SetProjectSimple(string langCode, ProjectEnum projectName)
 {
     Project = projectName;
     SetProjectLangCode(langCode);
 }
コード例 #22
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is english Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 public static void SetProject(LangCodeEnum langCode, ProjectEnum projectName)
 {
     SetProject(langCode, projectName, "");
 }
コード例 #23
0
 public void Warrning(ProjectEnum project, string message)
 {
     logger.LogWarning("Example Warrning log message");
 }
コード例 #24
0
 public void Info(ProjectEnum project, string message)
 {
     logger.LogInformation("Example Information log message");
 }
コード例 #25
0
 public void Warrning(ProjectEnum project, string message)
 {
     ConfigureLogging();
     logger.Warn(string.Format("Owner:{0},Message{1}", project.ToString(), message));
 }
コード例 #26
0
		/// <summary>
		/// Sets the language specific values: summary tag, stub regex, AWB project link
		/// </summary>
		/// <param name='langCode'>
		/// Language code of wiki.
		/// </param>
		/// <param name='projectName'>
		/// Project name of wiki.
		/// </param>
        private static void SetLanguageSpecificValues(string langCode, ProjectEnum projectName)
        {
            switch (langCode)
            {
                case "en":
                    if (projectName == ProjectEnum.wikipedia)
                        SetToEnglish();
                    TypoSummaryTag = @"[[WP:AWB/T|typo(s) fixed]]: ";
                    break;

                case "ar":
                    mSummaryTag = "";
                    WPAWB = "باستخدام [[Project:أوب|أوب]]";
                    Stub = @"[^{}|]*?(?:[Ss]tub|بذرة|بذور)[^{}]*?";
                    TypoSummaryTag = "الأخطاء المصححة: ";
                    break;

                case "arz":
                    mSummaryTag = "";
                    WPAWB = "عن طريق [[Project:AWB|اوب]]";
                    Stub = @"[^{}|]*?(?:[Ss]tub|تقاوى|بذرة)[^{}]*?";
                    TypoSummaryTag = "الأخطاء المصححة: ";
                    break;
                    
                case "bg":
                    mSummaryTag = "редактирано с";
                    WPAWB = "AWB";
                    break;

                case "ca":
                    mSummaryTag = "";
                    WPAWB = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                    break;

                case "cs":
                    mSummaryTag = "za použití";
                    WPAWB = "[[Wikipedie:AutoWikiBrowser|AWB]]";
                    Stub = @"[^{}|]*?([Pp]ahýl)";
                    break;

                case "cy":
                    Stub = @"[^{}|]*?([Ss]tub|[Εe]ginyn[^{}]*?)";
                    break;
                    
                case "da":
                    mSummaryTag = "ved brug af";
                    WPAWB = "[[en:WP:AWB|AWB]]";
                    break;

                case "de":
                    mSummaryTag = "mit";
                    TypoSummaryTag = "Schreibweise: ";
                    break;

                case "el":
                    mSummaryTag = "με τη χρήση";
                    WPAWB = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
                    Stub = @"[^{}|]*?([Ss]tub|[Εε]πέκταση)";
                    SectStub = @"\{\{θέματος";
                    SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                    break;

                case "eo":
                    mSummaryTag = "per";
                    WPAWB = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                    TypoSummaryTag = "Skribmaniero: ";
                    break;

                case "fa":
                    mSummaryTag = "";
                    WPAWB = "با استفاده از [[Project:AutoWikiBrowser|AWB]]";
                    break;

                case "fr":
                    mSummaryTag = "avec";
                    WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "he":
                    mSummaryTag = "באמצעות";
                    WPAWB = "[[ויקיפדיה:AutoWikiBrowser|AWB]]";
                    break;

                case "hi":
                    mSummaryTag = "";
                    WPAWB = "[[विकिपीडिया:ऑटोविकिब्राउज़र|AWB]] के साथ";
                    break;

                case "hu":
                    mSummaryTag = "";
                    WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "hy":
                    mSummaryTag = "oգտվելով";
                    WPAWB = "[[Վիքիպեդիա:ԱվտոՎիքիԲրաուզեր|ԱՎԲ]]";
                    break;

                case "ku":
                    mSummaryTag = "";
                    WPAWB = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                    break;

                case "ms":
                    mSummaryTag = "menggunakan";
                    break;

                case "ne":
                    mSummaryTag = "";
                    WPAWB = "स्वतःविकी ब्राउजर प्रयोग गर्दै";
                    break;
                    
                case "nl":
                    mSummaryTag = "met";
                    break;
                    
                case "pl":
                    mSummaryTag = "przy użyciu";
                    SectStub = @"\{\{[Ss]ek";
                    SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                    break;

                case "pt":
                    mSummaryTag = "utilizando";
                    WPAWB = "[[Project:AutoWikiBrowser|AWB]]";
                    break;

                case "ru":
                    mSummaryTag = "с помощью";
                    Stub = "[^{}]*?(?:[Ss]tub|[Зз]аготовка)";
                    break;

                case "sk":
                    mSummaryTag = "";
                    WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "sl":
                    mSummaryTag = "";
                    WPAWB = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                    Stub = "(?:[^{}]*?[Ss]tub|[Šš]krbina[^{}]*?)";
                    break;

                case "sv":
                    mSummaryTag = "med";
                    TypoSummaryTag = "rättar stavfel: ";
                    Stub = @"(?:[^{}]*?[Ss]tub|[^{}]+?stub(?:[ \-][^{}]+)?)(?<![Ss]tubbmall|[Ss]ubstub|[Ss]tubavsnitt|[Uu]ncategorized stub)";
                    break;

                case "tr":
                    mSummaryTag = "";
                    WPAWB = "[[Vikipedi:AWB|AWB]] ile ";
                    TypoSummaryTag = "yazış şekli: ";
                    break;

                case "uk":
                    Stub = ".*?(?:[Ss]tub|[Дд]оробити)";
                    mSummaryTag = "за допомогою";
                    WPAWB = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                    break;

                case "zh":
                    mSummaryTag = "由";
                    WPAWB = "[[维基百科:自动维基浏览器|自动维基浏览器]]协助";
                    break;

                case "zh-classical":
                    mSummaryTag = "藉";
                    WPAWB = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]之助";
                    break;

                case "zh-yue":
                    mSummaryTag = "由";
                    WPAWB = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]協助";
                    break;

                    // case "xx:
                    // strsummarytag = " ";
                    // strWPAWB = "";
                    // break;
            }
        }
コード例 #27
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        /// <param name="protocol"></param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject, string protocol)
        {
            TryLoadingAgainAfterLogin = false;
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();
            WikiRegexes.TemplateRedirects.Clear();

            Project = projectName;
            LangCode = langCode;
            CustomProject = customProject;
            Protocol = protocol;

            RefreshProxy();

            URLEnd = "/w/";

            Stub = "[^{}|]*?[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            TypoSummaryTag = "typos fixed: ";
            AWBDefaultSummaryTag();
            mSummaryTag = "using";
            NotificationsEnabled = true;

            if (IsCustomProject)
            {
                LangCode = "en";
                var uri = new Uri(Protocol + customProject);
                URLEnd = uri.AbsolutePath;
                URL = protocol + uri.Host;
                CustomProject = customProject;
            }
            else
            {
                URL = "https://" + LangCode + "." + Project + ".org";
            }

            // HACK:
            switch (projectName)
            {
                case ProjectEnum.wikipedia:
                case ProjectEnum.wikinews:
                case ProjectEnum.wikisource:
                case ProjectEnum.wikibooks:
                case ProjectEnum.wikiquote:
                case ProjectEnum.wiktionary:
                case ProjectEnum.wikiversity:
                    //If not set the following will be used:
                    //mSummaryTag="using";
                    //WPAWB = "[[Project:Wikipedia:AutoWikiBrowser|AWB]]";
                    SetLanguageSpecificValues(langCode, projectName);
                    break;
                case ProjectEnum.commons:
                    URL = "https://commons.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.meta:
                    URL = "https://meta.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.mediawiki:
                    URL = "https://www.mediawiki.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.incubator:
                    URL = "https://incubator.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.species:
                    URL = "https://species.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.wikia:
                    URL = "http://" + customProject + ".wikia.com";
                    URLEnd = "/";
                    break;
                case ProjectEnum.custom:
                    break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                try
                {
                    if (!MainForm.TheSession.UpdateProject(false))
                    {
                        LangCode = "en";
                        Project = ProjectEnum.wikipedia;
                        SetToEnglish();
                    }
                }
                catch (ReadApiDeniedException)
                {
                    TryLoadingAgainAfterLogin = true;
                    ReloadProjectSettings = new ProjectHoldArea
                                                {
                                                    projectName = projectName,
                                                    customProject = customProject,
                                                    langCode = langCode,
                                                    protocol = Protocol
                                                };
                    return;
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            if(MainForm != null)
                MainForm.LoadTypos(true);

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");

            if (projectName.Equals(ProjectEnum.wiktionary))
                CapitalizeFirstLetter = false;
        }
コード例 #28
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject)
        {
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();

            foreach(var s in AttackSites)
                if (customProject.Contains(s))
                {
                    MessageBox.Show("This software does not work on attack sites.");
                    Application.ExitThread();
                }

            Project = projectName;
            LangCode = langCode;
            CustomProject = customProject;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            if (IsCustomProject)
            {
                LangCode = "en";
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd = customProject.Substring(x, customProject.Length - x);
                    customProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
                URL = "http://" + LangCode + "." + Project + ".org";

            // HACK:
            switch (projectName)
            {
                case ProjectEnum.wikipedia:
                case ProjectEnum.wikinews:
                case ProjectEnum.wikisource:
                case ProjectEnum.wikibooks:
                case ProjectEnum.wikiquote:
                case ProjectEnum.wiktionary:
                case ProjectEnum.wikiversity:
                    switch (langCode)
                    {
                        case "en":
                            if (projectName == ProjectEnum.wikipedia)
                                SetToEnglish();
                            break;

                        case "ar":
                            mSummaryTag = " ";
                            WPAWB = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                            TypoSummaryTag = ".الأخطاء المصححة: ";
                            break;

                        case "bg":
                            mSummaryTag = " редактирано с ";
                            WPAWB = "AWB";
                            break;

                        case "ca":
                            mSummaryTag = " ";
                            WPAWB = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                            break;

                        case "da":
                            mSummaryTag = " ved brug af ";
                            WPAWB = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                            break;

                        case "de":
                            mSummaryTag = " mit ";
                            TypoSummaryTag = ", Schreibweise:";
                            break;
						
						case "el":
							mSummaryTag = " με τη χρήση ";
                            WPAWB = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
							break;

                        case "eo":
                            mSummaryTag = " ";
                            WPAWB = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                            break;

                        case "hu":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "ku":
                            mSummaryTag = " ";
                            WPAWB = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                            break;

                        case "nl":
                            mSummaryTag = " met ";
                            break;

                        case "pl":
                            SectStub = @"\{\{[Ss]ek";
                            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                            break;

                        case "pt":
                            mSummaryTag = " utilizando ";
                            break;

                        case "ru":
                            mSummaryTag = " с помощью ";
                            Stub = "(?:[Ss]tub|[Зз]аготовка)";
                            break;

                        case "sk":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "sl":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                            Stub = "(?:[Ss]tub|[Šš]krbina)";
                            break;

                        case "uk":
                            Stub = "(?:[Ss]tub|[Дд]оробити)";
                            mSummaryTag = " за допомогою ";
                            WPAWB = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                            break;

                        // case "xx:
                        // strsummarytag = " ";
                        // strWPAWB = "";
                        // break;

                        default:
                            break;
                    }
                    break;
                case ProjectEnum.commons:
                    URL = "http://commons.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.meta:
                    URL = "http://meta.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.mediawiki:
                    URL = "http://www.mediawiki.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.species:
                    URL = "http://species.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.wikia:
                    URL = "http://" + customProject + ".wikia.com";
                    URLEnd = "/";
                    break;
                case ProjectEnum.custom:
                    URLEnd = "";
                    break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                if (!MainForm.TheSession.UpdateProject())
                {
                    LangCode = "en";
                    Project = ProjectEnum.wikipedia;
                    SetToEnglish();
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");
        }
コード例 #29
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        /// <param name="protocol"></param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject, string protocol)
        {
            TryLoadingAgainAfterLogin = false;
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();
            WikiRegexes.TemplateRedirects.Clear();

            Project       = projectName;
            LangCode      = langCode;
            CustomProject = customProject;
            Protocol      = protocol;

            RefreshProxy();

            URLEnd = "/w/";

            Stub = "[^{}|]*?[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub      = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            TypoSummaryTag = "typos fixed: ";
            AWBDefaultSummaryTag();
            mSummaryTag          = " using ";
            NotificationsEnabled = true;

            if (IsCustomProject)
            {
                LangCode = "en";
                var uri = new Uri(Protocol + customProject);
                URLEnd        = uri.AbsolutePath;
                URL           = protocol + uri.Host;
                CustomProject = customProject;
            }
            else
            {
                URL = "https://" + LangCode + "." + Project + ".org";
            }

            // HACK:
            switch (projectName)
            {
            case ProjectEnum.wikipedia:
            case ProjectEnum.wikinews:
            case ProjectEnum.wikisource:
            case ProjectEnum.wikibooks:
            case ProjectEnum.wikiquote:
            case ProjectEnum.wiktionary:
            case ProjectEnum.wikiversity:
                //If not set the following will be used:
                //mSummaryTag="using";
                //WPAWB = "[[Project:Wikipedia:AutoWikiBrowser|AWB]]";
                switch (langCode)
                {
                case "en":
                    if (projectName == ProjectEnum.wikipedia)
                    {
                        SetToEnglish();
                    }
                    TypoSummaryTag = @"[[WP:AWB/T|typos fixed]]: ";
                    break;

                case "ar":
                    mSummaryTag    = " ";
                    WPAWB          = "باستخدام [[Project:أوب|أوب]]";
                    Stub           = @"(?:[^{}|]*?[Ss]tub|بذرة|بذور[^{}]*?)";
                    TypoSummaryTag = ".الأخطاء المصححة: ";
                    break;

                case "arz":
                    mSummaryTag    = " ";
                    WPAWB          = "عن طريق [[Project:AWB|اوب]]";
                    Stub           = @"(?:[^{}|]*?[Ss]tub|تقاوى|بذرة[^{}]*?)";
                    TypoSummaryTag = ".الأخطاء المصححة: ";
                    break;

                case "bg":
                    mSummaryTag = " редактирано с ";
                    WPAWB       = "AWB";
                    break;

                case "ca":
                    mSummaryTag = " ";
                    WPAWB       = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                    break;

                case "cs":
                    mSummaryTag = " za použití ";
                    WPAWB       = "[[Wikipedie:AutoWikiBrowser|AWB]]";
                    Stub        = @"[^{}|]*?([Pp]ahýl)";
                    break;

                case "cy":
                    Stub = @"[^{}|]*?([Ss]tub|[Εe]ginyn[^{}]*?)";
                    break;

                case "da":
                    mSummaryTag = " ved brug af ";
                    WPAWB       = "[[en:WP:AWB|AWB]]";
                    break;

                case "de":
                    mSummaryTag    = " mit ";
                    TypoSummaryTag = ", Schreibweise:";
                    break;

                case "el":
                    mSummaryTag   = " με τη χρήση ";
                    WPAWB         = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
                    Stub          = @"[^{}|]*?([Ss]tub|[Εε]πέκταση)";
                    SectStub      = @"\{\{θέματος";
                    SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                    break;

                case "eo":
                    mSummaryTag    = " per ";
                    WPAWB          = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                    TypoSummaryTag = ", Skribmaniero:";
                    break;

                case "he":
                    mSummaryTag = " באמצעות ";
                    WPAWB       = "[[ויקיפדיה:AutoWikiBrowser|AWB]]";
                    break;

                case "hi":
                    mSummaryTag = " ";
                    WPAWB       = "[[विकिपीडिया:ऑटोविकिब्राउज़र|AWB]] के साथ";
                    break;

                case "hu":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "hy":
                    mSummaryTag = " oգտվելով ";
                    WPAWB       = "[[Վիքիպեդիա:ԱվտոՎիքիԲրաուզեր|ԱՎԲ]]";
                    break;

                case "ku":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                    break;

                case "ms":
                    mSummaryTag = "menggunakan";
                    break;

                case "nl":
                    mSummaryTag = " met ";
                    break;

                case "pl":
                    mSummaryTag   = " przy użyciu ";
                    SectStub      = @"\{\{[Ss]ek";
                    SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                    break;

                case "pt":
                    mSummaryTag = " utilizando ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "ru":
                    mSummaryTag = " с помощью ";
                    Stub        = "[^{}]*?(?:[Ss]tub|[Зз]аготовка)";
                    break;

                case "sk":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "sl":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                    Stub        = "(?:[^{}]*?[Ss]tub|[Šš]krbina[^{}]*?)";
                    break;

                case "sv":
                    mSummaryTag    = " med ";
                    TypoSummaryTag = ", rättningar:";
                    Stub           = @"(?:[^{}]*?[Ss]tub|[^{}]+?stub\-[^{}]+)";
                    break;

                case "tr":
                    mSummaryTag    = " ";
                    WPAWB          = "[[Vikipedi:AWB|AWB]] ile ";
                    TypoSummaryTag = " yazış şekli:";
                    break;

                case "uk":
                    Stub        = ".*?(?:[Ss]tub|[Дд]оробити)";
                    mSummaryTag = " за допомогою ";
                    WPAWB       = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                    break;

                case "zh":
                    mSummaryTag = "由";
                    WPAWB       = "[[维基百科:自动维基浏览器|自动维基浏览器]]协助";
                    break;

                case "zh-classical":
                    mSummaryTag = "藉";
                    WPAWB       = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]之助";
                    break;

                case "zh-yue":
                    mSummaryTag = "由";
                    WPAWB       = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]協助";
                    break;

                    // case "xx:
                    // strsummarytag = " ";
                    // strWPAWB = "";
                    // break;
                }
                break;

            case ProjectEnum.commons:
                URL      = "https://commons.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.meta:
                URL      = "https://meta.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.mediawiki:
                URL      = "https://www.mediawiki.org";
                LangCode = "en";
                break;

            case ProjectEnum.incubator:
                URL      = "https://incubator.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.species:
                URL      = "https://species.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.wikia:
                URL    = "http://" + customProject + ".wikia.com";
                URLEnd = "/";
                break;

            case ProjectEnum.custom:
                break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                try
                {
                    if (!MainForm.TheSession.UpdateProject(false))
                    {
                        LangCode = "en";
                        Project  = ProjectEnum.wikipedia;
                        SetToEnglish();
                    }
                }
                catch (ReadApiDeniedException)
                {
                    TryLoadingAgainAfterLogin = true;
                    ReloadProjectSettings     = new ProjectHoldArea
                    {
                        projectName   = projectName,
                        customProject = customProject,
                        langCode      = langCode,
                        protocol      = Protocol
                    };
                    return;
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");

            if (projectName.Equals(ProjectEnum.wiktionary))
            {
                CapitalizeFirstLetter = false;
            }
        }
コード例 #30
0
        private static void SetDefaults()
        {
            mProject = ProjectEnum.wikipedia;
            mLangCode = LangCodeEnum.en;
            mSummaryTag = " using ";
            strWPAWB = "[[Project:AWB|AWB]]";

            Namespaces.Clear();
            SetToEnglish();
        }
コード例 #31
0
ファイル: SettingsClasses.cs プロジェクト: svn2github/awb
        // the public constructors are used to create an object with settings from the UI
        public UserPrefs(FaRPrefs mFaRPrefs, EditPrefs mEditprefs, ListPrefs mList, SkipPrefs mSkipOptions,
            GeneralPrefs mGeneral, DabPrefs mDisambiguation, ModulePrefs mModule, ExternalProgramPrefs mExternalProgram, SpecialFilterPrefs mSpecial, ToolsPrefs mTool,
            Dictionary<string, Plugin.IAWBPlugin> plugins)
        {
            LanguageCode = Variables.LangCode;
            Project = Variables.Project;
            CustomProject = Variables.CustomProject;
            Protocol = Variables.Protocol;

            FindAndReplace = mFaRPrefs;
            Editprefs = mEditprefs;
            List = mList;
            SkipOptions = mSkipOptions;
            General = mGeneral;
            Disambiguation = mDisambiguation;
            Module = mModule;
            ExternalProgram = mExternalProgram;
            Special = mSpecial;

            Tool = mTool;

            foreach (KeyValuePair<string, Plugin.IAWBPlugin> a in plugins)
            {
                Plugin.Add(new PluginPrefs(a.Key, a.Value.SaveSettings()));
            }
        }
コード例 #32
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject)
        {
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();

            foreach (var s in AttackSites)
            {
                if (customProject.Contains(s))
                {
                    MessageBox.Show("This software does not work on attack sites.");
                    Application.ExitThread();
                }
            }

            Project       = projectName;
            LangCode      = langCode;
            CustomProject = customProject;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub      = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            if (IsCustomProject)
            {
                LangCode = "en";
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd        = customProject.Substring(x, customProject.Length - x);
                    customProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
            {
                URL = "http://" + LangCode + "." + Project + ".org";
            }

            // HACK:
            switch (projectName)
            {
            case ProjectEnum.wikipedia:
            case ProjectEnum.wikinews:
            case ProjectEnum.wikisource:
            case ProjectEnum.wikibooks:
            case ProjectEnum.wikiquote:
            case ProjectEnum.wiktionary:
            case ProjectEnum.wikiversity:
                switch (langCode)
                {
                case "en":
                    if (projectName == ProjectEnum.wikipedia)
                    {
                        SetToEnglish();
                    }
                    break;

                case "ar":
                    mSummaryTag    = " ";
                    WPAWB          = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                    TypoSummaryTag = ".الأخطاء المصححة: ";
                    break;

                case "bg":
                    mSummaryTag = " редактирано с ";
                    WPAWB       = "AWB";
                    break;

                case "ca":
                    mSummaryTag = " ";
                    WPAWB       = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                    break;

                case "da":
                    mSummaryTag = " ved brug af ";
                    WPAWB       = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                    break;

                case "de":
                    mSummaryTag    = " mit ";
                    TypoSummaryTag = ", Schreibweise:";
                    break;

                case "el":
                    mSummaryTag = " με τη χρήση ";
                    WPAWB       = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
                    break;

                case "eo":
                    mSummaryTag = " ";
                    WPAWB       = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                    break;

                case "hu":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "ku":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                    break;

                case "nl":
                    mSummaryTag = " met ";
                    break;

                case "pl":
                    SectStub      = @"\{\{[Ss]ek";
                    SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                    break;

                case "pt":
                    mSummaryTag = " utilizando ";
                    break;

                case "ru":
                    mSummaryTag = " с помощью ";
                    Stub        = "(?:[Ss]tub|[Зз]аготовка)";
                    break;

                case "sk":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case "sl":
                    mSummaryTag = " ";
                    WPAWB       = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                    Stub        = "(?:[Ss]tub|[Šš]krbina)";
                    break;

                case "uk":
                    Stub        = "(?:[Ss]tub|[Дд]оробити)";
                    mSummaryTag = " за допомогою ";
                    WPAWB       = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                    break;

                // case "xx:
                // strsummarytag = " ";
                // strWPAWB = "";
                // break;

                default:
                    break;
                }
                break;

            case ProjectEnum.commons:
                URL      = "http://commons.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.meta:
                URL      = "http://meta.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.mediawiki:
                URL      = "http://www.mediawiki.org";
                LangCode = "en";
                break;

            case ProjectEnum.species:
                URL      = "http://species.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.wikia:
                URL    = "http://" + customProject + ".wikia.com";
                URLEnd = "/";
                break;

            case ProjectEnum.custom:
                URLEnd = "";
                break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                if (!MainForm.TheSession.UpdateProject())
                {
                    LangCode = "en";
                    Project  = ProjectEnum.wikipedia;
                    SetToEnglish();
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");
        }
コード例 #33
0
ファイル: MockVsSolution.cs プロジェクト: yazici/PTVS
 public int Clone(out IEnumHierarchies ppenum)
 {
     ppenum = new ProjectEnum(_projects);
     return(VSConstants.S_OK);
 }
コード例 #34
0
        private void cmboProject_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProjectEnum prj = Project;

            //disable language selection for single language projects
            cmboLang.Enabled = (prj < ProjectEnum.species);

            string temp = (cmboLang.SelectedItem != null) ? cmboLang.SelectedItem.ToString() : "";

            cmboLang.Items.Clear();
            List <string> langs;

            switch (prj)
            {
            case ProjectEnum.wikipedia:
                langs = SiteMatrix.WikipediaLanguages;
                break;

            case ProjectEnum.wiktionary:
                langs = SiteMatrix.WiktionaryLanguages;
                break;

            case ProjectEnum.wikibooks:
                langs = SiteMatrix.WikibooksLanguages;
                break;

            case ProjectEnum.wikinews:
                langs = SiteMatrix.WikinewsLanguages;
                break;

            case ProjectEnum.wikiquote:
                langs = SiteMatrix.WikiquoteLanguages;
                break;

            case ProjectEnum.wikisource:
                langs = SiteMatrix.WikisourceLanguages;
                break;

            case ProjectEnum.wikiversity:
                langs = SiteMatrix.WikiversityLanguages;
                break;

            default:
                langs = SiteMatrix.Languages;
                break;
            }
            cmboLang.Items.AddRange(langs.ToArray());

            if (!string.IsNullOrEmpty(temp))
            {
                cmboLang.SelectedIndex = cmboLang.Items.IndexOf(temp);
            }

            if (prj == ProjectEnum.custom || prj == ProjectEnum.wikia)
            {
                cmboCustomProject.Visible = true;
                cmboLang.Visible          = false;
                lblLang.Text    = "http://";
                lblPostfix.Text = prj == ProjectEnum.wikia ? ".wikia.com" : "";
                cmboCustomProjectChanged(null, null);

                chkSupressAWB.Enabled = true;

                chkPHP5Ext.Enabled = (prj == ProjectEnum.custom);

                return;
            }

            lblPostfix.Text           = "";
            cmboCustomProject.Visible = false;
            cmboLang.Visible          = true;
            lblLang.Text          = "Language:";
            btnOK.Enabled         = true;
            chkSupressAWB.Enabled = false;
        }
コード例 #35
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        /// <param name="protocol"></param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject, string protocol)
        {
            TryLoadingAgainAfterLogin = false;
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();
            WikiRegexes.TemplateRedirects.Clear();
            bool typoReloadNeeded = (LangCode != langCode || Project != projectName || customProject != CustomProject);

            Project       = projectName;
            LangCode      = langCode;
            CustomProject = customProject;
            Protocol      = protocol;

            RefreshProxy();

            URLEnd = "/w/";

            Stub = "[^{}|]*?[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub      = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            TypoSummaryTag = "typos fixed: ";
            AWBDefaultSummaryTag();
            mSummaryTag          = "using";
            NotificationsEnabled = true;

            if (IsCustomProject)
            {
                LangCode = "en";
                var uri = new Uri(Protocol + customProject);
                URLEnd        = uri.AbsolutePath;
                URL           = protocol + uri.Host;
                CustomProject = customProject;
            }
            else
            {
                URL = "https://" + LangCode + "." + Project + ".org";
            }

            // HACK:
            switch (projectName)
            {
            case ProjectEnum.wikipedia:
            case ProjectEnum.wikinews:
            case ProjectEnum.wikisource:
            case ProjectEnum.wikibooks:
            case ProjectEnum.wikiquote:
            case ProjectEnum.wiktionary:
            case ProjectEnum.wikiversity:
                //If not set the following will be used:
                //mSummaryTag="using";
                //WPAWB = "[[Project:Wikipedia:AutoWikiBrowser|AWB]]";
                SetLanguageSpecificValues(langCode, projectName);
                break;

            case ProjectEnum.commons:
                URL      = "https://commons.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.meta:
                URL      = "https://meta.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.mediawiki:
                URL      = "https://www.mediawiki.org";
                LangCode = "en";
                break;

            case ProjectEnum.incubator:
                URL      = "https://incubator.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.species:
                URL      = "https://species.wikimedia.org";
                LangCode = "en";
                break;

            case ProjectEnum.wikia:
                URL    = "http://" + customProject + ".wikia.com";
                URLEnd = "/";
                break;

            case ProjectEnum.custom:
                break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                try
                {
                    if (!MainForm.TheSession.UpdateProject(false))
                    {
                        LangCode = "en";
                        Project  = ProjectEnum.wikipedia;
                        SetToEnglish();
                    }
                }
                catch (ReadApiDeniedException)
                {
                    TryLoadingAgainAfterLogin = true;
                    ReloadProjectSettings     = new ProjectHoldArea
                    {
                        projectName   = projectName,
                        customProject = customProject,
                        langCode      = langCode,
                        protocol      = Protocol
                    };
                    return;
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            if (typoReloadNeeded && MainForm != null)
            {
                MainForm.LoadTypos(true);
            }

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");

            if (projectName.Equals(ProjectEnum.wiktionary))
            {
                CapitalizeFirstLetter = false;
            }
        }
コード例 #36
0
ファイル: Tools.cs プロジェクト: svn2github/autowikibrowser
 // Covered by ToolsTests.IsWikimediaProject()
 /// <summary>
 /// Returns true if given project belongs to Wikimedia
 /// </summary>
 public static bool IsWikimediaProject(ProjectEnum p)
 {
     return (p != ProjectEnum.custom && p != ProjectEnum.wikia);
 }
コード例 #37
0
 public void Error(ProjectEnum project, string message)
 {
     logger.Error(string.Format("Owner:{0}-Message:{1}", project.ToString(), message));
 }
コード例 #38
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is english Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 public static void SetProject(string langCode, ProjectEnum projectName)
 {
     SetProject(langCode, projectName, "", false);
 }
コード例 #39
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is english Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 public static void SetProject(string langCode, ProjectEnum projectName)
 {
     SetProject(langCode, projectName, "");
 }
コード例 #40
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        public static void SetProject(LangCodeEnum langCode, ProjectEnum projectName, string customProject)
        {
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();

            if (customProject.Contains("traditio.") || customProject.Contains("volgota.com") ||
                customProject.Contains("encyclopediadramatica"))
            {
                MessageBox.Show("This software does not work on attack sites.");
                Application.Exit();
            }

            Project       = projectName;
            LangCode      = langCode;
            CustomProject = customProject;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";

            if (IsCustomProject)
            {
                LangCode = LangCodeEnum.en;
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd        = customProject.Substring(x, customProject.Length - x);
                    customProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
            {
                URL = "http://" + LangCodeEnumString() + "." + Project + ".org";
            }

            switch (projectName)
            {
            case ProjectEnum.wikipedia:
            case ProjectEnum.wikinews:
            case ProjectEnum.wikisource:
            case ProjectEnum.wikibooks:
            case ProjectEnum.wikiquote:
            case ProjectEnum.wiktionary:
            case ProjectEnum.wikiversity:
                switch (langCode)
                {
                case LangCodeEnum.en:
                    SetToEnglish();
                    break;

                case LangCodeEnum.ar:
                    mSummaryTag       = " ";
                    strWPAWB          = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                    strTypoSummaryTag = ".الأخطاء المصححة: ";
                    break;

                case LangCodeEnum.bg:
                    mSummaryTag = " редактирано с ";
                    strWPAWB    = "AWB";
                    break;

                case LangCodeEnum.ca:
                    mSummaryTag = " ";
                    strWPAWB    = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                    break;

                case LangCodeEnum.da:
                    mSummaryTag = " ved brug af ";
                    strWPAWB    = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                    break;

                case LangCodeEnum.de:
                    mSummaryTag       = " mit ";
                    strTypoSummaryTag = ", Schreibweise:";
                    break;

                case LangCodeEnum.eo:
                    mSummaryTag = " ";
                    strWPAWB    = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                    break;

                case LangCodeEnum.hu:
                    mSummaryTag = " ";
                    strWPAWB    = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case LangCodeEnum.ku:
                    mSummaryTag = " ";
                    strWPAWB    = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                    break;

                case LangCodeEnum.nl:
                    mSummaryTag = " met ";
                    break;

                case LangCodeEnum.pl:
                    SectStub = @"\{\{[Ss]ek";
                    break;

                case LangCodeEnum.pt:
                    mSummaryTag = " utilizando ";
                    break;

                case LangCodeEnum.ru:
                    mSummaryTag = " с помощью ";
                    Stub        = "(?:[Ss]tub|[Зз]аготовка)";
                    break;

                case LangCodeEnum.sk:
                    mSummaryTag = " ";
                    strWPAWB    = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                    break;

                case LangCodeEnum.sl:
                    mSummaryTag = " ";
                    strWPAWB    = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                    Stub        = "(?:[Ss]tub|[Šš]krbina)";
                    break;

                case LangCodeEnum.uk:
                    Stub        = "(?:[Ss]tub|[Дд]оробити)";
                    mSummaryTag = " за допомогою ";
                    strWPAWB    = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                    break;

                // case LangCodeEnum.xx:
                // strsummarytag = " ";
                // strWPAWB = "";
                // break;

                default:
                    break;
                }
                break;

            case ProjectEnum.commons:
                URL      = "http://commons.wikimedia.org";
                LangCode = LangCodeEnum.en;
                break;

            case ProjectEnum.meta:
                URL      = "http://meta.wikimedia.org";
                LangCode = LangCodeEnum.en;
                break;

            case ProjectEnum.mediawiki:
                URL      = "http://www.mediawiki.org";
                LangCode = LangCodeEnum.en;
                break;

            case ProjectEnum.species:
                URL      = "http://species.wikimedia.org";
                LangCode = LangCodeEnum.en;
                break;

            case ProjectEnum.wikia:
                URL    = "http://" + customProject + ".wikia.com";
                URLEnd = "/";
                break;

            case ProjectEnum.custom:
                URLEnd = "";
                break;
            }

            if (projectName != ProjectEnum.wikipedia || langCode != LangCodeEnum.en)
            {
                //LoadProjectOptions(); //TODO:Reinstate/use in Session if necessary
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");
        }
コード例 #41
0
ファイル: Tools.cs プロジェクト: svn2github/autowikibrowser
 /// <summary>
 /// Returns true if given project belongs to Wikimedia
 /// </summary>
 public static bool IsWikimediaProject(ProjectEnum p)
 {
     return (p == ProjectEnum.commons || p == ProjectEnum.meta || p == ProjectEnum.species
         || p == ProjectEnum.wikibooks || p == ProjectEnum.wikinews || p == ProjectEnum.wikipedia
         || p == ProjectEnum.wikiquote || p == ProjectEnum.wikisource || p == ProjectEnum.wikiversity
         || p == ProjectEnum.wiktionary);
 }
コード例 #42
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        public static void SetProject(LangCodeEnum langCode, ProjectEnum projectName, string customProject)
        {
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();

            if (customProject.Contains("traditio.") || customProject.Contains("volgota.com")
                || customProject.Contains("encyclopediadramatica"))
            {
                MessageBox.Show("This software does not work on attack sites.");
                Application.Exit();
            }

            Project = projectName;
            LangCode = langCode;
            CustomProject = customProject;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";

            if (IsCustomProject)
            {
                LangCode = LangCodeEnum.en;
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd = customProject.Substring(x, customProject.Length - x);
                    customProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
                URL = "http://" + LangCodeEnumString() + "." + Project + ".org";

            switch (projectName)
            {
                case ProjectEnum.wikipedia:
                case ProjectEnum.wikinews:
                case ProjectEnum.wikisource:
                case ProjectEnum.wikibooks:
                case ProjectEnum.wikiquote:
                case ProjectEnum.wiktionary:
                case ProjectEnum.wikiversity:
                    switch (langCode)
                    {
                        case LangCodeEnum.en:
                            SetToEnglish();
                            break;

                        case LangCodeEnum.ar:
                            mSummaryTag = " ";
                            strWPAWB = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                            strTypoSummaryTag = ".الأخطاء المصححة: ";
                            break;

                        case LangCodeEnum.bg:
                            mSummaryTag = " редактирано с ";
                            strWPAWB = "AWB";
                            break;

                        case LangCodeEnum.ca:
                            mSummaryTag = " ";
                            strWPAWB = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                            break;

                        case LangCodeEnum.da:
                            mSummaryTag = " ved brug af ";
                            strWPAWB = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                            break;

                        case LangCodeEnum.de:
                            mSummaryTag = " mit ";
                            strTypoSummaryTag = ", Schreibweise:";
                            break;

                        case LangCodeEnum.eo:
                            mSummaryTag = " ";
                            strWPAWB = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                            break;

                        case LangCodeEnum.hu:
                            mSummaryTag = " ";
                            strWPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case LangCodeEnum.ku:
                            mSummaryTag = " ";
                            strWPAWB = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                            break;

                        case LangCodeEnum.nl:
                            mSummaryTag = " met ";
                            break;

                        case LangCodeEnum.pl:
                            SectStub = @"\{\{[Ss]ek";
                            break;

                        case LangCodeEnum.pt:
                            mSummaryTag = " utilizando ";
                            break;

                        case LangCodeEnum.ru:
                            mSummaryTag = " с помощью ";
                            Stub = "(?:[Ss]tub|[Зз]аготовка)";
                            break;

                        case LangCodeEnum.sk:
                            mSummaryTag = " ";
                            strWPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case LangCodeEnum.sl:
                            mSummaryTag = " ";
                            strWPAWB = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                            Stub = "(?:[Ss]tub|[Šš]krbina)";
                            break;

                        case LangCodeEnum.uk:
                            Stub = "(?:[Ss]tub|[Дд]оробити)";
                            mSummaryTag = " за допомогою ";
                            strWPAWB = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                            break;

                        // case LangCodeEnum.xx:
                        // strsummarytag = " ";
                        // strWPAWB = "";
                        // break;

                        default:
                            break;
                    }
                    break;
                case ProjectEnum.commons:
                    URL = "http://commons.wikimedia.org";
                    LangCode = LangCodeEnum.en;
                    break;
                case ProjectEnum.meta:
                    URL = "http://meta.wikimedia.org";
                    LangCode = LangCodeEnum.en;
                    break;
                case ProjectEnum.mediawiki:
                    URL = "http://www.mediawiki.org";
                    LangCode = LangCodeEnum.en;
                    break;
                case ProjectEnum.species:
                    URL = "http://species.wikimedia.org";
                    LangCode = LangCodeEnum.en;
                    break;
                case ProjectEnum.wikia:
                    URL = "http://" + customProject + ".wikia.com";
                    URLEnd = "/";
                    break;
                case ProjectEnum.custom:
                    URLEnd = "";
                    break;
            }

            if (projectName != ProjectEnum.wikipedia || langCode != LangCodeEnum.en)
            {
                LoadProjectOptions();
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");
        }
コード例 #43
0
 public void Error(ProjectEnum project, string message)
 {
     logger.LogError("Example Error log message");
 }
コード例 #44
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        /// <param name="protocol"></param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject, string protocol)
        {
            TryLoadingAgainAfterLogin = false;
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();
            WikiRegexes.TemplateRedirects.Clear();

            Project = projectName;
            LangCode = langCode;
            CustomProject = customProject;
            Protocol = protocol;

            RefreshProxy();

            URLEnd = "/w/";

            Stub = "[^{}|]*?[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            TypoSummaryTag = "typos fixed: ";
            AWBDefaultSummaryTag();
            mSummaryTag = " using ";

            if (IsCustomProject)
            {
                LangCode = "en";
                var uri = new Uri(Protocol + customProject);
                URLEnd = uri.AbsolutePath;
                URL = protocol + uri.Host;
                CustomProject = customProject;
            }
            else
            {
                URL = "https://" + LangCode + "." + Project + ".org";
            }

            // HACK:
            switch (projectName)
            {
                case ProjectEnum.wikipedia:
                case ProjectEnum.wikinews:
                case ProjectEnum.wikisource:
                case ProjectEnum.wikibooks:
                case ProjectEnum.wikiquote:
                case ProjectEnum.wiktionary:
                case ProjectEnum.wikiversity:
                    //If not set the following will be used:
                    //mSummaryTag="using";
                    //WPAWB = "[[Project:Wikipedia:AutoWikiBrowser|AWB]]";
                    switch (langCode)
                    {
                        case "en":
                            if (projectName == ProjectEnum.wikipedia)
                                SetToEnglish();
                            TypoSummaryTag = @"[[WP:AWB/T|typos fixed]]: ";
                            break;

                        case "ar":
                            mSummaryTag = " ";
                            WPAWB = "باستخدام [[Project:أوب|أوب]]";
                            Stub = @"(?:[^{}|]*?[Ss]tub|(بذرة|بذور)[^{}]*?)";
                            TypoSummaryTag = ".الأخطاء المصححة: ";
                            break;

                        case "bg":
                            mSummaryTag = " редактирано с ";
                            WPAWB = "AWB";
                            break;

                        case "ca":
                            mSummaryTag = " ";
                            WPAWB = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                            break;

                        case "cs":
                            mSummaryTag = " za použití ";
                            WPAWB = "[[Wikipedie:AutoWikiBrowser|AWB]]";
                            //Stub = @"[^{}|]*?([Pp]ahýl)";
                            break;
                            
                        case "da":
                            mSummaryTag = " ved brug af ";
                            WPAWB = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                            break;

                        case "de":
                            mSummaryTag = " mit ";
                            TypoSummaryTag = ", Schreibweise:";
                            break;

                        case "el":
                            mSummaryTag = " με τη χρήση ";
                            WPAWB = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
                            //Stub = @"[^{}|]*?([Ss]tub|[Εε]πέκταση)";
                            SectStub = @"\{\{θέματος";
                            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                            break;

                        case "eo":
                            mSummaryTag = " per ";
                            WPAWB = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                            TypoSummaryTag = ", Skribmaniero:";
                            break;

                        case "he":
                            mSummaryTag = " באמצעות ";
                            WPAWB = "[[ויקיפדיה:AutoWikiBrowser|AWB]]";
                            break;

                        case "hi":
                            mSummaryTag = " ";
                            WPAWB = "[[विकिपीडिया:ऑटोविकिब्राउज़र|AWB]] के साथ";
                            break;

                        case "hu":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "hy":
                            mSummaryTag = " oգտվելով ";
                            WPAWB = "[[Վիքիպեդիա:ԱվտոՎիքիԲրաուզեր|ԱՎԲ]]";
                            break;

                           case "ku":
                            mSummaryTag = " ";
                            WPAWB = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                            break;

                        case "ms":
                            mSummaryTag = "menggunakan";
                            break;

                        case "nl":
                            mSummaryTag = " met ";
                            break;
                            
                        case "pl":
                            mSummaryTag = " przy użyciu ";
                            SectStub = @"\{\{[Ss]ek";
                            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                            break;

                        case "pt":
                            mSummaryTag = " utilizando ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "ru":
                            mSummaryTag = " с помощью ";
                            Stub = "[^{}]*?(?:[Ss]tub|[Зз]аготовка)";
                            break;

                        case "sk":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "sl":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                            Stub = "(?:[^{}]*?[Ss]tub|[Šš]krbina[^{}]*?)";
                            break;

                        case "sv":
                            mSummaryTag = " med ";
                            TypoSummaryTag = ", rättningar:";
                            break;

                        case "tr":
                            mSummaryTag = " ";
                            WPAWB = "[[Vikipedi:AWB|AWB]] ile ";
                            TypoSummaryTag = " yazış şekli:";
                            break;

                        case "uk":
                            Stub = ".*?(?:[Ss]tub|[Дд]оробити)";
                            mSummaryTag = " за допомогою ";
                            WPAWB = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                            break;

                        case "zh":
                            mSummaryTag = "由";
                            WPAWB = "[[维基百科:自动维基浏览器|自动维基浏览器]]协助";
                            break;

                        case "zh-classical":
                            mSummaryTag = "藉";
                            WPAWB = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]之助";
                            break;

                        case "zh-yue":
                            mSummaryTag = "由";
                            WPAWB = "[[维基百科:自动维基浏览器|自動維基瀏覽器]]協助";
                            break;

                            // case "xx:
                            // strsummarytag = " ";
                            // strWPAWB = "";
                            // break;
                    }
                    break;
                case ProjectEnum.commons:
                    URL = "https://commons.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.meta:
                    URL = "https://meta.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.mediawiki:
                    URL = "https://www.mediawiki.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.incubator:
                    URL = "https://incubator.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.species:
                    URL = "https://species.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.wikia:
                    URL = "http://" + customProject + ".wikia.com";
                    URLEnd = "/";
                    break;
                case ProjectEnum.custom:
                    break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                try
                {
                    if (!MainForm.TheSession.UpdateProject(false))
                    {
                        LangCode = "en";
                        Project = ProjectEnum.wikipedia;
                        SetToEnglish();
                    }
                }
                catch (ReadApiDeniedException)
                {
                    TryLoadingAgainAfterLogin = true;
                    ReloadProjectSettings = new ProjectHoldArea
                                                {
                                                    projectName = projectName,
                                                    customProject = customProject,
                                                    langCode = langCode,
                                                    protocol = Protocol
                                                };
                    return;
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");

            if (projectName.Equals(ProjectEnum.wiktionary))
                CapitalizeFirstLetter = false;
        }
コード例 #45
0
ファイル: Main.cs プロジェクト: svn2github/autowikibrowser
        private void SetProject(LangCodeEnum code, ProjectEnum project, string customProject)
        {
            SplashScreen.SetProgress(81);
            try
            {
                //set namespaces
                Variables.SetProject(code, project, customProject);

                //set interwikiorder
                switch (Variables.LangCode)
                {
                    case LangCodeEnum.en:
                    case LangCodeEnum.pl:
                    case LangCodeEnum.simple:
                        Parser.InterWikiOrder = InterWikiOrderEnum.LocalLanguageAlpha;
                        break;

                    case LangCodeEnum.he:
                    case LangCodeEnum.hu:
                        Parser.InterWikiOrder = InterWikiOrderEnum.AlphabeticalEnFirst;
                        break;

                    default:
                        Parser.InterWikiOrder = InterWikiOrderEnum.Alphabetical;
                        break;
                }

                //user interface
                if (!Variables.IsWikipediaEN)
                {
                    humanNameDisambigTagToolStripMenuItem.Visible = birthdeathCatsToolStripMenuItem.Visible = false;
                    chkAutoTagger.Checked = false;
                }
                else if (!humanNameDisambigTagToolStripMenuItem.Visible)
                {
                    humanNameDisambigTagToolStripMenuItem.Visible = birthdeathCatsToolStripMenuItem.Visible = true;
                }

                UserTalkWarningsLoaded = false; // force reload

                if (!Variables.IsCustomProject && !Variables.IsWikia && !Variables.IsWikimediaMonolingualProject)
                    lblProject.Text = Variables.LangCodeEnumString() + "." + Variables.Project;
                else lblProject.Text = Variables.IsWikimediaMonolingualProject ? Variables.Project.ToString() : Variables.URL;

                ResetTypoStats();
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("The interwiki list didn't load correctly. Please check your internet connection, and then restart AWB");
            }
        }
コード例 #46
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        /// <param name="usingSecure"></param>
        public static void SetProject(string langCode, ProjectEnum projectName, string customProject, bool usingSecure)
        {
            TryLoadingAgainAfterLogin = false;
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();
            WikiRegexes.TemplateRedirects.Clear();

            Project = projectName;
            LangCode = langCode;
            CustomProject = customProject;
            UsingSecure = usingSecure;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[^{}|]*?[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";
            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);

            if (IsCustomProject)
            {
                LangCode = "en";
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd = customProject.Substring(x, customProject.Length - x);
                    CustomProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
            {
                URL = "http://" + LangCode + "." + Project + ".org";
                URLSecure = "https://secure.wikimedia.org/";
                if (IsWikimediaMonolingualProject)
                {
                    URLSecure += "wikipedia/" + Project;
                }
                else
                {                   	
                    URLSecure += Project + "/" + LangCode; //https://secure.wikimedia.org/wikipedia/en
                }
             }

            // HACK:
            switch (projectName)
            {
                case ProjectEnum.wikipedia:
                case ProjectEnum.wikinews:
                case ProjectEnum.wikisource:
                case ProjectEnum.wikibooks:
                case ProjectEnum.wikiquote:
                case ProjectEnum.wiktionary:
                case ProjectEnum.wikiversity:
                    switch (langCode)
                    {
                        case "en":
                            if (projectName == ProjectEnum.wikipedia)
                                SetToEnglish();
                            break;

                        case "ar":
                            mSummaryTag = " ";
                            WPAWB = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                            TypoSummaryTag = ".الأخطاء المصححة: ";
                            break;

                        case "bg":
                            mSummaryTag = " редактирано с ";
                            WPAWB = "AWB";
                            break;

                        case "ca":
                            mSummaryTag = " ";
                            WPAWB = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                            break;

                        case "da":
                            mSummaryTag = " ved brug af ";
                            WPAWB = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                            break;

                        case "de":
                            mSummaryTag = " mit ";
                            TypoSummaryTag = ", Schreibweise:";
                            break;
						
						case "el":
							mSummaryTag = " με τη χρήση ";
                            WPAWB = "[[Βικιπαίδεια:AutoWikiBrowser|AWB]]";
							break;

                        case "eo":
                            mSummaryTag = " ";
                            WPAWB = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                            break;

                        case "hu":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "ku":
                            mSummaryTag = " ";
                            WPAWB = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                            break;
                            
                        case "ms":
                            mSummaryTag = "menggunakan";
                            break;

                        case "nl":
                            mSummaryTag = " met ";
                            break;

                        case "pl":
                            SectStub = @"\{\{[Ss]ek";
                            SectStubRegex = new Regex(SectStub, RegexOptions.Compiled);
                            break;

                        case "pt":
                            mSummaryTag = " utilizando ";
                            break;

                        case "ru":
                            mSummaryTag = " с помощью ";
                            Stub = "[^{}]*?(?:[Ss]tub|[Зз]аготовка)";
                            break;

                        case "sk":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                            break;

                        case "sl":
                            mSummaryTag = " ";
                            WPAWB = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                            Stub = "(?:[^{}]*?[Ss]tub|[Šš]krbina[^{}]*?)";
                            break;

                        case "uk":
                            Stub = ".*?(?:[Ss]tub|[Дд]оробити)";
                            mSummaryTag = " за допомогою ";
                            WPAWB = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                            break;

                        // case "xx:
                        // strsummarytag = " ";
                        // strWPAWB = "";
                        // break;

                        default:
                            break;
                    }
                    break;
                case ProjectEnum.commons:
                    URL = "http://commons.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.meta:
                    URL = "http://meta.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.mediawiki:
                    URL = "http://www.mediawiki.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.species:
                    URL = "http://species.wikimedia.org";
                    LangCode = "en";
                    break;
                case ProjectEnum.wikia:
                    URL = "http://" + customProject + ".wikia.com";
                    URLEnd = "/";
                    break;
                case ProjectEnum.custom:
                    //URLEnd = "";
                    break;
            }

            //refresh once more in case project settings were reset due to error with loading
            RefreshProxy();

            //HACK:HACK:HACK:HACK:HACK:
            if (MainForm != null && MainForm.TheSession != null)
            {
                try
                {
                    if (!MainForm.TheSession.UpdateProject(false))
                    {
                        LangCode = "en";
                        Project = ProjectEnum.wikipedia;
                        SetToEnglish();
                    }
                }
                catch (ReadApiDeniedException)
                {
                    TryLoadingAgainAfterLogin = true;
                    ReloadProjectSettings = new ProjectHoldArea
                                                {
                                                    projectName = projectName,
                                                    customProject = customProject,
                                                    langCode = langCode,
                                                    usingSecure = usingSecure
                                                };
                    return;
                }
            }

            RegenerateRegexes();

            RetfPath = Namespaces[Namespace.Project] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                                                "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                                            "Please contact a developer.");
            
            if(projectName.Equals(ProjectEnum.wiktionary))
              CapitalizeFirstLetter = false;
        }
コード例 #47
0
        /// <summary>
        /// Sets different language variables, such as namespaces. Default is english Wikipedia
        /// </summary>
        /// <param name="langCode">The language code, default is en</param>
        /// <param name="projectName">The project name default is Wikipedia</param>
        /// <param name="customProject">Script path of a custom project or ""</param>
        public static void SetProject(LangCodeEnum langCode, ProjectEnum projectName, string customProject)
        {
            Namespaces.Clear();
            CancelBackgroundRequests();
            UnderscoredTitles.Clear();

            if (customProject.Contains("traditio.") || customProject.Contains("volgota.com")
                || customProject.Contains("encyclopediadramatica"))
            {
                MessageBox.Show("This software does not work on attack sites.");
                Application.Exit();
            }

            mProject = projectName;
            mLangCode = langCode;
            strcustomproject = customProject;

            RefreshProxy();

            URLEnd = "/w/";

            AWBDefaultSummaryTag();
            Stub = "[Ss]tub";

            MonthNames = ENLangMonthNames;

            SectStub = @"\{\{[Ss]ect";

            if (IsCustomProject)
            {
                mLangCode = LangCodeEnum.en;
                int x = customProject.IndexOf('/');

                if (x > 0)
                {
                    URLEnd = customProject.Substring(x, customProject.Length - x);
                    customProject = customProject.Substring(0, x);
                }

                URL = "http://" + CustomProject;
            }
            else
                URL = "http://" + LangCode.ToString().ToLower() + "." + Project + ".org";

            if (projectName == ProjectEnum.wikipedia)
            {
                #region Interwiki Switch
                //set language variables
                switch (langCode)
                {
                    case LangCodeEnum.en:
                        SetToEnglish();
                        break;

                    case LangCodeEnum.ar:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "خاص:";
                        Namespaces[1] = "نقاش:";
                        Namespaces[2] = "مستخدم:";
                        Namespaces[3] = "نقاش المستخدم:";
                        Namespaces[4] = "ويكيبيديا:";
                        Namespaces[5] = "نقاش ويكيبيديا:";
                        Namespaces[6] = "صورة:";
                        Namespaces[7] = "نقاش الصورة:";
                        Namespaces[8] = "ميدياويكي:";
                        Namespaces[9] = "نقاش ميدياويكي:";
                        Namespaces[10] = "قالب:";
                        Namespaces[11] = "نقاش القالب:";
                        Namespaces[12] = "مساعدة:";
                        Namespaces[13] = "نقاش المساعدة:";
                        Namespaces[14] = "تصنيف:";
                        Namespaces[15] = "نقاش التصنيف:";
                        Namespaces[100] = "بوابة:";
                        Namespaces[101] = "نقاش البوابة:";

                        mSummaryTag = " ";
                        strWPAWB = "باستخدام [[ويكيبيديا:أوب|الأوتوويكي براوزر]]";
                        strTypoSummaryTag = ".الأخطاء المصححة: ";
                        break;

                    case LangCodeEnum.bg:
                        Namespaces[-2] = "Медия:";
                        Namespaces[-1] = "Специални:";
                        Namespaces[1] = "Беседа:";
                        Namespaces[2] = "Потребител:";
                        Namespaces[3] = "Потребител беседа:";
                        Namespaces[4] = "Уикипедия:";
                        Namespaces[5] = "Уикипедия беседа:";
                        Namespaces[6] = "Картинка:";
                        Namespaces[7] = "Картинка беседа:";
                        Namespaces[8] = "МедияУики:";
                        Namespaces[9] = "МедияУики беседа:";
                        Namespaces[10] = "Шаблон:";
                        Namespaces[11] = "Шаблон беседа:";
                        Namespaces[12] = "Помощ:";
                        Namespaces[13] = "Помощ беседа:";
                        Namespaces[14] = "Категория:";
                        Namespaces[15] = "Категория беседа:";
                        Namespaces[100] = "Портал:";
                        Namespaces[101] = "Портал беседа:";

                        mSummaryTag = " редактирано с ";
                        strWPAWB = "AWB";
                        break;

                    case LangCodeEnum.ca:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Especial:";
                        Namespaces[1] = "Discussió:";
                        Namespaces[2] = "Usuari:";
                        Namespaces[3] = "Usuari Discussió:";
                        Namespaces[4] = "Viquipèdia:";
                        Namespaces[5] = "Viquipèdia Discussió:";
                        Namespaces[6] = "Imatge:";
                        Namespaces[7] = "Imatge Discussió:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki Discussió:";
                        Namespaces[10] = "Plantilla:";
                        Namespaces[11] = "Plantilla Discussió:";
                        Namespaces[12] = "Ajuda:";
                        Namespaces[13] = "Ajuda Discussió:";
                        Namespaces[14] = "Categoria:";
                        Namespaces[15] = "Categoria Discussió:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portal Discussió:";
                        Namespaces[102] = "Viquiprojecte:";
                        Namespaces[103] = "Viquiprojecte Discussió:";

                        mSummaryTag = " ";
                        strWPAWB = "[[Viquipèdia:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.da:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Speciel:";
                        Namespaces[1] = "Diskussion:";
                        Namespaces[2] = "Bruger:";
                        Namespaces[3] = "Brugerdiskussion:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia-diskussion:";
                        Namespaces[6] = "Billede:";
                        Namespaces[7] = "Billeddiskussion:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki-diskussion:";
                        Namespaces[10] = "Skabelon:";
                        Namespaces[11] = "Skabelon-diskussion:";
                        Namespaces[12] = "Hjælp:";
                        Namespaces[13] = "Hjælp-diskussion:";
                        Namespaces[14] = "Kategori:";
                        Namespaces[15] = "Kategoridiskussion:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portaldiskussion:";

                        mSummaryTag = " ved brug af ";
                        strWPAWB = "[[en:Wikipedia:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.de:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Spezial:";
                        Namespaces[1] = "Diskussion:";
                        Namespaces[2] = "Benutzer:";
                        Namespaces[3] = "Benutzer Diskussion:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia Diskussion:";
                        Namespaces[6] = "Bild:";
                        Namespaces[7] = "Bild Diskussion:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki Diskussion:";
                        Namespaces[10] = "Vorlage:";
                        Namespaces[11] = "Vorlage Diskussion:";
                        Namespaces[12] = "Hilfe:";
                        Namespaces[13] = "Hilfe Diskussion:";
                        Namespaces[14] = "Kategorie:";
                        Namespaces[15] = "Kategorie Diskussion:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portal Diskussion:";
                        break;

                    case LangCodeEnum.dsb:
                        Namespaces[-2] = "Medija:";
                        Namespaces[-1] = "Specialne:";
                        Namespaces[1] = "Diskusija:";
                        Namespaces[2] = "Wužywaŕ:";
                        Namespaces[3] = "Diskusija wužywarja:";
                        Namespaces[4] = "Wikipedija:";
                        Namespaces[5] = "Wikipedija diskusija:";
                        Namespaces[6] = "Wobraz:";
                        Namespaces[7] = "Diskusija wó wobrazu:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki diskusija:";
                        Namespaces[10] = "Pśedłoga:";
                        Namespaces[11] = "Diskusija wó pśedłoze:";
                        Namespaces[12] = "Pomoc:";
                        Namespaces[13] = "Diskusija wó pomocy:";
                        Namespaces[14] = "Kategorija:";
                        Namespaces[15] = "Diskusija wó kategoriji:";
                        break;

                    case LangCodeEnum.es:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Especial:";
                        Namespaces[1] = "Discusión:";
                        Namespaces[2] = "Usuario:";
                        Namespaces[3] = "Usuario Discusión:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia Discusión:";
                        Namespaces[6] = "Imagen:";
                        Namespaces[7] = "Imagen Discusión:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki Discusión:";
                        Namespaces[10] = "Plantilla:";
                        Namespaces[11] = "Plantilla Discusión:";
                        Namespaces[12] = "Ayuda:";
                        Namespaces[13] = "Ayuda Discusión:";
                        Namespaces[14] = "Categoría:";
                        Namespaces[15] = "Categoría Discusión:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portal Discusión:";
                        Namespaces[102] = "Wikiproyecto:";
                        Namespaces[103] = "Wikiproyecto Discusión:";
                        break;

                    case LangCodeEnum.eo:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Speciala:";
                        Namespaces[1] = "Diskuto:";
                        Namespaces[2] = "Vikipediisto:";
                        Namespaces[3] = "Vikipediista diskuto:";
                        Namespaces[4] = "Vikipedio:";
                        Namespaces[5] = "Vikipedia diskuto:";
                        Namespaces[6] = "Dosiero:";
                        Namespaces[7] = "Dosiera diskuto:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki diskuto:";
                        Namespaces[10] = "Ŝablono:";
                        Namespaces[11] = "Ŝablona diskuto:";
                        Namespaces[12] = "Helpo:";
                        Namespaces[13] = "Helpa diskuto:";
                        Namespaces[14] = "Kategorio:";
                        Namespaces[15] = "Kategoria diskuto:";
                        Namespaces[100] = "Portalo:";
                        Namespaces[101] = "Portala diskuto:";

                        mSummaryTag = " ";
                        strWPAWB = "[[Vikipedio:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.fi:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Toiminnot:";
                        Namespaces[1] = "Keskustelu:";
                        Namespaces[2] = "Käyttäjä:";
                        Namespaces[3] = "Keskustelu käyttäjästä:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Keskustelu Wikipediasta:";
                        Namespaces[6] = "Kuva:";
                        Namespaces[7] = "Keskustelu kuvasta:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki talk:";
                        Namespaces[10] = "Malline:";
                        Namespaces[11] = "Keskustelu mallineesta:";
                        Namespaces[12] = "Ohje:";
                        Namespaces[13] = "Keskustelu ohjeesta:";
                        Namespaces[14] = "Luokka:";
                        Namespaces[15] = "Keskustelu luokasta:";
                        Namespaces[100] = "Teemasivu:";
                        Namespaces[101] = "Keskustelu teemasivusta:";
                        break;

                    case LangCodeEnum.fr:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Special:";
                        Namespaces[1] = "Discuter:";
                        Namespaces[2] = "Utilisateur:";
                        Namespaces[3] = "Discussion Utilisateur:";
                        Namespaces[4] = "Wikipédia:";
                        Namespaces[5] = "Discussion Wikipédia:";
                        Namespaces[6] = "Image:";
                        Namespaces[7] = "Discussion Image:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Discussion MediaWiki:";
                        Namespaces[10] = "Modèle:";
                        Namespaces[11] = "Discussion Modèle:";
                        Namespaces[12] = "Aide:";
                        Namespaces[13] = "Discussion Aide:";
                        Namespaces[14] = "Catégorie:";
                        Namespaces[15] = "Discussion Catégorie:";
                        Namespaces[100] = "Portail:";
                        Namespaces[101] = "Discussion Portail:";
                        Namespaces[102] = "Projet:";
                        Namespaces[103] = "Discussion Projet:";
                        Namespaces[104] = "Référence:";
                        Namespaces[105] = "Discussion Référence:";
                        break;

                    case LangCodeEnum.hi:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "विशेष:";
                        Namespaces[1] = "वार्ता:";
                        Namespaces[2] = "सदस्य:";
                        Namespaces[3] = "सदस्य वार्ता:";
                        Namespaces[4] = "विकिपीडिया:";
                        Namespaces[5] = "विकिपीडिया वार्ता:";
                        Namespaces[6] = "चित्र:";
                        Namespaces[7] = "चित्र वार्ता:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki talk:";
                        Namespaces[10] = "साँचा:";
                        Namespaces[11] = "साँचा वार्ता:";
                        Namespaces[12] = "Help:";
                        Namespaces[13] = "Help talk:";
                        Namespaces[14] = "श्रेणी:";
                        Namespaces[15] = "श्रेणी वार्ता:";
                        Namespaces[100] = "प्रवेशद्वार:";
                        Namespaces[101] = "प्रवेशद्वार वार्ता:";
                        break;

                    case LangCodeEnum.hu:
                        Namespaces[-2] = "Média:";
                        Namespaces[-1] = "Speciális:";
                        Namespaces[1] = "Vita:";
                        Namespaces[2] = "Szerkesztő:";
                        Namespaces[3] = "Szerkesztővita:";
                        Namespaces[4] = "Wikipédia:";
                        Namespaces[5] = "Wikipédia-vita:";
                        Namespaces[6] = "Kép:";
                        Namespaces[7] = "Képvita:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki-vita:";
                        Namespaces[10] = "Sablon:";
                        Namespaces[11] = "Sablonvita:";
                        Namespaces[12] = "Segítség:";
                        Namespaces[13] = "Segítségvita:";
                        Namespaces[14] = "Kategória:";
                        Namespaces[15] = "Kategóriavita:";
                        Namespaces[100] = "Portál:";
                        Namespaces[101] = "Portálvita:";

                        mSummaryTag = " ";
                        strWPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.Is:
                        Namespaces[-2] = "Miðill:";
                        Namespaces[-1] = "Kerfissíða:";
                        Namespaces[1] = "Spjall:";
                        Namespaces[2] = "Notandi:";
                        Namespaces[3] = "Notandaspjall:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipediaspjall:";
                        Namespaces[6] = "Mynd:";
                        Namespaces[7] = "Myndaspjall:";
                        Namespaces[8] = "Melding:";
                        Namespaces[9] = "Meldingarspjall:";
                        Namespaces[10] = "Snið:";
                        Namespaces[11] = "Sniðaspjall:";
                        Namespaces[12] = "Hjálp:";
                        Namespaces[13] = "Hjálparspjall:";
                        Namespaces[14] = "Flokkur:";
                        Namespaces[15] = "Flokkaspjall:";
                        Namespaces[100] = "Gátt:";
                        Namespaces[101] = "Gáttaspjall:";
                        break;

                    case LangCodeEnum.it:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Speciale:";
                        Namespaces[1] = "Discussione:";
                        Namespaces[2] = "Utente:";
                        Namespaces[3] = "Discussioni utente:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Discussioni Wikipedia:";
                        Namespaces[6] = "Immagine:";
                        Namespaces[7] = "Discussioni immagine:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Discussioni MediaWiki:";
                        Namespaces[10] = "Template:";
                        Namespaces[11] = "Discussioni template:";
                        Namespaces[12] = "Aiuto:";
                        Namespaces[13] = "Discussioni aiuto:";
                        Namespaces[14] = "Categoria:";
                        Namespaces[15] = "Discussioni categoria:";
                        Namespaces[100] = "Portale:";
                        Namespaces[101] = "Discussioni portale:";
                        break;

                    case LangCodeEnum.ja:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "特別:";
                        Namespaces[1] = "ノート:";
                        Namespaces[2] = "利用者:";
                        Namespaces[3] = "利用者‐会話:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia‐ノート:";
                        Namespaces[6] = "画像:";
                        Namespaces[7] = "画像‐ノート:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki‐ノート:";
                        Namespaces[10] = "Template:";
                        Namespaces[11] = "Template‐ノート:";
                        Namespaces[12] = "Help:";
                        Namespaces[13] = "Help‐ノート:";
                        Namespaces[14] = "Category:";
                        Namespaces[15] = "Category‐ノート:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portal‐ノート:";
                        break;

                    case LangCodeEnum.ku:
                        Namespaces[-2] = "Medya:";
                        Namespaces[-1] = "Taybet:";
                        Namespaces[1] = "Nîqaş:";
                        Namespaces[2] = "Bikarhêner:";
                        Namespaces[3] = "Bikarhêner nîqaş:";
                        Namespaces[4] = "Wîkîpediya:";
                        Namespaces[5] = "Wîkîpediya nîqaş:";
                        Namespaces[6] = "Wêne:";
                        Namespaces[7] = "Wêne nîqaş:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki nîqaş:";
                        Namespaces[10] = "Şablon:";
                        Namespaces[11] = "Şablon nîqaş:";
                        Namespaces[12] = "Alîkarî:";
                        Namespaces[13] = "Alîkarî nîqaş:";
                        Namespaces[14] = "Kategorî:";
                        Namespaces[15] = "Kategorî nîqaş:";

                        mSummaryTag = " ";
                        strWPAWB = "[[Wîkîpediya:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.mi:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Special:";
                        Namespaces[1] = "Talk:";
                        Namespaces[2] = "User:"******"User talk:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia talk:";
                        Namespaces[6] = "Image:";
                        Namespaces[7] = "Image talk:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki talk:";
                        Namespaces[10] = "Template:";
                        Namespaces[11] = "Template talk:";
                        Namespaces[12] = "Help:";
                        Namespaces[13] = "Help talk:";
                        Namespaces[14] = "Category:";
                        Namespaces[15] = "Category talk:";
                        break;

                    case LangCodeEnum.nl:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Speciaal:";
                        Namespaces[1] = "Overleg:";
                        Namespaces[2] = "Gebruiker:";
                        Namespaces[3] = "Overleg gebruiker:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Overleg Wikipedia:";
                        Namespaces[6] = "Afbeelding:";
                        Namespaces[7] = "Overleg afbeelding:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Overleg MediaWiki:";
                        Namespaces[10] = "Sjabloon:";
                        Namespaces[11] = "Overleg sjabloon:";
                        Namespaces[12] = "Help:";
                        Namespaces[13] = "Overleg help:";
                        Namespaces[14] = "Categorie:";
                        Namespaces[15] = "Overleg categorie:";
                        Namespaces[100] = "Portaal:";
                        Namespaces[101] = "Overleg portaal:";

                        mSummaryTag = " met ";
                        strWPAWB = "[[Wikipedia:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.no:
                        Namespaces[-2] = "Medium:";
                        Namespaces[-1] = "Spesial:";
                        Namespaces[1] = "Diskusjon:";
                        Namespaces[2] = "Bruker:";
                        Namespaces[3] = "Brukerdiskusjon:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia-diskusjon:";
                        Namespaces[6] = "Bilde:";
                        Namespaces[7] = "Bildediskusjon:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki-diskusjon:";
                        Namespaces[10] = "Mal:";
                        Namespaces[11] = "Maldiskusjon:";
                        Namespaces[12] = "Hjelp:";
                        Namespaces[13] = "Hjelpdiskusjon:";
                        Namespaces[14] = "Kategori:";
                        Namespaces[15] = "Kategoridiskusjon:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portaldiskusjon:";
                        break;

                    case LangCodeEnum.pl:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Specjalna:";
                        Namespaces[1] = "Dyskusja:";
                        Namespaces[2] = "Wikipedysta:";
                        Namespaces[3] = "Dyskusja Wikipedysty:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Dyskusja Wikipedii:";
                        Namespaces[6] = "Grafika:";
                        Namespaces[7] = "Dyskusja grafiki:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Dyskusja MediaWiki:";
                        Namespaces[10] = "Szablon:";
                        Namespaces[11] = "Dyskusja szablonu:";
                        Namespaces[12] = "Pomoc:";
                        Namespaces[13] = "Dyskusja pomocy:";
                        Namespaces[14] = "Kategoria:";
                        Namespaces[15] = "Dyskusja kategorii:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Dyskusja portalu:";

                        SectStub = @"\{\{[Ss]ek";
                        break;

                    case LangCodeEnum.pt:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Especial:";
                        Namespaces[1] = "Discussão:";
                        Namespaces[2] = "Usuário:";
                        Namespaces[3] = "Usuário Discussão:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia Discussão:";
                        Namespaces[6] = "Imagem:";
                        Namespaces[7] = "Imagem Discussão:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki Discussão:";
                        Namespaces[10] = "Predefinição:";
                        Namespaces[11] = "Predefinição Discussão:";
                        Namespaces[12] = "Ajuda:";
                        Namespaces[13] = "Ajuda Discussão:";
                        Namespaces[14] = "Categoria:";
                        Namespaces[15] = "Categoria Discussão:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Discussão Portal:";
                        Namespaces[102] = "Anexo:";
                        Namespaces[103] = "Anexo Discussão:";

                        mSummaryTag = " utilizando ";
                        strWPAWB = "[[Wikipedia:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.ro:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Special:";
                        Namespaces[1] = "Discuţie:";
                        Namespaces[2] = "Utilizator:";
                        Namespaces[3] = "Discuţie Utilizator:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Discuţie Wikipedia:";
                        Namespaces[6] = "Imagine:";
                        Namespaces[7] = "Discuţie Imagine:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Discuţie MediaWiki:";
                        Namespaces[10] = "Format:";
                        Namespaces[11] = "Discuţie Format:";
                        Namespaces[12] = "Ajutor:";
                        Namespaces[13] = "Discuţie Ajutor:";
                        Namespaces[14] = "Categorie:";
                        Namespaces[15] = "Discuţie Categorie:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Discuţie Portal:";
                        break;

                    case LangCodeEnum.ru:
                        Namespaces[-2] = "Медиа:";
                        Namespaces[-1] = "Служебная:";
                        Namespaces[1] = "Обсуждение:";
                        Namespaces[2] = "Участник:";
                        Namespaces[3] = "Обсуждение участника:";
                        Namespaces[4] = "Википедия:";
                        Namespaces[5] = "Обсуждение Википедии:";
                        Namespaces[6] = "Изображение:";
                        Namespaces[7] = "Обсуждение изображения:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Обсуждение MediaWiki:";
                        Namespaces[10] = "Шаблон:";
                        Namespaces[11] = "Обсуждение шаблона:";
                        Namespaces[12] = "Справка:";
                        Namespaces[13] = "Обсуждение справки:";
                        Namespaces[14] = "Категория:";
                        Namespaces[15] = "Обсуждение категории:";
                        Namespaces[100] = "Портал:";
                        Namespaces[101] = "Обсуждение портала:";

                        mSummaryTag = " с помощью ";
                        strWPAWB = "[[WP:AWB|AWB]]";
                        Stub = "(?:[Ss]tub|[Зз]аготовка)";
                        MonthNames = new string[12] { "января", "февраля", "марта", "апреля",
                            "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"};
                        break;

                    case LangCodeEnum.si:
                        Namespaces[-2] = "මාධ්‍යය:";
                        Namespaces[-1] = "විශේෂ:";
                        Namespaces[1] = "සාකච්ඡාව:";
                        Namespaces[2] = "පරිශීලක:";
                        Namespaces[3] = "පරිශීලක සාකච්ඡාව:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipedia සාකච්ඡාව:";
                        Namespaces[6] = "රූපය:";
                        Namespaces[7] = "රූපය සාකච්ඡාව:";
                        Namespaces[8] = "විකිමාධ්‍ය:";
                        Namespaces[9] = "විකිමාධ්‍ය සාකච්ඡාව:";
                        Namespaces[10] = "සැකිල්ල:";
                        Namespaces[11] = "සැකිල සාකච්ඡාව:";
                        Namespaces[12] = "උදවු:";
                        Namespaces[13] = "උදව සාකච්ඡාව:";
                        Namespaces[14] = "ප්‍රවර්ගය:";
                        Namespaces[15] = "ප්‍රවර්ග සාකච්ඡාව:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portal talk:";
                        break;

                    case LangCodeEnum.simple:
                        SetToEnglish("Wikipedia:", "Wikipedia talk:");
                        break;

                    case LangCodeEnum.sk:
                        Namespaces[-2] = "Médiá:";
                        Namespaces[-1] = "Špeciálne:";
                        Namespaces[1] = "Diskusia:";
                        Namespaces[2] = "Redaktor:";
                        Namespaces[3] = "Diskusia s redaktorom:";
                        Namespaces[4] = "Wikipédia:";
                        Namespaces[5] = "Diskusia k Wikipédii:";
                        Namespaces[6] = "Obrázok:";
                        Namespaces[7] = "Diskusia k obrázku:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Diskusia k MediaWiki:";
                        Namespaces[10] = "Šablóna:";
                        Namespaces[11] = "Diskusia k šablóne:";
                        Namespaces[12] = "Pomoc:";
                        Namespaces[13] = "Diskusia k pomoci:";
                        Namespaces[14] = "Kategória:";
                        Namespaces[15] = "Diskusia ku kategórii:";
                        Namespaces[100] = "Portál:";
                        Namespaces[101] = "Diskusia k portálu:";

                        mSummaryTag = " ";
                        strWPAWB = "[[Wikipédia:AutoWikiBrowser|AWB]]";
                        break;

                    case LangCodeEnum.sl:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Posebno:";
                        Namespaces[1] = "Pogovor:";
                        Namespaces[2] = "Uporabnik:";
                        Namespaces[3] = "Uporabniški pogovor:";
                        Namespaces[4] = "Wikipedija:";
                        Namespaces[5] = "Pogovor o Wikipediji:";
                        Namespaces[6] = "Slika:";
                        Namespaces[7] = "Pogovor o sliki:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Pogovor o MediaWiki:";
                        Namespaces[10] = "Predloga:";
                        Namespaces[11] = "Pogovor o predlogi:";
                        Namespaces[12] = "Pomoč:";
                        Namespaces[13] = "Pogovor o pomoči:";
                        Namespaces[14] = "Kategorija:";
                        Namespaces[15] = "Pogovor o kategoriji:";

                        mSummaryTag = " ";
                        strWPAWB = "[[Wikipedija:AutoWikiBrowser|AWB]]";
                        Stub = "(?:[Ss]tub|[Šš]krbina)";
                        break;

                    case LangCodeEnum.sr:
                        Namespaces[-2] = "Медија:";
                        Namespaces[-1] = "Посебно:";
                        Namespaces[1] = "Разговор:";
                        Namespaces[2] = "Корисник:";
                        Namespaces[3] = "Разговор са корисником:";
                        Namespaces[4] = "Википедија:";
                        Namespaces[5] = "Разговор о Википедији:";
                        Namespaces[6] = "Слика:";
                        Namespaces[7] = "Разговор о слици:";
                        Namespaces[8] = "МедијаВики:";
                        Namespaces[9] = "Разговор о МедијаВикију:";
                        Namespaces[10] = "Шаблон:";
                        Namespaces[11] = "Разговор о шаблону:";
                        Namespaces[12] = "Помоћ:";
                        Namespaces[13] = "Разговор о помоћи:";
                        Namespaces[14] = "Категорија:";
                        Namespaces[15] = "Разговор о категорији:";
                        Namespaces[100] = "Портал:";
                        Namespaces[101] = "Разговор о порталу:";
                        break;

                    case LangCodeEnum.sv:
                        Namespaces[-2] = "Media:";
                        Namespaces[-1] = "Special:";
                        Namespaces[1] = "Diskussion:";
                        Namespaces[2] = "Användare:";
                        Namespaces[3] = "Användardiskussion:";
                        Namespaces[4] = "Wikipedia:";
                        Namespaces[5] = "Wikipediadiskussion:";
                        Namespaces[6] = "Bild:";
                        Namespaces[7] = "Bilddiskussion:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "MediaWiki diskussion:";
                        Namespaces[10] = "Mall:";
                        Namespaces[11] = "Malldiskussion:";
                        Namespaces[12] = "Hjälp:";
                        Namespaces[13] = "Hjälp diskussion:";
                        Namespaces[14] = "Kategori:";
                        Namespaces[15] = "Kategoridiskussion:";
                        Namespaces[100] = "Portal:";
                        Namespaces[101] = "Portaldiskussion:";
                        break;

                    case LangCodeEnum.te:
                        Namespaces[-2] = "మీడియా:";
                        Namespaces[-1] = "ప్రత్యేక:";
                        Namespaces[1] = "చర్చ:";
                        Namespaces[2] = "సభ్యుడు:";
                        Namespaces[3] = "సభ్యులపై చర్చ:";
                        Namespaces[4] = "వికీపీడియా:";
                        Namespaces[5] = "వికీపీడియా చర్చ:";
                        Namespaces[6] = "బొమ్మ:";
                        Namespaces[7] = "బొమ్మపై చర్చ:";
                        Namespaces[8] = "మీడియావికీ:";
                        Namespaces[9] = "మీడియావికీ చర్చ:";
                        Namespaces[10] = "మూస:";
                        Namespaces[11] = "మూస చర్చ:";
                        Namespaces[12] = "సహాయము:";
                        Namespaces[13] = "సహాయము చర్చ:";
                        Namespaces[14] = "వర్గం:";
                        Namespaces[15] = "వర్గం చర్చ:";
                        break;

                    case LangCodeEnum.uk:
                        Namespaces[-2] = "Медіа:";
                        Namespaces[-1] = "Спеціальні:";
                        Namespaces[1] = "Обговорення:";
                        Namespaces[2] = "Користувач:";
                        Namespaces[3] = "Обговорення користувача:";
                        Namespaces[4] = "Вікіпедія:";
                        Namespaces[5] = "Обговорення Вікіпедії:";
                        Namespaces[6] = "Зображення:";
                        Namespaces[7] = "Обговорення зображення:";
                        Namespaces[8] = "MediaWiki:";
                        Namespaces[9] = "Обговорення MediaWiki:";
                        Namespaces[10] = "Шаблон:";
                        Namespaces[11] = "Обговорення шаблону:";
                        Namespaces[12] = "Довідка:";
                        Namespaces[13] = "Обговорення довідки:";
                        Namespaces[14] = "Категорія:";
                        Namespaces[15] = "Обговорення категорії:";

                        Stub = "(?:[Ss]tub|[Дд]оробити)";
                        mSummaryTag = " з допомогою ";
                        strWPAWB = "[[Вікіпедія:AutoWikiBrowser|AWB]]";
                        break;

                    //http://xx.project.org/wiki/api.php?action=query&meta=siteinfo&siprop=namespaces
                    // case LangCodeEnum.xx:
                    // Namespaces[-2] = ":";
                    // Namespaces[-1] = ":";
                    // Namespaces[1] = ":";
                    // Namespaces[2] = ":";
                    // Namespaces[3] = ":";
                    // Namespaces[4] = ":";
                    // Namespaces[5] = ":";
                    // Namespaces[6] = ":";
                    // Namespaces[7] = ":";
                    // Namespaces[8] = ":";
                    // Namespaces[9] = ":";
                    // Namespaces[10] = ":";
                    // Namespaces[11] = ":";
                    // Namespaces[12] = ":";
                    // Namespaces[13] = ":";
                    // Namespaces[14] = ":";
                    // Namespaces[15] = ":";
                    // Namespaces[100] = ":";
                    // Namespaces[101] = ":";

                    // strsummarytag = " ";
                    // strWPAWB = "";
                    // break;

                    default:
                        LoadProjectOptions();
                        break;
                }

                #endregion
            }
            else if (projectName == ProjectEnum.commons)
            {
                SetToEnglish("Commons:", "Commons talk:");
                Namespaces[100] = "Creator:";
                Namespaces[101] = "Creator talk:";
                URL = "http://commons.wikimedia.org";
                mLangCode = LangCodeEnum.en;
            }
            else if (projectName == ProjectEnum.meta)
            {
                SetToEnglish("Meta:", "Meta talk:");
                Namespaces[100] = "Hilfe:";
                Namespaces[101] = "Hilfe Diskussion:";
                Namespaces[102] = "Aide:";
                Namespaces[103] = "Discussion Aide:";
                Namespaces[104] = "Hjælp:";
                Namespaces[105] = "Hjælp diskussion:";
                Namespaces[106] = "Helpo:";
                Namespaces[107] = "Helpa diskuto:";
                Namespaces[108] = "Hjälp:";
                Namespaces[109] = "Hjälp diskussion:";
                Namespaces[110] = "Ayuda:";
                Namespaces[111] = "Ayuda Discusión:";
                Namespaces[112] = "Aiuto:";
                Namespaces[113] = "Discussioni aiuto:";
                Namespaces[114] = "ヘルプ:";
                Namespaces[115] = "ヘルプ‐ノート:";
                Namespaces[116] = "NL Help:";
                Namespaces[117] = "Overleg help:";
                Namespaces[118] = "Pomoc:";
                Namespaces[119] = "Dyskusja pomocy:";
                Namespaces[120] = "Ajuda:";
                Namespaces[121] = "Ajuda Discussão:";
                Namespaces[122] = "CA Ajuda:";
                Namespaces[123] = "CA Ajuda Discussió:";
                Namespaces[124] = "Hjelp:";
                Namespaces[125] = "Hjelp diskusjon:";
                Namespaces[126] = "帮助:";
                Namespaces[127] = "帮助 对话:";
                Namespaces[128] = "Помощь:";
                Namespaces[129] = "Помощь Дискуссия:";
                Namespaces[130] = "Pomoč:";
                Namespaces[131] = "Pogovor o pomoči:";
                URL = "http://meta.wikimedia.org";
                mLangCode = LangCodeEnum.en;
            }
            else if (projectName == ProjectEnum.mediawiki)
            {
                SetToEnglish("Project:", "Project talk:");
                URL = "http://www.mediawiki.org";
                mLangCode = LangCodeEnum.en;
            }
            else if (projectName == ProjectEnum.species)
            {
                SetToEnglish("Wikispecies:", "Wikispecies talk:");
                URL = "http://species.wikimedia.org";
                mLangCode = LangCodeEnum.en;
            }
            else if (projectName == ProjectEnum.wikia)
            {
                URL = "http://" + customProject + ".wikia.com";
                URLEnd = "/";
                LoadProjectOptions();
            }
            else
            {
                if (projectName == ProjectEnum.custom)
                    URLEnd = "";
                LoadProjectOptions();
            }

            //refresh once more in case project settings were reset due to
            //error with loading
            RefreshProxy();

            RegenerateRegexes();

            RETFPath = Namespaces[4] + "AutoWikiBrowser/Typos";

            foreach (string s in Namespaces.Values)
            {
                System.Diagnostics.Trace.Assert(s.EndsWith(":"), "Internal error: namespace does not end with ':'.",
                    "Please contact a developer.");
            }
            System.Diagnostics.Trace.Assert(!Namespaces.ContainsKey(0), "Internal error: key exists for namespace 0.",
                    "Please contact a developer.");
        }
コード例 #48
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is english Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 public static void SetProject(string langCode, ProjectEnum projectName)
 {
     SetProject(langCode, projectName, "", "http://");
 }
コード例 #49
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is english Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 public static void SetProject(LangCodeEnum langCode, ProjectEnum projectName)
 {
     SetProject(langCode, projectName, "");
 }
コード例 #50
0
 /// <summary>
 /// Sets different language variables, such as namespaces. Default is English Wikipedia
 /// </summary>
 /// <param name="langCode">The language code, default is en</param>
 /// <param name="projectName">The project name default is Wikipedia</param>
 /// <remarks>Do not use this outside unit tests</remarks>
 public static void SetProjectSimple(string langCode, ProjectEnum projectName)
 {
     Project = projectName;
     SetProjectLangCode(langCode);
 }
コード例 #51
0
ファイル: Main.cs プロジェクト: svn2github/autowikibrowser
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code"></param>
        /// <param name="project"></param>
        /// <param name="customProject"></param>
        /// <param name="protocol"></param>
        private void SetProject(string code, ProjectEnum project, string customProject, string protocol)
        {
            SplashScreen.SetProgress(81);
            try
            {
                //set namespaces
                try
                {
                    //set namespaces
                    Variables.SetProject(code, project, customProject, protocol);
                }
                catch (WebException ex)
                {
                    // Check for HTTP 401 error.
                    var resp = (HttpWebResponse)ex.Response;
                    if (resp == null) throw;
                    switch (resp.StatusCode)
                    {
                        case HttpStatusCode.Unauthorized /*401*/:
                            ShowLogin();

                            // Reload project.
                            Variables.SetProject(code, project, customProject, protocol);

                            break;
                    }
                }

                if (Variables.TryLoadingAgainAfterLogin)
                {
                    MessageBox.Show(
                        "You seem to be accessing a private wiki. Project loading will be attempted again after login.",
                        "Restricted Wiki");
                }

                //set interwikiorder
                switch (Variables.LangCode)
                {
                    case "en":
                    case "lb":
                    case "pl":
                    case "no":
                    case "sv":
                    case "simple":
                        Parser.InterWikiOrder = InterWikiOrderEnum.LocalLanguageAlpha;
                        break;

                    case "he":
                    case "hu":
                    case "te":
                    case "yi":
                        Parser.InterWikiOrder = InterWikiOrderEnum.AlphabeticalEnFirst;
                        break;

                    case "ms":
                    case "et":
                    case "nn":
                    case "fi":
                    case "vi":
                    case "ur":
                        Parser.InterWikiOrder = InterWikiOrderEnum.LocalLanguageFirstWord;
                        break;

                    default:
                        Parser.InterWikiOrder = InterWikiOrderEnum.Alphabetical;
                        break;
                }

                //user interface
                if (!Variables.IsWikipediaEN)
                {
                    humanNameDisambigTagToolStripMenuItem.Visible = birthdeathCatsToolStripMenuItem.Visible = false;
                    chkAutoTagger.Checked = false;
                }
                else if (!humanNameDisambigTagToolStripMenuItem.Visible)
                {
                    humanNameDisambigTagToolStripMenuItem.Visible = birthdeathCatsToolStripMenuItem.Visible = true;
                }

                UserTalkWarningsLoaded = false; // force reload

                if (!Variables.IsCustomProject && !Variables.IsWikia && !Variables.IsWikimediaMonolingualProject)
                    lblProject.Text = Variables.LangCode + "." + Variables.Project;
                else
                    lblProject.Text = Variables.IsWikimediaMonolingualProject ? Variables.Project.ToString() : Variables.URL;

                TemplateRedirectsLoaded = false;
                ResetTypoStats();
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("The interwiki list didn't load correctly. Please check your internet connection, and then restart AWB");
            }
        }
コード例 #52
0
ファイル: Main.cs プロジェクト: svn2github/autowikibrowser
        private void SetProject(LangCodeEnum code, ProjectEnum project, string customProject)
        {
            splash.SetProgress(81);
            try
            {
                //set namespaces
                Variables.SetProject(code, project, customProject);

                //set interwikiorder
                switch (Variables.LangCode)
                {
                    case LangCodeEnum.en:
                    case LangCodeEnum.pl:
                    case LangCodeEnum.simple:
                        parsers.InterWikiOrder = InterWikiOrderEnum.LocalLanguageAlpha;
                        break;

                    case LangCodeEnum.he:
                    case LangCodeEnum.hu:
                        parsers.InterWikiOrder = InterWikiOrderEnum.AlphabeticalEnFirst;
                        break;

                    default:
                        parsers.InterWikiOrder = InterWikiOrderEnum.Alphabetical;
                        break;
                }

                //user interface
                if (!Variables.IsWikipediaEN)
                {
                    // TODO: Hide or disable some of the text box context menu stuff, which is likely WP-EN only (and do the opposite for WP-EN)
                    chkAutoTagger.Checked = false;
                    //chkGeneralFixes.Checked = false; // helluva works everywhere.. more or less
                }

                userTalkWarningsLoaded = false; // force reload

                if (!Variables.IsCustomProject && !Variables.IsWikia && !Variables.IsWikimediaMonolingualProject)
                    lblProject.Text = Variables.LangCode.ToString().ToLower() + "." + Variables.Project;
                else if (Variables.IsWikimediaMonolingualProject)
                    lblProject.Text = Variables.Project.ToString();
                else
                    lblProject.Text = Variables.URL;
            }
            catch (ArgumentNullException ex)
            {
                if (ex is ArgumentNullException)
                    MessageBox.Show("The interwiki list didn't load correctly. Please check your internet connection, and then restart AWB");
                else
                    throw;
            }
        }