Пример #1
0
        public static string GetParameter(ScoreParameter[] parameters, string name, string defaultValue)
        {
            string result = defaultValue;

            if (parameters != null && parameters.Length > 0)
            {
                ScoreParameter p = parameters.FirstOrDefault(pp => pp.name == name);
                if (p != null && !String.IsNullOrEmpty(p.Value))
                {
                    result = p.Value;
                }
            }

            return(result);
        }
Пример #2
0
        public string GetParameterValue(string parameterName, string defaultValue)
        {
            string result = defaultValue;

            if (this.Parameters != null && this.Parameters.Length > 0)
            {
                ScoreParameter p = this.Parameters.FirstOrDefault(pp => pp.name == parameterName);
                if (p != null && !String.IsNullOrEmpty(p.Value))
                {
                    result = p.Value;
                }
            }

            return(result);
        }
Пример #3
0
        /// <summary>
        /// Save options to score center.
        /// </summary>
        private void SaveOptions()
        {
            if (m_center.Setup == null)
            {
                m_center.Setup = new ScoreCenterSetup();
            }

            m_center.Setup.Name                = tbxName.Text;
            m_center.Setup.BackdropDir         = tbxBackdrop.Text;
            m_center.Setup.CacheExpiration     = (int)numCacheExpiration.Value;
            m_center.Setup.LiveNotifTime       = (int)numNotificationTime.Value;
            m_center.Setup.LiveCheckDelay      = (int)numCheckDelay.Value;
            m_center.Setup.LivePlaySound       = ckxPlaySound.Checked;
            m_center.Setup.UseAltColor         = ckxUseAltColor.Checked;
            m_center.Setup.AutoRefresh.enabled = ckxAutoRefresh.Checked;
            m_center.Setup.AutoRefresh.Value   = (int)numAutoRefreshDelay.Value;

            m_center.Setup.UpdateOnlineMode = Tools.ParseEnum <UpdateMode>(comboBox1.SelectedValue.ToString());
            m_center.Setup.UpdateUrl        = tbxUrl.Text;

            ImportOptions options = ReadImportOptions();

            m_center.Setup.UpdateRule = options.ToString();

            List <ScoreParameter> plist = new List <ScoreParameter>();
            DataTable             dt    = dataGridView1.DataSource as DataTable;

            foreach (DataRow r in dt.Rows)
            {
                ScoreParameter p = new ScoreParameter();
                p.name  = r["Name"] as string;
                p.Value = r["Value"] as string;
                if (!String.IsNullOrEmpty(p.name) && !String.IsNullOrEmpty(p.Value))
                {
                    plist.Add(p);
                }
            }

            m_center.Parameters = plist.ToArray();
        }