コード例 #1
0
ファイル: TdrTypeUtil.cs プロジェクト: isoundy000/wzry-1
        public static TdrError.ErrorType tdrIP2Str(ref TdrVisualBuf buf, uint ip)
        {
            string str = new IPAddress((long)ip).ToString();

            object[] args = new object[] { str };
            return(buf.sprintf("{0}", args));
        }
コード例 #2
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
        public static TdrError.ErrorType printString(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, byte[] bStr)
        {
            TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR;
            string             text      = string.Empty;
            int num = TdrTypeUtil.cstrlen(bStr);

            if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
            {
                errorType = TdrBufUtil.printMultiStr(ref buf, "    ", indent);
            }
            if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
            {
                text = Encoding.get_ASCII().GetString(bStr, 0, num);
            }
            if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
            {
                errorType = buf.sprintf("{0}[{1:d}]: {2}{3}", new object[]
                {
                    variable,
                    arrIdx,
                    text,
                    sep
                });
            }
            return(errorType);
        }
コード例 #3
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
 public static TdrError.ErrorType printVariable(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, bool withSep)
 {
     TdrError.ErrorType errorType = TdrBufUtil.printMultiStr(ref buf, "    ", indent);
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         if (withSep)
         {
             errorType = buf.sprintf("{0}[{1:d}]{2}", new object[]
             {
                 variable,
                 arrIdx,
                 sep
             });
         }
         else
         {
             errorType = buf.sprintf("{0}[{1:d}]: ", new object[]
             {
                 variable,
                 arrIdx
             });
         }
     }
     return(errorType);
 }
コード例 #4
0
        public static TdrError.ErrorType printWString(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, short[] str)
        {
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            int num = TdrTypeUtil.wstrlen(str) + 1;

            object[] args = new object[] { variable, arrIdx };
            type = buf.sprintf("{0}[{1:d}]", args);
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                int num2 = TdrTypeUtil.wstrlen(str);
                for (int i = 0; i < num2; i++)
                {
                    object[] objArray2 = new object[] { str[i] };
                    type = buf.sprintf("0x{0:X4}", objArray2);
                    if (type != TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        break;
                    }
                }
            }
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] objArray3 = new object[] { sep };
                type = buf.sprintf("{0}", objArray3);
            }
            return(type);
        }
コード例 #5
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
        public static TdrError.ErrorType printWString(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, short[] str)
        {
            int num = TdrTypeUtil.wstrlen(str) + 1;

            TdrError.ErrorType errorType = buf.sprintf("{0}[{1:d}]", new object[]
            {
                variable,
                arrIdx
            });
            if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
            {
                int num2 = TdrTypeUtil.wstrlen(str);
                for (int i = 0; i < num2; i++)
                {
                    errorType = buf.sprintf("0x{0:X4}", new object[]
                    {
                        str[i]
                    });
                    if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
                    {
                        break;
                    }
                }
            }
            if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
            {
                errorType = buf.sprintf("{0}", new object[]
                {
                    sep
                });
            }
            return(errorType);
        }
コード例 #6
0
        public static TdrError.ErrorType tdrIP2Str(ref TdrVisualBuf buf, uint ip)
        {
            IPAddress iPAddress = new IPAddress((long)((ulong)ip));
            string    text      = iPAddress.ToString();

            return(buf.sprintf("{0}", new object[]
            {
                text
            }));
        }
コード例 #7
0
ファイル: TdrTypeUtil.cs プロジェクト: isoundy000/wzry-1
        public static TdrError.ErrorType tdrTime2Str(ref TdrVisualBuf buf, uint time)
        {
            TdrTime time2 = new TdrTime();

            if (time2.parse(time) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { time2.nHour, time2.bMin, time2.bSec };
                return(buf.sprintf("{0:d2}:{1:d2}:{2:d2}", args));
            }
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE);
        }
コード例 #8
0
ファイル: TdrTypeUtil.cs プロジェクト: isoundy000/wzry-1
        public static TdrError.ErrorType tdrDateTime2Str(ref TdrVisualBuf buf, ulong datetime)
        {
            TdrDateTime time = new TdrDateTime();

            if (time.parse(datetime) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { time.tdrDate.nYear, time.tdrDate.bMon, time.tdrDate.bDay, time.tdrTime.nHour, time.tdrTime.bMin, time.tdrTime.bSec };
                return(buf.sprintf("{0:d4}-{1:d2}-{2:d2} {3:d2}:{4:d2}:{5:d2}", args));
            }
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRDATETIME_VALUE);
        }
コード例 #9
0
 public static TdrError.ErrorType printArray(ref TdrVisualBuf buf, int indent, char sep, string variable, long count)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     type = printMultiStr(ref buf, "    ", indent);
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         object[] args = new object[] { variable, count };
         type = buf.sprintf("{0}[0:{1:d}]: ", args);
     }
     return(type);
 }
コード例 #10
0
ファイル: TdrTypeUtil.cs プロジェクト: isoundy000/wzry-1
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, uint date)
        {
            TdrDate date2 = new TdrDate();

            if (date2.parse(date) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { date2.nYear, date2.bMon, date2.bDay };
                return(buf.sprintf("{0:d4}-{1:d2}-{2:d2}", args));
            }
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE);
        }
コード例 #11
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
 public static TdrError.ErrorType printArray(ref TdrVisualBuf buf, int indent, char sep, string variable, long count)
 {
     TdrError.ErrorType errorType = TdrBufUtil.printMultiStr(ref buf, "    ", indent);
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}[0:{1:d}]: ", new object[]
         {
             variable,
             count
         });
     }
     return(errorType);
 }
コード例 #12
0
 public static TdrError.ErrorType printMultiStr(ref TdrVisualBuf buf, string str, int times)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     for (int i = 0; i < times; i++)
     {
         object[] args = new object[] { str };
         type = buf.sprintf("{0}", args);
         if (type != TdrError.ErrorType.TDR_NO_ERROR)
         {
             return(type);
         }
     }
     return(type);
 }
コード例 #13
0
 public static TdrError.ErrorType printVariable(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, bool withSep)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     type = printMultiStr(ref buf, "    ", indent);
     if (type != TdrError.ErrorType.TDR_NO_ERROR)
     {
         return(type);
     }
     if (withSep)
     {
         object[] objArray1 = new object[] { variable, arrIdx, sep };
         return(buf.sprintf("{0}[{1:d}]{2}", objArray1));
     }
     object[] args = new object[] { variable, arrIdx };
     return(buf.sprintf("{0}[{1:d}]: ", args));
 }
コード例 #14
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
 public static TdrError.ErrorType printMultiStr(ref TdrVisualBuf buf, string str, int times)
 {
     TdrError.ErrorType errorType = TdrError.ErrorType.TDR_NO_ERROR;
     for (int i = 0; i < times; i++)
     {
         errorType = buf.sprintf("{0}", new object[]
         {
             str
         });
         if (errorType != TdrError.ErrorType.TDR_NO_ERROR)
         {
             break;
         }
     }
     return(errorType);
 }
コード例 #15
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, uint date)
        {
            TdrDate tdrDate = new TdrDate();

            TdrError.ErrorType result;
            if (tdrDate.parse(date) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                result = buf.sprintf("{0:d4}-{1:d2}-{2:d2}", new object[]
                {
                    tdrDate.nYear,
                    tdrDate.bMon,
                    tdrDate.bDay
                });
            }
            else
            {
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }
            return(result);
        }
コード例 #16
0
 public static TdrError.ErrorType printTdrDate(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, uint date)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     type = printMultiStr(ref buf, "    ", indent);
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         object[] args = new object[] { variable, arrIdx };
         type = buf.sprintf("{0}[{1:d}]: ", args);
     }
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         type = TdrTypeUtil.tdrDate2Str(ref buf, date);
     }
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         object[] objArray2 = new object[] { sep };
         type = buf.sprintf("{0}", objArray2);
     }
     return(type);
 }
