ScreenToGif/Util/Humanizer.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
namespace ScreenToGif.Util
{
/// <summary>
/// Machine to Human converter. Just kidding. ;)
/// </summary>
public class Humanizer
{
/// <summary>
/// Converts a lenght value to a readable size.
/// </summary>
/// <param name="byteCount">The lenght of the file.</param>
/// <returns>A string representation of a file size.</returns>
public static string BytesToString(long byteCount)
{
string[] suf = { " B", " KB", " MB", " GB" }; //I hope no one make a gif with TB's of size. haha - Nicke
if (byteCount == 0)
return "0" + suf[0];
var bytes = Math.Abs(byteCount);
var place = Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024)));
var num = Math.Round(bytes / Math.Pow(1024, place), 1);
return (Math.Sign(byteCount) * num) + suf[place];
}
/// <summary>
/// Random welcome symbol.
/// </summary>
/// <returns>Returns a welcome text/emoji.</returns>
public static string Welcome()
{
var random = new Random();
string[] faces = { "^.^", ":D", ";D", "^_^", "\\ (•◡•) /", "☺", "✌", "😉", "😊", "😆", "🎈",
"💡", "🎬", "😎", "🎞", "🎨", "🎥", "📽", "📷", "📸", "📹", "🌏", "🌍", "🌎", "🗺", "🌠" };
var maxValue = Other.IsWin8OrHigher() ? faces.Length : 6; //Exclusive bound.
return faces[random.Next(maxValue)];
}
/// <summary>
/// Gets two sets of welcome messages.
/// </summary>
/// <returns>Two welcome messages.</returns>
public static string WelcomeInfo()
{
var random = new Random();
string[] texts = { "Welcome.New", "Welcome.Import", "Welcome.ThankYou", "Welcome.Size", "Welcome.Contact", "Welcome.Trouble" };
var pick1 = random.Next(texts.Length);
return texts[pick1];
}
/// <summary>
后面还有 19 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
