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)); }
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); }
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); }
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); }
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); }
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 })); }
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); }
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); }
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); }
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); }
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); }
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); }
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)); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }