Dangerous Character Filtering Class (Perfect Edition) [2] (Test Document, Also Perfect)

xiaoxiao2021-03-06  66

// Not too much time to improve it, the heroes are empty, give me a copy after perfect? (A mountain NET a3news (AT) hotmail.com http://www.vcsharp.com) using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Runtime.Remoting; using System.Runtime.Remoting.Proxies; using System.Runtime.Remoting.Messaging; using System.Reflection; using FilterRealProxy;

Namespace Filterform {///

///fterformtest's summary description. /// public class FilterFormTest: System.Windows.Forms.Form {private System.Windows.Forms.Button btnFilter; private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.TextBox MyTextBox; private System.windows.Forms.Button btnopenfile; private system.windows.forms.listbox listbox1; /// // / / must-have designer variable. /// private system.componentmodel.container components = null;

Public filterFormTest () {// // Windows Form Designer Support for // InitializeComponent ();

// // Todo: Add any constructor code after INITIALIZEComponent call //}

///

/// Clean all the resources being used. /// Protected Override Void Dispose (Bool Disposing) {if (disponents! = Null) {components.dispose ();}} Base.Dispose

#REGION Windows Form Designer The code ///

/// designer supports the required method - do not use the code editor to modify the // / this method.

/// private void InitializeComponent () {this.MyTextBox = new System.Windows.Forms.TextBox (); this.btnFilter = new System.Windows.Forms.Button (); this.openFileDialog1 = new System. Windows.Forms.openFileDialog (); this.btnopenfile = new system.windows.Forms.Button (); this.listbox1 = new system.windows.forms.listbox (); this.suspendlayout (); // // mytextbox / / this.MyTextBox.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles. Left) | System.Windows.Forms.AnchorStyles.Right))); this.MyTextBox.Location = new System.Drawing.Point (8, 8); this.MyTextBox.Multiline = true; this.MyTextBox.Name = "MyTextBox "; this.MyTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.MyTextBox.Size = new System.Drawing.Size (432, 360); this.MyTextBox.TabIndex = 0; this.MyTextBox.Text = ""; // / btnfilter // this.btnfilter.an chor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnFilter.Location = new System.Drawing.Point ( 448, 232); this.btnfilter.name = "btnfilter"; this.btnfilter.size = new system.drawing.size (88, 23); this.btnfilter.tabindex = 1; this.btnfilter.Text = "Remove danger character "; this.btnFilter.Click = new System.EventHandler (this.btnFilter_Click); // // btnOpenFile // this.btnOpenFile.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms .Anchorstyles.top | system.windows.Forms.AnchorseLes.right))))))))))))

this.btnopenfile.location = new system.drawing.point (456, 48); this.btnopenfile.name = "btnopenfile"; this.btnopenfile.tabindex = 2; this.btnopenfile.text = "Open file"; this.btnopenfile .Click = new System.EventHandler (this.btnOpenFile_Click); // // listBox1 // this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System .Windows.forms.ancystyles.right))); this.listbox1.itemheight = 12; this.listbox1.items.addrange (new object [] {"script script", "HTML code", "Object object", "link Script, "IFRAME Inner Frame", "Frameset Frame", "SRC Insert Script", "Ilm Characters", "Include", "All"}); this.listbox1.location = new system.drawing. Point (448, 88); this.listbox1.multicolumn = true; this.listbox1.name = "ListBox1"; this.listbox1.size = new system.drawing.size (96, 124); this.listbox1.tabindex = 3 ; // // Filte RFORMTEST // this.autoscalebasesize = new system.drawing.size (6, 14); this.clientsize = new system.drawing.size (544, 381); this.controls.add (this.listbox1); this.controls. Add (this.btnopenfile); this.btnfilter; this.controls.add (this.mytextbox); this.name = "filterformtest"; this.text = "filterformtest"; this.ResumeLayout (False } #ENDREGION

///

////// [stathread] static void main () {Application.run (new filterformtest ());} /// /// Entity class: This entity class must inherit from MarshalByrefObject, so filtering entity classes can no longer inherit or implement interfaces from other classes, which is the limitations of using transparent agents. /// public class Entry: MarshalByRefObject {public Entry () {} public static Entry CreateInstance () {Entry entry = new Entry (); RealProxy realProxy = new FilterRealProxy.FilterRealProxy (entry); object transparentProxy = realProxy. GetTransparentProxy (); return (Entry) transparentProxy;} private string _body; public virtual string Body {[StringFilter ((FilterType) 16)] get {return _body;} set {_body = value;}}}

Private void btnfilter_click (object sender, system.eventargs e) {entry en = entry.createInstance (); en.body = mytextBox.text; mytextbox.text = en.body;}

private void btnOpenFile_Click (object sender, System.EventArgs e) {OpenFileDialog dlgFile = new OpenFileDialog (); dlgFile.Filter = "Html (. * htm) | * .htm | Text (. * txt) | * .txt | All Files (*. *) | *. * "; If (DLGFile.Showdialog () == DialogResult.ok) {system.io.streamReader sr = new system.io.streamReader (DLGFile.FileName, System.Text.Encoding.default ); // Get a string MytextBox.Text = sr.readToEnd () () (), Sr.Close ();}}

Private void ComboBox1_selectedIndexchanged (Object Sender, System.EventArgs E) {}}}

转载请注明原文地址:https://www.9cbs.com/read-84441.html

New Post(0)