Click here to Skip to main content
15,860,972 members
Articles / Programming Languages / C#

CodeDom Assistant

Rate me:
Please Sign up or sign in to vote.
4.84/5 (26 votes)
21 Sep 20074 min read 136.5K   6.6K   82  
Generating CodeDom Code By Parsing C# or VB
using System;
using System.Collections.Generic;
using System.Text;

namespace ScintillaNet
{
	public class DocumentHandler : ScintillaHelperBase
	{
		internal DocumentHandler(Scintilla scintilla) : base(scintilla) { }

		public Document Current
		{
			get
			{
				return new Document(Scintilla,NativeScintilla.GetDocPointer());
			}
			set
            {
				NativeScintilla.SetDocPointer(value.Handle);
            }
		}

		public Document Create()
		{
			return new Document(Scintilla, NativeScintilla.CreateDocument());
		}
	}

	public class Document : ScintillaHelperBase
	{
		private IntPtr _handle;
		public IntPtr Handle
		{
			get
			{
				return _handle;
			}
			set
			{
				_handle = value;
			}
		}

		internal Document(Scintilla scintilla, IntPtr handle) : base(scintilla) 
		{
			_handle = handle;
		}

		//	No, you aren't looking at COM, move along.
		public void AddRef()
		{
			NativeScintilla.AddRefDocument(_handle);
		}

		public void Release()
		{
			NativeScintilla.ReleaseDocument(_handle);
		}

		public override bool Equals(object obj)
		{
			Document d = obj as Document;

			if (_handle == IntPtr.Zero)
				return false;

			return _handle.Equals(d._handle);
		}

		public override int GetHashCode()
		{
			return _handle.GetHashCode();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions