private void TableStatusUsers_Load(object sender, EventArgs e) { ServerMethods.CreateServer(IPAddress.Parse(loginS.IPAddress), loginS.Port); SetButtons(); listViewUsers.Enabled = false; listViewHistory.Enabled = false; }
public static void Main() { if (!File.Exists("PublicKey.key")) { // Assume first run, generate keys and sign document. ServerMethods.GenerateKeyPair(); var input = new XmlDocument(); input.Load("input.xml"); Debug.Assert(input.DocumentElement != null); var licNode = input.DocumentElement["lic"]; Debug.Assert(licNode != null); var licNodeXml = licNode.OuterXml; var signedNode = input.CreateElement("signature"); signedNode.InnerText = ServerMethods.CalculateSignature(licNodeXml); input.DocumentElement.AppendChild(signedNode); input.Save("output.xml"); } if (ClientMethods.IsValidLicense("output.xml")) { Console.WriteLine("VALID"); } else { Console.WriteLine("INVALID"); } }
private void btnDisconnect_Click(object sender, EventArgs e) { try { ServerMethods.CloseServer(); } catch (Exception) { MessageBox.Show("Server failed to disconnect"); } SetButtons(); }
private void btnConnect_Click(object sender, EventArgs e) { try { ServerMethods.CreateServer(IPAddress.Parse(loginS.IPAddress), loginS.Port); } catch (Exception) { MessageBox.Show("Server failed to connect"); } SetButtons(); listViewUsers.Enabled = false; listViewHistory.Enabled = false; //לתקן //counting number of connected clients //int count = 0; //foreach (var client in ) //{ // count++; //} //this.Text = count + " Connected Users"; }
public void create_document_on_save() { // Arrange string partName = Guid.NewGuid().ToString("N"); Item context = Inn.newItem("Part", "add"); context.setProperty("item_number", partName); context = context.apply(); var item = new ServerMethods(context); Item doc = Inn.newItem("Document", "get"); doc.setProperty("item_number", partName); // Act var res = item.create_document_on_save(); doc = doc.apply(); // Assert Assert.False(res.isError()); Assert.False(doc.isError()); Assert.False(doc.isCollection()); Assert.False(string.IsNullOrWhiteSpace(doc.getID())); }
public T Call <T>(ServerMethods serverMethod, string messageBeforeCall, string messageAfterSuccess, params object[] args) { return(Call <T>(serverMethod.ToString(), messageBeforeCall, messageAfterSuccess, args)); }
public void Call(ServerMethods serverMethod, string messageBeforeCall, string messageAfterSuccess, params object[] args) { Call(serverMethod.ToString(), messageBeforeCall, messageAfterSuccess, args); }