public static CClientInfo GetClientInfo(bool forceRenew)
    {
        CClientInfo clientInfo = null;

        if (forceRenew)
        {
            try
            {
                clientInfo = UltimaWebService.GetClientInfo();
            }
            catch (Exception ex)
            {
                SessionErrors.Add(ex.Message);
                SignOut();
            }

            SetClientInfo(clientInfo);
        }
        else
        {
            clientInfo = (CClientInfo)HttpContext.Current.Session["ClientInfo"];
        }

        if (clientInfo == null && HttpContext.Current.User.Identity.IsAuthenticated)
        {
            SignOut();
        }

        return(clientInfo);
    }
Ejemplo n.º 2
0
 public void UpdateClient(CClientInfo client)
 {
     using (var context = _contextFactory.Get <CDbContext>())
     {
         context.TryUpdate(client);
     }
 }
    private void Application_PostAuthenticateRequest(object sender, EventArgs e)
    {
        HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

        if (authCookie != null)
        {
            //Extract the forms authentication cookie
            FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

            // If caching roles in userData field then extract
            string clientId = authTicket.UserData;

            // Create the IIdentity instance
            IIdentity id = new FormsIdentity(authTicket);

            CClientInfo clientInfo = SessionClient.GetClientInfo(true);
            //if (clientInfo == null)
            //	clientInfo = SessionClient.GetClientInfo(true);

            // Create the IPrinciple instance
            IPrincipal principal = new UltimaPrincipal(id, clientInfo);

            // Set the context user
            HttpContext.Current.User = principal;
            System.Threading.Thread.CurrentPrincipal = principal;
        }
    }
Ejemplo n.º 4
0
 public void Add(CClientInfo ci)
 {
     lock (this)
     {
         Lst.Add(ci);
     }
 }
Ejemplo n.º 5
0
 public CRuleController(
     IFaStorageService storageService,
     CClientInfo client)
 {
     _storageService = storageService;
     _client         = client;
 }
Ejemplo n.º 6
0
 protected CEventInfo CreateEvent(CClientInfo client, int eventId)
 {
     return(new CEventInfo(Guid.NewGuid(), eventId, rnd.Next(10000),
                           DateTime.UtcNow.AddMinutes(rnd.Next(-1000, 1000)), client.ComputerName,
                           "user", "domain", Path.GetRandomFileName(),
                           (EAccessMask)masks.GetValue(rnd.Next(masks.Length)),
                           (EFileEvents)fileEvents.GetValue(rnd.Next(fileEvents.Length)),
                           rnd.Next(10000).ToString(), client.ClientInfoId));
 }
Ejemplo n.º 7
0
        public void SendTeminalInfoForDealingServer(int conID)
        {
            CClientInfo termInfo = new CClientInfo
            {
                Version  = CUtil.GetVersion(),
                Instance = 1
            };

            Communicator.SendDataToServer(conID, termInfo, enmTradingEvent.ClientInfo);
        }
Ejemplo n.º 8
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException += HandleException;

            var storageService = new FaStorageService.FaStorageServiceClient();

            string      computerName = SNetworkHelper.GetComputerName();
            string      ipAddress    = SNetworkHelper.GetLocalIp();
            CClientInfo clientInfo   = storageService.RegisterClient(computerName, ipAddress);

            CRuleController controller = new CRuleController(storageService, clientInfo);

            controller.Start();
        }
Ejemplo n.º 9
0
    // Called by the person who died
    public void ReportKill(int _iKillerSlotId)
    {
        CClientInfo cKillerClientInfo = m_cPlayerList.RetrieveNetPlayerInfo(_iKillerSlotId);



        if (!m_bFirstBloodTaken)
        {
            //Debug.Log("Announced First blood");
            Color  colGuy    = cKillerClientInfo.GetWarlock().GetComponent <CWarlockController>().transform.FindChild("Point light").light.color;
            string hexColGuy = ColorToHex(colGuy);

            networkView.RPC("AnnounceFirstBlood", RPCMode.All, ("<color=" + hexColGuy + ">" + cKillerClientInfo.GetUsername() + "</color>"));

            if (!Network.isServer)
            {
                networkView.RPC("AwardFirstBlood", RPCMode.Server, _iKillerSlotId);
            }
            else
            {
                AwardFirstBlood(_iKillerSlotId);
            }
        }

        //Debug.Log("Announced Kill");
        int iMyID = GameApp.GetInstance().GetClientObj().GetComponent <CClientInfo>().GetSlotId();

        networkView.RPC("AnnounceKill", RPCMode.All, cKillerClientInfo.GetSlotId(), iMyID);

        if (!Network.isServer)
        {
            networkView.RPC("AwardKillReward", RPCMode.Server, _iKillerSlotId);
        }
        else
        {
            AwardKillReward(_iKillerSlotId);
        }

        if (!Network.isServer)
        {
            networkView.RPC("CheckPlacings", RPCMode.Server, networkView.owner, iMyID);
        }
        else
        {
            CheckPlacings(networkView.owner, iMyID);
        }
    }
