ScreenToGif/Util/Framerate.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Diagnostics;
namespace ScreenToGif.Util
{
/// <summary>
/// Frame rate monitor.
/// </summary>
public static class FrameRate
{
#region Private Variables
private static Stopwatch _stopwatch = new Stopwatch();
private static int _interval = 15;
private static bool _started = true;
private static bool _fixedFrameRate = false;
#endregion
/// <summary>
/// Prepares the FrameRate monitor.
/// </summary>
/// <param name="interval">The selected interval of each snapshot.</param>
public static void Start(int interval)
{
_stopwatch = new Stopwatch();
_interval = interval;
_fixedFrameRate = UserSettings.All.FixedFrameRate;
}
/// <summary>
/// Gets the diff between the last call.
/// </summary>
/// <returns>The ammount of seconds.</returns>
public static int GetMilliseconds(int? framerate = null)
{
//Specific delay, for the snapshot feature, for example.
if (framerate.HasValue)
return framerate.Value;
if (_fixedFrameRate)
return _interval;
if (_started)
{
_started = false;
_stopwatch.Start();
return _interval;
}
var mili = (int)_stopwatch.ElapsedMilliseconds;
_stopwatch.Restart();
return mili;
}
/// <summary>
/// Determine that a stop/pause of the recording.
/// </summary>
public static void Stop()
后面还有 6 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
