public static void LogTXTExport(List <PlotableProcess> fcfs, List <PlotableProcess> sjf, List <PlotableProcess> rr, double quantum)
 {
     if (fcfs != null && sjf != null && rr != null)
     {
         string txt = "FCFS\n";
         foreach (PlotableProcess process in fcfs)
         {
             txt += process.name + " " + process.ExecTime + "\n";
         }
         txt += "\nSJF\n";
         foreach (PlotableProcess process in sjf)
         {
             txt += process.name + " " + process.ExecTime + "\n";
         }
         txt += "\nRR: Quantum = +" + quantum.ToString() + "\n";
         foreach (PlotableProcess process in rr)
         {
             txt += process.name + " " + process.ExecTime + "\n";
         }
         if (GTKUtils.ShowFileChooser(out string path, ".txt", "Exportar Log: .txt", "Salvar"))
         {
             JsonController.SaveJson(txt, path);
         }
     }
     else
     {
         NotProcess();
     }
 }
 public static void TxtToPRBConverter()
 {
     if (GTKUtils.ShowFileChooser(out string path, ".txt", "Arquivo alvo", "Converter"))
     {
         string txt = "";
         if (JsonController.OpenJson(path, ref txt))
         {
             try
             {
                 string prb = DataConverter.TxtToPRB(txt);
                 if (GTKUtils.ShowFileChooser(out string newPath, ".prb", "Arquivo Convertido", "Salvar"))
                 {
                     JsonController.SaveJson(prb, newPath);
                 }
             }
             catch
             {
                 ErrorDilog("Erro ao converter arquivo!", "Não foi possivel extrair os dados do arquivo!");
             }
         }
         else
         {
             WarningDilog("Erro ao abrir o arquivo!", "Arquivo inexistente ou corrompido!");
         }
     }
 }
 public static void LogJsonImport()
 {
     if (GTKUtils.ShowFileChooser(out string path, ".log", "Abrir Log", "Abrir"))
     {
         string json = "";
         if (JsonController.OpenJson(path, ref json))
         {
             SchedulersResult result = new SchedulersResult();
             if (JsonController.JsonToObject(json, ref result))
             {
                 Console.WriteLine(result);
                 ImportView view = new ImportView(result);
                 view.Show();
             }
             else
             {
                 WarningDilog("Erro ao deserializar arquivo!",
                              "Arquivo não contem as informações nessesarias!");
             }
         }
         else
         {
             WarningDilog("Erro ao abrir o arquivo!", "Arquivo inexistente ou corrompido!");
         }
     }
 }
 public static void LogExport(List <PlotableProcess> fcfs, List <PlotableProcess> sjf, List <PlotableProcess> rr, double quantum)
 {
     if (fcfs != null && sjf != null && rr != null)
     {
         SchedulersResult result = new SchedulersResult
         {
             FCFS    = fcfs.ConvertAll((input) => { return(new LogProcess(input)); }),
             SJF     = sjf.ConvertAll((input) => { return(new LogProcess(input)); }),
             Quantum = quantum,
             RR      = rr.ConvertAll((input) => { return(new LogProcess(input)); }),
         };
         if (GTKUtils.ShowFileChooser(out string path, ".log", "Exportar Log: .log", "Salvar"))
         {
             string json = JsonController.ObjectToJson(result);
             JsonController.SaveJson(json, path);
         }
     }
     else
     {
         NotProcess();
     }
 }