Exemplo n.º 1
0
        private void HandleNewIPCGameState(string gs_data)
        {
            //Global.logger.LogLine("Received gs!");
            //Global.logger.LogLine(gs_data);

            GameState_Wrapper new_state = new GameState_Wrapper(gs_data); //GameState_Wrapper

            wrapper_connected = true;
            wrapped_process   = new_state.Provider.Name.ToLowerInvariant();

            var task = new System.Threading.Tasks.Task(() =>
            {
                if (new_state.Provider.Name.ToLowerInvariant().Equals("gta5.exe"))
                {
                    CurrentGameState = new Profiles.GTA5.GSI.GameState_GTA5(gs_data);
                }
                else
                {
                    CurrentGameState = new_state;
                }
            }
                                                       );

            task.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// A copy constructor, creates a GameState_GTA5 instance based on the data from the passed GameState instance.
        /// </summary>
        /// <param name="other_state">The passed GameState</param>
        public GameState_GTA5(GameState other_state) : base(other_state)
        {
            GameState_GTA5 gta = other_state as GameState_GTA5;

            if (gta != null)
            {
                this.HasCops         = gta.HasCops;
                this.LeftSirenColor  = gta.LeftSirenColor;
                this.RightSirenColor = gta.RightSirenColor;
                this.CurrentState    = gta.CurrentState;
                this.StateColor      = gta.StateColor;
            }
        }
Exemplo n.º 3
0
        private void HandleNewIPCGameState(string gs_data)
        {
            GameState_Wrapper new_state = new GameState_Wrapper(gs_data); //GameState_Wrapper

            wrapper_connected = true;
            wrapped_process   = new_state.Provider.Name.ToLowerInvariant();

            if (new_state.Provider.Name.ToLowerInvariant().Equals("gta5.exe"))
            {
                CurrentGameState = new Profiles.GTA5.GSI.GameState_GTA5(gs_data);
            }
            else
            {
                CurrentGameState = new_state;
            }
        }
Exemplo n.º 4
0
        private void IPCServerThread()
        {
            PipeSecurity pipeSa = new PipeSecurity();

            pipeSa.SetAccessRule(new PipeAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null),
                                                    PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow));
            while (true)
            {
                try
                {
                    using (NamedPipeServerStream pipeStream = new NamedPipeServerStream(
                               "Aurora\\server",
                               PipeDirection.In,
                               NamedPipeServerStream.MaxAllowedServerInstances,
                               PipeTransmissionMode.Message,
                               PipeOptions.None,
                               5 * 1024,
                               5 * 1024,
                               pipeSa,
                               HandleInheritability.None
                               ))
                    {
                        wrapper_connected = false;
                        wrapped_process   = "";
                        Global.logger.LogLine(String.Format("[IPCServer] Pipe created {0}", pipeStream.GetHashCode()));

                        pipeStream.WaitForConnection();
                        Global.logger.LogLine("[IPCServer] Pipe connection established");

                        using (StreamReader sr = new StreamReader(pipeStream))
                        {
                            string temp;
                            while ((temp = sr.ReadLine()) != null)
                            {
                                //Global.logger.LogLine(String.Format("{0}: {1}", DateTime.Now, temp));

                                GameState_Wrapper new_state = new GameState_Wrapper(temp); //GameState_Wrapper

                                wrapper_connected = true;
                                wrapped_process   = new_state.Provider.Name.ToLowerInvariant();

                                if (new_state.Provider.Name.ToLowerInvariant().Equals("gta5.exe"))
                                {
                                    CurrentGameState = new Profiles.GTA5.GSI.GameState_GTA5(temp);
                                }
                                else
                                {
                                    CurrentGameState = new_state;
                                }
                            }
                        }
                    }

                    wrapper_connected = false;
                    wrapped_process   = "";
                    Global.logger.LogLine("[IPCServer] Pipe connection lost");
                }
                catch (Exception exc)
                {
                    wrapper_connected = false;
                    wrapped_process   = "";
                    Global.logger.LogLine("[IPCServer] Named Pipe Exception, " + exc, Logging_Level.Error);
                }
            }
        }