Esempio n. 1
0
        public override string ToString()
        {
            string s = "\n\tMyArgs: \n";

            s += "\t\t switchParameterString=" + m_switchParameterString + "\n";
            s += "\t\t argumentParameterString=" + m_argumentParameterString + "\n";
            s += "\t\t requiredParameterString=" + m_requiredParameterString + "\n";
            s += "\t\t argC    =" + m_argV.Count + "\n";
            s += "\t\t argV    =" + m_argV + "\n";
            s += "\t\t Nargs   =" + nargs() + "\n";
            s += "\t\t Flags:  =";
            IEnumerator it = m_flags.GetEnumerator();

            while (it.MoveNext())
            {
                s += it.Current + ", ";
            }
            s += "\n";
            it = m_Parameters.Keys.GetEnumerator();
            s += "\t\t Parameters: \n";
            while (it.MoveNext())
            {
                string key = (string)it.Current;
                s += "\t\t\t " + key + " = " + (string)m_Parameters[key] + "\n";
            }
            s += "\t\t onlyArgs=" + m_onlyArgs + "\n";

            return(s += "\n");
        }
Esempio n. 2
0
        public static System.String escape(System.String text, NuGenEncodingCharacters encChars)
        {
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            int textLength = text.Length;

            System.Collections.Hashtable esc  = getEscapeSequences(encChars);
            SupportClass.SetSupport      keys = new SupportClass.HashSetSupport(esc.Keys);
            System.String escChar             = System.Convert.ToString(encChars.EscapeCharacter);
            int           position            = 0;

            while (position < textLength)
            {
                System.Collections.IEnumerator it = keys.GetEnumerator();
                bool isReplaced = false;
                while (it.MoveNext() && !isReplaced)
                {
                    System.String seq = (System.String)it.Current;
                    System.String val = (System.String)esc[seq];
                    if (text.Substring(position, (position + 1) - (position)).Equals(val))
                    {
                        result.Append(seq);
                        isReplaced = true;
                    }
                }
                if (!isReplaced)
                {
                    result.Append(text.Substring(position, ((position + 1)) - (position)));
                }
                position++;
            }
            return(result.ToString());
        }
Esempio n. 3
0
		public static System.String unescape(System.String text, NuGenEncodingCharacters encChars)
		{
			System.Text.StringBuilder result = new System.Text.StringBuilder();
			int textLength = text.Length;
			System.Collections.Hashtable esc = getEscapeSequences(encChars);
			SupportClass.SetSupport keys = new SupportClass.HashSetSupport(esc.Keys);
			System.String escChar = System.Convert.ToString(encChars.EscapeCharacter);
			int position = 0;
			while (position < textLength)
			{
				System.Collections.IEnumerator it = keys.GetEnumerator();
				bool isReplaced = false;
				while (it.MoveNext() && !isReplaced)
				{
					System.String seq = (System.String) it.Current;
					System.String val = (System.String) esc[seq];
					int seqLength = seq.Length;
					if (position + seqLength <= textLength)
					{
						if (text.Substring(position, (position + seqLength) - (position)).Equals(seq))
						{
							result.Append(val);
							isReplaced = true;
							position = position + seq.Length;
						}
					}
				}
				if (!isReplaced)
				{
					result.Append(text.Substring(position, ((position + 1)) - (position)));
					position++;
				}
			}
			return result.ToString();
		}
Esempio n. 4
0
        public static System.String escape(System.String text, EncodingCharacters encChars)
        {
            //First, take all special characters and replace them with something that is garbled
            for (int i = 0; i < SPECIAL_ENCODING_VALUES.Length; i++)
            {
                string specialValues = SPECIAL_ENCODING_VALUES[i];
                text = text.Replace(specialValues, EncodeSpecialCharacters(i.ToString()));
            }
            //Encode each escape character
            System.Collections.Hashtable esc    = getEscapeSequences(encChars);
            System.Text.StringBuilder    result = new System.Text.StringBuilder();
            SupportClass.SetSupport      keys   = new SupportClass.HashSetSupport(esc.Keys);
            System.String escChar  = System.Convert.ToString(encChars.EscapeCharacter);
            int           position = 0;

            while (position < text.Length)
            {
                System.Collections.IEnumerator it = keys.GetEnumerator();
                bool isReplaced = false;
                while (it.MoveNext() && !isReplaced)
                {
                    System.String seq = (System.String)it.Current;
                    System.String val = (System.String)esc[seq];
                    if (text.Substring(position, 1).Equals(val))
                    {
                        result.Append(seq);
                        isReplaced = true;
                    }
                }
                if (!isReplaced)
                {
                    result.Append(text.Substring(position, 1));
                }
                position++;
            }

            //Replace each garbled entry with the correct special value
            for (int i = 0; i < SPECIAL_ENCODING_VALUES.Length; i++)
            {
                string specialValues = SPECIAL_ENCODING_VALUES[i];
                result.Replace(EncodeSpecialCharacters(i.ToString()), specialValues);
            }
            return(result.ToString());
        }
