Create WarningStat.cs

This commit is contained in:
lastvoidtemplar
2021-07-12 12:59:05 +03:00
parent 4c7d878f2e
commit d180bfb9e1

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BoerseDataConvert.Model
{
public static class WarningStat
{
private class Warning
{
string type;
int count;
public Warning(string type)
{
this.type = type;
count = 1;
}
public void Add()
{
count++;
}
}
private static Dictionary<int, Warning> tableWarnings = tableWarnings = new Dictionary<int, Warning>();
private static string curFile;
public static void Refresh(string fileName)
{
curFile = fileName;
tableWarnings = new Dictionary<int,Warning>();
}
/*
type "inv" - Ivalid tag
type "long" - too long string value
type "notnum" - is not in a valid format for number
type "range" - Value not in range
*/
public static void Add(int tag,string type)//
{
if (tableWarnings.ContainsKey(tag))
{
tableWarnings[tag].Add();
}
else
{
Warning warning = new Warning(type);
tableWarnings.Add(tag, warning);
}
}
}
}