Exemplo n.º 1
0
 public static bool ChangePassword(Configuration config_, string newPassword, out string error)
 {
     Session session = new Session( config_, FakeProcessAnswer);
     if (!session.Connect())
     {
         error = session.GetLastError();
         return false;
     }
     if (!session.DoChangePassword( config_.password, newPassword))
     {
         error = session.GetLastError();
         return false;
     }
     session.Shutdown();
     session.Close();
     error = null;
     return true;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {
                string relativeSslCertPath = "..\\..\\..\\..\\..\\..\\examples\\demo\\tutorial\\step4a\\server\\SSL\\wolframed.pfx";
                string curpath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString();
                string sslCertPath = Path.Combine( curpath, relativeSslCertPath).ToString();

                SecureString pw = new SecureString();
                char[] pwar = {'w','o','l','f','r','a','m','e',(char)0};
                for (int pi = 0; pwar[pi] != 0; ++pi) pw.AppendChar(pwar[pi]);

                var cfg = new Session.Configuration
                {
                    host = "localhost",
                    port = 7961,
                    sslcert = sslCertPath,
                    sslpassword = pw,
                    validatecert = false,
                    authmethod = "WOLFRAME-CRAM",
                    password = "******",
                    username = "******"
                };
                string pwdError;
                // if (!Session.ChangePassword(cfg, "bork124", out pwdError))
                // {
                //     Console.WriteLine("Error changing password: {0}", pwdError);
                // }

                Session session = new Session( cfg, ProcessAnswer);
                if (!session.Connect())
                {
                    Console.WriteLine("Error in connect of session: {0}", session.GetLastError());
                }
                else
                {
                    Customer customer = new Customer { Name = "Ottmar Hitzfeld", Address = "Loerrach Germany" };
                    int answerid = (int)AnswerId.CustomerInsertedObj;

                    int ii = 0;
                    for (ii = 0; ii < 10; ++ii)
                    {
                        Request request = new Request { id = answerid, command = "Insert", number = ii, doctype = "Customer", root = "customer", obj = customer, objtype = typeof(Customer), answertype = typeof(CustomerInserted) };
                        session.IssueRequest(request);
                    }
                    while (session.NofOpenRequests() > 0)
                    {
                        Thread.Sleep(200);
                    }
                    Thread.Sleep(2000);
                    Console.WriteLine("All done");
                    session.Shutdown();
                    session.Close();
                    string err = session.GetLastError();
                    if (err != null)
                    {
                        Console.WriteLine("Error in session: {0}", err);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in session: {0}", e.Message);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            try
            {
                string relativeSslCertPath = "wolframed.pfx";
                string curpath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString();
                string sslCertPath = Path.Combine( curpath, relativeSslCertPath).ToString();

                SecureString pw = new SecureString();
                char[] pwar = {'w','o','l','f','r','a','m','e',(char)0};
                for (int pi = 0; pwar[pi] != 0; ++pi) pw.AppendChar(pwar[pi]);

                var cfg = new Session.Configuration
                {
                    host = "localhost",
                    port = 7961,
                    sslcert = sslCertPath,
                    sslpassword = pw,
                    validatecert = false,
                    authmethod = null
                };
                Session session = new Session( cfg, ProcessAnswer);
                if (!session.Connect())
                {
                    Console.WriteLine("Error in connect of session: {0}", session.GetLastError());
                }
                else
                {
                    Customer customer = new Customer { Name = "Ottmar Hitzfeld", Address = "Loerrach Germany" };
                    int answerid = (int)AnswerId.CustomerInsertedObj;

                    Request request = new Request { id = answerid, command = "Insert", number = ii, doctype = "Customer", root = "customer", obj = customer, objtype = typeof(Customer), answertype = typeof(CustomerInserted) };
                    session.IssueRequest(request);

                    Thread.Sleep(1000);
                    session.Shutdown();
                    session.Close();

                    string err = session.GetLastError();
                    if (err != null)
                    {
                        Console.WriteLine("Error in session: {0}", err);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in session: {0}", e.Message);
            }
        }