示例#1
0
        public async Task <IActionResult> BuildJar([FromBody] CompileRequest request)
        {
            try
            {
                var bytes = await _service.BuildJarFromGit(request.GitPath);

                bytes = await _obfuscation.Obfuscate(new ObfuscateRequest
                {
                    Bytes  = bytes,
                    Config = request.ObfuscateConfig
                });

                return(File(bytes, "application/java-archive", "result.jar"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                var split = e.Message.Split("@@");
                return(BadRequest(JsonConvert.SerializeObject(new
                {
                    Logs = split[0],
                    Errors = split.Length > 1 ? split[1] : string.Empty
                })));
            }
        }
示例#2
0
        protected virtual void ObfuscateProperty <T>(T objectToObfuscate, PropertyInfo propertyInfo, IObfuscationService obfuscator)
        {
            // get property value
            var oldValue = propertyInfo.GetValue(objectToObfuscate);

            if (oldValue == null)
            {
                return;
            }

            // run obfuscator
            var obfuscatedValue = obfuscator.Obfuscate(oldValue);

            // set new value to property
            propertyInfo.SetValue(objectToObfuscate, obfuscatedValue);
        }
        public async Task <IActionResult> Execute(ObfuscateRequest request)
        {
            var bytes = await _service.Obfuscate(request);

            return(File(bytes, "application/java-archive", "result.jar"));
        }