/// <summary>Creates a new client. A client can manage one connection to a server.</summary> /// <param name="dispatcherType">The message processing method for incomming notifications. /// See <see cref="EventDispatchType"/> for further information about each type.</param> public TsFullClient(DedicatedTaskScheduler?scheduler = null) { status = TsClientStatus.Disconnected; msgProc = new AsyncMessageProcessor(MessageHelper.GetToClientNotificationType); this.scheduler = scheduler ?? new DedicatedTaskScheduler(Id.Null); this.isOwnScheduler = scheduler is null; }
public Core(DedicatedTaskScheduler scheduler, string?configFilePath = null) { this.scheduler = scheduler; // setting defaults this.configFilePath = configFilePath ?? FilesConst.CoreConfig; injector = new CoreInjector(); }
public static int Main(string[] args) { Thread.CurrentThread.Name = "TAB Main"; Tools.SetLogId("Core"); var parsedArgs = new Parser(with => { with.AutoHelp = true; with.AutoVersion = false; }).ParseArguments <ParameterData?>(args); ParameterData?setup = parsedArgs.MapResult(ok => ok, _ => null); if (setup is null) { Console.WriteLine(HelpText.AutoBuild(parsedArgs, h => { h.Heading = $"TS3AudioBot {SystemData.AssemblyData}"; h.Copyright = ""; return(HelpText.DefaultParsingErrorsHandler(parsedArgs, h)); })); return(ExitCodeMalformedArguments); } if (setup.ShowVersion) { Console.WriteLine(SystemData.AssemblyData.ToLongString()); return(ExitCodeOk); } if (setup.ShowStatsExample) { Console.WriteLine("The bot will contribute to the stats counter about once per day."); Console.WriteLine("We do NOT store any IP or identifiable information."); Console.WriteLine("Please keep this feature enabled to help us improve and grow."); Console.WriteLine("An example stats packet looks like this:"); Console.WriteLine(Stats.CreateExample()); return(ExitCodeOk); } SetupLog(); if (!SetupLibopus()) { return(ExitCodeLibopusLoadError); } if (setup.Llgc) { EnableLlgc(); } if (!setup.HideBanner) { LogHeader(); } DedicatedTaskScheduler.FromCurrentThread(() => StartBot(setup)); return(ExitCodeOk); }
public Player(ConfRoot confRoot, ConfBot config, DedicatedTaskScheduler scheduler, Id id) { this.scheduler = scheduler; FfmpegProducer = new FfmpegProducer(confRoot.Tools.Ffmpeg, scheduler, id); StallCheckPipe = new StallCheckPipe(); VolumePipe = new VolumePipe(); Volume = config.Audio.Volume.Default; EncoderPipe = new EncoderPipe(SendCodec) { Bitrate = ScaleBitrate(config.Audio.Bitrate) }; TimePipe = new PreciseTimedPipe(EncoderPipe, id) { ReadBufferSize = EncoderPipe.PacketSize }; MergePipe = new PassiveMergePipe(); config.Audio.Bitrate.Changed += (s, e) => EncoderPipe.Bitrate = ScaleBitrate(e.NewValue); MergePipe.Into(TimePipe).Chain <CheckActivePipe>().Chain(StallCheckPipe).Chain(VolumePipe).Chain(EncoderPipe); }
public Stats(ConfRoot conf, DbStore database, BotManager botManager, DedicatedTaskScheduler scheduler) { this.conf = conf; this.database = database; this.botManager = botManager; uploadParamEnabled = true; runtimeLastTrack = Tools.Now; ticker = scheduler.CreateTimer(TrackPoint, CheckInterval, false); meta = database.GetMetaData(StatsTable); trackEntries = database.GetCollection <StatsData>(StatsTable); trackEntries.EnsureIndex(x => x.Id, true); trackEntries.EnsureIndex(x => x.Time); accEntries = database.GetCollection <StatsData>(StatsTableAcc); accEntries.EnsureIndex(x => x.Id, true); if (meta.Version != StatsVersion || meta.CustomData is null) { statsPoints = new StatsMeta { LastSend = Tools.Now, }; meta.Version = StatsVersion; UpdateMeta(); } else { statsPoints = JsonConvert.DeserializeObject <StatsMeta>(meta.CustomData, JsonSettings) ?? new StatsMeta(); // Upgrade steps here } overallStats = accEntries.FindById(OverallId) ?? new StatsData { Id = OverallId }; }
public SystemMonitor(DedicatedTaskScheduler scheduler) { _ = scheduler.CreateTimer(CreateSnapshot, TimeSpan.FromSeconds(1), true); }
public FfmpegProducer(ConfToolsFfmpeg config, DedicatedTaskScheduler scheduler, Id id) { this.config = config; this.scheduler = scheduler; this.id = id; }