public static string ProduceErrorMsg(StackTrace oStackTrace, string sMsg) { smStackTrace = oStackTrace; return(ConventionSupport.cmsErrorMsgPrefix + "[" + sMsg + "] " + ConventionSupport.GetCurrentMethodFileName( ) + ConventionSupport.cmsSpace + ConventionSupport.GetCurrentMethodLineNumber( ) + ConventionSupport.cmsSpace + ConventionSupport.GetCurrentMethodName( ) + ConventionSupport.cmsSpace + ConventionSupport.cmsNewLine); }
public static string ProduceHexString(ulong iValue, int iNumHexDigits) { if (iNumHexDigits > ConventionSupport.MaxiumHexDigitsForToString || iNumHexDigits < ConventionSupport.MinimumDigitsForToString) { StackTrace oStackTrace = new StackTrace( ); string sMsg = string.Format("{0} ( int iValue, int iNumBinaryDigits ): iNumHexDigits must be >= {1} or <= {2} -> was '{3}'", ConventionSupport.GetCurrentMethodName(new StackTrace( )), ConventionSupport.MinimumDigitsForToString, ConventionSupport.MaxiumHexDigitsForToString, iNumHexDigits); throw new Exception(ConventionSupport.ProduceErrorMsg(oStackTrace, sMsg)); } return(ConventionSupport.HexPrefix + iValue.ToString("X" + iNumHexDigits.ToString())); }
public static string ProduceBinaryString(ulong iValue, int iNumBinaryDigits) { if (iNumBinaryDigits > ConventionSupport.MaxiumBinaryDigitsForToString || iNumBinaryDigits < ConventionSupport.MinimumDigitsForToString) { StackTrace oStackTrace = new StackTrace( ); string sMsg = string.Format("{0} ( int iValue, int iNumBinaryDigits ): iNumBinaryDigits must be >= {1} or <= {2} -> was '{3}'", ConventionSupport.GetCurrentMethodName(oStackTrace), ConventionSupport.MinimumDigitsForToString, ConventionSupport.MaxiumBinaryDigitsForToString, iNumBinaryDigits); throw new Exception(ConventionSupport.ProduceErrorMsg(oStackTrace, sMsg)); } return(ConventionSupport.BinaryPrefix + Convert.ToString((int)iValue, 2).PadLeft(iNumBinaryDigits, '0')); }