Esempio n. 1
0
        internal void AddSessionToCache(CimSession cimSession, XOperationContextBase context, CmdletOperationBase cmdlet)
        {
            string str;

            DebugHelper.WriteLogEx();
            CimNewSession.CimTestCimSessionContext cimTestCimSessionContext = context as CimNewSession.CimTestCimSessionContext;
            uint   num  = this.sessionState.GenerateSessionId();
            string name = cimTestCimSessionContext.CimSessionWrapper.Name;

            if (name != null)
            {
                str = name;
            }
            else
            {
                object[] cimSessionClassName = new object[2];
                cimSessionClassName[0] = CimSessionState.CimSessionClassName;
                cimSessionClassName[1] = num;
                str = string.Format(CultureInfo.CurrentUICulture, "{0}{1}", cimSessionClassName);
            }
            string     str1        = str;
            CimSession cimSession1 = cimTestCimSessionContext.Proxy.Detach();
            PSObject   cache       = this.sessionState.AddObjectToCache(cimSession1, num, cimSession1.InstanceId, str1, cimTestCimSessionContext.CimSessionWrapper.ComputerName, cimTestCimSessionContext.Proxy.Protocol);

            cmdlet.WriteObject(cache, null);
        }
Esempio n. 2
0
        /// <summary>
        /// <para>
        /// Add session to global cache,
        /// </para>
        /// </summary>
        /// <param name="cimSession"></param>
        /// <param name="context"></param>
        /// <param name="cmdlet"></param>
        internal void AddSessionToCache(CimSession cimSession, XOperationContextBase context, CmdletOperationBase cmdlet)
        {
            DebugHelper.WriteLogEx();

            CimTestCimSessionContext testCimSessionContext = context as CimTestCimSessionContext;
            uint   sessionId           = this.sessionState.GenerateSessionId();
            string originalSessionName = testCimSessionContext.CimSessionWrapper.Name;
            string sessionName         = (originalSessionName != null) ? originalSessionName : string.Format(CultureInfo.CurrentUICulture, @"{0}{1}", CimSessionState.CimSessionClassName, sessionId);

            // detach CimSession from the proxy object
            CimSession createdCimSession = testCimSessionContext.Proxy.Detach();
            PSObject   psObject          = this.sessionState.AddObjectToCache(
                createdCimSession,
                sessionId,
                createdCimSession.InstanceId,
                sessionName,
                testCimSessionContext.CimSessionWrapper.ComputerName,
                testCimSessionContext.Proxy.Protocol);

            cmdlet.WriteObject(psObject, null);
        }
Esempio n. 3
0
		internal void AddSessionToCache(CimSession cimSession, XOperationContextBase context, CmdletOperationBase cmdlet)
		{
			string str;
			DebugHelper.WriteLogEx();
			CimNewSession.CimTestCimSessionContext cimTestCimSessionContext = context as CimNewSession.CimTestCimSessionContext;
			uint num = this.sessionState.GenerateSessionId();
			string name = cimTestCimSessionContext.CimSessionWrapper.Name;
			if (name != null)
			{
				str = name;
			}
			else
			{
				object[] cimSessionClassName = new object[2];
				cimSessionClassName[0] = CimSessionState.CimSessionClassName;
				cimSessionClassName[1] = num;
				str = string.Format(CultureInfo.CurrentUICulture, "{0}{1}", cimSessionClassName);
			}
			string str1 = str;
			CimSession cimSession1 = cimTestCimSessionContext.Proxy.Detach();
			PSObject cache = this.sessionState.AddObjectToCache(cimSession1, num, cimSession1.InstanceId, str1, cimTestCimSessionContext.CimSessionWrapper.ComputerName, cimTestCimSessionContext.Proxy.Protocol);
			cmdlet.WriteObject(cache, null);
		}
Esempio n. 4
0
        /// <summary>
        /// <para>
        /// Add session to global cache
        /// </para>
        /// </summary>
        /// <param name="cimSession"></param>
        /// <param name="context"></param>
        /// <param name="cmdlet"></param>
        internal void AddSessionToCache(CimSession cimSession, XOperationContextBase context, CmdletOperationBase cmdlet)
        {
            DebugHelper.WriteLogEx();

            CimTestCimSessionContext testCimSessionContext = context as CimTestCimSessionContext;
            UInt32 sessionId = this.sessionState.GenerateSessionId();
            string originalSessionName = testCimSessionContext.CimSessionWrapper.Name;
            string sessionName = (originalSessionName != null) ? originalSessionName : String.Format(CultureInfo.CurrentUICulture, @"{0}{1}", CimSessionState.CimSessionClassName, sessionId);

            // detach CimSession from the proxy object
            CimSession createdCimSession = testCimSessionContext.Proxy.Detach();
            PSObject psObject = this.sessionState.AddObjectToCache(
                createdCimSession,
                sessionId,
                createdCimSession.InstanceId,
                sessionName,
                testCimSessionContext.CimSessionWrapper.ComputerName,
                testCimSessionContext.Proxy.Protocol);
            cmdlet.WriteObject(psObject, null);
        }
Esempio n. 5
0
		public override void Execute(CmdletOperationBase cmdlet)
		{
			ValidationHelper.ValidateNoNullArgument(cmdlet, "cmdlet");
			cmdlet.WriteObject(this.result, base.Context);
		}
Esempio n. 6
0
 public override void Execute(CmdletOperationBase cmdlet)
 {
     ValidationHelper.ValidateNoNullArgument(cmdlet, "cmdlet");
     cmdlet.WriteObject(this.result, base.Context);
 }