static async Task Main(string[] args) { UniversalClient _client = GetUniversalClient(); string valueTitle = "VermeerVersion"; UniversalPacket getValueCommand = new UniversalPacket( new Header() { status = UniversalPacket.HTTPSTATUS.GET }, new Message() { Data = JsonConvert.SerializeObject(new string[] { "userdatabase", "getvalue", valueTitle }), IsEncrypted = true }, _client.GetSignature); UniversalServerPacket serverReturn = _client.SendMessage(getValueCommand); switch (serverReturn.Message.ToUpper()) { case "UNAUTHORIZED": break; case "UNKNOWNCOMMAND": break; case "USRDBS_GETVALUE_VALUEEXIST": break; default: break; } }
private static UniversalClient GetUniversalClient() { UniversalClient client = new UniversalClient(); client.ConnectToRemoteServer(serverIP, serverPort); return(client); }
public MainView() : base("MainView") { UniversalClient client = (App.Current as App).Client; this.InitializeComponent(); FileUploader uploader = new FileUploader(); ViewModel = new MainViewModel(this, new PackageOut(client), client, SynchronizationContext.Current); ViewModel.SetUploader(uploader); DataContext = ViewModel; }
static void Main(string[] args) { UniversalClient client = new UniversalClient(false); client.ConnectToRemoteServer("localhost", 7777); Console.WriteLine("Connected to a local universal server on port 7875"); Thread.Sleep(3); client.SendCommand("dyn", new string[] { "AddProject", "UniversalServer", "4.3.4", "123", "*****@*****.**" }); string s = client.WaitForResult(); Console.WriteLine(s); }
public void CheckUpdate(string ServerIP, int ServerPort) { //Checks if UniversalAPI is installed. if (!CheckUniversalAPI()) { Console.WriteLine("Universal API is currently not installed!"); } //Set private vars ApplicationVersion = Application.ProductVersion; ApplicationName = Application.ProductName.Replace(" ", "_"); //Initialize the update server UpdateServer = new UniversalClient(false); //Connect to the vortex studio update server UpdateServer.ConnectToRemoteServer(ServerIP, ServerPort); //Check if the project exist's string ProjectCheck = UpdateServer.SendCommand("Dyn", new string[] { "CHECKPROJECTNAME", ApplicationName }); if (ProjectCheck == "CHECKPROJECT_FALSE") { string CreateProject = UpdateServer.SendCommand("Dyn", new string[] { "ADDPROJECT", ApplicationName, ApplicationVersion, "test:test", "*****@*****.**" }); } //Get the application version string ServerVersion = UpdateServer.SendCommand("Dyn", new string[] { "GETVERSION", ApplicationName }); if (ServerVersion == ApplicationVersion) { //Does nothing } else { //Continues with the update //Sets the quote string const string quote = "\""; //Starts the process Process.Start(UniversalApiDirectory + UniversalApplicationName, quote + Application.ProductName + quote + " " + quote + Application.StartupPath + quote + " " + quote + _updateURLlocation + quote); } }
private void CheckForSystemUpdate() { MoonbyteServerConnection = new UniversalClient(false); if (!settingsFramework.CheckSetting("UPDATEP")) { settingsFramework.EditSetting("UPDATEP", true.ToString()); } if (settingsFramework.ReadSetting("UPDATEP") == true.ToString()) { string IP = "moonbyte.us"; string externalip = new WebClient().DownloadString("http://icanhazip.com"); if (externalip.Contains(Dns.GetHostAddresses(new Uri("http://moonbyte.us").Host)[0].ToString())) { IP = "192.168.0.16"; } MoonbyteServerConnection.ConnectToRemoteServer(IP, 7777); AssemblyFileVersionAttribute UPFVersion = typeof(UniversalPluginFramework).GetTypeInfo().Assembly.GetCustomAttribute <AssemblyFileVersionAttribute>(); AssemblyFileVersionAttribute UCVersion = typeof(UniversalClient).GetTypeInfo().Assembly.GetCustomAttribute <AssemblyFileVersionAttribute>(); string CurrentVersion = MoonbyteServerConnection.SendCommand("dyn", new string[] { "GetVersion", "UniversalServer" }); Assembly assembly = Assembly.GetExecutingAssembly(); string Version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion; if (Version != CurrentVersion) { ILogger.AddToLog("WARN", "Universal Server is currently out of date! Current version installed : " + Version); ILogger.AddToLog("WARN", "With UniversalServer not updated, some plugins and features may not work correctly."); ILogger.AddToLog("WARN", "Please install the updated version " + CurrentVersion); } else { ILogger.AddToLog("INFO", "Universal Server - Version " + Version + ", is currently up to date!"); } ILogger.AddWhitespace(); ILogger.AddToLog("INFO", "UniversalPluginFramework version " + UPFVersion.Version); ILogger.AddToLog("INFO", "UniversalClient version " + UCVersion.Version); ILogger.AddWhitespace(); } }