public static void Init() { Dictionary <string, string> dic = ConfigDA.List(); client_version_no = dic["client_version_no"]; client_version = int.Parse(dic["client_version"]); }
public FrmMain() { InitializeComponent(); dgvFiles.AutoGenerateColumns = false; Dictionary <string, string> dic = ConfigDA.List(); txt_version_no_old.Text = dic["client_version_no"]; txt_version_old.Text = dic["client_version"]; txt_version_new.Text = DateTime.Now.ToString("yyyyMMdd") + "01"; string dir = ConfigurationManager.AppSettings["ClientDir"]; List <ClientFile> files_old = ClientFileDA.List(); List <ClientFile> files_new = new List <ClientFile>(); GetDirectorFiles(dir, ref files_new); List <ClientFileCompare> files_compare = files_old.Select(f => new ClientFileCompare() { name = f.name, size = f.size, time = f.time, version = f.version }).ToList(); foreach (ClientFile fn in files_new) { fn.name = fn.name.Substring(dir.Length).Replace('\\', '/'); ClientFileCompare fc = files_compare.Find(f => f.name == fn.name); if (fc == null) { files_compare.Add(new ClientFileCompare() { name = fn.name, size_new = fn.size, time_new = fn.time, need_upgrade = "是" }); } else { fc.size_new = fn.size; fc.time_new = fn.time; fc.need_upgrade = fc.time != fc.time_new ? "是" : "否"; } } dgvFiles.DataSource = files_compare.OrderByDescending(f => f.need_upgrade).ToList(); files_upgrade = files_compare.Where(f => f.time != f.time_new).ToList(); btnSave.Text += "\r\n(可发布" + files_upgrade.Count + "个文件)"; }