private static string WebConstructExtraArgs()
    {
        StringBuilder strb = new StringBuilder("");

        // If there are any additional args then start off with ',' since the caller has not placed it!
        foreach (KeyValuePair <int, string> kv in dimensions)
        {
            strb.Append(",'dimension" + kv.Key + "': '" + WebMakeStringSafe(kv.Value) + "'");
        }

        dimensions.Clear();

        foreach (KeyValuePair <int, int> kv in metrics)
        {
            strb.Append(",'metric" + kv.Key + "': " + kv.Value);
        }

        metrics.Clear();

        // Session
        if (sessionAction == SessionAction.Start)
        {
            strb.Append(",'sessionControl': 'start'");
        }
        else if (sessionAction == SessionAction.End)
        {
            strb.Append(",'sessionControl': 'end'");
        }

        sessionAction = SessionAction.None;

        return(strb.ToString());
    }
示例#2
0
        /// <summary>
        /// Retrieves all objects of a given type.
        /// </summary>
        /// <typeparam name="T">The type of the objects to be retrieved.</typeparam>
        /// <returns>A list of all objects of the specified type.</returns>
        public IList <T> RetrieveAll <T>(SessionAction sessionAction)
        {
            /* Note that NHibernate guarantees that two object references will point to the
             * same object only if the references are set in the same session. For example,
             * Order #123 under the Customer object Able Inc and Order #123 in the Orders
             * list will point to the same object only if we load Customers and Orders in
             * the same session. If we load them in different sessions, then changes that
             * we make to Able Inc's Order #123 will not be reflected in Order #123 in the
             * Orders list, since the references point to different objects. That's why we
             * maintain a session as a member variable, instead of as a local variable. */

            // Open a new session if specified
            if ((sessionAction == SessionAction.Begin) || (sessionAction == SessionAction.BeginAndEnd))
            {
                m_Session = m_SessionFactory.OpenSession();
            }

            // Retrieve all objects of the type passed in
            ICriteria targetObjects = m_Session.CreateCriteria(typeof(T));
            IList <T> itemList      = targetObjects.List <T>();

            // Close the session if specified
            if ((sessionAction == SessionAction.End) || (sessionAction == SessionAction.BeginAndEnd))
            {
                m_Session.Close();
                m_Session.Dispose();
            }

            // Set return value
            return(itemList);
        }
示例#3
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetSessionActionRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetSessionActionRequestRequest> CustomSetSessionActionRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_FromIOP_SetSessionActionRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("targetOperatorIdType", TargetOperatorId.Format.AsText()),
                                   new XElement("targetOperatorId", TargetOperatorId.ToString()),

                                   new XElement("serviceSessionId", ServiceSessionId.ToString()),

                                   ExecPartnerSessionId.HasValue
                              ? new XElement("execPartnerSessionId", ExecPartnerSessionId.ToString())
                              : null,

                                   SessionAction.ToXML()

                                   );


            return(CustomSetSessionActionRequestSerializer != null
                       ? CustomSetSessionActionRequestSerializer(this, XML)
                       : XML);
        }
示例#4
0
        SetSessionAction(this IEMPClient EMPClient,
                         Partner_Id PartnerId,
                         Operator_Id OperatorId,
                         ServiceSession_Id ServiceSessionId,
                         SessionAction SessionAction,

                         Transaction_Id?TransactionId = null,
                         PartnerServiceSession_Id?SalePartnerSessionId = null,

                         HTTPRequest HTTPRequest             = null,
                         DateTime?Timestamp                  = null,
                         CancellationToken?CancellationToken = null,
                         EventTracking_Id EventTrackingId    = null,
                         TimeSpan?RequestTimeout             = null)


        => EMPClient.SetSessionAction(new SetSessionActionRequest(PartnerId,
                                                                  OperatorId,
                                                                  ServiceSessionId,
                                                                  SessionAction,

                                                                  TransactionId,
                                                                  SalePartnerSessionId,

                                                                  HTTPRequest,
                                                                  Timestamp,
                                                                  CancellationToken,
                                                                  EventTrackingId,
                                                                  RequestTimeout ?? EMPClient.RequestTimeout));
示例#5
0
        /// <summary>
        /// Create a SetSessionActionRequest XML/SOAP request.
        /// </summary>
        /// <param name="PartnerId">The partner identification.</param>
        /// <param name="OperatorId">The operator identification.</param>
        /// <param name="ServiceSessionId">The service session identification.</param>
        /// <param name="SessionAction">The session action.</param>
        ///
        /// <param name="TransactionId">An optional transaction identification.</param>
        /// <param name="SalePartnerSessionId">An optional partner service session identification.</param>
        ///
        /// <param name="HTTPRequest">The correlated HTTP request of this eMIP request.</param>
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public SetSessionActionRequest(Partner_Id PartnerId,
                                       Operator_Id OperatorId,
                                       ServiceSession_Id ServiceSessionId,
                                       SessionAction SessionAction,

                                       Transaction_Id?TransactionId = null,
                                       PartnerServiceSession_Id?SalePartnerSessionId = null,

                                       HTTPRequest HTTPRequest             = null,
                                       DateTime?Timestamp                  = null,
                                       CancellationToken?CancellationToken = null,
                                       EventTracking_Id EventTrackingId    = null,
                                       TimeSpan?RequestTimeout             = null)

            : base(HTTPRequest,
                   PartnerId,
                   TransactionId,
                   Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout)

        {
            this.OperatorId           = OperatorId;
            this.ServiceSessionId     = ServiceSessionId;
            this.SessionAction        = SessionAction;
            this.SalePartnerSessionId = SalePartnerSessionId;
        }
示例#6
0
 public bool AddSessionAction(SessionAction action)
 {
     if (action == null)
     {
         return(false);
     }
     SessionActionsQueue.Enqueue(action);
     return(true);
 }
    public static void StartSessionOnNextHit()
    {
        if (!initialized)
        {
            return;
        }

        sessionAction = SessionAction.Start;
    }
示例#8
0
 public void Process(SessionAction action)
 {
     try
     {
         this.rule[this.state][action]();
     }
     catch (KeyNotFoundException)
     {
         throw new InvalidOperationException(string.Format("Invalid state transistion from {0} with action {1}", this.state, action));
     }
 }
