// for more details.
//
// You should have received a copy of the GNU General public License along
-// with this program. if (not, see <http://www.gnu.org/licenses/>, or write to
+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;
{
return;
}
- for (int i = 0; i < HistoryHashList.SelectedIndices.Count; i++)
+
+ // 削除によってインデックス番号が変わらないように逆順に処理する
+ var selectedIndices = this.HistoryHashList.SelectedIndices.Cast<int>()
+ .OrderByDescending(x => x).ToArray();
+
+ foreach (var idx in selectedIndices)
{
- if (UseHashText.Text == HistoryHashList.SelectedItems[0].ToString()) UseHashText.Text = "";
- HistoryHashList.Items.RemoveAt(HistoryHashList.SelectedIndices[0]);
+ if (UseHashText.Text == HistoryHashList.Items[idx].ToString()) UseHashText.Text = "";
+ HistoryHashList.Items.RemoveAt(idx);
}
if (HistoryHashList.Items.Count > 0)
{
idx += 1;
continue;
}
- if (string.Compare(src, value, true) == 0)
+ if (string.Compare(src, value, StringComparison.OrdinalIgnoreCase) == 0)
{
return idx;
}