GMap.NET.Core/GMap.NET.Internals/Stuff.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace GMap.NET.Internals
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Reflection;
/// <summary>
/// etc functions...
/// </summary>
internal class Stuff
{
public static string EnumToString(Enum value)
{
FieldInfo fi = value.GetType().GetField(value.ToString());
DescriptionAttribute[] attributes =
(DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false);
return (attributes.Length > 0) ? attributes[0].Description : value.ToString();
}
[System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "SetCursorPos")]
[return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern bool SetCursorPos(int X, int Y);
static readonly Random random = new System.Random();
public static void Shuffle<T>(List<T> deck)
{
int N = deck.Count;
for(int i = 0; i < N; ++i)
{
int r = i + (int)(random.Next(N - i));
T t = deck[r];
deck[r] = deck[i];
deck[i] = t;
}
}
public static MemoryStream CopyStream(Stream inputStream, bool SeekOriginBegin)
{
const int readSize = 32 * 1024;
byte[] buffer = new byte[readSize];
MemoryStream ms = new MemoryStream();
{
int count = 0;
while((count = inputStream.Read(buffer, 0, readSize)) > 0)
{
ms.Write(buffer, 0, count);
}
}
buffer = null;
if(SeekOriginBegin)
{
inputStream.Seek(0, SeekOrigin.Begin);
}
后面还有 79 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
