/// <summary>
/// Loads namespaces
/// </summary>
private void LoadProjectOptions()
{
string[] months = (string[])Variables.ENLangMonthNames.Clone();
try
{
Site = new SiteInfo(Editor.SynchronousEditor);
for (int i = 0; i < months.Length; i++)
{
months[i] += "-gen";
}
Dictionary <string, string> messages = Site.GetMessages(months);
if (messages.Count == 12)
{
for (int i = 0; i < months.Length; i++)
{
months[i] = messages[months[i]];
}
Variables.MonthNames = months;
}
Variables.Namespaces = Site.Namespaces;
Variables.NamespaceAliases = Site.NamespaceAliases;
Variables.MagicWords = Site.MagicWords;
}
catch (ReadApiDeniedException)
{
throw;
}
catch (Exception ex)
{
//TODO:Better error handling
string message = ex is WikiUrlException && ex.InnerException != null
? ex.InnerException.Message
: ex.Message;
MessageBox.Show("An error occured while connecting to the server or loading project information from it. " +
"Please make sure that your internet connection works and such combination of project/language exist." +
"\r\nEnter the URL in the format \"en.wikipedia.org/w/\" (including path where index.php and api.php reside)." +
"\r\nError description: " + message,
"Error connecting to wiki", MessageBoxButtons.OK, MessageBoxIcon.Error);
throw;
}
}