当前位置: 首页>>代码示例>>C#>>正文


C# SessionProperties类代码示例

本文整理汇总了C#中SessionProperties的典型用法代码示例。如果您正苦于以下问题:C# SessionProperties类的具体用法?C# SessionProperties怎么用?C# SessionProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SessionProperties类属于命名空间,在下文中一共展示了SessionProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AuthenticatedUserGateway

        public BooleanResult AuthenticatedUserGateway(SessionProperties properties)
        {
            UserInformation userInfo = properties.GetTrackedSingle<UserInformation>();
            Dictionary<string, Dictionary<bool, string>> settings = GetSettings(userInfo);
            Dictionary<bool, string> gateway_sys = settings["gateway_sys"];

            foreach (KeyValuePair<bool, string> line in gateway_sys)
            {
                if (!Run(userInfo.SessionID, line.Value, userInfo, line.Key, true))
                    return new BooleanResult { Success = false, Message = String.Format("failed to run:{0}", line.Value) };
            }

            // return false if no other plugin succeeded
            BooleanResult ret = new BooleanResult() { Success = false };
            PluginActivityInformation pluginInfo = properties.GetTrackedSingle<PluginActivityInformation>();
            foreach (Guid uuid in pluginInfo.GetAuthenticationPlugins())
            {
                if (pluginInfo.GetAuthenticationResult(uuid).Success)
                {
                    return new BooleanResult() { Success = true };
                }
                else
                {
                    ret.Message = pluginInfo.GetAuthenticationResult(uuid).Message;
                }
            }

            return ret;
        }
开发者ID:MutonUfoAI,项目名称:pgina,代码行数:29,代码来源:PluginImpl.cs

示例2: BooleanResult

        BooleanResult IPluginAuthentication.AuthenticateUser(SessionProperties properties)
        {
            try
            {
                m_logger.DebugFormat("AuthenticateUser({0})", properties.Id.ToString());

                // Get user info
                UserInformation userInfo = properties.GetTrackedSingle<UserInformation>();

                m_logger.DebugFormat("Found username: {0}", userInfo.Username);
                if (userInfo.Username.StartsWith("p"))
                {
                    m_logger.InfoFormat("Authenticated user: {0}", userInfo.Username);
                    return new BooleanResult() { Success = true };
                }

                m_logger.ErrorFormat("Failed to authenticate user: {0}", userInfo.Username);
                return new BooleanResult() { Success = false, Message = string.Format("Your username does not start with a 'p'") };
            }
            catch (Exception e)
            {
                m_logger.ErrorFormat("AuthenticateUser exception: {0}", e);
                throw;  // Allow pGina service to catch and handle exception
            }
        }
开发者ID:hellyhe,项目名称:pgina,代码行数:25,代码来源:PluginImpl.cs

示例3: LidgrenAvailableSession

 internal LidgrenAvailableSession(SessionType sessionType, int currentGamerCount, string hostName, int openPrivateSlots, int openPublicSlots, SessionProperties sessionProperties, TimeSpan averageRoundtripTime)
 {
     _sessionType = sessionType;
     _currentGamerCount = currentGamerCount;
     _hostName = hostName;
     _openPrivateSlots = openPrivateSlots;
     _openPublicSlots = openPublicSlots;
     _sessionProperties = sessionProperties;
     _averageRoundtripTime = averageRoundtripTime;
 }
开发者ID:Indiefreaks,项目名称:igf,代码行数:10,代码来源:LidgrenAvailableSession.cs

示例4: SessionChange

 public void SessionChange(System.ServiceProcess.SessionChangeDescription changeDescription, SessionProperties properties)
 {
     // Check that we're logging on, and that we're configured to do anything
     if (properties != null && changeDescription.Reason == System.ServiceProcess.SessionChangeReason.SessionLogon)
     {
         m_logger.DebugFormat("Attempting to map drive(s) in session: id={0}", changeDescription.SessionId);
         List<DriveMap> maps = Settings.GetMaps();
         foreach( DriveMap map in maps )
         {
             MapDrive(changeDescription.SessionId, map, properties);
         }
     }
 }
开发者ID:hellyhe,项目名称:pgina,代码行数:13,代码来源:PluginMain.cs

示例5: ConvertFromLiveSessionProperties

        /// <summary>
        /// Converts a NetworkSessionProperties instance to the SessionProperties
        /// </summary>
        internal static SessionProperties ConvertFromLiveSessionProperties(NetworkSessionProperties networkSessionProperties)
        {
            if (networkSessionProperties == null)
                return null;

            var sessionProperties = new SessionProperties();

            for (int i = 0; i < networkSessionProperties.Count; i++)
            {
                sessionProperties[i] = networkSessionProperties[i];
            }

            return sessionProperties;
        }
开发者ID:rc183,项目名称:igf,代码行数:17,代码来源:LiveSessionProperties.cs