示例#9
0
        /// <summary>
        /// Get the values to populate each row of the table
        /// </summary>
        /// <param name="action">The session action to process</param>
        /// <returns>The row data</returns>
        private String [] getCellValues(SessionAction action)
        {
            string sessionName             = "";
            string newSessionFolder        = "";
            string existingSessionFolder   = "";
            string newSessionHostname      = "";
            string existingSessionHostname = "";
            string newProtocol             = "";
            string existingProtocol        = "";
            string newPort      = "";
            string existingPort = "";

            if (action.NewSession != null)
            {
                sessionName        = action.NewSession.SessionDisplayText;
                newSessionFolder   = action.NewSession.FolderDisplayText;
                newSessionHostname = action.NewSession.Hostname;
                newProtocol        = action.NewSession.Protocol;
                newPort            = action.NewSession.Portnumber.ToString();
            }

            if (action.ExistingSession != null)
            {
                if (action.Action != SessionAction.ACTION.RENAME)
                {
                    sessionName = action.ExistingSession.SessionDisplayText;
                }
                else
                {
                    sessionName = action.NewSession.SessionDisplayText + " [" +
                                  action.ExistingSession.SessionDisplayText + "]";
                }
                existingSessionFolder   = action.ExistingSession.FolderDisplayText;
                existingSessionHostname = action.ExistingSession.Hostname;
                existingProtocol        = action.ExistingSession.Protocol;
                existingPort            = action.ExistingSession.Portnumber.ToString();
            }

            String[] cellValues = new String[] { sessionName
                                                 , existingSessionFolder
                                                 , newSessionFolder
                                                 , existingSessionHostname
                                                 , newSessionHostname
                                                 , existingProtocol
                                                 , newProtocol
                                                 , existingPort
                                                 , newPort
                                                 , action.getActionDescription()
                                                 , getAction(action.Action) };
            return(cellValues);
        }
        /// <summary>
        /// Load sessions into the table
        /// </summary>
        /// <param name="ea"></param>
        public void LoadSessions(SyncSessionsLoadedEventArgs ea)
        {
            DataGridViewRow dgvr = null;

            sessionList            = ea.SessionList;
            templateSession        = ea.SessionTemplate;
            ignoreExistingSessions = ea.IgnoreExistingSessions;

            Dictionary <String, Session> sessionsDictionary = new Dictionary <string, Session>();

            dataGridView1.SuspendLayout();
            dataGridView1.Rows.Clear();

            foreach (Session newSession in sessionList)
            {
                Session       existingSession = sc.findSession(newSession);
                SessionAction action          = new SessionAction(existingSession, newSession);

                // Make sure we skip over duplicate sessions
                if (!sessionsDictionary.ContainsKey(newSession.SessionKey))
                {
                    sessionsDictionary.Add(newSession.SessionKey, newSession);

                    dgvr = new DataGridViewRow();
                    dgvr.CreateCells(dataGridView1, getCellValues(action));
                    dgvr.Tag = action;
                    dataGridView1.Rows.Add(dgvr);
                }
            }

            if (ea.IgnoreExistingSessions == false)
            {
                foreach (Session existingSession in sc.getSessionList())
                {
                    if (!sessionsDictionary.ContainsKey(existingSession.SessionKey))
                    {
                        SessionAction action = new SessionAction(existingSession, null);

                        dgvr = new DataGridViewRow();
                        dgvr.CreateCells(dataGridView1, getCellValues(action));
                        dgvr.Tag = action;
                        dataGridView1.Rows.Add(dgvr);
                    }
                }
            }

            dataGridView1.ResumeLayout();
        }
示例#11
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return((TransactionId.HasValue
                            ? TransactionId.GetHashCode() * 17
                            : 0) ^

                       PartnerId.GetHashCode() * 13 ^
                       OperatorId.GetHashCode() * 11 ^
                       TargetOperatorId.GetHashCode() * 7 ^
                       ServiceSessionId.GetHashCode() * 5 ^
                       SessionAction.GetHashCode() * 3 ^

                       (ExecPartnerSessionId.HasValue
                            ? ExecPartnerSessionId.GetHashCode()
                            : 0));
            }
        }
示例#12
0
        /// <summary>
        /// Compares two SetSessionAction requests for equality.
        /// </summary>
        /// <param name="SetSessionActionRequest">A SetSessionAction request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(SetSessionActionRequestRequest SetSessionActionRequest)
        {
            if (SetSessionActionRequest is null)
            {
                return(false);
            }

            return(((!TransactionId.HasValue && !SetSessionActionRequest.TransactionId.HasValue) ||
                    (TransactionId.HasValue && SetSessionActionRequest.TransactionId.HasValue && TransactionId.Value.Equals(SetSessionActionRequest.TransactionId.Value))) &&

                   PartnerId.Equals(SetSessionActionRequest.PartnerId) &&
                   OperatorId.Equals(SetSessionActionRequest.OperatorId) &&
                   TargetOperatorId.Equals(SetSessionActionRequest.TargetOperatorId) &&
                   ServiceSessionId.Equals(SetSessionActionRequest.ServiceSessionId) &&
                   SessionAction.Equals(SetSessionActionRequest.SessionAction) &&

                   ((!ExecPartnerSessionId.HasValue && !SetSessionActionRequest.ExecPartnerSessionId.HasValue) ||
                    (ExecPartnerSessionId.HasValue && SetSessionActionRequest.ExecPartnerSessionId.HasValue && ExecPartnerSessionId.Equals(SetSessionActionRequest.ExecPartnerSessionId))));
        }
