Ejemplo n.º 1
0
        /// <summary>
        /// Connect to our named-pipe server, send arguements and close current process
        /// </summary>
        /// <param name="args"></param>
        /// <param name="param"></param>
        private static void RunClient(string[] args, string param)
        {
            if (!IsServerRunning)
            {
                MessageBox.Show("FTPbox must be running to use the context menus!", "FTPbox", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RemoveFTPboxMenu();
                Process.GetCurrentProcess().Kill();
            }

            var pipeClient = new NamedPipeClientStream(".", "FTPbox Server", PipeDirection.InOut, PipeOptions.None, System.Security.Principal.TokenImpersonationLevel.Impersonation);

            Log.Write(l.Client, "Connecting client...");
            pipeClient.Connect();

            var ss = new StreamString(pipeClient);

            if (ss.ReadString() == "ftpbox")
            {
                var p = CombineParameters(args, param);
                ss.WriteString(p);
                Log.Write(l.Client, ss.ReadString());
            }
            else
            {
                Log.Write(l.Client, "Server couldnt be verified.");
            }
            pipeClient.Close();
            Thread.Sleep(4000);

            Process.GetCurrentProcess().Kill();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Connect to our named-pipe server, send arguements and close current process
        /// </summary>
        /// <param name="args"></param>
        /// <param name="param"></param>
        private static void RunClient(string[] args, string param)
        {
            if (!isServerRunning)
            {
                MessageBox.Show("iwit sync doit fonctionner pour utiliser le menu contextuel!", "iwit sync", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RemoveFTPboxMenu();
                Process.GetCurrentProcess().Kill();
            }

            NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "iwit sync Server", PipeDirection.InOut, PipeOptions.None, System.Security.Principal.TokenImpersonationLevel.Impersonation);

            Log.Write(l.Client, "Connexion au client...");
            pipeClient.Connect();

            StreamString ss = new StreamString(pipeClient);

            if (ss.ReadString() == "iwitSync")
            {
                string p = CombineParameters(args, param);
                ss.WriteString(p);
                Log.Write(l.Client, ss.ReadString());
            }
            else
            {
                Log.Write(l.Client, "Le serveur n'a pas pu être vérifié.");
            }
            pipeClient.Close();
            Thread.Sleep(4000);

            Process.GetCurrentProcess().Kill();
        }
Ejemplo n.º 3
0
 public ReadMessageSent(StreamString str, string data)
 {
     _data = data;
     _ss   = str;
 }
Ejemplo n.º 4
0
 public ReadMessageSent(StreamString str, string data)
 {
     _data = data;
     ss = str;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Connect to our named-pipe server, send arguements and close current process
        /// </summary>
        /// <param name="args"></param>
        /// <param name="param"></param>
        private static void RunClient(string[] args, string param)
        {
            if (!isServerRunning)
            {
                MessageBox.Show("FTPbox must be running to use the context menus!", "FTPbox", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RemoveFTPboxMenu();
                Process.GetCurrentProcess().Kill();
            }

            NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "FTPbox Server", PipeDirection.InOut, PipeOptions.None, System.Security.Principal.TokenImpersonationLevel.Impersonation);

            Log.Write(l.Client, "Connecting client...");
            pipeClient.Connect();

            StreamString ss = new StreamString(pipeClient);
            if (ss.ReadString() == "ftpbox")
            {
                string p = CombineParameters(args, param);
                ss.WriteString(p);
                Log.Write(l.Client, ss.ReadString());
            }
            else
            {
                Log.Write(l.Client, "Server couldnt be verified.");
            }
            pipeClient.Close();
            Thread.Sleep(4000);

            Process.GetCurrentProcess().Kill();
        }