public Squad(StarSonataApi.StarSonataApi ssApi) { this.ssApi = ssApi; SquadThread = Channel.CreateUnbounded <Func <Task> >(); InviteEveryone = false; _ = Task.Run( async() => { while (await SquadThread.Reader.WaitToReadAsync()) { if (SquadThread.Reader.TryRead(out var func)) { if (this.IsCancelled) { continue; } await func(); await Task.Delay(TimeSpan.FromMilliseconds(1000)); } } }); if (File.Exists(filePath)) { var definition = new { squadLeader = "", memberList = new List <string>() }; using (StreamReader file = File.OpenText(filePath)) { var fileData = JsonConvert.DeserializeAnonymousType(file.ReadToEnd(), definition); this.SquadActive = true; this.SquadLeader = fileData.squadLeader; this.InvitedSquadMembers = fileData.memberList; } } }
public void SetSSApi(StarSonataApi.StarSonataApi ssApi) { this.ssApi = ssApi; }