Exemplo n.º 1
0
        public void CacheEvent(AppEnvironment env, string tag, bool reserved = false)
        {
            var evtrequest = new BugSenseEventRequest(env, tag, reserved);
            string contents = evtrequest.getFlatLine();

            Task t = new Task(async () =>
                {
                    try
                    {
                        LogEvent evt = new LogEvent(contents, reserved);
                        _lockToSendEvt.WaitOne();
                        if (!evtrequest.TimeStamp.Equals(_prevEvtTs))
                        {
                            _prevEvtTs = evtrequest.TimeStamp;
                            _lockToSendEvt.Release();
                            Helpers.Log("begin(CacheEvent)");
                            string res = await evt.Execute();
                            Helpers.Log("end(CacheEvent): " + res);
                        }
                        else
                        {
                            Helpers.Log("Duplicate_Event(CacheEvent(" + _prevEvtTs + "))");
                            _lockToSendEvt.Release();
                        }
                    }
                    catch (Exception)
                    {
                        Helpers.Log("fail(CacheEvent)");
                    }
                });
            t.Start();
        }
Exemplo n.º 2
0
		private string CacheTestPing (string uuid)
		{
			string res = "";

			var evtrequest = new BugSenseEventRequest (
				BugSenseEnvironment.GetEnvironment ("test", "0.0.0.0", uuid, true),
				"_ping", true);

			string contents = evtrequest.getFlatLine ();
			LogEvent evt = new LogEvent (contents, true);
			Task.Run (async () => {
				res = await evt.Execute ();
			}).Wait ();

			return res;
		}
Exemplo n.º 3
0
        public void SendEventNow(AppEnvironment env, string tag, bool reserved = false)
        {
            var evtrequest = new BugSenseEventRequest(env, tag, reserved);
            string contents = evtrequest.getFlatLine();

            Task t = new Task(async () =>
                {
                    try
                    {
                        string uuid = env.Uid;
                        string url = WebRequests.GetEventURL(uuid);
                        _lockToSendEvt.WaitOne();
                        if (!evtrequest.TimeStamp.Equals(_prevEvtTs))
                        {
                            _prevEvtTs = evtrequest.TimeStamp;
                            _lockToSendEvt.Release();
                            Helpers.Log("begin(SendEventNow-1)");
                            LogEvent evt = new LogEvent(contents, reserved);
                            string str = await evt.Execute();
                            if (!string.IsNullOrEmpty(str))
                            {
                                SendRequest msg = new SendRequest(url, str, false);
                                _lockToSend.WaitOne();
                                Helpers.Log("begin(SendEventNow-2)");
                                bool res = await msg.Execute();
                                Helpers.Log("end(SendEventNow-2): " + res);
                                _lockToSend.Release();
                            }
                            Helpers.Log("end(SendEventNow-1)");
                        }
                        else
                        {
                            Helpers.Log("Duplicate_Event(SendEventNow(" + _prevEvtTs + "))");
                            _lockToSendEvt.Release();
                        }
                    }
                    catch (Exception)
                    {
                        Helpers.Log("fail(SendEventNow)");
                    }
                });
            t.Start();
        }
Exemplo n.º 4
0
        public bool IsSimilarTo(BugSenseEventRequest that)
        {
            bool res = true;

            res = ApiVer.Equals(that.ApiVer);
            res = res && Tag.Equals(that.Tag);
            res = res && PhoneModel.Equals(that.PhoneModel);
            res = res && PhoneManufacturer.Equals(that.PhoneManufacturer);
            res = res && OsVer.Equals(that.OsVer);
            res = res && AppVer.Equals(that.AppVer);
            res = res && Locale.Equals(that.Locale);

            return res;
        }