コード例 #17
0
 public static TdrError.ErrorType printVariable(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, string format, params object[] args)
 {
     TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
     type = printMultiStr(ref buf, "    ", indent);
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         object[] objArray1 = new object[] { variable, arrIdx };
         type = buf.sprintf("{0}[{1:d}]: ", objArray1);
     }
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         type = buf.sprintf(format, args);
     }
     if (type == TdrError.ErrorType.TDR_NO_ERROR)
     {
         object[] objArray2 = new object[] { sep };
         type = buf.sprintf("{0}", objArray2);
     }
     return(type);
 }
コード例 #18
0
        public static TdrError.ErrorType tdrTime2Str(ref TdrVisualBuf buf, uint time)
        {
            TdrTime tdrTime = new TdrTime();

            TdrError.ErrorType result;
            if (tdrTime.parse(time) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                result = buf.sprintf("{0:d2}:{1:d2}:{2:d2}", new object[]
                {
                    tdrTime.nHour,
                    tdrTime.bMin,
                    tdrTime.bSec
                });
            }
            else
            {
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE;
            }
            return(result);
        }
コード例 #19
0
        public static TdrError.ErrorType printString(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, byte[] bStr)
        {
            TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR;
            string             str  = string.Empty;
            int count = TdrTypeUtil.cstrlen(bStr);

            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                type = printMultiStr(ref buf, "    ", indent);
            }
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                str = Encoding.ASCII.GetString(bStr, 0, count);
            }
            if (type == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { variable, arrIdx, str, sep };
                type = buf.sprintf("{0}[{1:d}]: {2}{3}", args);
            }
            return(type);
        }
コード例 #20
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
 public static TdrError.ErrorType printTdrDateTime(ref TdrVisualBuf buf, int indent, char sep, string variable, ulong datetime)
 {
     TdrError.ErrorType errorType = TdrBufUtil.printMultiStr(ref buf, "    ", indent);
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}: ", new object[]
         {
             variable
         });
     }
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = TdrTypeUtil.tdrDateTime2Str(ref buf, datetime);
     }
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}", new object[]
         {
             sep
         });
     }
     return(errorType);
 }
コード例 #21
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
 public static TdrError.ErrorType printVariable(ref TdrVisualBuf buf, int indent, char sep, string variable, string format, params object[] args)
 {
     TdrError.ErrorType errorType = TdrBufUtil.printMultiStr(ref buf, "    ", indent);
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}: ", new object[]
         {
             variable
         });
     }
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf(format, args);
     }
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}", new object[]
         {
             sep
         });
     }
     return(errorType);
 }
コード例 #22
0
        public static TdrError.ErrorType tdrDateTime2Str(ref TdrVisualBuf buf, ulong datetime)
        {
            TdrDateTime tdrDateTime = new TdrDateTime();

            TdrError.ErrorType result;
            if (tdrDateTime.parse(datetime) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                result = buf.sprintf("{0:d4}-{1:d2}-{2:d2} {3:d2}:{4:d2}:{5:d2}", new object[]
                {
                    tdrDateTime.tdrDate.nYear,
                    tdrDateTime.tdrDate.bMon,
                    tdrDateTime.tdrDate.bDay,
                    tdrDateTime.tdrTime.nHour,
                    tdrDateTime.tdrTime.bMin,
                    tdrDateTime.tdrTime.bSec
                });
            }
            else
            {
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATETIME_VALUE;
            }
            return(result);
        }
コード例 #23
0
ファイル: TdrBufUtil.cs プロジェクト: TonyDongGuaPi/joework
 public static TdrError.ErrorType printTdrTime(ref TdrVisualBuf buf, int indent, char sep, string variable, int arrIdx, uint time)
 {
     TdrError.ErrorType errorType = TdrBufUtil.printMultiStr(ref buf, "    ", indent);
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}[{1:d}]: ", new object[]
         {
             variable,
             arrIdx
         });
     }
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = TdrTypeUtil.tdrTime2Str(ref buf, time);
     }
     if (errorType == TdrError.ErrorType.TDR_NO_ERROR)
     {
         errorType = buf.sprintf("{0}", new object[]
         {
             sep
         });
     }
     return(errorType);
 }