From bdb1e350f6db63d6e8f74c989504ab8a516a80b3 Mon Sep 17 00:00:00 2001 From: JacobTech Date: Mon, 3 Jul 2023 23:26:16 -0400 Subject: [PATCH] Upkeeping This push is just to prevent a merge conflict for myself. --- Luski/GUI/MainScreen.cs | 26 ++++++++++++++---------- Luski/GUI/MainScreen/UI/Chat.cs | 5 +++-- Luski/GUI/MainScreen/UI/ChatMessage.cs | 3 ++- Luski/GUI/MainScreen/UI/Friend.cs | 3 ++- Luski/GUI/MainScreen/UI/FriendRequest.cs | 3 ++- Luski/Luski.csproj | 4 ++-- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Luski/GUI/MainScreen.cs b/Luski/GUI/MainScreen.cs index 2282b5d..a3ed2da 100644 --- a/Luski/GUI/MainScreen.cs +++ b/Luski/GUI/MainScreen.cs @@ -105,16 +105,12 @@ public class MainScreen : Window }); t.Start(); - WindowLoaded += OnWindowLoadedd; - } - - private Task OnWindowLoadedd(Window arg) - { - return Task.CompletedTask; + WindowLoaded += OnWindowLoaded; } + private Task OnWindowLoaded(Window arg) { - if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient().GetAsync($"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch={Globals.UpdaterSettings.Branch}&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}").Result.Content.ReadAsStringAsync().Result != FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion) + if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient().GetAsync($"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch={Globals.UpdaterSettings.Branch.ToString()}&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}").Result.Content.ReadAsStringAsync().Result != FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion) { var update = new UpdateWindow(); var result = update.ShowDialogue(this); @@ -206,13 +202,15 @@ public class MainScreen : Window channelCancellationToken.Cancel(false); } channelCancellationToken = new CancellationTokenSource(); - Globals.Luski.ChangeChannel(arg.Channel.Id, channelCancellationToken.Token).Wait(); + Globals.Luski.ChangeChannel(arg.Channel.Id, channelCancellationToken.Token, Globals.Luski.CurrentUser.Servers.First()).Wait(); Invoke(new Action(() => { chat!.Clear(); })); IReadOnlyList messages = arg.Channel.GetMessages(channelCancellationToken.Token, Globals.Settings.LoadPerChannel).Result; - + + + foreach (SocketMessage message in messages.Reverse()) { if (channelCancellationToken is null || channelCancellationToken.Token.IsCancellationRequested) return; @@ -260,11 +258,17 @@ public class MainScreen : Window BackgroundColor = new Color4(34, 34, 34, 255); Rectangle u=new Rectangle(TextureManager.AddTexture(Tools.GetResourceBytes(Assembly.GetExecutingAssembly(), "Luski.Resources.Textures.Status.png"))) { Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Size = new((int)(46 * Globals.Settings.Scale)), Location = new((int)(62 * Globals.Settings.Scale), (int)(812 * Globals.Settings.Scale))}; - Texture uut = TextureManager.AddTexture(Globals.Luski.CurrentUser.GetAvatar(CancellationToken.None).Result); + Texture uut = TextureManager.AddTexture(Globals.Luski.CurrentUser.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result); uut.Unit = TextureUnit.Texture1; u.Shader = Rectangle.DefaultAlphaTextureShader[Context]; u.Textures.Add(uut); Controls.Add(u); + Globals.Luski.CurrentUser.AddServer(SocketServer.GetServer("TCLL.LuskiServers.JacobTech.com")); + foreach (SocketServer Server in Globals.Luski.CurrentUser.Servers) + { + Console.WriteLine("Loading Server: {0}", Server.Domain); + //add server to UI + } Label ul = new Label(){ Font = Globals.DefaultFont, Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Location = new(0, (int)(826 * Globals.Settings.Scale)), Text = Globals.Luski.CurrentUser.Username}; FlowLayout ser; ul.Location = new((int)(112 * Globals.Settings.Scale), @@ -322,7 +326,7 @@ public class MainScreen : Window } Console.WriteLine("Channels done in " + (DateTime.Now - start).TotalSeconds + " seconds"); - SocketTextChannel chan = Globals.Luski.GetChannel(Globals.Luski.CurrentUser.SelectedChannel, CancellationToken.None).Result; + SocketTextChannel chan = Globals.Luski.GetChannel(Globals.Luski.CurrentUser.SelectedChannel, CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result; chat.UpdateTitle(chans.First(s => s.Channel.Id == chan.Id)); chat.MessageFlow.BlockDraw = true; try diff --git a/Luski/GUI/MainScreen/UI/Chat.cs b/Luski/GUI/MainScreen/UI/Chat.cs index 3d349f5..ec6b950 100644 --- a/Luski/GUI/MainScreen/UI/Chat.cs +++ b/Luski/GUI/MainScreen/UI/Chat.cs @@ -3,6 +3,7 @@ using GraphicsManager.Interfaces; using GraphicsManager.Objects; using GraphicsManager.Objects.Core; using Luski.GUI.MainScreen.Interfaces; +using Luski.net; using Luski.net.Enums; using Luski.net.JsonTypes; using OpenTK.Mathematics; @@ -46,7 +47,7 @@ public class Chat : UserControl BorderColor = Color4.DarkCyan, Location = new((int)(10 * Globals.Settings.Scale), (int)(824 * Globals.Settings.Scale)), Size = new((int)(960 * Globals.Settings.Scale), (int)(34 * Globals.Settings.Scale)), - Anchor = ObjectAnchor.All + Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right }); tb.KeyPress += TbOnKeyPress; Globals.Luski.MessageReceived += LuskiOnMessageReceived; @@ -62,7 +63,7 @@ public class Chat : UserControl private void Thr() { - Globals.Luski.SendMessage(tb.Text, Channel!.Id, CancellationToken.None); + Globals.Luski.SendMessage(tb.Text, Channel!.Id, Globals.Luski.CurrentUser.Servers.First(), CancellationToken.None); Window!.Invoke(() => { tb.Text = string.Empty; }); } diff --git a/Luski/GUI/MainScreen/UI/ChatMessage.cs b/Luski/GUI/MainScreen/UI/ChatMessage.cs index 7f6fdae..a3e620e 100644 --- a/Luski/GUI/MainScreen/UI/ChatMessage.cs +++ b/Luski/GUI/MainScreen/UI/ChatMessage.cs @@ -4,6 +4,7 @@ using GraphicsManager.Enums; using GraphicsManager.Interfaces; using GraphicsManager.Objects; using GraphicsManager.Objects.Core; +using Luski.net; using Luski.net.Enums; using Luski.net.Interfaces; using Luski.net.JsonTypes; @@ -52,7 +53,7 @@ public class ChatMessage : UserControl Controls.Add(new Label() { Scale = 0.8f, Font = Globals.DefaultFont, Location = new(label1.Location.X + label1.Size.X + 4, label1.Location.Y), Text = timestr}); Rectangle r = new Rectangle(tm.AddTexture(Tools.GetResourceBytes(Assembly.GetExecutingAssembly(), "Luski.Resources.Textures.Status.png"))) { Location = new((int)(10 * Globals.Settings.Scale), (int)(2 * Globals.Settings.Scale)), Size = new((int)(38 * Globals.Settings.Scale)) }; - Texture tex = tm.AddTexture(user.GetAvatar(CancellationToken.None).Result); + Texture tex = tm.AddTexture(user.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result); tex.Unit = TextureUnit.Texture1; r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; r.Textures.Add(tex); diff --git a/Luski/GUI/MainScreen/UI/Friend.cs b/Luski/GUI/MainScreen/UI/Friend.cs index c292a75..baea8c5 100644 --- a/Luski/GUI/MainScreen/UI/Friend.cs +++ b/Luski/GUI/MainScreen/UI/Friend.cs @@ -5,6 +5,7 @@ using GraphicsManager.Objects; using GraphicsManager.Objects.Core; using Luski.GUI.MainScreen.Interfaces; using Luski.GUI.Windows; +using Luski.net; using Luski.net.Enums; using Luski.net.JsonTypes; using OpenTK.Graphics.OpenGL4; @@ -54,7 +55,7 @@ public class Friend : UserControl, IChannelPick UserStatus.Offline or UserStatus.Invisible or _ => Color4.LightGray }; r = new Rectangle(this.rr.Textures.First()) { Location = new(this.rr.Location.X + 4,this.rr.Location.Y + 4), Size = new(this.rr.Size.X - 8)}; - Texture t = Globals.ms.TextureManager.AddTexture(person.GetAvatar(CancellationToken.None).Result); + Texture t = Globals.ms.TextureManager.AddTexture(person.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result); t.Unit = TextureUnit.Texture1; r.Textures.Add(t); r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; diff --git a/Luski/GUI/MainScreen/UI/FriendRequest.cs b/Luski/GUI/MainScreen/UI/FriendRequest.cs index 9851c22..ebc5a4b 100644 --- a/Luski/GUI/MainScreen/UI/FriendRequest.cs +++ b/Luski/GUI/MainScreen/UI/FriendRequest.cs @@ -4,6 +4,7 @@ using GraphicsManager.Enums; using GraphicsManager.Interfaces; using GraphicsManager.Objects; using GraphicsManager.Objects.Core; +using Luski.net; using Luski.net.Enums; using Luski.net.JsonTypes; using OpenTK.Graphics.OpenGL4; @@ -31,7 +32,7 @@ public class FriendRequest : UserControl Size = new ((int)(42 * Globals.Settings.Scale)) }); rr.BackgroundColor = BackgroundColor; - Texture t = Globals.ms.TextureManager.AddTexture(User.GetAvatar(CancellationToken.None).Result); + Texture t = Globals.ms.TextureManager.AddTexture(User.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result); t.Unit = TextureUnit.Texture1; rr.Textures.Add(t); rr.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; diff --git a/Luski/Luski.csproj b/Luski/Luski.csproj index 72c308c..d9e4235 100644 --- a/Luski/Luski.csproj +++ b/Luski/Luski.csproj @@ -5,7 +5,7 @@ net6.0 enable enable - 1.1.0.0 + 1.1.0.1 JacobTech, LLC @@ -20,7 +20,7 @@ - +