예제 #1
0
        public uint[] FromAsmSource(string asmSource)
        {
            // making a API call to integration server.
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                // on Windows, integration server is required to run in Docker or WSL.
                // Installation steps are same for WSL and for docker.
                // https://github.com/EvgenyMuryshkin/Quokka.RISCV.Docker

                var instructions = RISCVIntegrationClient.Asm(new RISCVIntegrationEndpoint(), asmSource);
                return(instructions.Result);
            }
            else
            {
                // on Linux, just make local call to RISCV toolchain
                return(RISCVIntegrationClient.ToInstructions(Toolchain.Asm(asmSource)).ToArray());
            }
        }
예제 #2
0
        public async Task <ActionResult> Asm()
        {
            try
            {
                using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
                {
                    var asmSource = await reader.ReadToEndAsync();

                    return(File(Toolchain.Asm(asmSource), "application/octet-stream"));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);

                return(BadRequest(ex.ToString()));
            }
        }