/// <summary>
 /// 添加拖拽的文件路径到行
 /// </summary>
 /// <param name="filePaths"></param>
 public void AddDragFilesToRow(string[] filePaths)
 {
     foreach (string filePath in filePaths)
     {
         DataRow row = ShortNameAndCommandsTable.NewRow();
         row[RealCommandName] = filePath;
         SetDefaultShortNameForDragFile(filePath, row);
         ShortNameAndCommandsTable.Rows.Add(row);
     }
 }
 private void ReplaceDataTable()
 {
     ShortNameAndCommandsTable.Rows.Clear();
     foreach (var shortNameAndExePath in ShortNameAndCommands)
     {
         DataRow row = ShortNameAndCommandsTable.NewRow();
         row[RealCommandName] = shortNameAndExePath.Value;
         row[ShortName]       = shortNameAndExePath.Key;
         ShortNameAndCommandsTable.Rows.Add(row);
     }
 }
        /// <summary>
        /// 合并重复项和唯一项表格
        /// </summary>
        /// <returns></returns>
        public DataTable MergeRepeatedAndDistinctTable()
        {
            if (distinctCommandTable == null)
            {
                return(ShortNameAndCommandsTable);
            }

            //重复项为空
            if (repeatedCommandTable.Rows.Count == 0)
            {
                ShortNameAndCommandsTable = distinctCommandTable;
                return(ShortNameAndCommandsTable);
            }

            ShortNameAndCommandsTable = distinctCommandTable.Copy();
            ShortNameAndCommandsTable.Merge(repeatedCommandTable);
            return(ShortNameAndCommandsTable);
        }
        /// <summary>
        /// 计算只包含重复命令的表格
        /// </summary>
        /// <returns></returns>
        public DataTable ComputeOnlyIncludeRepeatedCommandsTable()
        {
            repeatedCommandTable = ShortNameAndCommandsTable.Clone();
            distinctCommandTable = ShortNameAndCommandsTable.Clone();
            Dictionary <string, int> commandAndCount = GetCommandAndCount();

            foreach (DataRow dataRow in ShortNameAndCommandsTable.Rows)
            {
                string command = dataRow[RealCommandName].ToString();
                if (commandAndCount[command] > 1)
                {
                    repeatedCommandTable.ImportRow(dataRow);
                }
                else
                {
                    distinctCommandTable.ImportRow(dataRow);
                }
            }

            return(repeatedCommandTable);
        }