Exemplo n.º 1
0
        /// <summary>
        /// Gets the parameter.
        /// </summary>
        /// <param name="entities">The edc.</param>
        /// <param name="index">The parameter index.</param>
        /// <returns></returns>
        public static string GetParameter(Entities entities, SettingsEntry index)
        {
            Settings _ret = (from _sx in entities.Settings where _sx.KeyValue == (index.ToString()) select _sx).FirstOrDefault();

            if (_ret == null)
            {
                _ret = new Settings()
                {
                    KeyValue = index.ToString(),
                    Title    = m_DefaultSettings[index]
                };
                entities.Settings.InsertOnSubmit(_ret);
                entities.SubmitChanges();
            }
            return(_ret.Title);
        }
Exemplo n.º 2
0
        public static void SwitchSettings(SettingsEntry entry, int index)
        {
            var xml = new XmlDocument();

            xml.Load(settingsFile);

            var newValue = 0;

            switch (entry)
            {
            case SettingsEntry.Volume:
                newValue = SupportedVolumes[index];

                Volume      = newValue;
                VolumeIndex = index;

                break;

            case SettingsEntry.Resolution:
                var newResolution = SupportedResolutions[index];

                Width  = newResolution.X;
                Height = newResolution.Y;

                ResolutionIndex = index;

                xml.GetElementsByTagName("Width")[0].InnerText  = newResolution.X.ToString();
                xml.GetElementsByTagName("Height")[0].InnerText = newResolution.Y.ToString();
                xml.Save(settingsFile);

                return;

            default:
                newValue = SupportedGameSizes[index];

                GameSize      = newValue;
                GameSizeIndex = index;

                break;
            }

            xml.GetElementsByTagName(entry.ToString())[0].InnerText = newValue.ToString();
            xml.Save(settingsFile);
        }