Esempio n. 5
0
        /// <summary>
        /// Unescape the string
        /// </summary>
        /// <param name="text"></param>
        /// <param name="encChars"></param>
        /// <returns></returns>
        public static String unescape(String text, EncodingCharacters encChars)
        {
            // is there an escape character in the text at all?
            if (text.IndexOf(encChars.EscapeCharacter) == -1)
            {
                return(text);
            }

            StringBuilder result     = new StringBuilder();
            int           textLength = text.Length;
            Hashtable     esc        = getEscapeSequences(encChars);

            SupportClass.ISetSupport keys = new SupportClass.HashSetSupport(esc.Keys);
            String escChar  = Convert.ToString(encChars.EscapeCharacter);
            int    position = 0;

            while (position < textLength)
            {
                IEnumerator it         = keys.GetEnumerator();
                bool        isReplaced = false;
                while (it.MoveNext() && !isReplaced)
                {
                    String seq       = (String)it.Current;
                    String val       = (String)esc[seq];
                    int    seqLength = seq.Length;
                    if (position + seqLength <= textLength)
                    {
                        if (text.Substring(position, (position + seqLength) - (position)).Equals(seq))
                        {
                            result.Append(val);
                            isReplaced = true;
                            position   = position + seq.Length;
                        }
                    }
                }
                if (!isReplaced)
                {
                    result.Append(text.Substring(position, ((position + 1)) - (position)));
                    position++;
                }
            }
            return(result.ToString());
        }
Esempio n. 6
0
        public static System.String escape(System.String text, EncodingCharacters encChars)
        {
            //First, take all special characters and replace them with something that is garbled
            for(int i=0;i<SPECIAL_ENCODING_VALUES.Length;i++)
            {
                string specialValues = SPECIAL_ENCODING_VALUES[i];
                text = text.Replace(specialValues, EncodeSpecialCharacters(i.ToString()));
            }
            //Encode each escape character
                        System.Collections.Hashtable esc = getEscapeSequences(encChars);
            System.Text.StringBuilder result = new System.Text.StringBuilder();
            SupportClass.SetSupport keys = new SupportClass.HashSetSupport(esc.Keys);
            System.String escChar = System.Convert.ToString(encChars.EscapeCharacter);
            int position = 0;
            while (position < text.Length)
            {
                System.Collections.IEnumerator it = keys.GetEnumerator();
                bool isReplaced = false;
                while (it.MoveNext() && !isReplaced)
                {
                    System.String seq = (System.String) it.Current;
                    System.String val = (System.String) esc[seq];
                    if (text.Substring(position, 1).Equals(val))
                    {
                        result.Append(seq);
                        isReplaced = true;
                    }
                }
                if (!isReplaced)
                {
                    result.Append(text.Substring(position, 1));
                }
                position++;
            }

            //Replace each garbled entry with the correct special value
            for(int i=0;i<SPECIAL_ENCODING_VALUES.Length;i++)
            {
                string specialValues = SPECIAL_ENCODING_VALUES[i];
                result.Replace(EncodeSpecialCharacters(i.ToString()), specialValues);
            }
            return result.ToString();
        }
Esempio n. 7
0
        /// <summary>
        /// Unescape the string
        /// </summary>
        /// <param name="text"></param>
        /// <param name="encChars"></param>
        /// <returns></returns>
        public static String unescape(String text, EncodingCharacters encChars)
        {
            // is there an escape character in the text at all?
            if (text.IndexOf(encChars.EscapeCharacter) == -1)
            {
                return text;
            }

            StringBuilder result = new StringBuilder();
            int textLength = text.Length;
            Hashtable esc = getEscapeSequences(encChars);
            SupportClass.ISetSupport keys = new SupportClass.HashSetSupport(esc.Keys);
            String escChar = Convert.ToString(encChars.EscapeCharacter);
            int position = 0;
            while (position < textLength)
            {
                IEnumerator it = keys.GetEnumerator();
                bool isReplaced = false;
                while (it.MoveNext() && !isReplaced)
                {
                    String seq = (String) it.Current;
                    String val = (String) esc[seq];
                    int seqLength = seq.Length;
                    if (position + seqLength <= textLength)
                    {
                        if (text.Substring(position, (position + seqLength) - (position)).Equals(seq))
                        {
                            result.Append(val);
                            isReplaced = true;
                            position = position + seq.Length;
                        }
                    }
                }
                if (!isReplaced)
                {
                    result.Append(text.Substring(position, ((position + 1)) - (position)));
                    position++;
                }
            }
            return result.ToString();
        }