示例#1
0
        static void Main(string[] args)
        {
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            XmlConfigurator.Configure();

            _log.Info("===== NODE STARTED =====");

            ConfigureUnhandledExceptions();

            ClientBootstrapper nodeBootstrapper = new ClientBootstrapper(cancellationTokenSource.Token);

            nodeBootstrapper.Run(new Dictionary <string, string> {
                { "secretKey", "1F0B7DBB567EFC99060EC69DD60130B4364E36B7A88248DD234285B3860F63C3" }
            });
            //nodeBootstrapper.Run(new Dictionary<string, string> { { "secretKey", CryptoHelper.GetRandomSeed().ToHexString() } });

            string command = null;

            do
            {
                command = System.Console.ReadLine();
            } while (command?.ToLower() != "exit");

            cancellationTokenSource.Cancel();
        }
示例#2
0
        private void OnDrawGizmos()
        {
            if (colliders == null)
            {
                return;
            }

            for (var index = 0; index < colliders.Count; index++)
            {
                var collider = colliders[index];
                if (_withColliderIndex == index)
                {
                    ClientBootstrapper.GizmoDrawCollider(collider, Color.red);
                }
                else
                {
                    ClientBootstrapper.GizmoDrawCollider(collider, Color.magenta);
                }

                Gizmos.DrawCube(collider.Position, Vector3.one * 0.1f);
            }

            Gizmos.color = _collided ? Color.red : Color.green;
            Gizmos.DrawCube(transform.position, new float3(size));

            if (sweptBox.HasValue)
            {
                Gizmos.color = Color.magenta;
                Gizmos.DrawCube(new Vector3(sweptBox.Value.x, 0, sweptBox.Value.y), new float3(0.5f));
            }
        }
示例#3
0
    private void OnDrawGizmos()
    {
        if (_colliders == null || _colliders.Count == 0)
        {
            return;
        }

        foreach (var collider in _colliders)
        {
            ClientBootstrapper.GizmoDrawCollider(collider, Color.magenta);
            //break;
        }
    }
示例#4
0
    private void OnDrawGizmos()
    {
        if (_colliders != null)
        {
            foreach (var collider in _colliders)
            {
                ClientBootstrapper.GizmoDrawCollider(collider, Color.magenta);
            }
        }

        Gizmos.color = collided ? Color.red : Color.green;
        Gizmos.DrawCube(transform.position, new float3(0.5f));
    }
示例#5
0
        public MainWindow()
        {
            InitializeComponent();

            var builder = new ContainerBuilder();

            builder.RegisterInstance <ILog>(new NoOpLogger());

            _container = builder.Build();

            var bootstrapper = new ClientBootstrapper(_container);

            bootstrapper.RegisterRequestAndResponseTypes(typeof(AssemblyHook).Assembly);

            Loaded += OnLoaded;
        }
示例#6
0
 public App()
 {
     InitializeComponent();
     clientBootstrapper = new ClientBootstrapper();
 }
示例#7
0
        /// <summary>
        /// Record the SecurityUserActivityHistory record if profiling is enabled
        /// </summary>
        /// <param name="isException"></param>
        /// <param name="additionalInfo"></param>
        private void RecordHttpProfilingEntry(bool isException = false, String additionalInfo = null)
        {
            //
            //Persist profiling data to the database
            //Also, dont profile glimpse requests, this is counterproductive and causes a big performance hit
            //
            var currentHandlerName = HttpContext.Current.Handler.GetType().ToString();

            if (!ApplicationService.Instance.HTTPRequestProfilingEnabled ||
                Request.RawUrl.Contains("/Glimpse.axd")
                //Visual studio debug browser link, dont log these items
                || Request.RawUrl.Contains("/__browserLink/") ||
                (currentHandlerName.Equals("System.Web.Optimization.BundleHandler"))
                )
            {
                //Dont profile in this case
                return;
            }

            //
            //Add in additional profiler info if it was set in other modules.
            //
            var additionalProfilerInfo = DomainHTTPContextService.Instance.ProfilerAdditionalInfo;

            if (!String.IsNullOrWhiteSpace(additionalProfilerInfo))
            {
                //Init the string if necessary
                if (String.IsNullOrWhiteSpace(additionalInfo))
                {
                    additionalInfo = "";
                }
                additionalInfo += additionalProfilerInfo;
            }

            //We already put start time in the context so we can use it to determine how long the
            //page takes to render, so retrieve it here
            var      requestHandlerExecuteStartTime = DomainHTTPContextService.Instance.RequestHandlerExecuteStartTime.Value;
            var      requestHandlerExecuteEndTime   = DateTime.Now;
            TimeSpan span           = requestHandlerExecuteEndTime - requestHandlerExecuteStartTime;
            int      loadTimeMS     = (int)span.TotalMilliseconds;
            var      transactionId  = DomainHTTPContextService.Instance.RequestTransactionId;
            var      httpMethod     = Request.HttpMethod;
            var      url            = Request.RawUrl;
            var      referrer       = Request.UrlReferrer;
            var      statusCode     = Response.StatusCode;
            var      user           = DomainSessionService.Instance.CurrentUser;
            int?     securityUserId = DomainSessionService.Instance.CurrentUser.UserIdAsNullableInt;

            //
            //Since we dont have an HTTP Context at this point, we cannot use the Domain Application Service to get the IOC Container,
            //So instead we need to initialize a new one
            //
            var iocContainer = new ClientBootstrapper().Run();

            using (var repository = iocContainer.GetInstance <IRepository>())
            {
                //
                //Update the login history record with the last request date, and record the activity that just occurred
                //
                if (user != null && user.SecurityUserLoginHistoryId != null)
                {
                    var loginHistory = repository.GetAll <SecurityUserLoginHistory>()
                                       .FirstOrDefault(
                        p =>
                        p.SecurityUserLoginHistoryId ==
                        user.SecurityUserLoginHistoryId);
                    if (loginHistory != null)
                    {
                        loginHistory.LastRequestDate    = DateTime.Now;
                        loginHistory.SessionTimeoutDate = DomainSessionService.Instance.SessionTimeoutDate;
                        loginHistory.LastRequestUrl     = url;
                    }
                }

                //
                //Record the SecurityUserActivityHistory record
                //
                var securityUserActivityHistory = new SecurityUserActivityHistory()
                {
                    SecurityUserId             = securityUserId,
                    SecurityUserLoginHistoryId =
                        DomainSessionService.Instance.CurrentUser.SecurityUserLoginHistoryId,
                    UserName                  = DomainSessionService.Instance.CurrentUser.UserName,
                    MachineName               = ApplicationService.Instance.MachineName,
                    ApplicationCode           = ApplicationService.Instance.ApplicationCode,
                    IPAddress                 = Request.UserHostAddress,
                    SessionId                 = DomainSessionService.Instance.SessionId,
                    TransactionId             = transactionId,
                    RequestUrl                = url,
                    Method                    = httpMethod,
                    StatusCode                = statusCode,
                    LoadTimeMS                = loadTimeMS,
                    Referrer                  = (referrer != null ? referrer.ToString() : null),
                    SecuritySecurableActionId = null,
                    AddtlInfo                 = additionalInfo
                };
                repository.Add(securityUserActivityHistory);
                repository.Commit();
            }
        }