Ejemplo n.º 1
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            DownloadClipboard upload = new DownloadClipboard();

            if (upload.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    Random rand = new Random();
                    int    r    = rand.Next();
                    UserCredentialsStore store = UserCredentialsStore.GetInstance();
                    CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();
                    CodinggainClipboardService.EncryptionData           enData          = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                    CodinggainClipboardService.ReturnInterface          data            = remoteClipboard.getClipboardContent(store.Username, store.getPassword(r), upload.Fromdate, upload.Todate, enData.access_key_id, r);
                    if (data.success)
                    {
                        string str = Decode(data.content, (byte)enData.encrypt_key);
                        update(str);
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Ejemplo n.º 2
0
        private void GetSetText(int id)
        {
            UserCredentialsStore store = UserCredentialsStore.GetInstance();

            if (store.Valid)
            {
                Random rand = new Random();
                int    r    = rand.Next();
                CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();
                CodinggainClipboardService.EncryptionData           enData          = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                CodinggainClipboardService.ScratchDataInfo          data            = remoteClipboard.getScratchData(store.Username, store.getPassword(r), id, enData.access_key_id, r);
                if (data != null)
                {
                    if (data.containsdata)
                    {
                        currentContent = data.content;
                        string title = data.title;
                        if (title == null)
                        {
                            title = "";
                        }
                        setScratchText(currentContent, title);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void searchDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         SearchDatabase search = new SearchDatabase();
         if (search.ShowDialog() == DialogResult.OK)
         {
             string criteria            = search.Criteria;
             Random rand                = new Random();
             int    r                   = rand.Next();
             UserCredentialsStore store = UserCredentialsStore.GetInstance();
             CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();
             CodinggainClipboardService.EncryptionData           enData          = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
             CodinggainClipboardService.ReturnInterface          content         = remoteClipboard.searchClipboard(store.Username, store.getPassword(r), criteria, enData.access_key_id, r, 0);
             if (content != null && content.success)
             {
                 string contents = "";
                 string errors   = "";
                 if (content.numberOfSegments > 1)
                 {
                     int segs = content.numberOfSegments;
                     for (int n = 0; n < segs; n++)
                     {
                         try
                         {
                             enData  = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                             content = remoteClipboard.searchClipboard(store.Username, store.getPassword(r), criteria, enData.access_key_id, r, n + 1);
                             if (content != null && content.success)
                             {
                                 contents += Decode(content.content, (byte)enData.encrypt_key);
                             }
                         }
                         catch (Exception ex)
                         {
                             errors += " : Errors!!";
                         }
                     }
                 }
                 else
                 {
                     contents = Decode(content.content, (byte)enData.encrypt_key);
                 }
                 DisplayText dis = new DisplayText(contents);
                 dis.SearchWord(criteria);
                 dis.updateTitle(errors);
                 dis.ShowDialog();
             }
             else
             {
                 DisplayText dis = new DisplayText("Did not return any results!");
                 dis.SearchWord(criteria);
                 dis.ShowDialog();
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 4
0
        public void LoadScratchDates()
        {
            dateList.Clear();
            SelectComboBox.Items.Clear();
            CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();
            if (remoteClipboard != null)
            {
                Random rand = new Random();
                int    r    = rand.Next();
                UserCredentialsStore store = UserCredentialsStore.GetInstance();
                if (store.Valid)
                {
                    SaveButton.Enabled = true;
                    CodinggainClipboardService.EncryptionData    enData = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                    CodinggainClipboardService.ScratchDataInfo[] dates  = remoteClipboard.getScratchDates(store.Username, store.getPassword(r), enData.access_key_id, r);

                    foreach (CodinggainClipboardService.ScratchDataInfo info in dates)
                    {
                        try
                        {
                            if (info.date != null)
                            {
                                DateListComboInfo dl = new DateListComboInfo();
                                dl.date = info.date;
                                if (info.title != null)
                                {
                                    dl.title = info.title;
                                }
                                dl.id = info.id;
                                dateList.Add(dl);
                                // ListViewItem item = new ListViewItem(info.date);
                                string tt = info.date;
                                if (info.title != null)
                                {
                                    tt += " " + info.title;
                                }
                                SelectComboBox.Items.Add(info.date + " " + tt);
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (dates.Length > 0)
                    {
                        SelectComboBox.SelectedIndex = 0;
                        SelectComboBox.Text          = dates[0].date;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void sendData()
        {
            CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();

            if (!string.IsNullOrEmpty(ScratchPadTextBox.Text) && ScratchPadTextBox.Text != currentContent)
            {
                EncoderDecoder       encoder = new EncoderDecoder();
                Random               rand    = new Random();
                int                  r       = rand.Next();
                UserCredentialsStore store   = UserCredentialsStore.GetInstance();
                CodinggainClipboardService.EncryptionData enData = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                string str = encoder.Encode(ScratchPadTextBox.Text, (byte)enData.encrypt_key);
                currentContent = ScratchPadTextBox.Text;
                int id = remoteClipboard.putScratchPad(store.Username, store.getPassword(r), TitleTextBox.Text, str, ImportantCheckBox.Checked, false, enData.access_key_id, r, 0);
                if (ImportantCheckBox.Checked)
                {
                    ImportantCheckBox.Checked = false;
                }
                LoadScratchDates();
            }
        }
Ejemplo n.º 6
0
        private bool sendtoServer(string text)
        {
            try
            {
                if (text.Length > MaxUploadSize)
                {
                    int    size  = text.Length;
                    string local = text;
                    text = local.Substring(0, MaxUploadSize);
                    string whatsleft = text.Substring(MaxUploadSize, size);
                    //  Invoke(new SendToServer(sendtoServer, new object[] { whatsleft }));
                }
                Random rand = new Random();
                int    r    = rand.Next();
                UserCredentialsStore store = UserCredentialsStore.GetInstance();
                CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();
                CodinggainClipboardService.EncryptionData           enData          = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                if (enData.useable)
                {
                    string str = Encode(backupToServer, (byte)enData.encrypt_key);
                    if (!remoteClipboard.putClipboardContent(store.Username, store.getPassword(r), str, enData.access_key_id, r))
                    {
                        DifferenceTextBox.Text = "Unable to upload clip text!";
                    }
                }
                else
                {
                    DifferenceTextBox.Text = "Passwar not useable";
                }
                remoteClipboard.Close();
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 7
0
        void BackHaulThread()
        {
            Random rand = new Random();

            while (running)
            {
                try
                {
                    int r = rand.Next();
                    UserCredentialsStore store = UserCredentialsStore.GetInstance();
                    CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();
                    CodinggainClipboardService.EncryptionData           enData          = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                    String clip = remoteClipboard.checkForClip(store.Username, store.getPassword(r), enData.access_key_id, r);
                    if (!string.IsNullOrEmpty(clip))
                    {
                        update(clip);
                    }
                }
                catch
                {
                }
                System.Threading.Thread.Sleep(1000);
            }
        }