123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace IControls_FireManager
- {
- // 에러 검증 함수는 여기 클래스에서 전담한다
- public static class _Error
- {
- public static char Blank = ' ';
- public static char Comma = ',';
- public static char SemiColon = ';';
- public static char Colon = ':';
- public static string Apostrophe = "'";
- public static char Minus = '-';
-
- // 스트링중 숫자가 아닌 다른값이 포함되어있는지 체크
- public static bool Check_All_Int(string Data)
- {
- for(int i=0;i<Data.Length;i++)
- {
- if (Data[i] == '0'
- || Data[i] == '1'
- || Data[i] == '2'
- || Data[i] == '3'
- || Data[i] == '4'
- || Data[i] == '5'
- || Data[i] == '6'
- || Data[i] == '7'
- || Data[i] == '8'
- || Data[i] == '9')
- {
- ;
- }
- else
- return false;
- }
- return true;
- }
- // 한단어안에 지정한 문자가 있다면 에러 문구 리턴, 없다면(정상이라면) null 리턴
- public static string Data_Check_NotDefineChar(string Data, char DefindChar)
- {
- string result = null;
- string[] words = Data.Split(DefindChar);
- if (words.Length != 1)
- {
- if (DefindChar == Blank) result = _Text.DontBlank;
- else if (DefindChar == Comma) result = _Text.DontComma;
- else if (DefindChar == SemiColon) result = _Text.DontSemiColon;
- else if (DefindChar == Colon) result = _Text.DontColon;
-
- return result;
- }
- return result;
- }
- // 여러단어들중에 지정한 문자가 있다면 에러 문구 리턴, 없다면(정상이라면) null 리턴
- public static string Datas_Check_NotDefineChar(string Data, char DefindChar, int AllCount)
- {
- string result = null;
- string[] words = Data.Split(DefindChar);
- if(words.Length!=AllCount)
- {
- if (DefindChar == Blank) result = _Text.DontBlank;
- else if (DefindChar == Comma) result = _Text.DontComma;
- else if (DefindChar == SemiColon) result = _Text.DontSemiColon;
- else if (DefindChar == Colon) result = _Text.DontColon;
- return result;
- }
- return result;
- }
- // 한단어안에 지정한 단어가 있다면 에러 문구 리턴, 없다면(정상이라면) null 리턴
- public static string Data_Check_NotDefineString(string Data, string DefindString)
- {
- string result = null;
- int OriginalLength = Data.Length;
- string TempString = Data.Replace(DefindString, ""); // 지정자가 속해있다면 Length 가 변경됨
- if (TempString.Length != OriginalLength)
- return DefindString + _Text.DontDefineString;
- return result;
- }
- // 주의! 여러단어 입력시 공백 추가
- // 여러단어안에 지정한 단어가 있다면 에러 문구 리턴, 없다면(정상이라면) null 리턴
- public static string Datas_Check_NotDefineString(string Data, string DefindString)
- {
- string result = null;
- string[] words = Data.Split(Blank);
- foreach (string word in words)
- {
- int OriginalLength = word.Length;
- string TempString = word.Replace(DefindString, ""); // 지정자가 속해있다면 Length 가 변경됨
- if (TempString.Length != OriginalLength)
- return DefindString + _Text.DontDefineString;
- }
- return result;
- }
- // 상위에 있는 에러 전부 검사
- public static string Data_Confirm_NotDefineString(string Data)
- {
- string ConfirmText = null;
- ConfirmText = Data_Check_NotDefineString(Data, _Error.Apostrophe);
- if (ConfirmText != null)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, ConfirmText, 0);
- return ConfirmText;
- }
- ConfirmText = Data_Check_NotDefineString(Data, _Error.SemiColon.ToString());
- if (ConfirmText != null)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, ConfirmText, 0);
- return ConfirmText;
- }
- ConfirmText = Data_Check_NotDefineString(Data, _Error.Colon.ToString());
- if (ConfirmText != null)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, ConfirmText, 0);
- return ConfirmText;
- }
- ConfirmText = Data_Check_NotDefineString(Data, _Error.Comma.ToString());
- if (ConfirmText != null)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, ConfirmText, 0);
- return ConfirmText;
- }
- ConfirmText = Data_Check_NotDefineString(Data, _Error.Minus.ToString());
- if (ConfirmText != null)
- {
- _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, ConfirmText, 0);
- return ConfirmText;
- }
- return ConfirmText;
- }
- }
- }
|