Пример #1
0
        public static string ToInfoMessage(Box box)
        {
            if (box == null)
            {
                throw new ArgumentNullException(nameof(box));
            }

            try
            {
                var builder = new StringBuilder();

                if (!string.IsNullOrWhiteSpace(box.Name))
                {
                    builder.AppendLine(string.Format("{0}: {1}", LanguagesManager.Instance.Box_Name, box.Name));
                }
                builder.AppendLine(string.Format("{0}: {1} UTC", LanguagesManager.Instance.Box_CreationTime, BoxUtils.GetCreationTime(box).ToUniversalTime().ToString(LanguagesManager.Instance.DateTime_StringFormat, System.Globalization.DateTimeFormatInfo.InvariantInfo)));

                if (builder.Length != 0)
                {
                    return(builder.ToString().Remove(builder.Length - 2));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw new ArgumentException("ArgumentException", e);
            }
        }