コード例 #1
0
ファイル: Data.cs プロジェクト: CaineQT/hookme
        public void AddMatchAndReplace(MatchAndReplace.MatchAndReplace matchAndReplace)
        {
            lstMatchReplace.Add(matchAndReplace);

            if (NewMatchAndReplace != null)
                NewMatchAndReplace(matchAndReplace);
        }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: domeops/hookme-wsasendto
        void data_NewMatchAndReplace(MatchAndReplace.MatchAndReplace matchAndReplace)
        {
            string typeMatch = string.Empty;

            if (matchAndReplace.replaceIncomming && matchAndReplace.replaceOutcomming)
            {
                typeMatch = "In/Out";
            }
            else if (matchAndReplace.replaceIncomming)
            {
                typeMatch = "In";
            }
            else
            {
                typeMatch = "Out";
            }

            object[] row = new object[]
            {
                matchAndReplace.enabled,
                typeMatch,
                matchAndReplace.name,
                ASCIIEncoding.ASCII.GetString(matchAndReplace.match),
                ASCIIEncoding.ASCII.GetString(matchAndReplace.replace)
            };

            dgvMatchAndReplace.Rows.Add(row);
            dgvMatchAndReplace.Rows[dgvMatchAndReplace.Rows.Count - 1].Tag = matchAndReplace;
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: domeops/hookme-wsasendto
        private void removeMatchReplace_Click(object sender, EventArgs e)
        {
            if (dgvMatchAndReplace.SelectedRows.Count == 0)
            {
                return;
            }

            // remove from data
            MatchAndReplace.MatchAndReplace match = (MatchAndReplace.MatchAndReplace)dgvMatchAndReplace.SelectedRows[0].Tag;
            Program.data.RemoveMatchAndReplace(match);
            // remove from gui
            dgvMatchAndReplace.Rows.Remove(dgvMatchAndReplace.SelectedRows[0]);
        }
コード例 #4
0
ファイル: FormMatchReplace.cs プロジェクト: tr4nc3/hookme
        private bool CreateMatch()
        {
            bool   rIncomming  = false;
            bool   rOutcomming = false;
            string name        = tbName.Text;

            if (cbType.Text.ToLower() == "In".ToLower())
            {
                rIncomming = true;
            }
            else if (cbType.Text.ToLower() == "Out".ToLower())
            {
                rOutcomming = true;
            }
            else
            {
                rIncomming  = true;
                rOutcomming = true;
            }

            try
            {
                hbMatch.ByteProvider.ApplyChanges();
                hbReplace.ByteProvider.ApplyChanges();
                mStreamReplace.Seek(0, SeekOrigin.Begin);
                mStreamMatch.Seek(0, SeekOrigin.Begin);
                byte[] replace = new byte[mStreamReplace.Length];
                byte[] match   = new byte[mStreamMatch.Length];
                mStreamMatch.Seek(0, SeekOrigin.Begin);
                mStreamReplace.Seek(0, SeekOrigin.Begin);
                mStreamReplace.Read(replace, 0, replace.Length);
                mStreamMatch.Read(match, 0, match.Length);
                returnedMatch = new MatchAndReplace.MatchAndReplace(name, match, replace, rIncomming, rOutcomming);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
コード例 #5
0
ファイル: FormMatchReplace.cs プロジェクト: CaineQT/hookme
        private bool CreateMatch()
        {
            bool rIncomming = false;
            bool rOutcomming = false;
            string name = tbName.Text;

            if (cbType.Text.ToLower() == "In".ToLower())
                rIncomming = true;
            else if (cbType.Text.ToLower() == "Out".ToLower())
                rOutcomming = true;
            else
            {
                rIncomming = true;
                rOutcomming = true;
            }

            try
            {
                hbMatch.ByteProvider.ApplyChanges();
                hbReplace.ByteProvider.ApplyChanges();
                mStreamReplace.Seek(0, SeekOrigin.Begin);
                mStreamMatch.Seek(0, SeekOrigin.Begin);
                byte[] replace = new byte[mStreamReplace.Length];
                byte[] match = new byte[mStreamMatch.Length];
                mStreamMatch.Seek(0, SeekOrigin.Begin);
                mStreamReplace.Seek(0, SeekOrigin.Begin);
                mStreamReplace.Read(replace, 0, replace.Length);
                mStreamMatch.Read(match, 0, match.Length);
                returnedMatch = new MatchAndReplace.MatchAndReplace(name, match, replace, rIncomming, rOutcomming);
            }
            catch
            {
                return false;
            }

            return true; 
        }
コード例 #6
0
ファイル: Data.cs プロジェクト: CaineQT/hookme
 public void RemoveMatchAndReplace(MatchAndReplace.MatchAndReplace matchAndReplace)
 {
     lstMatchReplace.Remove(matchAndReplace);
 }
コード例 #7
0
ファイル: FormMatchReplace.cs プロジェクト: CaineQT/hookme
 private void btCancel_Click(object sender, EventArgs e)
 {
     returnedMatch = null;
     this.Close();
 }
コード例 #8
0
ファイル: FormMatchReplace.cs プロジェクト: tr4nc3/hookme
 private void btCancel_Click(object sender, EventArgs e)
 {
     returnedMatch = null;
     this.Close();
 }