/// <summary> /// 获得UpdateFileContent的基本信息和Content和签名 /// </summary> /// <param name="filename"></param> /// <returns></returns> public static UpdateFileContent GetUpdateFileContent(string filename) { UpdateFileContent f = FileUpdater.GetUpdateFile(filename) as UpdateFileContent; f.Content = System.IO.File.ReadAllBytes(filename); string k = System.Windows.Forms.Application.ProductName + System.Windows.Forms.Application.CompanyName; f.Signa = Core.ShaEnCoder.HashToString(Core.ShaEnCoder.GetHash(f.Content, Encoding.ASCII.GetBytes(k))); return(f); }
void AddFiles() { OpenFileDialog of = new OpenFileDialog(); of.Multiselect = true; if (of.ShowDialog(this) == DialogResult.OK) { foreach (string s in of.FileNames) { UpdateFile fc = FileUpdater.GetUpdateFile(s); int i = dataGridView1.Rows.Add(); dataGridView1[1, i].Value = fc.Name; dataGridView1[2, i].Value = fc.SourcePath; dataGridView1[3, i].Value = fc.FileVersion; dataGridView1[4, i].Value = fc.LastWriteTime.ToString(); dataGridView1[5, i].Value = Enum.GetName(typeof(FileSpecialFolder), FileSpecialFolder.ApplicationStartUpPath); } } }