//� 2005 Thaddaeus Parker thaddparker(at)usa(dot)net
//This code is free to use and modify as long as this statement is left intact.
//All other copyrights are held by their respective owners
using System;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.ComponentModel.Design.Serialization;
using System.Web.UI;
namespace OverLibWrapper{
/// <summary>A representation of an overLIB command</summary>
/// <remarks>Any new commands and other values need to be added to this class</remarks>
public class OverlibCommand:IComparable {
#region Private Members
private string _cmdName;
private OverlibCommandType _type;
private OverlibCommandLevel _level;
private object[] _values;
private OverlibCommand _parentCommand;
private bool _specialCase;
#endregion
#region Plugin Members
private enum PlugInFile{None,Anchor,Shadow,OverTwo,Draggable,FollowScroll,SetOnOff,Exclusive,CssStyle,CrossFrame,CenterPopup};
private const string overLIBString = "overlib_";
private static string[] overTwoList = new string[]{"puid","idalert","capalign","textalign"};
private static string[] cssStyleList = new string[]{"cssstyle","padunit","heightunit","widthunit","textsizeunit","textdecoration","textstyle","textweight","captionsizeunit","captiondecoration","captionstyle","captionweight","closesizeunit","closedecoration","closestyle","closeweight"};
private static string[] shadowList = new string[]{"shadow","shadowcolor","shadowimage","shadowopacity","shadowx","shadowy"};
private static string[] dragList = new string[]{"draggable","altcut","dragimg"};
private static string[] exclusList = new string[]{"exclusive","exclusivestatus","exclusiveoverride"};
private static string[] centerList = new string[]{"centerpopup","centeroffset"};
private static string[] scrollList = new string[]{"followscroll","followscrollrefresh"};
private static string[] crossList = new string[]{"frame"};
private static string[] onoffList = new string[]{"seton","setoff"};
private static string[] anchorList = new string[]{"anchor","anchorx","anchory","noanchorwarn","anchoralign"};
private PlugInFile _pluginFile;
#endregion
#region Constructors
/// <summary>Creates a new <see cref="OverlibCommand"/> instance.</summary>
/// <param name="cmdName">Name of the command.</param>
/// <param name="type">Type of <see cref="OverlibCommandType"/>.</param>
/// <param name="level">Level of <see cref="OverlibCommandLevel"/>.</param>
/// <param name="parent">The parent command of this particular command.</param>
/// <param name="hasSpecialCase">Has special case. This means that this command has a special case that need
/// to be looked at. This is <c>false</c> by default.</param>
public OverlibCommand(string cmdName, OverlibCommandType type, OverlibCommandLevel level, OverlibCommand parent, bool hasSpecialCase):this(cmdName,type,level){
_specialCase = hasSpecialCase;
_parentCommand = parent;
}
/// <summary>Creates a new <see cref="OverlibCommand"/> instance.</summary>
/// <param name="cmdName">Name of the Command.</param>
/// <param name="type">Type of <see cref="OverlibCommandType"/>.</param>
/// <param name="level">Level of <see cref="OverlibCommandLevel"/>.</param>
/// <param name="values">An array of object values that represent the parameters of the command.</param>
public OverlibCommand(string cmdName, OverlibCommandType type, OverlibCommandLevel level, params object[] values){
_cmdName = cmdName.ToUpper();
_type = type;
_level = level;
_values = values;
_parentCommand = OverlibCommand.Empty;
_specialCase = false;
if(!this.IsCoreCommand){
this.FindPlugIn(_cmdName);
}
}
/// <summary>Creates a new <see cref="OverlibCommand"/> instance.</summary>
/// <param name="type">Type of <see cref="OverlibCommandType"/>.</param>
/// <param name="cmdName">Name of the command.</param>
/// <param name="values">An array of object values that represent the parameters of the command.</param>
public OverlibCommand(string cmdName, OverlibCommandType type, params object[] values):this(cmdName,type,OverlibCommandLevel.Core,values){}
/// <summary>Creates a new <see cref="OverlibCommand"/> instance.</summary>
/// <param name="cmdName">Name of the Command.</param>
/// <param name="type">Type of <see cref="OverlibCommandType"/>.</param>
/// <param name="level">Level of <see cref="OverlibCommandLevel"/>.</param>
public OverlibCommand(string cmdName, OverlibCommandType type, OverlibCommandLevel level):this(cmdName,type,level,null){}
/// <summary>
/// Creates a new <see cref="OverlibCommand"/> instance.
/// </summary>
public OverlibCommand():this(OverlibCommand.Empty){}
/// <summary>Creates a new <see cref="OverlibCommand"/> instance.</summary>
/// <param name="cmdName">Name of the command.</param>
/// <param name="values">A comma-delimited string of values that represent the parameters of the command</param>
public OverlibCommand(string cmdName, string values):this(cmdName,((object[])values.Split(','))){}
/// <summary>Creates a new <see cref="OverlibCommand"/> instance.</summary>
/// <param name="cmdName">Name of the command.</param>
/// <param name="values">An array of object values that represent the parameters of the command</param>
public OverlibCommand(string cmdName, object[] values){
System.Collections.Hashtable ht = OverlibCommands.CommandTable("name");
if(ht.ContainsKey(cmdName)){
OverlibCommand c = (OverlibCommand)ht[cmdName.ToLower()];
this._cmdName = cmdName.ToUpper();
this._level = c.CommandLevel;
this._type = c.CommandType;
this._values = values;
this._specialCase = c.IsSpecialCase;
if(!this.IsCoreCommand || !this.IsEmpty){
this.FindPlugIn(_cmdName);
}
}else{
throw new ArgumentException("Invalid CommandName","cmdName");
}
}
/// <summary>Creates a new <see cref="OverlibCommand"/> instance from an existing Overlib command.
/// </summary>
/// <param name="oc">The OverlibCommand to copy</param>
public OverlibCommand(OverlibCommand oc){
_cmdName = oc.CommandName;
_type = oc.CommandType;
_level = oc.CommandLevel;
_values = oc.CommandValues;
_parentCommand = oc.ParentCommand;
_specialCase = oc.IsSpecialCase;
if(!this.IsCoreCommand){
this.FindPlugIn(_cmdName);
}
}
#endregion
private static OverlibCommand empty = new OverlibCommand("", OverlibCommandType.Other, OverlibCommandLevel.Other, null);
/// <summary>An empty representation of an <see cref="OverlibCommand"/></summary>
public static OverlibCommand Empty {get {return empty;}}
/// <summary>
/// Gets a value indicating whether this instance is valid within the command collection.
/// </summary>
/// <value>
/// <c>true</c> if this instance is valid; otherwise, <c>false</c>.
/// </value>
public bool IsValid{
get{return OverlibCommands.CommandCollection.Contains(this);}
}
/// <summary>
/// Gets a value indicating whether this instance is empty.
/// </summary>
/// <value>
/// <c>true</c> if this instance is empty; otherwise, <c>false</c>.
/// </value>
public bool IsEmpty{
get{return OverlibCommand.Empty.Equals(this);}
}
/// <summary>
/// Gets a value indicating whether this instance is special case.
/// </summary>
/// <value>
/// <c>true</c> if this instance is special case; otherwise, <c>false</c>.
/// </value>
public bool IsSpecialCase{
get{return this._specialCase;}
}
/// <summary>
/// Gets the parent command.
/// </summary>
/// <value>The parent command of this instance</value>
public OverlibCommand ParentCommand{
get{return this._parentCommand;}
}
/// <summary>
/// Gets the text string value of the commands.
/// </summary>
/// <value>A string that represents the values of the parameters of the commands</value>
public string TextString{
get{
System.Text.StringBuilder str = new System.Text.StringBuilder("");
if(_values.Length > 1){
int counter = 0;
foreach(object obj in _values){
str.Append(obj.ToString());
if(++counter < _values.Length){
str.Append(",");
}
}
}else{
str.Append(_values[0].ToString());
}
return str.ToString();
}
}
#region Properties
/// <summary>
/// Gets or sets the command values.
/// </summary>
/// <value>An array of objects that represent the parameters of the command</value>
public object[] CommandValues{
get{return _values;}
set{_values = value;}
}
/// <summary>
/// Gets the command text value.
/// </summary>
/// <value>The text value of the currently held parameter</value>
public string CommandTextValue{
get{
string val = "";
if(_values != null){
if(_values.Length == 0)
return "";
else {
if(this._type == OverlibCommandType.QText || this._type == OverlibCommandType.Color){
val = EscapeString(_values[0].ToString());
}else{
val = _values[0].ToString();
}
}
}
return val;
}
}
/// <summary>
/// Gets the command text values.
/// </summary>
/// <value>An array of string values</value>
public string[] CommandTextValues{
get{
if(_values == null){
return new string[0];
}
string[] vals = new string[_values.Length];
if(_values.Length == 1){
return new string[]{CommandTextValue};
}else{
Array.Copy(_values,0,vals,0,vals.Length);
}
return vals;
}
}
/// <summary>
/// Gets the command int value.
/// </summary>
/// <value>The integer parameter value</value>
public int CommandIntValue{
get{ int i = Int32.MinValue;
if(_values.Length == 0){
return i;
}
try{
i = Convert.ToInt32(_values[0].ToString());
}catch{
return i;
}
return i;
}
}
/// <summary>
/// Gets the command int values.
/// </summary>
/// <value>An array of integer parameter values</value>
public int[] CommandIntValues{
get{
if(_values == null){
return new int[0];
}
int[] vals = new int[_values.Length];
if(_values.Length == 1){
return new int[]{CommandIntValue};
}else{
int j = 0;
foreach(object obj in _values){
int ival = Convert.ToInt32(obj.ToString());
vals[j++] = ival;
}
}
return vals;
}
}
/// <summary>
/// Gets the name of the command.
/// </summary>
/// <value></value>
public string CommandName{
get{return _cmdName;}
}
/// <summary>
/// Gets the command type.
/// </summary>
/// <value></value>
public OverlibCommandType CommandType{
get{return _type;}
}
/// <summary>
/// Gets the command level.
/// </summary>
/// <value></value>
public OverlibCommandLevel CommandLevel{
get{return _level;}
}
/// <summary>
/// Gets a value indicating whether this instance is a core command.
/// </summary>
/// <value>
/// <c>true</c> if this instance is a core command; otherwise, <c>false</c>.
/// </value>
public bool IsCoreCommand{
get{return this._level == OverlibCommandLevel.Core;}
}
#endregion
#region Overrides
/// <summary>
/// Determines if this instance equals the specified obj.
/// </summary>
/// <param name="obj">Obj.</param>
/// <returns></returns>
public override bool Equals(object obj) {
if(!(obj is OverlibCommand)){
return false;
}
OverlibCommand oc = (OverlibCommand)obj;
return this._cmdName.ToUpper().Equals(oc.CommandName.ToUpper()) && this._level.Equals(oc.CommandLevel) && this._type.Equals(oc.CommandType);
}
/// <summary>
/// Gets the hash code.
/// </summary>
/// <returns>The integer hashcode of this instance</returns>
public override int GetHashCode() {
return this._cmdName.GetHashCode() ^ this._level.GetHashCode() ^ this._type.GetHashCode();
}
/// <summary>
/// Returns the string value of this command instance.
/// </summary>
/// <returns>Command instance string</returns>
public override string ToString() {
System.Text.StringBuilder str = new System.Text.StringBuilder("");
if(this.IsEmpty){
return str.ToString();
}
str.Append(this._cmdName.ToUpper());
if(_values.Length == 1 && (_values[0] is string || _values[0] is int)){
str.Append(",");
if(_values[0] is string){
str.Append(this.CommandTextValue);
}else{
str.Append(this.CommandIntValue);
}
}else{
foreach(object obj in _values){
if(this.CommandType == OverlibCommandType.QText || this.CommandType == OverlibCommandType.Color){
str.Append(",");
str.Append(this.EscapeString((string)obj));
}else {
str.Append(",");
str.Append((string)obj);
}
}
}
return str.ToString();
// return ToString(CultureInfo.CurrentCulture);
}
/// <summary>
/// Returns the string value of this command instance.
/// </summary>
/// <param name="info">The culture info for this instance</param>
/// <returns>Command instance string</returns>
public string ToString(CultureInfo info){
return TypeDescriptor.GetConverter(typeof(OverlibCommand)).ConvertToString(null,info,this);
}
#endregion
#region Plugin
/// <summary>
/// Gets the name of the plug in file.
/// </summary>
/// <value></value>
public string PlugInFileName{
get{
if(_pluginFile == PlugInFile.None)
return "";
else
return overLIBString + _pluginFile.ToString().ToLower() + ".js";
}
}
/// <summary>
/// Finds the plug in based on the string name of the command that is given.
/// </summary>
/// <param name="cmdName">Name of the command.</param>
private void FindPlugIn(string cmdName){
cmdName = cmdName.ToLower();
System.Collections.ArrayList otwo = new System.Collections.ArrayList(overTwoList);
System.Collections.ArrayList csss = new System.Collections.ArrayList(cssStyleList);
System.Collections.ArrayList shad = new System.Collections.ArrayList(shadowList);
System.Collections.ArrayList drag = new System.Collections.ArrayList(dragList);
System.Collections.ArrayList exclu = new System.Collections.ArrayList(exclusList);
System.Collections.ArrayList center = new System.Collections.ArrayList(centerList);
System.Collections.ArrayList scroll = new System.Collections.ArrayList(scrollList);
System.Collections.ArrayList cross = new System.Collections.ArrayList(crossList);
System.Collections.ArrayList onoff = new System.Collections.ArrayList(onoffList);
System.Collections.ArrayList anchor = new System.Collections.ArrayList(anchorList);
anchor.Sort();
cross.Sort();
scroll.Sort();
center.Sort();
exclu.Sort();
drag.Sort();
otwo.Sort();
csss.Sort();
shad.Sort();
if(otwo.Contains(cmdName)){
_pluginFile = PlugInFile.OverTwo;
return;
}else if(csss.Contains(cmdName)){
_pluginFile = PlugInFile.CssStyle;
return;
}else if(shad.Contains(cmdName)){
_pluginFile = PlugInFile.Shadow;
return;
}else if(drag.Contains(cmdName)){
_pluginFile = PlugInFile.Draggable;
return;
}else if(exclu.Contains(cmdName)){
_pluginFile = PlugInFile.Exclusive;
return;
}else if(center.Contains(cmdName)){
_pluginFile = PlugInFile.CenterPopup;
return;
}else if(scroll.Contains(cmdName)){
_pluginFile = PlugInFile.FollowScroll;
return;
}else if(cross.Contains(cmdName)){
_pluginFile = PlugInFile.CrossFrame;
return;
}else if(onoff.Contains(cmdName)){
_pluginFile = PlugInFile.SetOnOff;
return;
}else if(anchor.Contains(cmdName)){
_pluginFile = PlugInFile.Anchor;
}else{
_pluginFile = PlugInFile.None;
}
}
#endregion
/// <summary>
/// Escapes the single quotes that are contained within the overall string value.
/// </summary>
/// <param name="item">Item.</param>
/// <returns>The escaped string value</returns>
private string EscapeString(string item){
string st = item;
int counter = 0;
if(st.StartsWith("'")){
st = st.Remove(0,1);
}
if(st.EndsWith("'")){
st = st.Remove(st.Length -1,1);
}
string stc = st;
for(int i = 0; i < st.Length;i++){
if(st[i] == '\''){
if (i > 0 && st[i-1] != '\\'){
stc = stc.Insert(counter,@"\");
counter++;
}
}
if(st[i] == '(' || st[i] == ')'){
if(i > 0 && st[i-1] != '\\'){
stc = stc.Insert(counter,@"\");
counter++;
}
}
counter++;
}
if(!stc.StartsWith("'")){
stc = stc.Insert(0,"'");
}
if(!stc.EndsWith("'")){
stc = stc + "'";
}
return stc;
}
/// <summary>
/// Unescapes the string.
/// </summary>
/// <param name="item">Item.</param>
/// <returns>The unescaped string value</returns>
public static string UnEscapeString(string item) {
item = item.Replace(@"\\", @"\");
item = item.Replace(@"\'", @"'");
item = item.Replace(@"\(",@"(");
item = item.Replace(@"\)",@")");
return item;
}
#region Public Static Commands that are useful in generating simple command lists
#region Command Flags
private static OverlibCommand sticky = new OverlibCommand("STICKY", OverlibCommandType.Flag);
/// <summary>
/// Gets the sticky.
/// </summary>
/// <value></value>
public static OverlibCommand Sticky {get {return sticky;}}
private static OverlibCommand left = new OverlibCommand("LEFT", OverlibCommandType.Flag);
/// <summary>
/// Gets the left.
/// </summary>
/// <value></value>
public static OverlibCommand Left {get {return left;}}
private static OverlibCommand right = new OverlibCommand("RIGHT", OverlibCommandType.Flag);
/// <summary>
/// Gets the right.
/// </summary>
/// <value></value>
public static OverlibCommand Right {get {return right;}}
private static OverlibCommand center = new OverlibCommand("CENTER", OverlibCommandType.Flag);
/// <summary>
/// Gets the center.
/// </summary>
/// <value></value>
public static OverlibCommand Center {get {return center;}}
private static OverlibCommand above = new OverlibCommand("ABOVE", OverlibCommandType.Flag);
/// <summary>
/// Gets the above.
/// </summary>
/// <value></value>
public static OverlibCommand Above {get {return above;}}
private static OverlibCommand below = new OverlibCommand("BELOW", OverlibCommandType.Flag);
/// <summary>
/// Gets the below.
/// </summary>
/// <value></value>
public static OverlibCommand Below {get {return below;}}
private static OverlibCommand autoStatus = new OverlibCommand("AUTOSTATUS", OverlibCommandType.Flag);
/// <summary>
/// Gets the auto status.
/// </summary>
/// <value></value>
public static OverlibCommand AutoStatus {get {return autoStatus;}}
private static OverlibCommand autoStatusCaption = new OverlibCommand("AUTOSTATUSCAP", OverlibCommandType.Flag);
/// <summary>
/// Gets the auto status caption.
/// </summary>
/// <value></value>
public static OverlibCommand AutoStatusCaption {get {return autoStatusCaption;}}
private static OverlibCommand hAuto = new OverlibCommand("HAUTO", OverlibCommandType.Flag);
/// <summary>
/// Gets the H auto.
/// </summary>
/// <value></value>
public static OverlibCommand HAuto {get {return hAuto;}}
private static OverlibCommand vAuto = new OverlibCommand("VAUTO",OverlibCommandType.Flag);
/// <summary>
/// Gets the V auto.
/// </summary>
/// <value></value>
public static OverlibCommand VAuto {get{return vAuto;}}
private static OverlibCommand fullHtml = new OverlibCommand("FULLHTML", OverlibCommandType.Flag);
/// <summary>
/// Gets the full HTML.
/// </summary>
/// <value></value>
public static OverlibCommand FullHtml {get {return fullHtml;}}
private static OverlibCommand cssOff = new OverlibCommand("CSSOFF", OverlibCommandType.Flag);
/// <summary>
/// Gets the CSS off.
/// </summary>
/// <value></value>
public static OverlibCommand CssOff {get {return cssOff;}}
[Obsolete("This is only used for backwards compatbility",false)]
private static OverlibCommand cssClass = new OverlibCommand("CSSCLASS", OverlibCommandType.Flag);
/// <summary>
/// Gets the CSS class.
/// </summary>
/// <value></value>
public static OverlibCommand CssClass {get {return cssClass;}}
private static OverlibCommand compatMode = new OverlibCommand("COMPATMODE", OverlibCommandType.Flag);
/// <summary>
/// Gets the compat mode.
/// </summary>
/// <value></value>
public static OverlibCommand CompatMode {get {return compatMode;}}
private static OverlibCommand doNothing = new OverlibCommand("DONOTHING", OverlibCommandType.Flag);
/// <summary>
/// Gets the do nothing.
/// </summary>
/// <value></value>
public static OverlibCommand DoNothing {get {return doNothing;}}
private static OverlibCommand followMouse = new OverlibCommand("FOLLOWMOUSE", OverlibCommandType.Flag);
/// <summary>
/// Gets the follow mouse.
/// </summary>
/// <value></value>
public static OverlibCommand FollowMouse {get {return followMouse;}}
private static OverlibCommand mouseOff = new OverlibCommand("MOUSEOFF", OverlibCommandType.Flag);
/// <summary>
/// Gets the mouse off.
/// </summary>
/// <value></value>
public static OverlibCommand MouseOff {get {return mouseOff;}}
private static OverlibCommand noClose = new OverlibCommand("NOCLOSE", OverlibCommandType.Flag);
/// <summary>
/// Gets the no close.
/// </summary>
/// <value></value>
public static OverlibCommand NoClose {get {return noClose;}}
private static OverlibCommand wrap = new OverlibCommand("WRAP", OverlibCommandType.Flag);
/// <summary>
/// Gets the wrap.
/// </summary>
/// <value></value>
public static OverlibCommand Wrap {get {return wrap;}}
#endregion
#region Commands with numbers
private static OverlibCommand width = new OverlibCommand("WIDTH", OverlibCommandType.Number, 200);
/// <summary>
/// Gets the width.
/// </summary>
/// <value></value>
public static OverlibCommand Width {get {return width;}}
private static OverlibCommand height = new OverlibCommand("HEIGHT", OverlibCommandType.Number, -1);
/// <summary>
/// Gets the height.
/// </summary>
/// <value></value>
public static OverlibCommand Height {get {return height;}}
private static OverlibCommand offsetX = new OverlibCommand("OFFSETX", OverlibCommandType.Number, 10);
/// <summary>
/// Gets the offset X.
/// </summary>
/// <value></value>
public static OverlibCommand OffsetX {get {return offsetX;}}
private static OverlibCommand offsetY = new OverlibCommand("OFFSETY", OverlibCommandType.Number, 10);
/// <summary>
/// Gets the offset Y.
/// </summary>
/// <value></value>
public static OverlibCommand OffsetY {get {return offsetY;}}
private static OverlibCommand snapX = new OverlibCommand("SNAPX", OverlibCommandType.Number, 0);
/// <summary>
/// Gets the snap X.
/// </summary>
/// <value></value>
public static OverlibCommand SnapX {get {return snapX;}}
private static OverlibCommand snapY = new OverlibCommand("SNAPY", OverlibCommandType.Number, 0);
/// <summary>
/// Gets the snap Y.
/// </summary>
/// <value></value>
public static OverlibCommand SnapY {get {return snapY;}}
private static OverlibCommand fixX = new OverlibCommand("FIXX", OverlibCommandType.Number, -1);
/// <summary>
/// Gets the fix X.
/// </summary>
/// <value></value>
public static OverlibCommand FixX {get {return fixX;}}
private static OverlibCommand fixY = new OverlibCommand("FIXY", OverlibCommandType.Number, -1);
/// <summary>
/// Gets the fix Y.
/// </summary>
/// <value></value>
public static OverlibCommand FixY {get {return fixY;}}
private static OverlibCommand relX = new OverlibCommand("RELX", OverlibCommandType.Number, null);
/// <summary>
/// Gets the rel X.
/// </summary>
/// <value></value>
public static OverlibCommand RelX {get {return relX;}}
private static OverlibCommand relY = new OverlibCommand("RELY", OverlibCommandType.Number, null);
/// <summary>
/// Gets the rel Y.
/// </summary>
/// <value></value>
public static OverlibCommand RelY {get {return relY;}}
private static OverlibCommand timeOut = new OverlibCommand("TIMEOUT", OverlibCommandType.Number, 0);
/// <summary>
/// Gets the time out.
/// </summary>
/// <value></value>
public static OverlibCommand TimeOut {get {return timeOut;}}
private static OverlibCommand delay = new OverlibCommand("DELAY", OverlibCommandType.Number, 0);
/// <summary>
/// Gets the delay.
/// </summary>
/// <value></value>
public static OverlibCommand Delay {get {return delay;}}
private static OverlibCommand border = new OverlibCommand("BORDER", OverlibCommandType.Number, 1);
/// <summary>
/// Gets the border.
/// </summary>
/// <value></value>
public static OverlibCommand Border {get {return border;}}
private static OverlibCommand padX = new OverlibCommand("PADX", OverlibCommandType.Number, OverlibCommandLevel.Core, Empty, true);
/// <summary>
/// Gets the pad X.
/// </summary>
/// <value></value>
public static OverlibCommand PadX {get {return padX;}}
private static OverlibCommand padY = new OverlibCommand("PADY", OverlibCommandType.Number, OverlibCommandLevel.Core, Empty, true);
/// <summary>
/// Gets the pad Y.
/// </summary>
/// <value></value>
public static OverlibCommand PadY {get {return padY;}}
private static OverlibCommand cellPad = new OverlibCommand("CELLPAD", OverlibCommandType.Number, OverlibCommandLevel.Core, Empty, true);
/// <summary>
/// Gets the cell pad.
/// </summary>
/// <value></value>
public static OverlibCommand CellPad {get {return cellPad;}}
[Obsolete("Don't try to access this or use it in any way. There is no alternative at this point",false)]
private static OverlibCommand inArray = new OverlibCommand("INARRAY", OverlibCommandType.Number, OverlibCommandLevel.Core, Empty, true);
/// <summary>
/// Gets the in array.
/// </summary>
/// <value></value>
public static OverlibCommand InArray {get {return inArray;}}
[Obsolete("Don't try to access this or use it in any way. There is no alternative at this point",false)]
private static OverlibCommand capArray = new OverlibCommand("CAPARRAY", OverlibCommandType.Number, OverlibCommandLevel.Core, Empty, true);
/// <summary>
/// Gets the cap array.
/// </summary>
/// <value></value>
public static OverlibCommand CapArray {get {return capArray;}}
#endregion
//overlib.js
private static OverlibCommand function = new OverlibCommand("FUNCTION", OverlibCommandType.Text);
/// <summary>
/// Gets the function.
/// </summary>
/// <value></value>
public static OverlibCommand Function {get {return function;}}
#region Quoted Text Commands
private static OverlibCommand foregroundColor = new OverlibCommand("FGCOLOR", OverlibCommandType.Color, "'#CCCCFF'");
/// <summary>
/// Gets the color of the foreground.
/// </summary>
/// <value></value>
public static OverlibCommand ForegroundColor {get {return foregroundColor;}}
private static OverlibCommand backgroundColor = new OverlibCommand("BGCOLOR", OverlibCommandType.Color, "'#333399'");
/// <summary>
/// Gets the color of the background.
/// </summary>
/// <value></value>
public static OverlibCommand BackgroundColor {get { return backgroundColor;}}
private static OverlibCommand textColor = new OverlibCommand("TEXTCOLOR", OverlibCommandType.Color, "'#000000'");
/// <summary>
/// Gets the color of the text.
/// </summary>
/// <value></value>
public static OverlibCommand TextColor {get {return textColor;}}
private static OverlibCommand captionColor = new OverlibCommand("CAPCOLOR", OverlibCommandType.Color, "'#FFFFFF'");
/// <summary>
/// Gets the color of the caption.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionColor {get {return captionColor;}}
private static OverlibCommand closeTextColor = new OverlibCommand("CLOSECOLOR", OverlibCommandType.Color, "'#9999FF'");
/// <summary>
/// Gets the color of the close text.
/// </summary>
/// <value></value>
public static OverlibCommand CloseTextColor {get {return closeTextColor;}}
private static OverlibCommand textFont = new OverlibCommand("TEXTFONT", OverlibCommandType.QText, "'Verdana,Arial,Helvetica'");
/// <summary>
/// Gets the text font.
/// </summary>
/// <value></value>
public static OverlibCommand TextFont {get {return textFont;}}
private static OverlibCommand captionFont = new OverlibCommand("CAPTIONFONT", OverlibCommandType.QText, "'Verdana,Arial,Helvetica'");
/// <summary>
/// Gets the caption font.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionFont {get {return captionFont;}}
private static OverlibCommand closeFont = new OverlibCommand("CLOSEFONT", OverlibCommandType.QText, "'Verdana,Arial,Helvetica'");
/// <summary>
/// Gets the close font.
/// </summary>
/// <value></value>
public static OverlibCommand CloseFont {get {return closeFont;}}
private static OverlibCommand textSize = new OverlibCommand("TEXTSIZE", OverlibCommandType.QText, "'1'");
/// <summary>
/// Gets the size of the text.
/// </summary>
/// <value></value>
public static OverlibCommand TextSize {get {return textSize;}}
private static OverlibCommand captionSize = new OverlibCommand("CAPTIONSIZE", OverlibCommandType.QText, "'1'");
/// <summary>
/// Gets the size of the caption.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionSize {get {return captionSize;}}
private static OverlibCommand closeSize = new OverlibCommand("CLOSESIZE", OverlibCommandType.QText, "'1'");
/// <summary>
/// Gets the size of the close.
/// </summary>
/// <value></value>
public static OverlibCommand CloseSize {
get {
return closeSize;
}
}
private static OverlibCommand backgroundPicture = new OverlibCommand("FGBACKGROUND", OverlibCommandType.QText, "");
/// <summary>
/// Gets the background picture.
/// </summary>
/// <value></value>
public static OverlibCommand BackgroundPicture {
get {
return backgroundPicture;
}
}
private static OverlibCommand borderPicture = new OverlibCommand("BGBACKGROUND", OverlibCommandType.QText, "");
/// <summary>
/// Gets the border picture.
/// </summary>
/// <value></value>
public static OverlibCommand BorderPicture {
get {
return borderPicture;
}
}
private static OverlibCommand captionIcon = new OverlibCommand("CAPICON", OverlibCommandType.QText, "");
/// <summary>
/// Gets the caption icon.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionIcon {
get {
return captionIcon;
}
}
private static OverlibCommand background = new OverlibCommand("BACKGROUND", OverlibCommandType.QText, "");
/// <summary>
/// Gets the background.
/// </summary>
/// <value></value>
public static OverlibCommand Background {
get {
return background;
}
}
private static OverlibCommand foregroundClass = new OverlibCommand("FGCLASS", OverlibCommandType.QText, "");
/// <summary>
/// Gets the foreground class.
/// </summary>
/// <value></value>
public static OverlibCommand ForegroundClass {
get {
return foregroundClass;
}
}
private static OverlibCommand backgroundClass = new OverlibCommand("BGCLASS", OverlibCommandType.QText, "");
/// <summary>
/// Gets the background class.
/// </summary>
/// <value></value>
public static OverlibCommand BackgroundClass {
get {
return backgroundClass;
}
}
private static OverlibCommand textFontClass = new OverlibCommand("TEXTFONTCLASS", OverlibCommandType.QText, "");
/// <summary>
/// Gets the text font class.
/// </summary>
/// <value></value>
public static OverlibCommand TextFontClass {
get {
return textFontClass;
}
}
private static OverlibCommand captionFontClass = new OverlibCommand("CAPTIONFONTCLASS", OverlibCommandType.QText, "");
/// <summary>
/// Gets the caption font class.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionFontClass {
get {
return captionFontClass;
}
}
private static OverlibCommand closeFontClass = new OverlibCommand("CLOSEFONTCLASS", OverlibCommandType.QText, "");
/// <summary>
/// Gets the close font class.
/// </summary>
/// <value></value>
public static OverlibCommand CloseFontClass {
get {
return closeFontClass;
}
}
private static OverlibCommand caption = new OverlibCommand("CAPTION", OverlibCommandType.QText, "");
/// <summary>
/// Gets the caption.
/// </summary>
/// <value></value>
public static OverlibCommand Caption {
get {
return caption;
}
}
private static OverlibCommand closeText = new OverlibCommand("CLOSETEXT", OverlibCommandType.QText, "");
/// <summary>
/// Gets the close text.
/// </summary>
/// <value></value>
public static OverlibCommand CloseText {
get {
return closeText;
}
}
private static OverlibCommand closeTitle = new OverlibCommand("CLOSETITLE", OverlibCommandType.QText, "");
/// <summary>
/// Gets the close title.
/// </summary>
/// <value></value>
public static OverlibCommand CloseTitle {
get {
return closeTitle;
}
}
private static OverlibCommand status = new OverlibCommand("STATUS", OverlibCommandType.QText, "");
/// <summary>
/// Gets the status.
/// </summary>
/// <value></value>
public static OverlibCommand Status {
get {
return status;
}
}
#endregion
#region PluginCommands
private static OverlibCommand frame = new OverlibCommand("FRAME", OverlibCommandType.Text, OverlibCommandLevel.PlugIn);
//add public static command at the end of this list
//ensure that plugin lists are present in OverlibCommand class
//overlib_crossframe.js
/// <summary>
/// Gets the frame.
/// </summary>
/// <value></value>
public static OverlibCommand Frame {
get {
return frame;
}
}
private static OverlibCommand exclusive = new OverlibCommand("EXCLUSIVE", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, Empty, false);
//overlib_exclusive.js
/// <summary>
/// Gets the exclusive.
/// </summary>
/// <value></value>
public static OverlibCommand Exclusive {
get {
return exclusive;
}
}
private static OverlibCommand exclusiveStatus = new OverlibCommand("EXCLUSIVESTATUS", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, Exclusive, false);
/// <summary>
/// Gets the exclusive status.
/// </summary>
/// <value></value>
public static OverlibCommand ExclusiveStatus {
get {
return exclusiveStatus;
}
}
private static OverlibCommand exclusiveOverride = new OverlibCommand("EXCLUSIVEOVERRIDE", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn);
/// <summary>
/// Gets the exclusive override.
/// </summary>
/// <value></value>
public static OverlibCommand ExclusiveOverride {
get {
return exclusiveOverride;
}
}
private static OverlibCommand followScroll = new OverlibCommand("FOLLOWSCROLL", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, Sticky, true);
//overlib_followscroll.js
/// <summary>
/// Gets the follow scroll.
/// </summary>
/// <value></value>
public static OverlibCommand FollowScroll {
get {
return followScroll;
}
}
private static OverlibCommand followScrollRefresh = new OverlibCommand("FOLLOWSCROLLREFRESH", OverlibCommandType.Number, OverlibCommandLevel.PlugIn, FollowScroll, false);
/// <summary>
/// Gets the follow scroll refresh.
/// </summary>
/// <value></value>
public static OverlibCommand FollowScrollRefresh {
get {
return followScrollRefresh;
}
}
private static OverlibCommand centerPopup = new OverlibCommand("CENTERPOPUP", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn);
//overlib_centerpopup.js
/// <summary>
/// Gets the center popup.
/// </summary>
/// <value></value>
public static OverlibCommand CenterPopup {
get {
return centerPopup;
}
}
private static OverlibCommand centerOffset = new OverlibCommand("CENTEROFFSET", OverlibCommandType.Number, OverlibCommandLevel.PlugIn, CenterPopup, false);
/// <summary>
/// Gets the center offset.
/// </summary>
/// <value></value>
public static OverlibCommand CenterOffset {
get {
return centerOffset;
}
}
private static OverlibCommand cSSStyle = new OverlibCommand("CSSSTYLE", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn);
//overlib_csstyle.js
/// <summary>
/// Gets the CSS style.
/// </summary>
/// <value></value>
public static OverlibCommand CSSStyle {
get {
return cSSStyle;
}
}
private static OverlibCommand padUnit = new OverlibCommand("PADUNIT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the pad unit.
/// </summary>
/// <value></value>
public static OverlibCommand PadUnit {
get {
return padUnit;
}
}
private static OverlibCommand heightUnit = new OverlibCommand("HEIGHTUNIT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the height unit.
/// </summary>
/// <value></value>
public static OverlibCommand HeightUnit {
get {
return heightUnit;
}
}
private static OverlibCommand widthUnit = new OverlibCommand("WIDTHUNIT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the width unit.
/// </summary>
/// <value></value>
public static OverlibCommand WidthUnit {
get {
return widthUnit;
}
}
private static OverlibCommand textDecoration = new OverlibCommand("TEXTDECORATION", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the text decoration.
/// </summary>
/// <value></value>
public static OverlibCommand TextDecoration {
get {
return textDecoration;
}
}
private static OverlibCommand textStyle = new OverlibCommand("TEXTSTYLE", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the text style.
/// </summary>
/// <value></value>
public static OverlibCommand TextStyle {
get {
return textStyle;
}
}
private static OverlibCommand textWeight = new OverlibCommand("TEXTWEIGHT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the text weight.
/// </summary>
/// <value></value>
public static OverlibCommand TextWeight {
get {
return textWeight;
}
}
private static OverlibCommand captionSizeUnit = new OverlibCommand("CAPTIONSIZEUNIT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the caption size unit.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionSizeUnit {
get {
return captionSizeUnit;
}
}
private static OverlibCommand captionDecoration = new OverlibCommand("CAPTIONDECORATION", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets or sets the caption decoration.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionDecoration {
get {
return captionDecoration;
}
set {
captionDecoration = value;
}
}
private static OverlibCommand captionStyle = new OverlibCommand("CAPTIONSTYLE", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the caption style.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionStyle {
get {
return captionStyle;
}
}
private static OverlibCommand captionWeight = new OverlibCommand("CAPTIONWEIGHT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the caption weight.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionWeight {
get {
return captionWeight;
}
}
private static OverlibCommand closeSizeUnit = new OverlibCommand("CLOSESIZEUNIT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the close size unit.
/// </summary>
/// <value></value>
public static OverlibCommand CloseSizeUnit {
get {
return closeSizeUnit;
}
}
private static OverlibCommand closeDecoration = new OverlibCommand("CLOSEDECORATION", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the close decoration.
/// </summary>
/// <value></value>
public static OverlibCommand CloseDecoration {
get {
return closeDecoration;
}
}
private static OverlibCommand closeStyle = new OverlibCommand("CLOSESTYLE", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets or sets the close style.
/// </summary>
/// <value></value>
public static OverlibCommand CloseStyle {
get {
return closeStyle;
}
set {
closeStyle = value;
}
}
private static OverlibCommand closeWeight = new OverlibCommand("CLOSEWEIGHT", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, CSSStyle, false);
/// <summary>
/// Gets the close weight.
/// </summary>
/// <value></value>
public static OverlibCommand CloseWeight {
get {
return closeWeight;
}
}
private static OverlibCommand setOn = new OverlibCommand("SETON", OverlibCommandType.Other, OverlibCommandLevel.PlugIn, Empty, false);
//overlib_setonoff.js
/// <summary>
/// Gets the set on.
/// </summary>
/// <value></value>
public static OverlibCommand SetOn {
get {
return setOn;
}
}
private static OverlibCommand setOff = new OverlibCommand("SETOFF", OverlibCommandType.Other, OverlibCommandLevel.PlugIn, Empty, false);
/// <summary>
/// Gets the set off.
/// </summary>
/// <value></value>
public static OverlibCommand SetOff {
get {
return setOff;
}
}
private static OverlibCommand anchor = new OverlibCommand("ANCHOR", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, "");
//overlib_anchor.js
/// <summary>
/// Gets the anchor.
/// </summary>
/// <value></value>
public static OverlibCommand Anchor {
get {
return anchor;
}
}
private static OverlibCommand anchorAlign = new OverlibCommand("ANCHORALIGN", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, Anchor, false);
/// <summary>
/// Gets the anchor align.
/// </summary>
/// <value></value>
public static OverlibCommand AnchorAlign {
get {
return anchorAlign;
}
}
private static OverlibCommand anchorX = new OverlibCommand("ANCHORX", OverlibCommandType.Number, OverlibCommandLevel.PlugIn, Anchor, false);
/// <summary>
/// Gets the anchor X.
/// </summary>
/// <value></value>
public static OverlibCommand AnchorX {
get {
return anchorX;
}
}
private static OverlibCommand anchorY = new OverlibCommand("ANCHORY", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, Anchor, false);
/// <summary>
/// Gets the anchor Y.
/// </summary>
/// <value></value>
public static OverlibCommand AnchorY {
get {
return anchorY;
}
}
private static OverlibCommand noAnchorWarn = new OverlibCommand("NOANCHORWARN", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, Anchor, false);
/// <summary>
/// Gets the no anchor warn.
/// </summary>
/// <value></value>
public static OverlibCommand NoAnchorWarn {
get {
return noAnchorWarn;
}
}
private static OverlibCommand draggable = new OverlibCommand("DRAGGABLE", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn);
//overlib_draggable.js
/// <summary>
/// Gets the draggable.
/// </summary>
/// <value></value>
public static OverlibCommand Draggable {
get {
return draggable;
}
}
private static OverlibCommand altCut = new OverlibCommand("ALTCUT", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, Draggable, false);
/// <summary>
/// Gets the alt cut.
/// </summary>
/// <value></value>
public static OverlibCommand AltCut {
get {
return altCut;
}
}
private static OverlibCommand dragImage = new OverlibCommand("DRAGIMG", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, Draggable, false);
/// <summary>
/// Gets the drag image.
/// </summary>
/// <value></value>
public static OverlibCommand DragImage {
get {
return dragImage;
}
}
private static OverlibCommand useOverTwo = new OverlibCommand("USEOVERTWO", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, OverlibCommand.Empty, true);
//overlib_overtwo.js
/// <summary>
/// Gets the use over two.
/// </summary>
/// <value></value>
public static OverlibCommand UseOverTwo {
get {
return useOverTwo;
}
}
private static OverlibCommand pUid = new OverlibCommand("PUID", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, UseOverTwo, false);
/// <summary>
/// Gets the P uid.
/// </summary>
/// <value></value>
public static OverlibCommand PUid {
get {
return pUid;
}
}
private static OverlibCommand idAlert = new OverlibCommand("IDALERT", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, UseOverTwo, false);
/// <summary>
/// Gets the id alert.
/// </summary>
/// <value></value>
public static OverlibCommand IdAlert {
get {
return idAlert;
}
}
private static OverlibCommand captionAlign = new OverlibCommand("CAPALIGN", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, UseOverTwo, false);
/// <summary>
/// Gets the caption align.
/// </summary>
/// <value></value>
public static OverlibCommand CaptionAlign {
get {
return captionAlign;
}
}
private static OverlibCommand textAlign = new OverlibCommand("TEXTALIGN", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn, UseOverTwo, false);
/// <summary>
/// Gets the text align.
/// </summary>
/// <value></value>
public static OverlibCommand TextAlign {
get {
return textAlign;
}
}
private static OverlibCommand shadow = new OverlibCommand("SHADOW", OverlibCommandType.Flag, OverlibCommandLevel.PlugIn);
//overlib_shadow.js
/// <summary>
/// Gets the shadow.
/// </summary>
/// <value></value>
public static OverlibCommand Shadow {
get {
return shadow;
}
}
private static OverlibCommand shadowColor = new OverlibCommand("SHADOWCOLOR", OverlibCommandType.Color, OverlibCommandLevel.PlugIn, Shadow, false);
/// <summary>
/// Gets the color of the shadow.
/// </summary>
/// <value></value>
public static OverlibCommand ShadowColor {
get {
return shadowColor;
}
}
private static OverlibCommand shadowImage = new OverlibCommand("SHADOWIMAGE", OverlibCommandType.QText, OverlibCommandLevel.PlugIn, Shadow, false);
/// <summary>
/// Gets the shadow image.
/// </summary>
/// <value></value>
public static OverlibCommand ShadowImage {
get {
return shadowImage;
}
}
private static OverlibCommand shadowOpacity = new OverlibCommand("SHADOWOPACITY", OverlibCommandType.Number, OverlibCommandLevel.PlugIn, Shadow, false);
/// <summary>
/// Gets the shadow opacity.
/// </summary>
/// <value></value>
public static OverlibCommand ShadowOpacity {
get {
return shadowOpacity;
}
}
private static OverlibCommand shadowX = new OverlibCommand("SHADOWX", OverlibCommandType.Number, OverlibCommandLevel.PlugIn, Shadow, false);
/// <summary>
/// Gets the shadow X.
/// </summary>
/// <value></value>
public static OverlibCommand ShadowX {
get {
return shadowX;
}
}
private static OverlibCommand shadowY = new OverlibCommand("SHADOWY", OverlibCommandType.Number, OverlibCommandLevel.PlugIn, Shadow, false);
/// <summary>
/// Gets the shadow Y.
/// </summary>
/// <value></value>
public static OverlibCommand ShadowY {
get {
return shadowY;
}
}
#endregion
#endregion
#region IComparable Members
/// <summary>Compares this instance to an object.</summary>
/// <param name="obj">Obj.</param>
/// <returns>An integer value that represents the value of the comparision</returns>
int IComparable.CompareTo(object obj) {
return this.CompareTo((OverlibCommand)obj);
}
/// <summary>
/// Compares this instance to an OverlibCommand.
/// </summary>
/// <param name="cmd">The command name.</param>
/// <returns></returns>
public int CompareTo(OverlibCommand cmd){
if(this.Equals(cmd)){
return 0;
}
if((this._cmdName.ToUpper().CompareTo(cmd.CommandName.ToUpper())) < 0){
return -1;
}
if((this._cmdName.ToUpper().CompareTo(cmd.CommandName.ToUpper())) > 0){
return 1;
}
return -1;
}
#endregion
}
// /// <summary>
// /// Converts an <see cref="OverlibCommand"/> to and from a string
// /// </summary>
// public class OverlibCommandConverter:TypeConverter{
// /// <summary>
// /// Determines whether this instance [can convert from] the specified context.
// /// </summary>
// /// <param name="context">Context.</param>
// /// <param name="sourceType">Source type.</param>
// /// <returns>
// /// <c>true</c> if this instance [can convert from] the specified context; otherwise, <c>false</c>.
// /// </returns>
// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
// if(sourceType == typeof(string)){
// return true;
// }
// return base.CanConvertFrom (context, sourceType);
// }
// /// <summary>
// /// Determines whether this instance [can convert to] the specified context.
// /// </summary>
// /// <param name="context">Context.</param>
// /// <param name="destinationType">Destination type.</param>
// /// <returns>
// /// <c>true</c> if this instance [can convert to] the specified context; otherwise, <c>false</c>.
// /// </returns>
// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
// if((destinationType == typeof(string))||(destinationType == typeof(InstanceDescriptor))){
// return true;
// }
// return base.CanConvertTo (context, destinationType);
// }
// /// <summary>
// /// Converts from a string or other representation.
// /// </summary>
// /// <param name="context">Context.</param>
// /// <param name="culture">Culture.</param>
// /// <param name="value">Value.</param>
// /// <returns>The object that the value is converted from</returns>
// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
// if(value == null){
// return new OverlibCommand();
// }
// if(value is string){
// string s = (string)value;
// if(s.Trim().Length == 0){
// return new OverlibCommand();
// }
// string[] parts = s.Split(',');
// if(parts.Length < 1){
// throw new ArgumentException("Invalid OverlibCommand","value");
// }
// string command = "";
// System.Collections.ArrayList values = new System.Collections.ArrayList();
// int counter = 0;
// foreach(string ss in parts){
// if(counter++ == 0){
// command = ss.Trim();
// }
// values.Add(ss.Trim());
// }
// return new OverlibCommand(command,((object[])values.ToArray(typeof(object))));
// }
//
// return base.ConvertFrom (context, culture, value);
// }
// /// <summary>
// /// Converts to whatever the destination type is.
// /// </summary>
// /// <param name="context">Context.</param>
// /// <param name="culture">Culture.</param>
// /// <param name="value">Value.</param>
// /// <param name="destinationType">Destination type.</param>
// /// <returns>An object that the value is converted to</returns>
// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
// if(value != null){
// if(!(value is OverlibCommand)){
// throw new ArgumentException("Invalid OverlibCommand","value");
// }
// }
//
// if(destinationType == typeof(string)){
// if( value == null){
// return string.Empty;
// }
// OverlibCommand oc = (OverlibCommand)value;
//
// System.Text.StringBuilder text = new System.Text.StringBuilder("");
// text.Append(oc.CommandName);
//
// if(oc.CommandType != OverlibCommandType.Flag){
// if(oc.CommandType == OverlibCommandType.Number){
// if(oc.CommandIntValues.Length > 0 && oc.CommandIntValue != Int32.MinValue){
// foreach(int ival in oc.CommandIntValues){
// text.Append(",");
// text.Append(ival.ToString());
// }
// }
// }else{
// if(oc.CommandTextValues.Length > 0 && oc.CommandTextValue.Trim().Length != 0){
// foreach(string sval in oc.CommandTextValues){
// text.Append(",");
// if(oc.CommandType != OverlibCommandType.QText){
// text.Append("'" + sval+"'");
// }else{
// text.Append(sval);
// }
// }
// }
// }
// }
//
// return text.ToString();
// }else if(destinationType == typeof(InstanceDescriptor)){
// if(value == null){
// return null;
// }
// MemberInfo mi = null;
// object[] args = null;
// OverlibCommand olc = (OverlibCommand)value;
// if(olc.IsEmpty){
// mi = typeof(OverlibCommand).GetConstructor(new Type[0]);
// }else{
// Type sType = typeof(string);
// Type oType = typeof(object[]);
// mi = typeof(OverlibCommand).GetConstructor(new Type[]{sType,oType});
// args = olc.CommandValues;
// }
// if(mi != null){
// return new InstanceDescriptor(mi,args);
// }else{
// return null;
// }
// }
// return base.ConvertTo (context, culture, value, destinationType);
// }
// }
}