/// <summary>
        /// Return the first index of the entry in <paramref name="entries"/>
        /// with the name <paramref name="name"/>. Return -1 if it is not found.
        /// </summary>
        /// <typeparam name="T">Type of ConstrainedSessionStateEntry</typeparam>
        /// <param name="entries">Collection of entries to search for <paramref name="name"/> in.</param>
        /// <param name="name">Named of the entry we are looking for</param>
        /// <returns>
        /// The first index of the entry in <paramref name="entries"/> with the
        /// name <paramref name="name"/>, or return -1 if it is not found.
        /// </returns>
        private static int GetIndexOfEntry <T>(
            InitialSessionStateEntryCollection <T> entries,
            string name) where T : ConstrainedSessionStateEntry
        {
            int foundIndex = 0;

            foreach (T entry in entries)
            {
                if (entry.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
                {
                    return(foundIndex);
                }

                foundIndex++;
            }

            return(-1);
        }
Ejemplo n.º 2
0
        public static string ToTraceMessage(this InitialSessionState iss)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("Initial Session State");
            stringBuilder.AppendLine(string.Concat("Language Mode = ", iss.LanguageMode.ToString()));
            stringBuilder.AppendLine(string.Concat("Apartment State = ", iss.ApartmentState.ToString()));
            stringBuilder.AppendLine(string.Concat("Thread Options = ", iss.ThreadOptions.ToString()));
            bool useFullLanguageModeInDebugger = iss.UseFullLanguageModeInDebugger;

            stringBuilder.AppendLine(string.Concat("Full language mode in debugger = ", useFullLanguageModeInDebugger.ToString()));
            stringBuilder.AppendLine("Visible Commands ");
            InitialSessionStateEntryCollection <SessionStateCommandEntry> commands = iss.Commands;

            commands.Where <SessionStateCommandEntry>((SessionStateCommandEntry item) => item.Visibility == SessionStateEntryVisibility.Public).ToList <SessionStateCommandEntry>().ForEach((SessionStateCommandEntry item) => stringBuilder.AppendLine(string.Concat("\t", item.Name)));
            stringBuilder.AppendLine("Invisible Commands ");
            InitialSessionStateEntryCollection <SessionStateCommandEntry> sessionStateCommandEntries = iss.Commands;

            sessionStateCommandEntries.Where <SessionStateCommandEntry>((SessionStateCommandEntry item) => item.Visibility == SessionStateEntryVisibility.Private).ToList <SessionStateCommandEntry>().ForEach((SessionStateCommandEntry item) => stringBuilder.AppendLine(string.Concat("\t", item.Name)));
            return(stringBuilder.ToString());
        }
Ejemplo n.º 3
0
 protected InitialSessionState()
 {
     sessionstatentry = new InitialSessionStateEntryCollection<SessionStateCommandEntry>();
     sessionstatprovider = new InitialSessionStateEntryCollection<SessionStateProviderEntry>();
 }
Ejemplo n.º 4
0
 protected InitialSessionState()
 {
     _commandEntries = new InitialSessionStateEntryCollection<SessionStateCommandEntry>();
     sessionstatprovider = new InitialSessionStateEntryCollection<SessionStateProviderEntry>();
     variables = new InitialSessionStateEntryCollection<SessionStateVariableEntry>();
 }