package W;

import V.ExceptionInVPackage;
import bH.F;
import bH.X;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.Date;

public class ThrottleCalibrationGenerator {
  public File ExceptionInVPackage(String paramString, int paramInt1, int paramInt2) {
    CalibrationFileHeader f = new CalibrationFileHeader(this);
    f.b("THROTTLEFACTOR:");
    f.ExceptionInVPackage("EFI Analytics generated Linear Throttle Calibration");
    f.ExceptionInVPackage("Created on " + (new Date()).toString());
    f.ExceptionInVPackage("");
    f.ExceptionInVPackage("\tLow ADC = " + paramInt1 + "  \tHigh ADC = " + paramInt2);
    f.ExceptionInVPackage("");
    CalibrationDataRow[] arrayOfG = new CalibrationDataRow[257];
    arrayOfG[0] = new CalibrationDataRow(this);
    arrayOfG[0].ExceptionInVPackage("ADC");
    for (byte b = 1; b < arrayOfG.length; b++) {
      int i = b - 1;
      int j = -1;
      j = Math.round(100.0F * (i - paramInt1) / (paramInt2 - paramInt1));
      arrayOfG[b] = new CalibrationDataRow(this, "DB", "" + j, "" + i);
    } 
    File file = new File(paramString, "throttlefactor.inc");
    return ExceptionInVPackage(file, f, arrayOfG);
  }
  
  public File ExceptionInVPackage(File paramFile, F paramF, CalibrationDataRow[] paramArrayOfG) {
    try {
      if (paramFile.exists() && !paramFile.delete())
        throw new ExceptionInVPackage("Unable to delete existing inc file! Check permissions.\n" + paramFile.getAbsolutePath()); 
      paramFile.createNewFile();
      FileOutputStream fileOutputStream = new FileOutputStream(paramFile);
      PrintStream printStream = new PrintStream(fileOutputStream);
      printStream.print(paramF.ExceptionInVPackage());
      printStream.println(paramF.b());
      for (byte b = 0; b < paramArrayOfG.length; b++) {
        if (paramArrayOfG[b].b() != null && !paramArrayOfG[b].b().equals("")) {
          printStream.println("\t" + paramArrayOfG[b].ExceptionInVPackage() + "\t" + X.ExceptionInVPackage(paramArrayOfG[b].b(), ' ', 3) + "T\t; " + X.ExceptionInVPackage(paramArrayOfG[b].c(), ' ', 3));
        } else {
          printStream.println("\t" + paramArrayOfG[b].ExceptionInVPackage() + "\t" + X.ExceptionInVPackage(paramArrayOfG[b].b(), ' ', 3) + "\t; " + X.ExceptionInVPackage(paramArrayOfG[b].c(), ' ', 3));
        } 
      } 
    } catch (Exception exception) {
      exception.printStackTrace();
      throw new ExceptionInVPackage("Error writing " + paramFile.getAbsoluteFile() + "\n" + exception.getMessage());
    } 
    F.c();
    return paramFile;
  }
}


/* Location:              /home/rewrich/Downloads/TunerStudioMS/TunerStudioMS/!/W/E.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */