Esempio n. 1
0
 private void TableStatusUsers_Load(object sender, EventArgs e)
 {
     ServerMethods.CreateServer(IPAddress.Parse(loginS.IPAddress), loginS.Port);
     SetButtons();
     listViewUsers.Enabled   = false;
     listViewHistory.Enabled = false;
 }
Esempio n. 2
0
 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");
     }
 }
Esempio n. 3
0
 private void btnDisconnect_Click(object sender, EventArgs e)
 {
     try
     {
         ServerMethods.CloseServer();
     }
     catch (Exception)
     {
         MessageBox.Show("Server failed to disconnect");
     }
     SetButtons();
 }
Esempio n. 4
0
        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";
        }
Esempio n. 5
0
        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()));
        }
Esempio n. 6
0
 public T Call <T>(ServerMethods serverMethod, string messageBeforeCall, string messageAfterSuccess, params object[] args)
 {
     return(Call <T>(serverMethod.ToString(), messageBeforeCall, messageAfterSuccess, args));
 }
Esempio n. 7
0
 public void Call(ServerMethods serverMethod, string messageBeforeCall, string messageAfterSuccess, params object[] args)
 {
     Call(serverMethod.ToString(), messageBeforeCall, messageAfterSuccess, args);
 }