Exemplo n.º 1
0
        private void StoreManage_Load(object sender, EventArgs e)
        {
            StoreServerConfiguration sc = StoreServerConfiguration.Load();

            this.text_Paths.Text = sc.Paths;

            chk_oss.Checked    = sc.UseOSS == "1";
            txtAkID.Text       = sc.AccessKeyId;
            txtAkSecret.Text   = sc.AccessKeySecret;
            txtOssAddress.Text = sc.OssAddress;
            txtStoreName.Text  = sc.StoreName;
        }
Exemplo n.º 2
0
        public List <string> GetConfigInfo()
        {
            if (ssc == null)
            {
                ssc = StoreServerConfiguration.Load();
            }
            List <string> ConfigInfo = new List <string>();

            ConfigInfo.Add(ssc.ServiceIP);
            ConfigInfo.Add(ssc.Status);
            ConfigInfo.Add(ssc.Paths);
            return(ConfigInfo);
        }
Exemplo n.º 3
0
        private void Bt_Confrim_Click(object sender, EventArgs e)
        {
            if (text_Paths.Text.Trim() == string.Empty)
            {
                MessageBox.Show("路径不能为空");
                return;
            }

            if (chk_oss.Checked)
            {
                if (string.IsNullOrEmpty(txtOssAddress.Text))
                {
                    MessageBox.Show("OSS路径不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txtAkID.Text))
                {
                    MessageBox.Show("AkID不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txtAkSecret.Text))
                {
                    MessageBox.Show("AkSecret不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txtStoreName.Text))
                {
                    MessageBox.Show("存储对象名称不能为空");
                    return;
                }
            }

            StoreServerConfiguration sc = new StoreServerConfiguration();

            sc.Paths = text_Paths.Text;

            sc.UseOSS          = chk_oss.Checked ? "1" : "0";
            sc.OssAddress      = txtOssAddress.Text.Trim();
            sc.AccessKeyId     = txtAkID.Text.Trim();
            sc.AccessKeySecret = txtAkSecret.Text.Trim();
            sc.StoreName       = txtStoreName.Text.Trim();

            if (sc.Save() == 1)
            {
                MessageBox.Show("保存成功");
            }
            else
            {
                MessageBox.Show("保存失败");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 加载配置实例
        /// </summary>
        /// <returns></returns>
        public static StoreServerConfiguration Load()
        {
            StoreServerConfiguration instance = new StoreServerConfiguration();

            try
            {
                XmlSerializer xs = new XmlSerializer(typeof(StoreServerConfiguration));
                StreamReader  sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"ConfigXml\StoreServerConfiguration.Config");
                instance = xs.Deserialize(sr) as StoreServerConfiguration;
                sr.Close();
                sr.Dispose();
            }
            catch
            { }
            return(instance);
        }
Exemplo n.º 5
0
 public void ReloadConfigureFile()
 {
     StoreServerConfiguration.Load();
 }