Ejemplo n.º 10
0
    public static bool SignIn(string user, string password)
    {
        bool isSignedIn = UltimaWebService.SignInAgent(user, password);

        if (isSignedIn)
        {
            CClientInfo info = SessionClient.GetClientInfo(true);

            if (info != null)
            {
                bool   isPersistent = false;
                string userData     = info.Id.ToString();

                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                    1,                                                         // ticket version
                    info.FirstName,                                            // authenticated username
                    DateTime.Now,                                              // issueDate
                    DateTime.Now.AddMinutes(30),                               // expiryDate
                    isPersistent,                                              // true to persist across browser sessions
                    userData,                                                  // can be used to store additional user data
                    FormsAuthentication.FormsCookiePath);                      // the path for the cookie

                string encryptedTicket = FormsAuthentication.Encrypt(ticket);

                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                cookie.HttpOnly = true;
                HttpContext.Current.Response.Cookies.Add(cookie);
                return(true);
            }
            else
            {
                SessionTrace.Add("ClientInfo is null");
            }
        }
        else
        {
            SessionTrace.Add("Not signed in - signing out..");
        }

        SignOut();

        return(false);
    }
Ejemplo n.º 11
0
    public CClientInfo RetrieveNetPlayerInfo(NetworkPlayer _netPlayer)
    {
        GameObject[] aoClients = GameObject.FindGameObjectsWithTag("Client Object");


        foreach (GameObject oClient in aoClients)
        {
            CClientInfo cClientInfo = oClient.GetComponent <CClientInfo>();


            if (cClientInfo.GetNetworkPlayer() == _netPlayer)
            {
                return(cClientInfo);
            }
        }

        Debug.LogError("Could not retrieve player info.");

        return(null);
    }
        private void ProcessClientInfo(int conId, byte[] arrMsgBody)
        {
            CClientInfo ci = CUtilProto.DeserializeProto <CClientInfo>(arrMsgBody);


            ci.ConId        = conId;
            ci.BotId        = GetBotId(conId);
            ci.DtConnection = DateTime.Now;
            ci.Ip           = _tcpServer.GetClientIp(conId);

            Log(String.Format("Client info. ConId={0} ip={1} botId={2} version={3} instance={4}",
                              conId,           //0
                              _tcpServer.GetClientIp(conId),
                              GetBotId(conId), //1
                              ci.Version,      //2
                              ci.Instance      //3

                              ));

            _client.AddClientInfo(ci);
            //_dictKBotIdVBotTrader[_dictConnIdTrader[conId].BotId].AddRestOrder(ro.Instrument, ro.Price, ro.Dir);
        }
Ejemplo n.º 13
0
        public CClientInfo RegisterClient(string computerName, string ipAddress)
        {
            CClientInfo client;

            try
            {
                client = FindClientInfo(computerName, ipAddress).FirstOrDefault();
                if (client == null)
                {
                    client = new CClientInfo(computerName, ipAddress);
                    using (var context = _contextFactory.Get <CDbContext>())
                    {
                        context.TryAdd(client);
                    }
                }
            }
            catch (Exception ex)
            {
                s_logger.Error(ex);
                throw;
            }
            return(client);
        }
Ejemplo n.º 14
0
 public static void SetClientInfo(CClientInfo clientInfo)
 {
     HttpContext.Current.Session["ClientInfo"] = clientInfo;
 }
Ejemplo n.º 15
0
 public static VMClientInfo Create(CClientInfo clientInfo)
 {
     return(new VMClientInfo(clientInfo));
 }
Ejemplo n.º 16
0
 private VMClientInfo(CClientInfo clietInfo)
 {
     _modelClientInfo = clietInfo;
 }
Ejemplo n.º 17
0
 public UltimaPrincipal(IIdentity id, CClientInfo clientInfo)
 {
     this.ClientInfo = clientInfo;
     this.Identity   = id;
 }
Ejemplo n.º 18
0
 public CClientItemViewModel(CClientInfo client)
 {
     Client = client;
 }
 public void AddClientsInfo(CClientInfo ci)
 {
     _lstClientInfo.Add(ci);
 }