Ejemplo n.º 1
0
        /// <summary>
        /// 根据文件路径获取程序集信息
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static ReferManageArgment GetReferInfo(string path)
        {
            ReferManageArgment temp = new ReferManageArgment();

            temp.ReferName     = Path.GetFileNameWithoutExtension(path);
            temp.Path          = path;
            temp.currentVesion = AssemblyOprateHelp.GetVesion(path);
            temp.ModifyTime    = File.GetLastWriteTime(path);
            return(temp);
        }
Ejemplo n.º 2
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 3)
         {
             OpenFileDialog dlg = new OpenFileDialog();
             dlg.Filter      = "应用程序集(.dll)|*.dll";
             dlg.Multiselect = false;
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 string sourcePath = dlg.FileName;
                 int    index      = e.RowIndex;
                 string name       = Path.GetFileNameWithoutExtension(sourcePath);
                 if (string.Compare(name, dataGridView1[0, index].Value.ToString(), true) == 0)
                 {
                     File.Copy(sourcePath, dataGridView1[4, index].Value.ToString(), true);
                     ReferManageArgment arg = ReferManageLogic.GetReferInfo(dataGridView1[4, index].Value.ToString());
                     dataGridView1[0, index].Value = arg.ReferName;
                     dataGridView1[1, index].Value = arg.currentVesion;
                     dataGridView1[2, index].Value = arg.ModifyTime;
                     dataGridView1[3, index].Value = "更新";
                     dataGridView1[4, index].Value = arg.Path;
                     dataGridView1.Refresh();
                 }
                 else
                 {
                     MsgBoxHelp.ShowWorning("引用程序集名称和源名称不一致,请选择正确的程序集");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MsgBoxHelp.ShowError("更新程序集错误", ex);
     }
 }