本文整理汇总了C#中System.Int64类的典型用法代码示例。如果您正苦于以下问题:C# Int64类的具体用法?C# Int64怎么用?C# Int64使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Int64类属于System命名空间,在下文中一共展示了Int64类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: highlightStuff
public void highlightStuff(string[] fileContent, Int64 seconds, Player p)
{
Player.UndoPos Pos;
for (int i = fileContent.Length / 7; i >= 0; i--)
{
try
{
if (Convert.ToDateTime(fileContent[(i * 7) + 4].Replace('&', ' ')).AddSeconds(seconds) >= DateTime.Now)
{
Level foundLevel = Level.Find(fileContent[i * 7]);
if (foundLevel != null && foundLevel == p.level)
{
Pos.mapName = foundLevel.name;
Pos.x = Convert.ToUInt16(fileContent[(i * 7) + 1]);
Pos.y = Convert.ToUInt16(fileContent[(i * 7) + 2]);
Pos.z = Convert.ToUInt16(fileContent[(i * 7) + 3]);
Pos.type = foundLevel.GetTile(Pos.x, Pos.y, Pos.z);
if (Pos.type == Convert.ToByte(fileContent[(i * 7) + 6]) || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
{
if (Pos.type == Block.air || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.red);
else p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.green);
}
}
}
else break;
}
catch { }
}
}
示例2: StepsToMiles
public static float StepsToMiles(Int64 stepCount)
{
if (stepCount <= 0) return 0.00f;
//Average steps in a mile
const float stepsPerMile = 2000;
return stepCount/stepsPerMile;
}
示例3: IsNetworkAvailable
/// <summary>
/// Indicates whether any network connection is available.
/// Filter connections below a specified speed, as well as virtual network cards.
/// </summary>
/// <param name="minimumSpeed">The minimum speed required. Passing 0 will not filter connection using speed.</param>
/// <returns>True if a network connection is available; otherwise false.</returns>
public static Boolean IsNetworkAvailable(Int64 minimumSpeed)
{
if (NetworkInterface.GetIsNetworkAvailable())
{
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
{
// discard because of standard reasons
if ((ni.OperationalStatus != OperationalStatus.Up) ||
(ni.NetworkInterfaceType == NetworkInterfaceType.Loopback) ||
(ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel))
continue;
// this allow to filter modems, serial, etc.
// I use 10000000 as a minimum speed for most cases
if (ni.Speed < minimumSpeed)
continue;
// discard virtual cards (virtual box, virtual pc, etc.)
if ((ni.Description.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0) ||
(ni.Name.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0))
continue;
// discard "Microsoft Loopback Adapter", it will not show as NetworkInterfaceType.Loopback but as Ethernet Card.
if (ni.Description.Equals("Microsoft Loopback Adapter", StringComparison.OrdinalIgnoreCase))
continue;
return true;
}
}
return false;
}
示例4: GetBestAddress
public static bool GetBestAddress(Int64 APartnerKey,
out PLocationTable AAddress,
out string ACountryNameLocal)
{
bool NewTransaction;
TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
TEnforceIsolationLevel.eilMinimum, out NewTransaction);
bool ResultValue = false;
try
{
ResultValue = TAddressTools.GetBestAddress(APartnerKey,
out AAddress,
out ACountryNameLocal,
Transaction);
}
catch (Exception)
{
throw;
}
finally
{
if (NewTransaction)
{
DBAccess.GDBAccessObj.RollbackTransaction();
}
}
return ResultValue;
}
示例5: Partition
public Partition( Device device, MBRPartitionEntry entry )
{
this.device = device;
partition_id = entry.id;
partition_start = ( Int64 ) entry.start_lba * ( Int64 ) device.SectorSize;
partition_length = ( Int64 ) entry.size_lba * ( Int64 ) device.SectorSize;
}
示例6: ValueVersion
public ValueVersion(UInt64 ve, string ss, byte[] va, int ec, ProcessStatus status, Int64 start, Int64 stop)
{
version = ve;
shortStatus = ss;
value = va;
exitCode = ec;
startTime = start;
stopTime = stop;
switch (status)
{
case ProcessStatus.Queued:
processStatus = "Queued";
break;
case ProcessStatus.Running:
processStatus = "Running";
break;
case ProcessStatus.Canceling:
processStatus = "Canceling";
break;
default:
processStatus = "Completed";
break;
}
}
示例7: GetHashFinalBlock
private static byte[] GetHashFinalBlock(byte[] input, int ibStart, int cbSize, ABCDStruct ABCD, Int64 len)
{
byte[] working = new byte[64];
byte[] length = BitConverter.GetBytes(len);
//Padding is a single bit 1, followed by the number of 0s required to make size congruent to 448 modulo 512. Step 1 of RFC 1321
//The CLR ensures that our buffer is 0-assigned, we don't need to explicitly set it. This is why it ends up being quicker to just
//use a temporary array rather then doing in-place assignment (5% for small inputs)
Array.Copy(input, ibStart, working, 0, cbSize);
working[cbSize] = 0x80;
//We have enough room to store the length in this chunk
if (cbSize <= 56)
{
Array.Copy(length, 0, working, 56, 8);
GetHashBlock(working, ref ABCD, 0);
}
else //We need an aditional chunk to store the length
{
GetHashBlock(working, ref ABCD, 0);
//Create an entirely new chunk due to the 0-assigned trick mentioned above, to avoid an extra function call clearing the array
working = new byte[64];
Array.Copy(length, 0, working, 56, 8);
GetHashBlock(working, ref ABCD, 0);
}
byte[] output = new byte[16];
Array.Copy(BitConverter.GetBytes(ABCD.A), 0, output, 0, 4);
Array.Copy(BitConverter.GetBytes(ABCD.B), 0, output, 4, 4);
Array.Copy(BitConverter.GetBytes(ABCD.C), 0, output, 8, 4);
Array.Copy(BitConverter.GetBytes(ABCD.D), 0, output, 12, 4);
return output;
}
示例8: PlanningOfficerMessage
public PlanningOfficerMessage(string message, Int64 customerMobile, DateTime dateSent, string connectionString)
{
Message = message;
CustomerMobile = customerMobile;
DateSent = dateSent;
_connectionString = connectionString;
}
示例9: QuickIOTransferFileCopyFinishedEventArgs
/// <summary>
/// Creates new instance of <see cref="QuickIOTransferFileCopyProgressEventArgs"/>
/// </summary>
/// <param name="job">Affected job</param>
/// <param name="sourcePath">Source file path</param>
/// <param name="targetPath">Target file path</param>
/// <param name="totalBytes">Total bytes to transfer</param>
/// <param name="transferStarted"></param>
public QuickIOTransferFileCopyFinishedEventArgs( IQuickIOTransferJob job, string sourcePath, string targetPath, Int64 totalBytes, DateTime transferStarted )
: base(job, sourcePath, targetPath)
{
TotalBytes = ( UInt64 ) totalBytes;
TransferStarted = transferStarted;
TransferFinished = DateTime.Now;
}
示例10: GetProduct
public Product GetProduct(Int64 id)
{
var products = new List<Product>();
using (var conn = _getConnection())
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT * FROM Products WHERE Id = @Id order by Name";
cmd.Parameters.Add(new SqlParameter("Id", System.Data.SqlDbType.BigInt) { Value = id });
using (var reader = cmd.ExecuteReader())
{
if (!reader.Read())
{
return null;
}
return new Product
{
Id = (Int64)reader["Id"],
Name = reader["Name"].ToString(),
Description = reader["Description"].ToString(),
Title1 = reader["Title1"].ToString(),
Title2 = reader["Title2"].ToString(),
TitlesCount = (int)(reader["TitlesCount"] ?? 0),
Price = (int)reader["Price"]
};
}
}
}
}
示例11: GetSongPlayCount
public int GetSongPlayCount(Int64 productId, Int64 customerId)
{
var playCount = 0;
using (var conn = _getConnection())
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT Sum(CU.IsPlayed) as PlayCount FROM CustomerUsage CU WHERE Cu.CustomerId = @CustomerId AND Cu.ProductId = @ProductId";
cmd.Parameters.Add(new SqlParameter("CustomerId", System.Data.SqlDbType.BigInt) { Value = customerId });
cmd.Parameters.Add(new SqlParameter("ProductId", System.Data.SqlDbType.BigInt) { Value = productId });
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (!DBNull.Value.Equals(reader["PlayCount"]))
{
playCount = (int) (reader["PlayCount"]);
}
else
{
playCount = 0;
}
}
}
}
}
return playCount;
}
示例12: switch
void IStream.Seek(Int64 offset, Int32 origin, IntPtr newPositionPtr)
{
SeekOrigin seekOrigin;
// The operation will generally be I/O bound, so there is no point in
// eliminating the following switch by playing on the fact that
// System.IO uses the same integer values as IStream for SeekOrigin.
switch(origin)
{
case NativeMethods.STREAM_SEEK_SET:
seekOrigin = SeekOrigin.Begin;
break;
case NativeMethods.STREAM_SEEK_CUR:
seekOrigin = SeekOrigin.Current;
break;
case NativeMethods.STREAM_SEEK_END:
seekOrigin = SeekOrigin.End;
break;
default:
throw new ArgumentOutOfRangeException("origin");
}
long position = _ioStream.Seek(offset, seekOrigin);
// Dereference newPositionPtr and assign to the pointed location.
if (newPositionPtr != IntPtr.Zero)
{
Marshal.WriteInt64(newPositionPtr, position);
}
}
示例13: PercentageOf
/// <summary>
/// Gets the specified percentage of the number.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="percent">The percent.</param>
/// <returns>Returns the specified percentage of the number</returns>
public static Double PercentageOf( this Int64 number, Int64 percent )
{
if ( number <= 0 )
throw new DivideByZeroException( "The number must be greater than zero." );
return (Double) number * percent / 100;
}
示例14: Trip
public Trip(BinaryReader byteFile)
{
this.Time = byteFile.ReadInt64();
this.TimeDT = new DateTime(this.Time);
this.Comment = byteFile.ReadString();
this.declination = byteFile.ReadInt16();
}
示例15: getCliente
public static Cliente getCliente(Int64 id_cliente)
{
//creo la conexion
SqlConnection cnn = new SqlConnection(conexion);
//abro la conexion
cnn.Open();
//creo la lista para almacenar las personas
Cliente c = new Cliente();
//Creo el comando sql a utlizar
SqlCommand cmd = new SqlCommand("select c.id_cliente, c.nombre, c.documento, c.telefono, c.email, c.direccion, c.ciudad, c.id_pais, p.nombre, c.rut, c.nacimiento from cliente c, pais p where c.id_pais = p.id_pais and id_cliente = @id_cliente");
cmd.Parameters.Add(new SqlParameter("@id_cliente", id_cliente));
//asigno la conexion al comando
cmd.Connection = cnn;
//creo el datareader
SqlDataReader obdr = cmd.ExecuteReader();
//recorro el datareader
while (obdr.Read())
{
c.Nombre = obdr.GetString(1);
}
//Cierro la conexion
cnn.Close();
//retorno la lsita
return c;
}