Luski.Net/Luski.net/Server.old.Globals.cs

97 lines
3.4 KiB
C#
Raw Normal View History

/*using Luski.net.Enums;
using Luski.net.Interfaces;
using Luski.net.JsonTypes;
using Luski.net.Sockets;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using WebSocketSharp;
namespace Luski.net;
public sealed partial class Serverold
{
internal static string JT
{
get
{
string tmp = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "JacobTech");
if (OperatingSystem.IsLinux())
{
tmp = Path.Combine(Environment.GetEnvironmentVariable("HOME")!, ".config/");
tmp += "JacobTech";
}
return tmp;
}
}
internal static SocketAudioClient? AudioClient = null;
internal static string? Token = null, Error = null;
internal static bool CanRequest = false;
internal static SocketAppUser? _user;
internal static string platform = "win-x64";
internal static Branch Branch;
internal static double Percent = 0.5;
private static WebSocket? ServerOut;
private static string? gen = null;
private static bool login = false;
public static SocketServer CurrentServer = null!;
internal static string Cache
{
get
{
if (gen is null)
{
if (!Directory.Exists(JT)) Directory.CreateDirectory(JT);
string path = JT + "/Luski/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += Branch.ToString() + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += platform + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += "Data/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += _user?.Id + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += "Cache/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += Path.GetRandomFileName() + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
gen = path;
}
if (!Directory.Exists($"{gen}/avatars")) Directory.CreateDirectory($"{gen}/avatars");
if (!Directory.Exists($"{gen}/channels")) Directory.CreateDirectory($"{gen}/channels");
return gen;
}
}
internal static List<IUser> poeople = new();
internal static List<SocketChannel> chans { get; set; } = new();
internal static string GetKeyFilePath
{
get
{
return GetKeyFilePathBr(Branch.ToString());
}
}
internal static string GetKeyFilePathBr(string br)
{
if (!Directory.Exists(JT)) Directory.CreateDirectory(JT);
string path = JT + "/Luski/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += br + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += platform + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += "Data/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += _user?.Id + "/";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
path += "keys.lsk";
return path;
}
}
*/