Beispiel #1
0
        public VisionExport()
        {
            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            PostgresExport.InitSQLTypes();
            player = Game.Player;
            server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            server.Bind(new IPEndPoint(IPAddress.Loopback, 5555));
            server.Listen(5);
            //server = new UdpClient(5555);
            var parser     = new FileIniDataParser();
            var location   = AppDomain.CurrentDomain.BaseDirectory;
            var data       = parser.ReadFile(Path.Combine(location, "GTAVision.ini"));
            var access_key = data["aws"]["access_key"];
            var secret_key = data["aws"]["secret_key"];

            //client = new AmazonS3Client(new BasicAWSCredentials(access_key, secret_key), RegionEndpoint.USEast1);
            //outputPath = @"D:\Datasets\GTA\";
            //outputPath = Path.Combine(outputPath, "testData.yaml");
            //outStream = File.CreateText(outputPath);
            this.Tick    += new EventHandler(this.OnTick);
            this.KeyDown += OnKeyDown;

            Interval = 1000;
            if (enabled)
            {
                postgresTask?.Wait();
                postgresTask = StartSession();
                runTask?.Wait();
                runTask = StartRun();
            }
        }
Beispiel #2
0
        public VisionExport()
        {
            // loading ini file
            var parser = new FileIniDataParser();

            location = AppDomain.CurrentDomain.BaseDirectory;
            var data = parser.ReadFile(Path.Combine(location, "GTAVision.ini"));

            //UINotify(ConfigurationManager.AppSettings["database_connection"]);
            dataPath           = data["Snapshots"]["OutputDir"];
            logFilePath        = data["Snapshots"]["LogFile"];
            Logger.logFilePath = logFilePath;

            Logger.WriteLine("VisionExport constructor called.");
            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            PostgresExport.InitSQLTypes();
            player = Game.Player;
            server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            server.Bind(new IPEndPoint(IPAddress.Loopback, 5555));
            server.Listen(5);
            //server = new UdpClient(5555);
            //outputPath = @"D:\Datasets\GTA\";
            //outputPath = Path.Combine(outputPath, "testData.yaml");
            //outStream = File.CreateText(outputPath);
            this.Tick    += new EventHandler(this.OnTick);
            this.KeyDown += OnKeyDown;

            Interval = 50;
            if (enabled)
            {
                postgresTask?.Wait();
                postgresTask = StartSession();
                runTask?.Wait();
                runTask = StartRun();
            }

            Logger.WriteLine("Logger prepared");
            UINotify("Logger initialized. Going to initialize cameras.");
            CamerasList.initialize();
            initialize4cameras();

//            var newCamera = World.CreateCamera(new Vector3(), new Vector3(), 50);
//            newCamera.NearClip = 0.15f;
//            newCamera.IsActive = true;
//            newCamera.Position = new Vector3(-1078f, -216f, 37f);
////            newCamera.Rotation = new Vector3(270f, 0f, 0f);  // x and y rotation seem to be switched. Can be fixed by setting the last parameter to 2
//            newCamera.Rotation = new Vector3(0f, 270f, 0f);  // x and y rotation seem to be switched. Can be fixed by setting the last parameter to 2
//            World.RenderingCamera = newCamera;

//            {-1078,-216,37}
//            CamerasList.setMainCamera(new Vector3(358f, -1308f, 52f), new Vector3(0f, 90f, 0f), 150, 0.15f);

            UINotify("VisionExport plugin initialized.");
        }
Beispiel #3
0
        private void basicInit()
        {
            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            PostgresExport.InitSQLTypes();
            player = Game.Player;
            server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            server.Bind(new IPEndPoint(IPAddress.Loopback, 5555));
            server.Listen(5);
            //server = new UdpClient(5555);
            var parser   = new FileIniDataParser();
            var location = AppDomain.CurrentDomain.BaseDirectory;
            var data     = parser.ReadFile(Path.Combine(location, "GTAVision.ini"));

            //var access_key = data["aws"]["access_key"];
            //var secret_key = data["aws"]["secret_key"];
            //client = new AmazonS3Client(new BasicAWSCredentials(access_key, secret_key), RegionEndpoint.USEast1);
            //outputPath = @"D:\Datasets\GTA\";
            //outputPath = Path.Combine(outputPath, "testData.yaml");
            //outStream = File.CreateText(outputPath);

            World.Weather        = Weather.Clear;
            World.CurrentDayTime = new TimeSpan(14, 0, 0);

            timeOfDays.Add(new KeyValuePair <string, int>("Night1", 22));    // Night 1
            //timeOfDays.Add(new KeyValuePair<string, int>("Night2", 23)); // Night 2
            timeOfDays.Add(new KeyValuePair <string, int>("Morning1", 6));   // Morning 1
            timeOfDays.Add(new KeyValuePair <string, int>("Morning2", 7));   // Morning 2
            timeOfDays.Add(new KeyValuePair <string, int>("Afternoon", 13)); // Afternoon
            timeOfDays.Add(new KeyValuePair <string, int>("Evening", 19));   // Evening
            if (Game.Player.Character.IsInVehicle())
            {
                Vehicle v = Game.Player.Character.CurrentVehicle;
                v.Repair();
            }

            this.Tick    += new EventHandler(this.OnTick);
            this.KeyDown += OnKeyDown;


            Interval = 3000; // this variable controls after how many milliseconds script will trigger onTick() method.
            if (enabled)
            {
                postgresTask?.Wait();
                postgresTask = StartSession();
                runTask?.Wait();
                runTask = StartRun();
            }
        }
Beispiel #4
0
        public VisionExport()
        {
            // loading ini file
            var parser = new FileIniDataParser();

            Location = AppDomain.CurrentDomain.BaseDirectory;
            var data = parser.ReadFile(Path.Combine(Location, "GTAVision.ini"));

            dataPath           = data["Snapshots"]["OutputDir"];
            LogFilePath        = data["Snapshots"]["LogFile"];
            everyNth           = int.Parse(data["Snapshots"]["EveryNth"]);
            ticked             = 0;
            Logger.logFilePath = LogFilePath;

            Logger.WriteLine("VisionExport constructor called.");
            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            PostgresExport.InitSQLTypes();
            Tick    += OnTick;
            KeyDown += OnKeyDown;

            Interval = 100;
            if (enabled)
            {
                postgresTask?.Wait();
                postgresTask = StartSession();
                runTask?.Wait();
                runTask = StartRun();
            }

            Logger.WriteLine("Logger prepared");
            UI.Notify("Logger initialized. Going to initialize cameras.");
            CamerasList.initialize();
            InitializeCameras();
            UI.Notify("VisionExport plugin initialized.");
        }
        public VisionExport()
        {
            // loading ini file
            var parser   = new FileIniDataParser();
            var location = AppDomain.CurrentDomain.BaseDirectory;
            var data     = parser.ReadFile(Path.Combine(location, "GTAVision.ini"));

            //UINotify(ConfigurationManager.AppSettings["database_connection"]);
            dataPath    = data["Snapshots"]["OutputDir"];
            logFilePath = data["Snapshots"]["LogFile"];

            System.IO.File.WriteAllText(logFilePath, "VisionExport constructor called.\n");
            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            PostgresExport.InitSQLTypes();
            player = Game.Player;
            server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            server.Bind(new IPEndPoint(IPAddress.Loopback, 5555));
            server.Listen(5);
            //server = new UdpClient(5555);
            //outputPath = @"D:\Datasets\GTA\";
            //outputPath = Path.Combine(outputPath, "testData.yaml");
            //outStream = File.CreateText(outputPath);
            this.Tick    += new EventHandler(this.OnTick);
            this.KeyDown += OnKeyDown;

            Interval = 1000;
            if (enabled)
            {
                postgresTask?.Wait();
                postgresTask = StartSession();
                runTask?.Wait();
                runTask = StartRun();
            }
        }