2024-04-19 14:59:45 +08:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2024-04-22 21:26:34 +08:00
|
|
|
|
using Canon.Server.Entities;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
|
2024-04-22 21:26:34 +08:00
|
|
|
|
namespace Canon.Server.DataTransferObjects;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
|
|
|
|
|
public class CompileResponse
|
|
|
|
|
{
|
|
|
|
|
[Required]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
2024-05-13 22:29:32 +08:00
|
|
|
|
[Required]
|
|
|
|
|
public bool Error { get; set; }
|
|
|
|
|
|
2024-04-19 14:59:45 +08:00
|
|
|
|
[Required]
|
|
|
|
|
public string SourceCode { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public string CompiledCode { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public string ImageAddress { get; set; }
|
|
|
|
|
|
2024-04-22 21:26:34 +08:00
|
|
|
|
[Required]
|
|
|
|
|
public string CompileTime { get; set; }
|
|
|
|
|
|
2024-04-29 23:55:36 +08:00
|
|
|
|
[Required]
|
|
|
|
|
public string CompileInformation { get; set; }
|
|
|
|
|
|
2024-04-19 14:59:45 +08:00
|
|
|
|
public CompileResponse()
|
|
|
|
|
{
|
|
|
|
|
Id = string.Empty;
|
|
|
|
|
SourceCode = string.Empty;
|
|
|
|
|
CompiledCode = string.Empty;
|
|
|
|
|
ImageAddress = string.Empty;
|
2024-04-22 21:26:34 +08:00
|
|
|
|
CompileTime = string.Empty;
|
2024-04-29 23:55:36 +08:00
|
|
|
|
CompileInformation = string.Empty;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CompileResponse(CompileResult result)
|
|
|
|
|
{
|
2024-05-13 22:29:32 +08:00
|
|
|
|
Id = result.Id.ToString();
|
|
|
|
|
Error = result.Error;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
SourceCode = result.SourceCode;
|
|
|
|
|
CompiledCode = result.CompiledCode;
|
|
|
|
|
ImageAddress = $"/api/file/{result.SytaxTreeImageFilename}";
|
2024-04-22 21:26:34 +08:00
|
|
|
|
CompileTime = result.CompileTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
|
2024-04-29 23:55:36 +08:00
|
|
|
|
CompileInformation = result.CompileInformation;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|