Exemplo n.º 1
0
        public static FeedbackInfomation ValidateIpAddress(string ipaddress)
        {
            var fi           = new FeedbackInfomation();
            var validipregex =
                new Regex(
                    @"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");

            if (ipaddress == "")
            {
                fi.ErrorStatus     = STATUS_ADAPTER.IP_EMPTY;
                fi.FeedbackMessage = Tips.IP + Tips.ERROR_EMPTY;
                fi.Result          = "";
                return(fi);
            }
            if (!validipregex.IsMatch(ipaddress.Trim()))
            {
                fi.ErrorStatus     = STATUS_ADAPTER.IP_FORMAT;
                fi.FeedbackMessage = Tips.IP + Tips.ERROR_FORMAT;
                fi.Result          = "";
                return(fi);
            }

            fi.ErrorStatus     = STATUS_ADAPTER.IP_NORMAL;
            fi.FeedbackMessage = "";
            fi.Result          = "";
            return(fi);
        }
Exemplo n.º 2
0
        public FeedbackInfomation SetFi(object o, STATUS_ADAPTER sa, string tips)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            fi.Result          = o;
            fi.ErrorStatus     = sa;
            fi.FeedbackMessage = tips;
            return(fi);
        }