public static List<TableData> FindConsecutiveDataWithinMinute(List<TableData> oldTable)
{
DateTime[] oldCreateTimeArray = oldTable.Select(t => t.CreateDatetime).ToArray();
int[] poorsArray = new int[oldCreateTimeArray.Length - 1];
for (int i = 1; i < oldCreateTimeArray.Length; i++)
{
TimeSpan timeDifference = oldCreateTimeArray[i] - oldCreateTimeArray[i - 1];
poorsArray[i - 1] = (int)timeDifference.TotalSeconds;
}
List<int> indexArray = new();
for (int i = 0; i <= poorsArray.Length - 4; i++)
{
if (poorsArray[i] == 1 && poorsArray[i + 1] == 1 && poorsArray[i + 2] == 1 && poorsArray[i + 3] == 1)
{
indexArray.Add(i + 3);
i += 3;
}
}
List<TableData> newTable = new();
foreach (int index in indexArray)
{
if (index >= 0 && index < oldTable.Count)
{
newTable.Add(oldTable[index + 1]);
}
}
return newTable;
}