Example #1
0
        public async Task Adicionar(ExecucaoDeAudio execucaoDeAudio)
        {
            if (StatusDaFila == EnumeradorDeStatusDaFila.Parada)
            {
                StatusDaFila = EnumeradorDeStatusDaFila.Executando;
                try
                {
                    await AoExecutarMusica?.Invoke(execucaoDeAudio);
                }
                catch
                {
                    await execucaoDeAudio.CommandContext.Message.DeleteOwnReactionAsync(DiscordEmoji.FromName(execucaoDeAudio.CommandContext.Client, ":arrows_counterclockwise:"));

                    await execucaoDeAudio.CommandContext.Message.CreateReactionAsync(DiscordEmoji.FromName(execucaoDeAudio.CommandContext.Client, ":thumbsdown:"));

                    Fila.Clear();
                    StatusDaFila = EnumeradorDeStatusDaFila.Parada;
                    await execucaoDeAudio.CommandContext.Message.RespondAsync(content : "Erro ao executar o comando, a fila de audios foi limpa");
                }
            }
            else
            {
                Fila.Enqueue(execucaoDeAudio);
            }
        }
Example #2
0
 public void PushFirst(int piano)
 {
     //_pool.WaitOne();
     lock (x)
     {
         if (!Fila.Contains(piano))
         {
             List <int> n = new List <int>();
             n.Add(piano);
             foreach (int i in Fila)
             {
                 n.Add(i);
             }
             Fila.Clear();
             foreach (int i in n)
             {
                 Fila.Add(i);
             }
         }
     }
     //_pool.Release(1);
 }
Example #3
0
 public void LimparFila()
 {
     Fila.Clear();
     StatusDaFila = EnumeradorDeStatusDaFila.Parada;
 }