当前位置: 首页>>代码示例>>C#>>正文


C# EndPoint.GetHashCode方法代码示例

本文整理汇总了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;
        }
开发者ID:xxgkgk,项目名称:UnifyNet,代码行数:94,代码来源:UnUdpServer.cs


注:本文中的System.Net.EndPoint.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。