示例6: ConvertToLiveSessionProperties

        /// <summary>
        /// Converts a SessionProperties instance to the NetworkSessionProperties
        /// </summary>
        internal static NetworkSessionProperties ConvertToLiveSessionProperties(SessionProperties sessionProperties)
        {
            if (sessionProperties == null)
                return null;

            var networkSessionProperties = new NetworkSessionProperties();
            
            for (int i = 0; i < sessionProperties.Count; i++)
            {
                networkSessionProperties[i] = sessionProperties[i];
            }

            return networkSessionProperties;
        }
开发者ID:rc183,项目名称:igf,代码行数:17,代码来源:LiveSessionProperties.cs

示例7: DebugSession

        /// <summary>
        /// Creates a new DebugSession object.
        /// </summary>
        /// <param name="debuggerName">The name of the session debugger.</param>
        /// <param name="loadedExtensions">The names of the loaded extensions.</param>
        /// <param name="architecture">The executing machine architecture.</param>
        /// <param name="initialProperties">Initial session properties to set.</param>
        public DebugSession(string debuggerName, string[] loadedExtensions, Architecture architecture,
            SessionProperties initialProperties)
            : this()
        {
            if (initialProperties == null)
                throw new ArgumentNullException("initialProperties");
            if (architecture == null)
                throw new ArgumentNullException("architecture");

            this.debuggerName   = debuggerName;
            this.extensionNames = loadedExtensions ?? new string[0];
            this.architecture   = architecture;
            this.properties     = new SessionProperties(initialProperties);
        }
开发者ID:jsren,项目名称:DebugOS,代码行数:21,代码来源:DebugSession.cs

示例8: BeginChain

 public void BeginChain(SessionProperties properties)
 {
     m_logger.Debug("BeginChain");
     try
     {
         SessionLogger m_sessionlogger = new SessionLogger();
         properties.AddTrackedSingle<SessionLogger>(m_sessionlogger);
     }
     catch (Exception e)
     {
         m_logger.ErrorFormat("Failed to create SessionLogger: {0}", e);
         properties.AddTrackedSingle<SessionLogger>(null);
     }
 }
开发者ID:Lo5t,项目名称:pGina.Plugin.MonogDBLogger,代码行数:14,代码来源:PluginImpl.cs

示例9: DidPluginAuth

 private bool DidPluginAuth(string uuid, SessionProperties properties)
 {
     try
     {
         Guid pluginUuid = new Guid(uuid);
         PluginActivityInformation pluginInfo = properties.GetTrackedSingle<PluginActivityInformation>();
         return pluginInfo.GetAuthenticationResult(pluginUuid).Success;
     }
     catch (Exception e)
     {
         m_logger.ErrorFormat("Unable to validate that {0} authenticated user: {1}", uuid, e);
         return false;
     }
 }
开发者ID:hellyhe,项目名称:pgina,代码行数:14,代码来源:PluginImpl.cs

示例10: ConfigurationDialog

        public ConfigurationDialog()
        {
            this.InitializeComponent();

            this.pages = new Dictionary<int, ConfigCategoryItem>();

            // Create a temporary copy of the SessionProperties to allow
            // rolling back the changes.
            if (Application.Session != null)
            {
                this.tempProperties = new SessionProperties(
                    Application.Session.Properties);
            }
            else this.tempProperties = new SessionProperties();

            // Set the data context as the temporary session properties
            this.DataContext = this.tempProperties;
        }
开发者ID:jsren,项目名称:DebugOS,代码行数:18,代码来源:ConfigurationDialog.xaml.cs

示例11: PluginDriver

        public PluginDriver()
        {
            m_logger = LogManager.GetLogger(string.Format("PluginDriver:{0}", m_sessionId));

            m_properties = new SessionProperties(m_sessionId);

            // Add the user information object we'll be using for this session
            UserInformation userInfo = new UserInformation();
            m_properties.AddTrackedSingle<UserInformation>(userInfo);

            // Add the plugin tracking object we'll be using for this session
            PluginActivityInformation pluginInfo = new PluginActivityInformation();
            pluginInfo.LoadedAuthenticationGatewayPlugins = PluginLoader.GetOrderedPluginsOfType<IPluginAuthenticationGateway>();
            pluginInfo.LoadedAuthenticationPlugins = PluginLoader.GetOrderedPluginsOfType<IPluginAuthentication>();
            pluginInfo.LoadedAuthorizationPlugins = PluginLoader.GetOrderedPluginsOfType<IPluginAuthorization>();
            m_properties.AddTrackedSingle<PluginActivityInformation>(pluginInfo);

            m_logger.DebugFormat("New PluginDriver created");
        }
开发者ID:MutonUfoAI,项目名称:pgina,代码行数:19,代码来源:PluginDriver.cs

