Example #1
0
        /// <summary>
        /// On Button Click.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void ButtonRun_Click(object sender, EventArgs e)
        {
            // IP and Port are valid ?
            if (!CheckIP() || !CheckPort())
            {
                return;
            }

            // Ensure that output and input as well all other events are relfected while we are not done here.
            Application.DoEvents();

            // Disable certain Gui functions while there is a process running.
            DisableGui();

            // Only Client Drop aka Payloader mode ?
            if (!checkServer.Checked && checkDrop.Checked)
            {
                try {
                    // Set args, initialize a clean new instance and run the client in a thread.
                    SetArgs();
                    args[3] = "client";
                    ps4TCP  = new PS4TCP(rtb, this, logMenuItem.Checked, save2BinMenuItem.Checked, noCMsgMenuItem.Checked, formatMenuItem.Checked, errCol.GetName(), sockCol.GetName(),
                                         pcCol.GetName(), socketName, backCol.GetName(), foreCol.GetName());

                    // Run The socket in a Thread and activate certain Menu Items.
                    RunSocketThread();
                    rtb.ContextMenu.MenuItems[7].Enabled = killMenuItem.Enabled = true;

                    while (!connected) /* Nothing to do here, just wait for the client to be connected. */ } {
                    // Do we have a drop file defined ?
                    if (dropFile != string.Empty)
                    {
                        ps4TCP.SendFileFromDrop(dropFile);
                        dropFile = string.Empty;
                    }

                    while (!sended) /* Nothing to do here, just waiting for the file to be sended, if not already. */ } {
                    ps4TCP.Exit();
                    EnableGui();
                    return;
            } catch (Exception ex) { MessagBox.Error("An Error Ocured !\n\n" + ex.ToString()); return; }
Example #2
0
        /// <summary>
        /// On Load of this Form do.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void TCPMagic_Load(object sender, EventArgs e)
        {
            // Set MessagBox stuff.
            MessagBox.ListClicks = new EventHandler[] { ButtonAdd_Click, ButtonRemove_Click, ButtonRename_Click, ButtonShow_Click, ButtonUTP_Click, ListBox_SelectedIndexChanged, ListBox_DoubleClick, ProfileSelector_Load };
            MessagBox.TextBack   = backCol;
            MessagBox.TextFore   = foreCol;
            MessagBox.ListIcon   = MessagBox.ProfileIcon;
            MessagBox.Size       = size;

            // Set some default options.
            logMenuItem.Checked = formatMenuItem.Checked = true;

            // Set encoding to display within the combo box.
            comboEncoding.Items.Add("ASCII");
            comboEncoding.Items.Add("UTF8");
            comboEncoding.Items.Add("UTF7");
            comboEncoding.Items.Add("UTF32");
            comboEncoding.Items.Add("Unicode");
            comboEncoding.SelectedItem = "UTF8";

            // Initialize the PS4TCP handler instance.
            ps4TCP = new PS4TCP(rtb, this);

            //Initialize a new instance of the ClipboardWatcher class. By default it is set to watch for text.
            clipboard = new ClipboardWatcher(DataFormats.Text, false);
            clipboard.ContentPresent += Clipboard_ContentPresent;

            // Initialize the settings instance and laod up.
            settings = new Settings();
            LoadSettings();
            LoadColors();

            // Set RichTextBox depending variables.
            actions = new EventHandler[] { ClearContext_Click, CopyContext_Click, CutContext_Click, PasteContext_Click, SaveContext_Click, Save2BinContext_Click, SelectAllContext_Click, KillContext_Click };
            rtb.InitContextMenu(actions);
            rtb.ContextMenu.MenuItems[0].Enabled = rtb.ContextMenu.MenuItems[6].Enabled = rtb.ContextMenu.MenuItems[7].Enabled = killMenuItem.Enabled = false;
            rtb.ContextMenu.MenuItems[1].Enabled = rtb.ContextMenu.MenuItems[2].Enabled = rtb.ContextMenu.MenuItems[4].Enabled = rtb.ContextMenu.MenuItems[5].Enabled = false;
            rtb.SelectionChanged += Rtb_SelectionChanged;
            checkServer.Checked   = true;
            rtb.ReadOnly          = false;
        }