Ejemplo n.º 1
0
        public bool ParseISBPath(string pRealPage, out Guid?pSessionID, out cdeSenderType pType, out long pFID, out string pVersion)
        {
            pSessionID = null;
            pType      = cdeSenderType.NOTSET;
            pFID       = 0;
            pVersion   = "";
            var tRealPage = CU.cdeDecrypt(pRealPage, MySecrets?.GetAI(), true);

            if (tRealPage?.StartsWith(MySecrets?.GetApID5()) != true)
            {
                return(false);
            }

            string[] tQ = tRealPage.Split('&');

            pType = tQ.Length == 4 ? (cdeSenderType)(CU.CInt(tQ[2])) : cdeSenderType.NOTSET;
            if (tQ.Length > 1)
            {
                pFID = CU.CLng(tQ[1]);
            }
            if (tQ.Length > 3)
            {
                pSessionID = CU.CGuid(tQ[3]);
            }
            if (tQ[0].Length == 7)
            {
                pVersion = tQ[0].Substring(5);
            }
            return(true);
        }
        public bool ParseISBPath(string pRealPage, out Guid?pSessionID, out cdeSenderType pType, out long pFID, out string pVersion)
        {
            pSessionID = null;
            pType      = cdeSenderType.NOTSET;
            pFID       = 0;
            pVersion   = "";

            try
            {
                string[] tQ = Base64Decode(pRealPage).Split('_');

                pType = tQ.Length == 4 ? (cdeSenderType)(CU.CInt(tQ[2])) : cdeSenderType.NOTSET;
                if (tQ.Length > 1)
                {
                    pFID = CU.CLng(tQ[1]);
                }
                if (tQ.Length > 3)
                {
                    pSessionID = CU.CGuid(tQ[3]);
                }
                if (tQ[0].Length == 7)
                {
                    pVersion = tQ[0].Substring(5);
                }
            }
            catch (Exception)
            {
                // ignored
            }
            return(true);
        }
Ejemplo n.º 3
0
 public void WriteToLog(int pLogID, TSM MyText, bool NoLog)
 {
     if (MyText == null)
     {
         return;
     }
     if (!UseSysLogQueue)
     {
         TheCommonUtils.cdeRunAsync(string.Format("WriteLog:{0}", pLogID), false, o =>
         {
             WriteToLogInternal(pLogID, MyText, NoLog, TheCommonUtils.CLng(o));
         }, Interlocked.Increment(ref LogSerial));
     }
     else
     {
         if (!sysLogQueue.TryAdd(new LogArgs {
             pLogID = pLogID, MyText = MyText, NoLog = NoLog, tLogSerial = Interlocked.Increment(ref LogSerial)
         }))
         {
             // queue is full, log entry dropped
         }
     }
 }
Ejemplo n.º 4
0
        private static void ValSetter2(ref TSM tTSM, string ptr, object tval, bool IsJSON)
        {
            switch (ptr) //int
            {
            case "TXT":
                tTSM.TXT = TheCommonUtils.CStr(tval);
                break;

            case "TIM":
                if (IsJSON)
                {
                    if (tval != null)
                    {
                        long tim = TheCommonUtils.CLng(tval.ToString().Substring(6, tval.ToString().Length - 8));
                        tTSM.TIM = new DateTimeOffset(1970, 1, 1, 0, 0, 0, DateTimeOffset.Now.Offset).Add(new TimeSpan(tim * 10000));
                    }
                }
                else
                {
                    if (tval != null)
                    {
                        tTSM.TIM = TheCommonUtils.CDate(tval.ToString());
                    }
                }
                break;

            case "FLG":
                tTSM.FLG = (ushort)TheCommonUtils.CInt(tval);
                break;

            case "PLS":
                tTSM.PLS = TheCommonUtils.CStr(tval);
                break;

            case "ORG":
                tTSM.ORG = TheCommonUtils.CStr(tval);    //ORG-OK
                break;

            case "QDX":
                tTSM.QDX = TheCommonUtils.CInt(tval);
                break;

            case "LVL":
                if (tval.Equals("l1_Error"))
                {
                    tTSM.LVL = eMsgLevel.l1_Error;
                }
                else if (tval.Equals("l2_Warning"))
                {
                    tTSM.LVL = eMsgLevel.l2_Warning;
                }
                else if (tval.Equals("l3_ImportantMessage"))
                {
                    tTSM.LVL = eMsgLevel.l3_ImportantMessage;
                }
                else if (tval.Equals("l4_Message"))
                {
                    tTSM.LVL = eMsgLevel.l4_Message;
                }
                else if (tval.Equals("l5_HostMessage"))
                {
                    tTSM.LVL = eMsgLevel.l5_HostMessage;
                }
                else if (tval.Equals("l6_Debug"))
                {
                    tTSM.LVL = eMsgLevel.l6_Debug;
                }
                else if (tval.Equals("l7_HostDebugMessage"))
                {
                    tTSM.LVL = eMsgLevel.l7_HostDebugMessage;
                }
                else if (tval.Equals("ALL"))
                {
                    tTSM.LVL = eMsgLevel.ALL;
                }
                else
                {
                    tTSM.LVL = 0;
                }
                break;

            case "ENG":
                tTSM.ENG = TheCommonUtils.CStr(tval);
                break;

            case "FID":
                tTSM.FID = TheCommonUtils.CStr(tval);
                break;

            case "SID":
                tTSM.SID = TheCommonUtils.CStr(tval);
                break;

            case "SEID":
                tTSM.SEID = TheCommonUtils.CStr(tval);
                break;

            case "UID":
                tTSM.UID = TheCommonUtils.CStr(tval);
                break;

            case "CST":
                tTSM.CST = TheCommonUtils.CStr(tval);
                break;

            case "OWN":
                tTSM.OWN = TheCommonUtils.CStr(tval);
                break;

            case "PLB":
                if (tval != null)
                {
                    tTSM.PLB = Convert.FromBase64String(tval.ToString());
                }
                break;
            }
        }