public ServerSelector(ServerInfo theServerInfo, UserPreferences thePreferences, bool blnAllowCustomServerUpdate, TextVariables theTextVariables)
 {
     TheServerInfo           = theServerInfo;
     TheUserPreferences      = thePreferences;
     AllowCustomServerUpdate = blnAllowCustomServerUpdate;
     TheTextVariables        = theTextVariables;
 }
 public ServerSelector(ServerInfo theServerInfo, UserPreferences thePreferences, bool blnAllowCustomServerUpdate, TextVariables theTextVariables)
 {
     TheServerInfo = theServerInfo;
     TheUserPreferences = thePreferences;
     AllowCustomServerUpdate = blnAllowCustomServerUpdate;
     TheTextVariables = theTextVariables;
 }
 public TextualServerControl(ServerInfo theServerInfo, UserPreferences thePreferences, bool blnAllowCustomServerUpdate, TextVariables theTextVariables)
 {
     TheServerInfo = theServerInfo;
     TheUserPreferences = thePreferences;
     AllowCustomServerUpdate = blnAllowCustomServerUpdate;
     TheTextVariables = theTextVariables;
 }
 public TextualServerControl(ServerInfo theServerInfo, UserPreferences thePreferences, bool blnAllowCustomServerUpdate, TextVariables theTextVariables)
 {
     TheServerInfo           = theServerInfo;
     TheUserPreferences      = thePreferences;
     AllowCustomServerUpdate = blnAllowCustomServerUpdate;
     TheTextVariables        = theTextVariables;
 }
