コード例 #1
0
        protected void gvSysConfig_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                var tbConfigValue = gvSysConfig.Rows[gvSysConfig.EditIndex].Cells[1].Controls[0] as TextBox;

                if (tbConfigValue != null)
                {
                    var c = new Config
                    {
                        ConfigSystem = ConfigSystem.iArsenal,
                        ConfigKey = gvSysConfig.DataKeys[gvSysConfig.EditIndex]?.Value.ToString(),
                        ConfigValue = tbConfigValue.Text.Trim()
                    };

                    c.Save();

                    ConfigGlobal.Refresh();
                }

                gvSysConfig.EditIndex = -1;

                BindData();
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(typeof (string), "failed", $"alert('{ex.Message}');", true);
            }
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
        public static void UpdateAssemblyInfo(Assembly assembly, ConfigSystem configSystem)
        {
            if (assembly != null)
            {
                //[assembly: AssemblyTitle("Arsenalcn.Core")]
                //[assembly: AssemblyDescription("沪ICP备12045527号")]
                //[assembly: AssemblyConfiguration("*****@*****.**")]
                //[assembly: AssemblyCompany("Arsenal China Official Supporters Club")]
                //[assembly: AssemblyProduct("Arsenalcn.com")]
                //[assembly: AssemblyCopyright("© 2015")]
                //[assembly: AssemblyTrademark("ArsenalCN")]
                //[assembly: AssemblyCulture("")]
                //[assembly: AssemblyVersion("1.8.*")]
                //[assembly: AssemblyFileVersion("1.8.2")]

                var c = new Config();
                c.ConfigSystem = configSystem;

                //AssemblyTitle
                c.ConfigKey = "AssemblyTitle";
                c.ConfigValue =
                    ((AssemblyTitleAttribute) Attribute.GetCustomAttribute(assembly, typeof (AssemblyTitleAttribute)))?
                        .Title;

                c.Save();

                //AssemblyDescription
                c.ConfigKey = "AssemblyDescription";
                c.ConfigValue =
                    ((AssemblyDescriptionAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyDescriptionAttribute)))?.Description;

                c.Save();

                //AssemblyConfiguration
                c.ConfigKey = "AssemblyConfiguration";
                c.ConfigValue =
                    ((AssemblyConfigurationAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyConfigurationAttribute)))?.Configuration;

                c.Save();

                //AssemblyCompany
                c.ConfigKey = "AssemblyCompany";
                c.ConfigValue =
                    ((AssemblyCompanyAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyCompanyAttribute)))?.Company;

                c.Save();

                //AssemblyProduct
                c.ConfigKey = "AssemblyProduct";
                c.ConfigValue =
                    ((AssemblyProductAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyProductAttribute)))?.Product;

                c.Save();

                //AssemblyCopyright
                c.ConfigKey = "AssemblyCopyright";
                c.ConfigValue =
                    ((AssemblyCopyrightAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyCopyrightAttribute)))?.Copyright;

                c.Save();

                //AssemblyTrademark
                c.ConfigKey = "AssemblyTrademark";
                c.ConfigValue =
                    ((AssemblyTrademarkAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyTrademarkAttribute)))?.Trademark;

                c.Save();

                //AssemblyCulture
                c.ConfigKey = "AssemblyCulture";
                c.ConfigValue =
                    ((AssemblyCultureAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyCultureAttribute)))?.Culture;

                c.Save();

                //AssemblyVersion
                var assemblyName = assembly.GetName();
                var version = assemblyName.Version;

                c.ConfigKey = "AssemblyVersion";
                c.ConfigValue = version?.ToString();

                c.Save();

                //AssemblyFileVersion
                c.ConfigKey = "AssemblyFileVersion";
                c.ConfigValue =
                    ((AssemblyFileVersionAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyFileVersionAttribute)))?.Version;

                c.Save();
            }
        }