• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ByteArray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ByteArray的典型用法代码示例。如果您正苦于以下问题:C# ByteArray类的具体用法?C# ByteArray怎么用?C# ByteArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ByteArray类属于命名空间,在下文中一共展示了ByteArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Read

        public void Read(ByteArray bs)
        {
            signature = bs.ReadStringNull();
            streamVersion = bs.ReadInt();
            unityVersion = bs.ReadStringNull();
            unityRevision = bs.ReadStringNull();
            minimumStreamedBytes = bs.ReadInt();
            headerSize = bs.ReadUInt();

            numberOfLevelsToDownload = bs.ReadInt();
            int numberOfLevels = bs.ReadInt();

            for (int i = 0; i < numberOfLevels; i++)
            {
                levelByteEnd.Add(new LevelInfo() { PackSize = bs.ReadUInt(), UncompressedSize = bs.ReadUInt() });
            }

            if (streamVersion >= 2)
            {
                completeFileSize = bs.ReadUInt();
            }

            if (streamVersion >= 3)
            {
                dataHeaderSize = bs.ReadUInt();
            }

            bs.ReadByte();
        }
开发者ID:hexiaoweiff8,项目名称:AssetBundleReader,代码行数:29,代码来源:AssetBundleHeader.cs


示例2: SendMessageAsync

        public override Task SendMessageAsync(ByteArray message, CancellationToken token)
        {
            if (token.IsCancellationRequested)
                return Task.FromResult<object>(null);

            return udp.SendAsync(message, message.Length);
        }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:7,代码来源:Udp.cs


示例3: upload

		public void upload(ByteArray vertexProgram, ByteArray fragmentProgram) {
			// convert shaders from AGAL to GLSL
			var glslVertex = AGALConverter.ConvertToGLSL(vertexProgram);
			var glslFragment = AGALConverter.ConvertToGLSL(fragmentProgram);
			// upload as GLSL
			uploadFromGLSL(glslVertex, glslFragment);
		}
开发者ID:robterrell,项目名称:playscript-mono,代码行数:7,代码来源:Program3D.cs


示例4: ToByteArray

 public static byte[] ToByteArray(Int16[] value)
 {
     ByteArray arr = new ByteArray();
     foreach (Int16 val in value)
         arr.Add(ToByteArray(val));
     return arr.array;
 }
开发者ID:Okalmas,项目名称:s7netplus,代码行数:7,代码来源:Int.cs


示例5: Write

    /// <summary>
    /// 将消息体编码
    /// </summary>
    /// <param name="type"></param>
    /// <param name="area"></param>
    /// <param name="command"></param>
    /// <param name="message"></param>
    public void Write(byte type, int area, int command, object message)
    {
        ByteArray ba = new ByteArray();
        ba.Write(type);
        ba.Write(area);
        ba.Write(command);

        if (message != null)
        {
            ba.Write(SerializeUtil.Encode(message));
        }

        //进行黏包处理
        ByteArray arrl = new ByteArray();
        arrl.Write(ba.Length);
        arrl.Write(ba.GetBuff());
        try
        {
            socket.Send(arrl.GetBuff());
        }
        catch(Exception e)
        {
            Debug.Log("网络错误,请重新登录" + e.Message);
        }
    }
开发者ID:dafei2015,项目名称:LOLClient,代码行数:32,代码来源:NetIO.cs


示例6: GenerateByteArray

 public System.Collections.Generic.List<object> GenerateByteArray(byte[] bytes)
 {
     ByteArray data = new ByteArray(bytes);
     System.Collections.Generic.List<object> list = new System.Collections.Generic.List<object>();
     int length = data.ReadInt();
     for (int i = 0; (i < length); i = (i + 1))
     {
         BuildingTemplateVO vo = new BuildingTemplateVO();
         vo.id = data.ReadInt();
         vo.name = data.ReadUTF();
         vo.type = data.ReadInt();
         vo.buildingIndex = data.ReadInt();
         vo.camp = data.ReadInt();
         vo.image = data.ReadUTF();
         vo.levelMap = data.ReadInt();
         vo.affiliation = data.ReadInt();
         vo.openNeedThLevel = data.ReadInt();
         vo.isInitZore = data.ReadInt();
         vo.levelRule = data.ReadInt();
         vo.gold = data.ReadInt();
         vo.wood = data.ReadInt();
         vo.crystal = data.ReadInt();
         vo.stone = data.ReadInt();
         vo.sulfur = data.ReadInt();
         vo.diamond = data.ReadInt();
         vo.upgradeCdTime = data.ReadInt();
         vo.productActorId = data.ReadInt();
         vo.makeCurrencyId = data.ReadInt();
         vo.desc = data.ReadUTF();
         vo.isOpen = data.ReadInt();
         list.Add(vo);
     }
     return list;
 }