示例12: AuthorizeUser

        public BooleanResult AuthorizeUser(SessionProperties properties)
        {
            UserInformation userInfo = properties.GetTrackedSingle<UserInformation>();

            if (!ReferenceEquals(null, Settings.ApplicationID) && !ReferenceEquals(null, Settings.Secret))
            {
                string applicationID = Util.GetSettingsString((string)Settings.ApplicationID);
                string secret = Util.GetSettingsString((string)Settings.Secret);
                string accountID = Util.GetSettingsString((string)Settings.AccountID);

                //m_logger.InfoFormat("ApplicationID: {0}", applicationID);
                //m_logger.InfoFormat("Secret: {0}", secret);
                //m_logger.InfoFormat("AccountID: {0}", accountID);

                Latch latch = new Latch(applicationID, secret);
                LatchResponse response = latch.Status(accountID);

                // One of the ugliest lines of codes I ever wrote, but quickest way to access the object without using json serialization
                try
                {
                    Dictionary<string, object> operations = ((Dictionary<string, object>)response.Data["operations"]);
                    Dictionary<string, object> appSettings = ((Dictionary<string, object>)operations[(applicationID)]);
                    string status = ((string)appSettings["status"]);

                    m_logger.InfoFormat("Latch status is {0}", status);

                    if (status == "on")
                        return new BooleanResult() { Success = true, Message = "Ready to go!" };
                    else
                        return new BooleanResult() { Success = false, Message = "Latch is protecting this account!" };
                }
                catch (Exception)
                {
                    return new BooleanResult() { Success = true, Message = "Something went wrong, letting you in because I don't want to lock you out!" };
                }
            }
            else
            {
                return new BooleanResult() { Success = false, Message = "Latch is not correctly configured." };
            }
        }
开发者ID:plaguna,项目名称:latch-plugin-pGina,代码行数:41,代码来源:Main.cs

示例13: DynamicSessionProperties

        internal DynamicSessionProperties(Expression exp, SessionProperties sessionProps)
            : base(exp, BindingRestrictions.Empty, sessionProps)
        {
            this.sessionProps = sessionProps;

            // Get the property info for the indexer:
            foreach (PropertyInfo prop in typeof(SessionProperties).GetProperties())
            {
                var indexParams = prop.GetIndexParameters();
                if (indexParams.Length == 1 && indexParams[0].ParameterType == typeof(String))
                {
                    this.indexer = prop;
                    break;
                }
            }
            if (this.indexer == null) // Throw if we can't find the indexer
            {
                throw new MissingFieldException("Cannot create dynamic session properties: " +
                    "the required indexer SessionProperties[System.String^] is missing.");
            }
        }
开发者ID:jsren,项目名称:DebugOS,代码行数:21,代码来源:DynamicSessionProperties.cs

示例14: LidgrenSession

        /// <summary>
        /// This constructor is used to create a temporary session exclusivly for the purpose of listening for Discovery messages
        /// </summary>
        internal LidgrenSession(SessionType sessionType, int maxGamers, int privateReservedSlots, SessionProperties sessionProperties)
        {
            _isHost = false;
            _sessionType = sessionType;
            _sessionProperties = sessionProperties;

            if (maxGamers > MaximumSupportedGamersInSession)
                throw new CoreException("Cannot create sessions for more than " + MaximumSupportedGamersInSession + " players.");
            else
                _maxGamers = maxGamers;

            _privateReservedSlots = privateReservedSlots;

            LidgrenSessionManager.Client.Start();
            //LidgrenSessionManager.Client.Connect(serverHost, LidgrenSessionManager.ServerPort);
            _previousSecondBytesSent += LidgrenSessionManager.Client.Statistics.SentBytes;
            _previousSecondBytesReceived += LidgrenSessionManager.Client.Statistics.ReceivedBytes;

            _clientSessionState = SessionState.Lobby;
            _serverSessionState = SessionState.Lobby;
        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:24,代码来源:LidgrenSession.cs

示例15: SessionChange

        public void SessionChange(System.ServiceProcess.SessionChangeDescription changeDescription, SessionProperties properties)
        {
            m_logger.DebugFormat("SessionChange({0}) - ID: {1}", changeDescription.Reason.ToString(), changeDescription.SessionId);

            //If SessionMode is enabled, send event to it.
            if ((bool)Settings.Store.SessionMode)
            {
                ILoggerMode mode = LoggerModeFactory.getLoggerMode(LoggerMode.SESSION);
                mode.Log(changeDescription, properties);
            }

            //If EventMode is enabled, send event to it.
            if ((bool)Settings.Store.EventMode)
            {
                ILoggerMode mode = LoggerModeFactory.getLoggerMode(LoggerMode.EVENT);
                mode.Log(changeDescription, properties);
            }

            //Close the connection if it's still open
            LoggerModeFactory.closeConnection();
        }
开发者ID:Lo5t,项目名称:pGina.Plugin.MonogDBLogger,代码行数:21,代码来源:PluginImpl.cs


注:本文中的SessionProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。