From 9a0c6ef5cd04201c85833a3c0241f927bc6fd263 Mon Sep 17 00:00:00 2001 From: morkt Date: Thu, 15 Dec 2016 19:35:07 +0400 Subject: [PATCH] (CowArray.IndexOf): fixed. --- GameRes/ByteArray.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GameRes/ByteArray.cs b/GameRes/ByteArray.cs index eb352238..0b89268c 100644 --- a/GameRes/ByteArray.cs +++ b/GameRes/ByteArray.cs @@ -70,12 +70,15 @@ namespace GameRes public int IndexOf (T item) { - return Array.IndexOf (m_source, item, m_offset, m_count); + int i = Array.IndexOf (m_source, item, m_offset, m_count); + if (-1 == i) + return i; + return i - m_offset; } public bool Contains (T item) { - return IndexOf (item) != -1; + return Array.IndexOf (m_source, item, m_offset, m_count) != -1; } public void CopyTo (T[] arr, int dst)