Esempio n. 1
0
        private static void LoadFilesPromScript(string name)
        {
            int num = Function.Call <int>(Hash.GET_NUM_RESOURCE_METADATA, name, "file");

            CitizenFX.Core.Debug.WriteLine($"{num} files for {name}");
            for (int i = 0; i < num; i++)
            {
                var filename = Function.Call <string>(Hash.GET_RESOURCE_METADATA, name, "file", i);

                var data = Function.Call <string>(Hash.LOAD_RESOURCE_FILE, name, filename);


                if (filename.Equals("extra-files/ELS.ini"))
                {
                    if (configuration.ControlConfiguration.isValidData(data))
                    {
                        OnSettingsLoaded?.Invoke(SettingsType.Type.GLOBAL, data);
                    }
                }
                else if (Path.GetExtension(filename).ToLower() == ".xml")
                {
                    if (VCF.isValidData(data))
                    {
#if DEBUG
                        CitizenFX.Core.Debug.WriteLine("Sending data to XML parser");
#endif
                        VCF.load(SettingsType.Type.VCF, filename, data, name);
                    }
                }
            }
        }
Esempio n. 2
0
        public void RunLoadeer(string name)
        {
            if (ELS.isStopped)
            {
                return;
            }
            int num = Function.Call <int>(Hash.GET_NUM_RESOURCE_METADATA, name, "ELSFM");

#if DEBUG
            Debug.WriteLine("number of INI files to load: " + num.ToString() + " " + name);
#endif
            for (int i = 0; i < num; i++)
            {
                var filename = Function.Call <string>(Hash.GET_RESOURCE_METADATA, name, "ELSFM", i);
#if DEBUG
                Debug.WriteLine($"Name: {name}, Loading: {filename}");
#endif

                if (filename.Equals("extra-files/ELS.ini"))
                {
                    var data = Function.Call <string>(Hash.LOAD_RESOURCE_FILE, name, filename);
                    OnSettingsLoaded?.Invoke(configuration.SettingsType.Type.GLOBAL, data);
                }
                // var ldata = Function.Call<string>(Hash.LOAD_RESOURCE_FILE, name, filename);
                //Debug.WriteLine(ldata);
            }

            num = Function.Call <int>(Hash.GET_NUM_RESOURCE_METADATA, name, "ELSFMVCF");
#if DEBUG
            Debug.WriteLine("number of VCF files to load: " + num.ToString() + " " + name);
#endif
            for (int i = 0; i < num; i++)
            {
                var filename = Function.Call <string>(Hash.GET_RESOURCE_METADATA, name, "ELSFMVCF", i);
#if DEBUG
                Debug.WriteLine($"Name: {name}, Loading: {filename}");
#endif


                var data = Function.Call <string>(Hash.LOAD_RESOURCE_FILE, name, filename);
                Debug.WriteLine("Sending data to XML parser");
                VCF.load(SettingsType.Type.VCF, filename, data);
            }
        }