本文整理汇总了C#中System.Net.EndPoint.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# EndPoint.GetHashCode方法的具体用法?C# EndPoint.GetHashCode怎么用?C# EndPoint.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.EndPoint
的用法示例。
在下文中一共展示了EndPoint.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: proDownFilePackage
// DownFile-处理数据包
private byte[] proDownFilePackage(EndPoint point, UnUdpEntity entity)
{
byte[] data = null;
UnUdpEntity downBack = new UnUdpEntity();
UnUdpEntity p = downFileClients.Find(t => t.Point.GetHashCode() == point.GetHashCode());
// 建立客户端表
if (p == null)
{
p = new UnUdpEntity();
p.Point = point;
downFileClients.Add(p);
ss.addDownTaskNum(1);
}
p.WakeTimeStamp = UnDate.ticksSec();
// 建立配置文件
UnUdpEntity config = downFileConfigs.Find(t => t.PackMD5 == entity.PackMD5);
if (config == null)
{
//UnFile.writeLog("downMD5", entity.PackMD5);
string filePath = null;
if (intServer != null)
{
UnAttrRst rst = intServer.downCodeAnalyze(point, entity);
if (rst != null)
{
if (rst.code > 0)
{
filePath = rst.back;
}
else
{
return null;
}
}
}
if (!File.Exists(filePath))
{
return null;
}
config = new UnUdpEntity(filePath, subSize_down);
config.PackMD5 = entity.PackMD5;
downFileConfigs.Add(config);
ss.addDownFileNum(1);
}
config.WakeTimeStamp = UnDate.ticksSec();
switch (entity.Event.getUnUdpEveEnum())
{
case UnUdpEveEnum.downFileQuery:
downBack.Event = UnUdpEveEnum.downFileQueryBack.getText();
downBack.Extent = config.Extent;
downBack.HashCode = config.HashCode;
downBack.TotalPacks = config.TotalPacks;
downBack.TotalSize = config.TotalSize;
downBack.SubSize = config.SubSize;
long[] ls = UnUdpHelp.waitUps(entity.PackNo + 1, config.TotalPacks, interval);
downBack.IntMin = ls[0];
downBack.IntMax = ls[1];
data = UnUdpHelp.assemblePackage(downBack);
return data;
case UnUdpEveEnum.downFile:
UnUdpEntity cache = null;
lock (cacheLock)
{
cache = downFileCaches.Find(t => t.PackNo == entity.PackNo && t.PackMD5 == config.PackMD5);
// 添加缓存
if (cache == null)
{
data = config.getDownFileBackPackage(entity.PackNo);
if (downFileCaches.Count < cacheQueueSize)
{
cache = new UnUdpEntity();
cache.PackMD5 = config.PackMD5;
cache.PackNo = entity.PackNo;
cache.PackData = data;
cache.WakeTimeStamp = UnDate.ticksSec();
downFileCaches.Add(cache);
ss.addDownCacheNum(1);
}
}
else
{
data = cache.PackData;
cache.WakeTimeStamp = UnDate.ticksSec();
}
ss.addProLength(config.SubSize);
}
return data;
}
return null;
}