تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
ممكن تحويل الكود من سي شارب لي فيجوال بيسك
#1
حاولت كتير احوله من خلال اكتر من موقع لكن يحدث مشاكل بالكود 

كود :
var client = NewClient();
await client.ConnectAsync();


var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var main = dialogs.Chats.ToList().Where(c => c.GetType() == typeof(TLChannel))
          .Cast<TLChannel>()
          .FirstOrDefault(c => c.Title == (gruopName));
var req = new TLRequestGetFullChannel()
{
  Channel = new TLInputChannel() { AccessHash =(long) main.AccessHash, ChannelId = main.Id }
};

var res = await client.SendRequestAsync<TeleSharp.TL.Messages.TLChatFull>(req);

////we have to do this in slices
var result = new ChannelInfo();
var offset = 0;
while (offset < (res.FullChat as TLChannelFull).ParticipantsCount)
{
  var pReq = new TLRequestGetParticipants()
  {
      Channel = new TLInputChannel() { AccessHash = main.AccessHash.Value, ChannelId = main.Id },
      Filter = new TLChannelParticipantsRecent() { },
      Limit = 200,
      Offset = offset
  };
  var pRes = await client.SendRequestAsync<TLChannelParticipants>(pReq);

  result.Users.AddRange(pRes.Users.ToList().Cast<TLUser>());
  offset += 200;
  await Task.Delay(500);
}
الرد
تم الشكر بواسطة:
#2
طبيعي يحصل مشاكل فى الكود بس شوف ايه هيه المشاكل وعدلها
او قول ايه المشاكل الموجوده عشان نقدر نساعدك

(20-02-21, 09:33 AM)اليوم السابع كتب : حاولت كتير احوله من خلال اكتر من موقع لكن يحدث مشاكل بالكود 

كود :
var client = NewClient();
await client.ConnectAsync();


var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var main = dialogs.Chats.ToList().Where(c => c.GetType() == typeof(TLChannel))
          .Cast<TLChannel>()
          .FirstOrDefault(c => c.Title == (gruopName));
var req = new TLRequestGetFullChannel()
{
  Channel = new TLInputChannel() { AccessHash =(long) main.AccessHash, ChannelId = main.Id }
};

var res = await client.SendRequestAsync<TeleSharp.TL.Messages.TLChatFull>(req);

////we have to do this in slices
var result = new ChannelInfo();
var offset = 0;
while (offset < (res.FullChat as TLChannelFull).ParticipantsCount)
{
  var pReq = new TLRequestGetParticipants()
  {
      Channel = new TLInputChannel() { AccessHash = main.AccessHash.Value, ChannelId = main.Id },
      Filter = new TLChannelParticipantsRecent() { },
      Limit = 200,
      Offset = offset
  };
  var pRes = await client.SendRequestAsync<TLChannelParticipants>(pReq);

  result.Users.AddRange(pRes.Users.ToList().Cast<TLUser>());
  offset += 200;
  await Task.Delay(500);
}
طبيعي يحصل مشاكل فى الكود بس شوف ايه هيه المشاكل وعدلها

او قول ايه المشاكل الموجوده عشان نقدر نساعدك
عموما جرب ده 

كود :
Dim client As var = NewClient

While (offset < CType(res.FullChat,TLChannelFull).ParticipantsCount)
   Dim pReq = New TLRequestGetParticipants
   Dim pRes = client.SendRequestAsync(Of TLChannelParticipants)(pReq)
   result.Users.AddRange(pRes.Users.ToList.Cast)
   offset = (offset + 200)
   Task.Delay(500)
   
End While


   
   Function client_ConnectAsync_(() As await Implements client.ConnectAsync.(
   End Function
   
   Private dialogs As var = CType(await,TLDialogs)
   
   Private main As var = dialogs.Chats.ToList.Where(() => {  }, (c.GetType = GetType(TLChannel))).Cast.FirstOrDefault(() => {  }, (c.Title = gruopName))
   
   Private req As var = New TLRequestGetFullChannel
   
   Private res As var = client.SendRequestAsync(Of TeleSharp.TL.Messages.TLChatFull)(req)
   
   '''/we have to do this in slices
   Private result As var = New ChannelInfo
   
   Private offset As var = 0
الرد
تم الشكر بواسطة:
#3
Dim client = NewClient()
Await client.ConnectAsync()


Dim dialogs = CType(Await, TLDialogs) client.GetUserDialogsAsync()
Dim main = dialogs.Chats.ToList().Where(Function© c.GetType() Is GetType(TLChannel)).Cast(Of TLChannel)().FirstOrDefault(Function© c.Title = (gruopName))
Dim req = New TLRequestGetFullChannel() With { _
.Channel = New TLInputChannel() With { _
.AccessHash =CLng(Fix(main.AccessHash)), _
.ChannelId = main.Id _
} _
}

Dim res = Await client.SendRequestAsync(Of TeleSharp.TL.Messages.TLChatFull)(req)
الرد
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم