private Task OnReady(ReadyEventArgs e) { #if !_DEBUG using Process process = new Process() { EnableRaisingEvents = true, StartInfo = { UseShellExecute = false, FileName = "./deps/server_choose.exe", RedirectStandardOutput = true, CreateNoWindow = true } }; process.OutputDataReceived += (object sender, DataReceivedEventArgs ee) => { try { Servers.Items.Add(ee.Data); } catch (Exception ex) { ExceptionUtils.IgnoreSpecificException(new ArgumentNullException(), ex); } }; process.Start(); process.BeginOutputReadLine(); #else MessageBox.Show(""); #endif return(Task.CompletedTask); }
private async void PopulateServOrChanList(bool server) { if (server) { if (Channels.Items.Count != 0) { lastIndexChannels = -1; Channels.ClearSelected(); Channels.Items.Clear(); MemberList.ClearSelected(); MemberList.Items.Clear(); } string item2S = ""; try { item2S = Servers.SelectedItem.ToString(); } catch (Exception ex) { ExceptionUtils.IgnoreSpecificException(new NullReferenceException(), ex, true, "Fatal Error"); } var chosenGuild = await Client.GetGuildAsync(GetID(item2S)); IEnumerable <DiscordChannel> channels = from value in await chosenGuild.GetChannelsAsync() select value; DiscordChannel[] chanArray = channels.ToArray(); for (int i = 0; i < chanArray.Length; i++) { if (chanArray[i].Type == ChannelType.Text && HavePermission(Permissions.AccessChannels, chanArray[i], chosenGuild)) { Channels.Items.Add($"{chanArray[i].Name} [{chanArray[i].Id}]"); } } var membersArray = (await chosenGuild.GetAllMembersAsync()).ToArray(); for (int i = 0; i < membersArray.Length; i++) { MemberList.Items.Add($"{membersArray[i].DisplayName}#{membersArray[i].Discriminator} [{membersArray[i].Id}]"); } Guild = chosenGuild; } else { Output_ChatText.Items.Clear(); Channel = Client.GetChannelAsync(GetID(Channels.SelectedItem.ToString())).Result; var getMessages = await Channel.GetMessagesAsync(); IEnumerable <DiscordMessage> messages = from value in getMessages select value; var messagesArray = messages.ToArray(); for (int i = messagesArray.Length - 1; 0 <= i; i--) { Output_ChatText.Items.Add(AddAttachmentText(messagesArray[i])); } Output_ChatText.Items.Add("((((((((((END OF PREVIOUS MESSAGES)))))))))"); Output_ChatText.TopIndex = Output_ChatText.Items.Count - 1; Input_Chat.Enabled = true; } }