Skip to content

Commit

Permalink
Working on factory patter implementation for R Objects
Browse files Browse the repository at this point in the history
  • Loading branch information
cthulhu-bot committed Feb 22, 2012
1 parent 1b4adb6 commit b4a9660
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 8 additions & 4 deletions output/test.R
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,8 @@
sink("C:\\Users\\Joshua\\Documents\\Visual Studio 2010\\Projects\\Dunwich\\Dunwich\\output\\test_output.txt") x <- c(1,2,3,4,5)
cat('this shit should be working') cat(x)
sink() y <- c(1,2,3,4,5)
cat('WTF') cat(y)
X11()
plot(x)
message("Press Return to Continue")
invisible(readLines("stdin", n=1))
12 changes: 5 additions & 7 deletions src/R.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ public void ExecuteRFile()


private void RFileInit() private void RFileInit()
{ {
string rFileName = "C:\\Users\\Joshua\\Documents\\Visual Studio 2010\\Projects\\Dunwich\\Dunwich\\output\\test.R";

// Create the file if it does not exist // Create the file if it does not exist
// Else wipe its contents // Else wipe its contents
if (!File.Exists(rFileName)) if (!File.Exists(this.RPath + this.RFile))
{ {
File.Create("C:\\Users\\Joshua\\Documents\\Visual Studio 2010\\Projects\\Dunwich\\Dunwich\\output\\test.R"); File.Create(this.RPath + this.RFile);
} }
else else
{ {
File.WriteAllText("C:\\Users\\Joshua\\Documents\\Visual Studio 2010\\Projects\\Dunwich\\Dunwich\\output\\test.R", ""); File.WriteAllText(this.RPath + this.RFile, "");
} }


} }
Expand All @@ -106,7 +104,7 @@ private void RFileInit()
* */ * */
private void batchFileInit() private void batchFileInit()
{ {
string batchFileName = "C:\\Users\\Joshua\\Documents\\Visual Studio 2010\\Projects\\Dunwich\\Dunwich\\output\\test.bat"; string batchFileName = this.RPath + this.BatchFile;


// Delete the file if it exists // Delete the file if it exists
if (File.Exists(batchFileName)) if (File.Exists(batchFileName))
Expand All @@ -116,7 +114,7 @@ private void batchFileInit()


using (FileStream fs = File.Create(batchFileName, 1024)) using (FileStream fs = File.Create(batchFileName, 1024))
{ {
byte[] info = new System.Text.UTF8Encoding(true).GetBytes("@ECHO OFF\nRscript \"C:\\Users\\Joshua\\Documents\\Visual Studio 2010\\Projects\\Dunwich\\Dunwich\\output\\test.R\""); byte[] info = new System.Text.UTF8Encoding(true).GetBytes("@ECHO OFF\nRscript \"" + this.RPath + this.RFile + "\"");
fs.Write(info, 0, info.Length); fs.Write(info, 0, info.Length);
} }
} }
Expand Down

0 comments on commit b4a9660

Please sign in to comment.