Exemple #1
0
        public async Task <byte[]> GetAmxFile(AmxNames amxName, bool edited = false)
        {
            var garc = await this.GetGarc(GarcNames.AmxFiles, edited : edited);

            var amxRef = this.AmxFiles.SingleOrDefault(amx => amx.Name == amxName);

            if (amxRef == null)
            {
                throw new NotSupportedException($"The game version \"{this.Version}\" does not support the AMX file \"{amxName}\"");
            }

            return(await garc.GetFile(amxRef.FileNumber));
        }
Exemple #2
0
        public async Task SaveAmxFile(AmxNames amxName, byte[] fileData)
        {
            var garc = await this.GetGarc(GarcNames.AmxFiles);

            var amxRef = this.AmxFiles.SingleOrDefault(amx => amx.Name == amxName);

            if (amxRef == null)
            {
                throw new NotSupportedException($"The game version \"{this.Version}\" does not support the AMX file \"{amxName}\"");
            }

            await garc.SetFile(amxRef.FileNumber, fileData);

            await this.SaveFile(garc);
        }
Exemple #3
0
 public Task SaveAmxScript(AmxNames amxName, Amx amxScript) => this.SaveAmxFile(amxName, amxScript.Data);
Exemple #4
0
        public async Task <Amx> GetAmxScript(AmxNames amxName, bool edited = false)
        {
            var amxFile = await this.GetAmxFile(amxName, edited);

            return(new Amx(amxFile));
        }
 public AmxReference(int fileNumber, AmxNames name)
 {
     this.FileNumber = fileNumber;
     this.Name       = name;
 }