Ejemplo n.º 1
0
        /// <summary>
        /// Authenticates to the service.
        /// <param name="username">the username.</param>
        /// <param name="password">the password.</param>
        /// </summary>
        private MSG Auth(string username, string password)
        {
            var svc = new proxy.ComposantServiceClient();

            svc.ClientCredentials.Windows.ClientCredential.Domain   = "WORKGROUP";
            svc.ClientCredentials.Windows.ClientCredential.UserName = "******";
            svc.ClientCredentials.Windows.ClientCredential.Password = "******";

            proxy.MSG msg = new proxy.MSG()
            {
                appVersion       = "1.0",
                info             = "[username, password]",
                operationName    = "Auth",
                operationVersion = "1.0",
                tokenApp         = MainWindow.tokenApp,
                statut_Op        = true,
                tokenUser        = "******",
                data             = new object[] { username, password }
            };

            try {
                return(svc.m_service(msg));
            } catch (Exception exc) {
                Console.WriteLine(exc.Message);
                msg.statut_Op = false;
                msg.info      = "Error contacting the server";
                return(msg);
            }
        }
Ejemplo n.º 2
0
        private proxy.MSG Decrypt(List <object> data)
        {
            // Creates the service.
            var svc = new proxy.ComposantServiceClient();

            svc.ClientCredentials.Windows.ClientCredential.Domain   = "WORKGROUP";
            svc.ClientCredentials.Windows.ClientCredential.UserName = "******";
            svc.ClientCredentials.Windows.ClientCredential.Password = "******";

            // Creates the msg to send to the service.
            proxy.MSG msg = new proxy.MSG()
            {
                appVersion       = "1.0",
                statut_Op        = true,
                operationVersion = "1.0",
                tokenApp         = MainWindow.tokenApp,
                tokenUser        = MainWindow.tokenUser,
                operationName    = "Decrypt",
                info             = "[[fileName, fileContent]]",
                data             = data.ToArray()
            };

            try {
                return(svc.m_service(msg));
            } catch (Exception exc) {
                Console.WriteLine(exc.Message);
                msg.statut_Op = false;
                msg.info      = "Error contacting the server";
                return(msg);
            }
        }