示例#13
0
        private void Action(SessionAction action, SocketAsyncEventArgs args)
        {
            lock (lockRef)
            {
                switch (action)
                {
                case SessionAction.Receive:
                    if (!m_socket.ReceiveAsync(args))
                    {
                        ProcessReceive(args);
                    }
                    break;

                case SessionAction.Send:
                    if (!m_socket.SendAsync(args))
                    {
                        ProcessSend(args);
                    }
                    break;
                }
            }
        }
    private static string WebConstructExtraArgs()
    {
        StringBuilder strb = new StringBuilder("");

        // If there are any additional args then start off with ',' since the caller has not placed it!
        foreach (KeyValuePair<int, string> kv in dimensions)
        {
            strb.Append(",'dimension" + kv.Key + "': '" + WebMakeStringSafe(kv.Value) + "'");
        }

        dimensions.Clear();

        foreach (KeyValuePair<int, int> kv in metrics)
        {
            strb.Append(",'metric" + kv.Key + "': " + kv.Value);
        }

        metrics.Clear();

        // Session
        if (sessionAction == SessionAction.Start)
        {
            strb.Append(",'sessionControl': 'start'");
        }
        else if (sessionAction == SessionAction.End)
        {
            strb.Append(",'sessionControl': 'end'");
        }

        sessionAction = SessionAction.None;

        return strb.ToString();
    }
    private static void SendData(WWWForm data)
    {
        LogDimensionsAndMetrics();
        LogSession();

        // Add default values.
        data.AddField("v", "1");
        data.AddField("tid", accountId);
        data.AddField("cid", cid);
        data.AddField("an", appName);
        data.AddField("av", appVersion);

        if (gatherSystemInformation)
        {
            data.AddField("sr", screenResolution);
            data.AddField("vp", viewportSize);
            data.AddField("ul", systemLanguage);
        }

        foreach (KeyValuePair<int, string> kv in dimensions)
        {
            data.AddField("cd" + kv.Key, kv.Value);
        }

        dimensions.Clear();

        foreach (KeyValuePair<int, int> kv in metrics)
        {
            data.AddField("cm" + kv.Key, kv.Value);
        }

        metrics.Clear();

        // Add the persistent dimensions and metrics
        foreach (KeyValuePair<int, string> kv in setDimensions)
        {
            data.AddField("cd" + kv.Key, kv.Value);
        }

        foreach (KeyValuePair<int, int> kv in setMetrics)
        {
            data.AddField("cm" + kv.Key, kv.Value);
        }

        if (_uid != null && _uid != "")
        {
            data.AddField("uid", _uid);
        }

        if (sessionAction == SessionAction.Start)
        {
            data.AddField("sc", "start");
        }
        else if (sessionAction == SessionAction.End)
        {
            data.AddField("sc", "end");
        }

        sessionAction = SessionAction.None;

        if (queueLogs)
        {
            logQueuer.SendData(data);
        }
        else
        {
            new WWW(UA_COLLECT_URL, data);
        }
    }
    public static void StartSessionOnNextHit()
    {
        if (!initialized)
        {
            return;
        }

        sessionAction = SessionAction.Start;
    }
 public static void EndSessionOnNextHit()
 {
     sessionAction = SessionAction.End;
 }
 public SessionActionPacket(string username, SessionAction action)
 {
     Username = username;
     Action = action;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void renameButton_Click(object sender, EventArgs e)
        {
            int matchCount = 0;

            if (dataGridView1.Rows.Count == 0)
            {
                return;
            }

            DialogResult r = MessageBox.Show("This will attempt to identify renamed \n"
                                             + "sessions based on matching the hostnames.\n"
                                             + "Do you want restrict the matching to sessions\n"
                                             + "with the same folder names?"
                                             , "Question"
                                             , MessageBoxButtons.YesNoCancel
                                             , MessageBoxIcon.Question);

            if (r == DialogResult.Yes || r == DialogResult.No)
            {
                List <SessionAction> deletedSessions = new List <SessionAction>();
                Dictionary <String, SessionAction>          newSessionsDict = new Dictionary <String, SessionAction>();
                Dictionary <SessionAction, DataGridViewRow> rowDict         = new Dictionary <SessionAction, DataGridViewRow>();

                bool includeFoldersInMatch = (r == DialogResult.Yes);

                // First indentify all the new and deleted sessions
                foreach (DataGridViewRow dvgr in dataGridView1.Rows)
                {
                    SessionAction sa = (SessionAction)dvgr.Tag;
                    if (sa.Action == SessionAction.ACTION.ADD ||
                        sa.Action == SessionAction.ACTION.DELETE)
                    {
                        rowDict.Add(sa, dvgr);
                        if (sa.Action == SessionAction.ACTION.ADD)
                        {
                            string key = sa.NewSession.Hostname;
                            if (includeFoldersInMatch)
                            {
                                key += "|" + sa.NewSession.FolderName;
                            }

                            // Only use the first instance of each key
                            if (!newSessionsDict.ContainsKey(key))
                            {
                                newSessionsDict.Add(key, sa);
                            }
                        }
                        else
                        {
                            deletedSessions.Add(sa);
                        }
                    }
                }

                dataGridView1.SuspendLayout();
                // Then try to match a new session to each deleted session
                foreach (SessionAction delSession in deletedSessions)
                {
                    string key = delSession.ExistingSession.Hostname;
                    if (includeFoldersInMatch)
                    {
                        key += "|" + delSession.ExistingSession.FolderName;
                    }

                    if (newSessionsDict.ContainsKey(key))
                    {
                        SessionAction newSession = null;
                        newSessionsDict.TryGetValue(key, out newSession);
                        if (newSession != null)
                        {
                            DataGridViewRow dvgr;
                            rowDict.TryGetValue(newSession, out dvgr);
                            if (dvgr != null)
                            {
                                dataGridView1.Rows.Remove(dvgr);
                                newSessionsDict.Remove(key);
                                delSession.NewSession = newSession.NewSession;
                                delSession.Action     = SessionAction.ACTION.RENAME;
                                rowDict.TryGetValue(delSession, out dvgr);
                                if (dvgr != null)
                                {
                                    dataGridView1.Rows.Remove(dvgr);
                                    dvgr = new DataGridViewRow();
                                    dvgr.CreateCells(dataGridView1, getCellValues(delSession));
                                    dvgr.Tag = delSession;
                                    dataGridView1.Rows.Add(dvgr);
                                    rowDict.Remove(delSession);
                                    rowDict.Add(delSession, dvgr);
                                    matchCount++;
                                }
                            }
                        }
                    }
                }
                dataGridView1.ResumeLayout();

                MessageBox.Show("Matched " + matchCount + " sessions"
                                , "Information"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Information);
            }

            return;
        }
示例#20
0
 /// <summary>Create a new SessionMessage</summary>
 /// <param name="channelId">The channel carrying this message.</param>
 /// <param name="clientId">The subject of the session action.</param>
 /// <param name="e">The session action.</param>
 public SessionMessage(byte channelId, int clientId, SessionAction e)
     : base(channelId, MessageType.Session)
 {
     this.clientId = clientId;
     this.action = e;
 }
        private void SendSessionEmail(Session session, ApplicationUser seller, ApplicationUser buyer, SessionAction sessionAction, BuySell buySell)
        {
            if (Request.Url == null)
            {
                return;
            }

            var sessionurl = Url.Action("Details", "Sessions", new { id = session.SessionId }, Request.Url.Scheme);

            switch (sessionAction)
            {
            case SessionAction.Buy:
            case SessionAction.Sell:
            {
                var subject = "Session " + session.SessionDate.ToString("dddd, MM/dd/yyyy, HH:mm") + " SOLD";
                var body    = "Your spot has been sold to " + buyer.FirstName + " " + buyer.LastName + "." + Environment.NewLine + Environment.NewLine;
                body += "Click here for the details: " + sessionurl + Environment.NewLine;
                if (seller.NotificationPreference != NotificationPreference.None)
                {
                    _emailServices.SendMail(subject, body, seller.Email);
                }

                subject = "Session " + session.SessionDate.ToString("dddd, MM/dd/yyyy, HH:mm") + " BOUGHT";
                body    = "You bought a spot from " + seller.FirstName + " " + seller.LastName + ", and your team assignment is " + buySell.TeamAssignment + "." + Environment.NewLine + Environment.NewLine;
                body   += "You are now obligated to pay the seller for their spot immediately. Please visit the site now and click through and complete the payment process. Then, return to the site, and be sure and click the 'Sent' checkbox for your transaction so the buyer knows that you initiated payment." + Environment.NewLine + Environment.NewLine;
                body   += "Your team assignment may change before or during play, so please ensure you bring the opposite jersey to the bench." + Environment.NewLine + Environment.NewLine;
                body   += "Click here for the details: " + sessionurl + Environment.NewLine;
                if (buyer.NotificationPreference != NotificationPreference.None)
                {
                    _emailServices.SendMail(subject, body, buyer.Email);
                }

                break;
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
        }
示例#22
0
        /// <summary>
        /// Try to parse the given XML representation of an eMIP SetSessionAction request.
        /// </summary>
        /// <param name="SetSessionActionRequestXML">The XML to parse.</param>
        /// <param name="CustomSendSetSessionActionRequestParser">An optional delegate to parse custom SetSessionActionRequest XML elements.</param>
        /// <param name="CustomSessionActionParser">An optional delegate to parse custom SessionAction XML elements.</param>
        /// <param name="SetSessionActionRequest">The parsed SetSessionAction request.</param>
        /// <param name="OnException">An optional delegate called whenever an exception occured.</param>
        ///
        /// <param name="HTTPRequest">The correlated HTTP request of this eMIP request.</param>
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public static Boolean TryParse(XElement SetSessionActionRequestXML,
                                       out SetSessionActionRequestRequest SetSessionActionRequest,
                                       CustomXMLParserDelegate <SetSessionActionRequestRequest> CustomSendSetSessionActionRequestParser = null,
                                       CustomXMLParserDelegate <SessionAction> CustomSessionActionParser = null,
                                       OnExceptionDelegate OnException = null,

                                       HTTPRequest HTTPRequest             = null,
                                       DateTime?Timestamp                  = null,
                                       CancellationToken?CancellationToken = null,
                                       EventTracking_Id EventTrackingId    = null,
                                       TimeSpan?RequestTimeout             = null)
        {
            try
            {
                SetSessionActionRequest = new SetSessionActionRequestRequest(

                    //ToDo: What to do with: <partnerIdType>eMI3</partnerIdType>?
                    SetSessionActionRequestXML.MapValueOrFail("partnerId", Partner_Id.Parse),

                    //ToDo: What to do with: <operatorIdType>eMI3</operatorIdType>
                    SetSessionActionRequestXML.MapValueOrFail("operatorId", Operator_Id.Parse),

                    //ToDo: What to do with: <targetOperatorIdType>eMI3</targetOperatorIdType>
                    SetSessionActionRequestXML.MapValueOrFail("targetOperatorId", Operator_Id.Parse),

                    SetSessionActionRequestXML.MapValueOrFail("serviceSessionId", ServiceSession_Id.Parse),

                    SetSessionActionRequestXML.MapElementOrFail("sessionAction",
                                                                (s, e) => SessionAction.Parse(s,
                                                                                              CustomSessionActionParser,
                                                                                              e),
                                                                OnException),

                    SetSessionActionRequestXML.MapValueOrNullable("transactionId", Transaction_Id.Parse),

                    SetSessionActionRequestXML.MapValueOrNullable("execPartnerSessionId", PartnerServiceSession_Id.Parse),


                    HTTPRequest,
                    Timestamp,
                    CancellationToken,
                    EventTrackingId,
                    RequestTimeout

                    );


                if (CustomSendSetSessionActionRequestParser != null)
                {
                    SetSessionActionRequest = CustomSendSetSessionActionRequestParser(SetSessionActionRequestXML,
                                                                                      SetSessionActionRequest);
                }

                return(true);
            }
            catch (Exception e)
            {
                OnException?.Invoke(DateTime.UtcNow, SetSessionActionRequestXML, e);

                SetSessionActionRequest = null;
                return(false);
            }
        }
    private static void SendData(WWWForm data)
    {
        LogDimensionsAndMetrics();
        LogSession();

        // Add default values.
        data.AddField("v", "1");
        data.AddField("tid", accountId);
        data.AddField("cid", cid);
        data.AddField("an", appName);
        data.AddField("av", appVersion);

        if (gatherSystemInformation)
        {
            data.AddField("sr", screenResolution);
            data.AddField("vp", viewportSize);
            data.AddField("ul", systemLanguage);
        }

        foreach (KeyValuePair <int, string> kv in dimensions)
        {
            data.AddField("cd" + kv.Key, kv.Value);
        }

        dimensions.Clear();

        foreach (KeyValuePair <int, int> kv in metrics)
        {
            data.AddField("cm" + kv.Key, kv.Value);
        }

        metrics.Clear();

        // Add the persistent dimensions and metrics
        foreach (KeyValuePair <int, string> kv in setDimensions)
        {
            data.AddField("cd" + kv.Key, kv.Value);
        }

        foreach (KeyValuePair <int, int> kv in setMetrics)
        {
            data.AddField("cm" + kv.Key, kv.Value);
        }

        if (_uid != null && _uid != "")
        {
            data.AddField("uid", _uid);
        }

        if (sessionAction == SessionAction.Start)
        {
            data.AddField("sc", "start");
        }
        else if (sessionAction == SessionAction.End)
        {
            data.AddField("sc", "end");
        }

        sessionAction = SessionAction.None;

        if (queueLogs)
        {
            logQueuer.SendData(data);
        }
        else
        {
            new WWW(UA_COLLECT_URL, data);
        }
    }
 public static void EndSessionOnNextHit()
 {
     sessionAction = SessionAction.End;
 }
示例#25
0
        internal static void SendSessionAction(string username, SessionAction action)
        {
            LoginServerConnection connection = Server.ServerInstance.LoginServerConnection;

            connection.SendPacket(new SessionActionPacket(username, action));
        }
 public SessionActionPacket(string username, SessionAction action)
 {
     Username = username;
     Action   = action;
 }
示例#27
0
文件: Server.cs 项目: briandealwis/gt
 /// <summary>Send notice of some session action.</summary>
 /// <param name="clientId">The subject of the action.</param>
 /// <param name="e">The session action.</param>
 /// <param name="channelId">Channel on which to send the notice.</param>
 /// <param name="mdr">How to send the session message (can be null)</param>
 /// <param name="cdr">Requirements for the message's channel.</param>
 public void Send(int clientId, SessionAction e, byte channelId, MessageDeliveryRequirements mdr,
     ChannelDeliveryRequirements cdr)
 {
     Send(new SessionMessage(channelId, clientId, e), mdr, cdr);
 }
 internal static void SendSessionAction(string username, SessionAction action)
 {
     LoginServerConnection connection = Server.ServerInstance.LoginServerConnection;
     connection.SendPacket(new SessionActionPacket(username, action));
 }