/// <summary> /// Переключение кодовой страницы вывода консоли. /// </summary> public static void SetOutputCodePage ( [NotNull] string codePage ) { Sure.NotNullNorEmpty(codePage, nameof(codePage)); SetOutputCodePage(Encoding.GetEncoding(codePage)); }
/// <summary> /// Constructor. /// </summary> /// <param name="name">Name of the attachment.</param> /// <param name="content">Content of the attachment.</param> public BinaryAttachment ( [NotNull] string name, [NotNull] byte[] content ) { Sure.NotNullNorEmpty(name, nameof(name)); Sure.NotNull(content, nameof(content)); Name = name; Content = content; }
/// <summary> /// Verify sub-object. /// </summary> public Verifier <T> VerifySubObject ( [NotNull] IVerifiable verifiable, [NotNull] string name ) { Sure.NotNull(verifiable, nameof(verifiable)); Sure.NotNullNorEmpty(name, nameof(name)); Assert(verifiable.Verify(ThrowOnError), name); return(this); }
public static string ToInvariantString ( this decimal value, [NotNull] string format ) { Sure.NotNullNorEmpty(format, nameof(format)); return(value.ToString ( format, CultureInfo.InvariantCulture )); }
public static long ParseInt64 ( [NotNull] string text ) { Sure.NotNullNorEmpty(text, nameof(text)); text = ConvertFloatToInvariant(text); long result = long.Parse ( text, NumberStyles.Any, CultureInfo.InvariantCulture ); return(result); }
public static int ParseInt32 ( [NotNull] string text ) { Sure.NotNullNorEmpty(text, nameof(text)); text = ConvertIntegerToInvariant(text); int result = int.Parse ( text, NumberStyles.Any, CultureInfo.InvariantCulture ); return(result); }
public static double ParseDouble ( [NotNull] string text ) { Sure.NotNullNorEmpty(text, nameof(text)); text = ConvertFloatToInvariant(text); double result = double.Parse ( text, NumberStyles.Any, CultureInfo.InvariantCulture ); return(result); }
/// <summary> /// Перенаправление стандартного вывода в файл. /// </summary> public static void RedirectStandardOutput ( [NotNull] string fileName, [NotNull] Encoding encoding ) { Sure.NotNullNorEmpty(fileName, nameof(fileName)); Sure.NotNull(encoding, nameof(encoding)); StreamWriter stdOutput = TextWriterUtility.Create ( fileName, encoding ); stdOutput.AutoFlush = true; Console.SetOut(stdOutput); }