Inheritance: java.io.OutputStreamWriter
 public SmartDashboardXMLWriter(string fileName)
 {
   base.\u002Ector();
   SmartDashboardXMLWriter dashboardXmlWriter = this;
   this.fileName = fileName;
   this.writer = new FileWriter(fileName);
   ((Writer) this.writer).write("<xml version=\"1.0\">\n");
 }
Esempio n. 2
0
 public virtual void start(string path)
 {
   if (this.m_fw != null)
     return;
   IOException ioException;
   try
   {
     this.m_startTime = System.currentTimeMillis();
     this.m_fw = new FileWriter(path);
     ((Writer) this.m_fw).write(new StringBuilder().append("Time (ms),Name,Value").append(LogToCSV.s_lineSeparator).toString());
     ((OutputStreamWriter) this.m_fw).flush();
     Robot.getTable().addTableListener((ITableListener) this, true);
     return;
   }
   catch (IOException ex)
   {
     int num = 1;
     ioException = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num);
   }
   Throwable.instancehelper_printStackTrace((Exception) ioException);
   JOptionPane.showMessageDialog((Component) null, (object) "An error occurred when attempting to open the output CSV file for writing. Please check the file path preference.", "Unable to Open CSV File", 0);
   this.frame.getPrefs().__\u003C\u003ElogToCSV.setValue((object) Boolean.valueOf(false));
 }
Esempio n. 3
0
    public virtual void stop()
    {
      if (this.m_fw == null)
        return;
      IOException ioException;
      try
      {
        ((OutputStreamWriter) this.m_fw).close();
        goto label_5;
      }
      catch (IOException ex)
      {
        int num = 1;
        ioException = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num);
      }
      Throwable.instancehelper_printStackTrace((Exception) ioException);
label_5:
      Robot.getTable().removeTableListener((ITableListener) this);
      this.m_fw = (FileWriter) null;
    }
		private void doTest(String test) {
			var userDir = System.getProperty("user.dir");
			var sourcePath = PathHelper.combine(PathHelper.combine(userDir, "tests/resources/ParseExpressionTest/sources"), test + ".txt");
			var fileReader = new InputStreamReader(new FileInputStream((sourcePath)), Charset.forName("UTF-8"));
			var code = readToEnd(fileReader);
			text = code.toCharArray();
			var parser = new Parser();
			var scanner = new SourceCodeScanner(new CodeErrorManager(), text);
			var expression = parser.parseExpression(scanner);
			var result = expressionToString(expression);
			
			var generatedPath = PathHelper.combine(userDir, "tests/resources/ParseExpressionTest/generated");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var fileWriter = new FileWriter(PathHelper.combine(generatedPath, test + ".txt"));
			fileWriter.write(result);
			fileWriter.close();
			
			var expectedPath = PathHelper.combine(userDir, "tests/resources/ParseExpressionTest/expected");
			var expectedFile = new File(PathHelper.combine(expectedPath, test + ".txt"));
			Assert.assertTrue("Expected file not found: " + expectedFile, expectedFile.exists());
			fileReader = new InputStreamReader(new FileInputStream((expectedFile)), Charset.forName("UTF-8"));
			var reference = readToEnd(fileReader);
			
			var genReader = new BufferedReader(new StringReader(result));
			var refReader = new BufferedReader(new StringReader(reference));
			for (;;) {
				var genLine = genReader.readLine();
				var refLine = refReader.readLine();
				if (genLine == null && refLine == null) {
					break;
				}
				Assert.assertEquals(refLine, genLine);
			}
		}
		private void doTest(String test, LambdaExpression lambda) {
			variables = new ArrayList<VariableExpression>();
			labels = new ArrayList<Label>();
			switchLabels = new ArrayList<SwitchLabel>();
			
			var result = lambdaToString(lambda);
			
			var userDir = System.getProperty("user.dir");
			var generatedPath = PathHelper.combine(userDir, "tests/resources/ExpressionTreesTest/generated");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var fileWriter = new FileWriter(PathHelper.combine(generatedPath, test + ".txt"));
			fileWriter.write(result);
			fileWriter.close();
		
			var referencePath = PathHelper.combine(PathHelper.combine(userDir, "tests/resources/ExpressionTreesTest/references"), test + ".txt");
			var referenceFile = new File(referencePath);
			String reference = null;
			if (referenceFile.exists()) {
				var fileReader = new InputStreamReader(new FileInputStream((referencePath)), Charset.forName("UTF-8"));
				reference = readToEnd(fileReader);
			} else {
				Assert.fail("No reference for '" + test + "'");
			}
			
			if (reference != null) {
				var genReader = new BufferedReader(new StringReader(result));
				var refReader = new BufferedReader(new StringReader(reference));
				for (;;) {
					var genLine = genReader.readLine();
					var refLine = refReader.readLine();
					if (genLine == null && refLine == null) {
						break;
					}
					Assert.assertEquals(refLine, genLine);
				}
			}
		}
		private void doTest(String test, TypeInfo typeInfo) {
			String result = typeToString(typeInfo, "");
			
			var userDir = System.getProperty("user.dir");
			var generatedPath = PathHelper.combine(userDir, "Tests/resources/TypeSystemTest/generated");
			var generatedDir = new File(generatedPath);
			if (!generatedDir.exists()) {
				generatedDir.mkdir();
			}
			var fileWriter = new FileWriter(PathHelper.combine(generatedPath, test + ".txt"));
			fileWriter.write(result);
			fileWriter.close();
			
			var expectedPath = PathHelper.combine(userDir, "Tests/resources/TypeSystemTest/expected");
			var expectedFile = new File(PathHelper.combine(expectedPath, test + ".txt"));
			Assert.assertTrue("Expected file not found: " + expectedFile, expectedFile.exists());
			var fileReader = new InputStreamReader(new FileInputStream((expectedFile)), Charset.forName("UTF-8"));
			var reference = readToEnd(fileReader);
			
			var genReader = new BufferedReader(new StringReader(result));
			var refReader = new BufferedReader(new StringReader(reference));
			for (;;) {
				var genLine = genReader.readLine();
				var refLine = refReader.readLine();
				if (genLine == null && refLine == null) {
					break;
				}
				Assert.assertEquals(refLine, genLine);
			}
		}