开发者ID:wsycarlos,项目名称:ARIA,代码行数:34,代码来源:BuildingTemplateVODataReader.cs


示例7: parseXMLFile

        public static bool parseXMLFile()
        {
            ByteArray bytes = ResourcePool.remove(GameConfig.XML_LIB_URL) as ByteArray;
            if (bytes != null) {
                try {
                    bytes.Uncompress();
                } catch (Exception e) {
                }

                map = new Dictionary<string,object>();
                while (bytes.Length != bytes.Postion) {
                    string name = bytes.readUTF();
                    if(name == "fish.xml"){
                        Debug.Log(name);
                    }
                    int size = bytes.readInt();
                    if (size > bytes.Length)
                    {
                        return false;
                    }
                    ByteArray xmlData;
                    byte[] xmlDataList = new byte[size];
                    bytes.readBytes(xmlDataList, 0, (uint)size);
                    xmlData = new ByteArray(xmlDataList);
                    map[name] = xmlData;
                }
                return true;
            }
            return false;
        }
开发者ID:ucjedpfmd,项目名称:U3DGame,代码行数:30,代码来源:CommonLocator.cs


示例8: GetBytes

 public ByteArray GetBytes()
 {
     if (writeObject == null) throw new Exception("write object is null");
     var byteArray = new ByteArray();
     byteArray.WriteObject(writeObject);
     return byteArray;
 }
开发者ID:jjcz123456,项目名称:CardTK,代码行数:7,代码来源:AMF3Protocol.cs


示例9: ImageSheetModel

 public ImageSheetModel(DeckModel deck, Guid id, SheetDisposition disp, Rectangle bounds, ByteArray md5, int height)
     : base(id, disp, bounds, false, height)
 {
     this.m_MD5 = md5;
     this.m_Deck = deck;
     this.visible_ = true;
 }
开发者ID:kevinbrink,项目名称:CP3_Enhancement,代码行数:7,代码来源:ImageSheetModel.cs


