public static NewSyncRequest ModifyProfile(string nickName, byte[] keyBuffer) { UserProfile.Builder upb = new UserProfile.Builder(); upb.SetBitFlag(2); upb.SetUserName(new SKBuiltinString_t.Builder().SetString("")); upb.SetNickName(new SKBuiltinString_t.Builder().SetString(nickName)); upb.SetBindUin(0); upb.SetBindEmail(new SKBuiltinString_t.Builder().SetString("")); upb.SetBindMobile(new SKBuiltinString_t.Builder().SetString("")); upb.SetStatus(0); upb.SetImgLen(0); upb.SetImgBuf(Google.ProtocolBuffers.ByteString.CopyFrom("", Encoding.Default)); upb.SetSex(0); upb.SetProvince(""); upb.SetCity(""); upb.SetSignature(""); upb.SetPersonalCard(1); upb.SetPluginFlag(0); upb.SetPluginSwitch(0); upb.SetAlias(""); upb.SetWeiboNickname(""); upb.SetWeiboFlag(0); upb.SetCountry("CN"); UserProfile upObj = upb.Build(); byte[] byteUp = upObj.ToByteArray(); SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder(); skbb.SetBuffer(ByteString.CopyFrom(byteUp)); skbb.SetILen(byteUp.Length); SKBuiltinBuffer_t skbObj = skbb.Build(); CmdItem.Builder cib = new CmdItem.Builder(); cib.SetCmdBuf(skbObj); cib.SetCmdId(1); CmdItem ciObj = cib.Build(); CmdList.Builder clb = new CmdList.Builder(); clb.SetCount(1); clb.AddList(ciObj); CmdList clObj = clb.Build(); NewSyncRequest.Builder nsrb = new NewSyncRequest.Builder(); nsrb.SetOplog(clObj); nsrb.SetSelector(7); nsrb.SetScene(7); SKBuiltinBuffer_t.Builder skb = new SKBuiltinBuffer_t.Builder(); skb.SetBuffer(ByteString.CopyFrom(keyBuffer)); skb.SetILen(keyBuffer.Length); nsrb.SetKeyBuf(skb.Build()); return(nsrb.Build()); }
public static NewSyncRequest ModifyProfile(string nickName, byte[] keyBuffer) { UserProfile.Builder builder = new UserProfile.Builder(); builder.SetBitFlag(2u); builder.SetUserName(new SKBuiltinString_t.Builder().SetString("")); builder.SetNickName(new SKBuiltinString_t.Builder().SetString(nickName)); builder.SetBindUin(0u); builder.SetBindEmail(new SKBuiltinString_t.Builder().SetString("")); builder.SetBindMobile(new SKBuiltinString_t.Builder().SetString("")); builder.SetStatus(0); builder.SetImgLen(0); builder.SetImgBuf(ByteString.CopyFrom("", Encoding.Default)); builder.SetSex(0); builder.SetProvince(""); builder.SetCity(""); builder.SetSignature(""); builder.SetPersonalCard(1); builder.SetPluginFlag(0); builder.SetPluginSwitch(0); builder.SetAlias(""); builder.SetWeiboNickname(""); builder.SetWeiboFlag(0); builder.SetCountry("CN"); UserProfile userProfile = builder.Build(); byte[] array = userProfile.ToByteArray(); SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder(); builder2.SetBuffer(ByteString.CopyFrom(array)); builder2.SetILen(array.Length); SKBuiltinBuffer_t cmdBuf = builder2.Build(); CmdItem.Builder builder3 = new CmdItem.Builder(); builder3.SetCmdBuf(cmdBuf); builder3.SetCmdId(1); CmdItem value = builder3.Build(); CmdList.Builder builder4 = new CmdList.Builder(); builder4.SetCount(1); builder4.AddList(value); CmdList oplog = builder4.Build(); NewSyncRequest.Builder builder5 = new NewSyncRequest.Builder(); builder5.SetOplog(oplog); builder5.SetSelector(7); builder5.SetScene(7); SKBuiltinBuffer_t.Builder builder6 = new SKBuiltinBuffer_t.Builder(); builder6.SetBuffer(ByteString.CopyFrom(keyBuffer)); builder6.SetILen(keyBuffer.Length); builder5.SetKeyBuf(builder6.Build()); return(builder5.Build()); }