Пример #5
0
        private void LoadLocales()
        {
            lstTextVariables = new List <TextVariables>();
            if (App.Current.Resources["TextVariables"] == null)
            {
                MemberInfo[] theMembers = new TextVariables().GetType().GetProperties();

                //how many locales do we have?
                string[] arFiles = Directory.GetFiles("lang", "*.xml");

                //load each one
                foreach (string strLocaleFile in arFiles)
                {
                    string strErrorMessage = "";

                    try
                    {
                        XElement theLanguage = XElement.Load(strLocaleFile);

                        TextVariables theVariables = new TextVariables();

                        foreach (MemberInfo theMemberInfo in theMembers)
                        {
                            try
                            {
                                //collect it from the data first
                                //most of them will be here
                                theVariables.GetType().GetProperty(theMemberInfo.Name).SetValue(theVariables, theLanguage.Element(theMemberInfo.Name).Value, null);
                            }
                            catch (Exception ex)
                            {
                                //some are also attributes though
                                try
                                {
                                    theVariables.GetType().GetProperty(theMemberInfo.Name).SetValue(theVariables, theLanguage.Attribute(theMemberInfo.Name).Value, null);
                                }
                                catch (Exception exGeneral)
                                {
                                    strErrorMessage += theMemberInfo.Name + "not found" + Environment.NewLine;
                                }
                            }
                        }

                        if (string.IsNullOrEmpty(strErrorMessage))
                        {
                            lstTextVariables.Add(theVariables);
                        }
                        else
                        {
                            MessageBox.Show("Error loading " + Path.GetFileName(strLocaleFile) + Environment.NewLine + strErrorMessage);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error loading " + strLocaleFile + "\r\n" + ex.Message);
                    }
                }

                if (App.Current.Resources["TextVariables"] == null)
                {
                    App.Current.Resources.Add("TextVariables", lstTextVariables);
                }
                else
                {
                    App.Current.Resources["TextVariables"] = lstTextVariables;
                }
            }
            else
            {
                lstTextVariables = App.Current.Resources["TextVariables"] as List <TextVariables>;
            }

            //and load the required one
            var currentLocales = lstTextVariables.Where(loc => loc.Locale.Equals(_CurrentLocale, StringComparison.InvariantCultureIgnoreCase));

            switch (currentLocales.Count())
            {
            case 0:
                CurrentLocale = new TextVariables();
                break;

            case 1:
                CurrentLocale = currentLocales.First();
                break;

            default:
                MessageBox.Show("Multiple files found for " + _CurrentLocale);
                CurrentLocale = currentLocales.First();
                break;
            }

            //and record the amount that were loaded
            NumberLoaded = lstTextVariables.Count;
        }
Пример #6
0
 public Patcher(TextVariables theVariables, UserPreferences theUserPreferences)
 {
     myVariables       = theVariables;
     hashmd5           = new MD5CryptoServiceProvider();
     myUserPreferences = theUserPreferences;
 }
Пример #7
0
 public ServerConnector(TextVariables theTextVariables)
 {
     myTextVariables = theTextVariables;
 }
Пример #8
0
 public Patcher(TextVariables theVariables, UserPreferences theUserPreferences)
 {
     myVariables = theVariables;
     hashmd5 = new MD5CryptoServiceProvider();
     myUserPreferences = theUserPreferences;
 }
Пример #9
0
 public Locale(TextVariables theVariable)
 {
     LocaleVariables = theVariable;
     this.DataContext = LocaleVariables;
 }
Пример #10
0
        private void LoadLocales()
        {
            lstTextVariables = new List<TextVariables>();
            if (App.Current.Resources["TextVariables"] == null)
            {
                MemberInfo[] theMembers = new TextVariables().GetType().GetProperties();

                //how many locales do we have?
                string[] arFiles = Directory.GetFiles("lang", "*.xml");

                //load each one
                foreach (string strLocaleFile in arFiles)
                {
                    string strErrorMessage = "";

                    try
                    {
                        XElement theLanguage = XElement.Load(strLocaleFile);

                        TextVariables theVariables = new TextVariables();

                        foreach (MemberInfo theMemberInfo in theMembers)
                        {
                            try
                            {
                                //collect it from the data first
                                //most of them will be here
                                theVariables.GetType().GetProperty(theMemberInfo.Name).SetValue(theVariables, theLanguage.Element(theMemberInfo.Name).Value, null);
                            }
                            catch (Exception ex)
                            {
                                //some are also attributes though
                                try
                                {
                                    theVariables.GetType().GetProperty(theMemberInfo.Name).SetValue(theVariables, theLanguage.Attribute(theMemberInfo.Name).Value, null);
                                }
                                catch (Exception exGeneral)
                                {
                                    strErrorMessage += theMemberInfo.Name + "not found" + Environment.NewLine;
                                }
                            }
                        }

                        if (string.IsNullOrEmpty(strErrorMessage))
                        {
                            lstTextVariables.Add(theVariables);
                        }
                        else
                        {
                            MessageBox.Show("Error loading " + Path.GetFileName(strLocaleFile) + Environment.NewLine + strErrorMessage);
                        }

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error loading " + strLocaleFile + "\r\n" + ex.Message);
                    }
                }

                if (App.Current.Resources["TextVariables"] == null)
                {
                    App.Current.Resources.Add("TextVariables", lstTextVariables);
                }
                else
                {
                    App.Current.Resources["TextVariables"] = lstTextVariables;
                }
            }
            else
            {
                lstTextVariables = App.Current.Resources["TextVariables"] as List<TextVariables>;
            }

            //and load the required one
            var currentLocales = lstTextVariables.Where(loc => loc.Locale.Equals(_CurrentLocale, StringComparison.InvariantCultureIgnoreCase));

            switch (currentLocales.Count())
            {
                case 0:
                    CurrentLocale = new TextVariables();
                    break;
                case 1:
                    CurrentLocale = currentLocales.First();
                    break;
                default:
                    MessageBox.Show("Multiple files found for " + _CurrentLocale);
                    CurrentLocale = currentLocales.First();
                    break;

            }

            //and record the amount that were loaded
            NumberLoaded = lstTextVariables.Count;
        }
 public ServerConnector(TextVariables theTextVariables)
 {
     myTextVariables = theTextVariables;
 }
Пример #12
0
 public Locale(TextVariables theVariable)
 {
     LocaleVariables  = theVariable;
     this.DataContext = LocaleVariables;
 }