示例10: ByteArray

 public ByteArray(ByteArray src, byte[] data, int pos) {
   if(data==null) {
     return;
   }
   if(src==null) {
     if(pos<0) {
       pos=0;
     }
     _val=new byte[pos+data.Length];
     Buffer.BlockCopy(data, 0, _val, pos, data.Length);
   } else {
     if(pos<0) {  // negative => position from end
       pos=src._val.Length+1+pos;
     }
     if(pos>=src._val.Length) {
       _val=new byte[pos+data.Length];
       Buffer.BlockCopy(src._val, 0, _val, 0, src._val.Length);
       Buffer.BlockCopy(data, 0, _val, pos, data.Length);
     } else if(pos==0) {
       _val=new byte[src._val.Length+data.Length];
       Buffer.BlockCopy(data, 0, _val, 0, data.Length);
       Buffer.BlockCopy(src._val, 0, _val, data.Length, src._val.Length);
     } else {
       _val=new byte[src._val.Length+data.Length];
       Buffer.BlockCopy(src._val, 0, _val, 0, pos);
       Buffer.BlockCopy(data, 0, _val, pos, data.Length);
       Buffer.BlockCopy(src._val, pos, _val, pos+data.Length, src._val.Length-pos);
     }
   }
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:30,代码来源:ByteArray.cs


示例11: GenerateByteArray

 public ByteArray GenerateByteArray(object data)
 {
     List<BuildingTemplateVO> list = data as List<BuildingTemplateVO>;
     ByteArray ba = new ByteArray();
     int length = list.Count;
     ba.WriteInt(length);
     for (int i = 0; (i < length); i = (i + 1))
     {
         ba.WriteInt(list[i].id);
         ba.WriteUTF(list[i].name);
         ba.WriteInt(list[i].type);
         ba.WriteInt(list[i].buildingIndex);
         ba.WriteInt(list[i].camp);
         ba.WriteUTF(list[i].image);
         ba.WriteInt(list[i].levelMap);
         ba.WriteInt(list[i].affiliation);
         ba.WriteInt(list[i].openNeedThLevel);
         ba.WriteInt(list[i].isInitZore);
         ba.WriteInt(list[i].levelRule);
         ba.WriteInt(list[i].gold);
         ba.WriteInt(list[i].wood);
         ba.WriteInt(list[i].crystal);
         ba.WriteInt(list[i].stone);
         ba.WriteInt(list[i].sulfur);
         ba.WriteInt(list[i].diamond);
         ba.WriteInt(list[i].upgradeCdTime);
         ba.WriteInt(list[i].productActorId);
         ba.WriteInt(list[i].makeCurrencyId);
         ba.WriteUTF(list[i].desc);
         ba.WriteInt(list[i].isOpen);
     }
     return ba;
 }
开发者ID:wsycarlos,项目名称:ARIA,代码行数:33,代码来源:BuildingTemplateVODataWriter.cs


示例12: Read

        public void Read(ByteArray inData, AssetHeader assetHeader)
        {
            if (assetHeader.GetVersion() >= 7)
            {
                inData.ReadStringNull();
                attributes = inData.ReadInt();
            }

            int numBaseClasses = inData.ReadInt();
            Debug.Log("numBaseClasses:" + numBaseClasses);
            for (int i = 0; i < numBaseClasses; i++)
            {
                int classID = inData.ReadInt();

                FieldTypeNode node = new FieldTypeNode();
                node.Read(inData);

                typeMap.Add(classID, node);
            }

            // padding
            if (assetHeader.GetVersion() >= 7)
            {
                inData.ReadInt();
            }
        }
开发者ID:hexiaoweiff8,项目名称:AssetBundleReader,代码行数:26,代码来源:MetadataInfo.cs


示例13: UnPack

        public static auto_id UnPack(ByteArray reader)
        {
            auto_id tbl = new auto_id();
            tbl.id = reader.ReadInt32();

            return tbl;
        }
开发者ID:en,项目名称:libunity,代码行数:7,代码来源:NetProto.cs


示例14: TestByteArrayWrite

 public static void TestByteArrayWrite()
 {
     ByteArray ba = new ByteArray();
     ba.write(5);
     ByteArray ba2 = new ByteArray();
     ba2.write(ba.getBuff());
 }
开发者ID:zhaoyabo,项目名称:GameBase,代码行数:7,代码来源:TestMemoryStream.cs


示例15: ReadToMemoryStream

		public static MemoryStream ReadToMemoryStream(this BinaryReader e, int length)
		{
			var o = new ByteArray();

			e.BaseStream.ToByteArray().readBytes(o, 0, (uint)length);

			return o.ToMemoryStream();
		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:8,代码来源:ArchiveExtensions.cs


示例16: LogEventMsgSet

 public LogEventMsgSet(AsyncLogEventInfo asyncLogEvent, ByteArray buffer, MessageBuilder messageBuilder, MessageTransmitter messageTransmitter)
 {
     this.asyncLogEvent = asyncLogEvent;
     this.buffer = buffer;
     this.messageBuilder = messageBuilder;
     this.messageTransmitter = messageTransmitter;
     currentMessage = 0;
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:8,代码来源:LogEventMsgSet.cs


示例17: AppendHeaderBytes

 private void AppendHeaderBytes(ByteArray buffer, LogEventInfo logEvent, Encoding encoding)
 {
     var timestamp = string.Format(CultureInfo.InvariantCulture, TimestampFormat, logEvent.TimeStamp);
     var host = hostnamePolicySet.Apply(hostnameLayout.Render(logEvent));
     var header = $"{timestamp} {host}";
     var headerBytes = encoding.GetBytes(header);
     buffer.Append(headerBytes);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:8,代码来源:Rfc3164.cs


示例18: Write

        public override ByteArray Write()
        {
            ByteArray data = new ByteArray();

            data.WriteInt32(texture);

            return data;
        }
开发者ID:sunag,项目名称:sea3d,代码行数:8,代码来源:TextureTech.cs


示例19: AppendBytes

 private void AppendBytes(ByteArray message, LogEventInfo logEvent, string invalidNamesPattern, EncodingSet encodings)
 {
     AppendNameBytes(message, logEvent, invalidNamesPattern, encodings);
     message.Append(EqualBytes);
     message.Append(QuotesBytes);
     AppendValueBytes(message, logEvent, encodings);
     message.Append(QuotesBytes);
 }
开发者ID:graffen,项目名称:NLog.Targets.Syslog,代码行数:8,代码来源:SdParam.cs


示例20: Read

 public void Read(ByteArray inData)
 {
     name = inData.ReadStringNull();
     offset = inData.ReadUInt();
     size = inData.ReadUInt();
     Debug.Log(string.Format("name={0},offset={1},size={2}",name,offset,size));
     //36+4+4=44
 }
开发者ID:hexiaoweiff8,项目名称:AssetBundleReader,代码行数:8,代码来源:AssetBundleEntryInfo.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ByteArrayBuffer类代码示例发布时间:2022-05-24
下一篇:
C# Byte4类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap