Esempio n. 1
0
        public XElement GetLoginData(IPpsPrivateDataContext ctx = null)
        {
            if (ctx == null)
            {
                ctx = DEScope.GetScopeService <IPpsPrivateDataContext>(true);
            }

            // basic login data
            var xLoginData = new XElement("user",
                                          new XAttribute("userId", ctx.UserId),
                                          new XAttribute("displayName", ctx.UserName)
                                          );

            // update optional values
            if (ctx.TryGetProperty <long>(UserContextKtKtId, out var ktktId))
            {
                xLoginData.SetAttributeValue(UserContextKtKtId, ktktId.ChangeType <string>());
            }
            if (ctx.TryGetProperty <long>(UserContextPersId, out var persId))
            {
                xLoginData.SetAttributeValue(UserContextPersId, persId.ChangeType <string>());
            }
            if (ctx.TryGetProperty(UserContextFullName, out var fullName))
            {
                xLoginData.SetAttributeValue(UserContextFullName, fullName);
            }
            if (ctx.TryGetProperty(UserContextInitials, out var initials))
            {
                xLoginData.SetAttributeValue(UserContextInitials, initials);
            }

            // execute script based extensions
            var t = new LuaTable();

            CallMemberDirect("OnExtentLogin", new object[] { ctx, t }, ignoreNilFunction: true);
            foreach (var kv in t.Members)
            {
                xLoginData.SetAttributeValue(kv.Key, kv.Value);
            }

            return(xLoginData);
        }         // func GetLoginData
Esempio n. 2
0
        }         // prop SetLogSize

        #endregion

        #region -- IDELogConfig Members -----------------------------------------------

        void ILogger.LogMsg(LogMsgType type, string text)
        {
            Debug.Print("[{0}] {1}", Name, text);

            // create log line
            if (IsDebug || type != LogMsgType.Debug)
            {
                var logLine = new DELogLine(DateTime.Now, type == LogMsgType.Debug ? LogMsgType.Information : type, text);
                if (Server.Queue?.IsQueueRunning ?? false)
                {
                    Server.Queue.RegisterCommand(() => logFile?.Add(logLine));
                }
                else                 // Background thread is not in service, synchron add
                {
                    logFile?.Add(logLine);
                }
            }

            DEScope.GetScopeService <IDEDebugContext>(false)?.OnMessage(type, text);
        }         // proc ILogger.LogMsg
Esempio n. 3
0
 internal DEScopeContext(DEScope scope, SynchronizationContext currentContext)
 {
     this.scope = scope;
     this.parentScopeContext = currentContext as DEScopeContext;
     this.parentContext      = parentScopeContext == null ? currentContext : parentScopeContext.parentContext;
 }             // ctor