public void GetTabStreamStringsShort() { /* Arrange */ var sut_TabFile = TestConstants.GetSUT_INPUT_FileInfo(TAB_FILE_NAME); var sut_JsonFile = TestConstants.GetSUT_OUTPUT_FileInfo(JSON_FILE_NAME); if (sut_JsonFile.Exists) { sut_JsonFile.Delete(); } var tr = new TabReader(); /* Act */ var gotHeader = tr.ReadLineTabJsonStrings(TAB_HEADER_SHORT); using var inputStream = sut_TabFile.OpenRead(); using var outputStream = sut_JsonFile.OpenWrite(); var tsr = new TabStreamReader(inputStream); tsr.WriteToSimpleJsonStream(gotHeader, outputStream); //Utf8JsonWriter writer = WriteJsonToStream(gotHeader, inputStream, outputStream); sut_JsonFile.Refresh(); /* Assert */ Assert.True(sut_JsonFile.Exists); Assert.True(sut_JsonFile.Length > 0); }
public void GetTabJsonStrings() { /* Arrange */ var tr = new TabReader(); var jsonFile = TestConstants.GetSUT_OUTPUT_FileInfo(JSON_FILE_NAME); /* Act */ var got = tr.ReadLineTabJsonStrings(TAB_LINE_SIMPLE); var gotHeader = tr.ReadLineTabJsonStrings(TAB_HEADER_SIMPLE); using var writefs = jsonFile.OpenWrite(); using var writer = new Utf8JsonWriter(writefs); writer.WriteStartArray(); writer.WriteStartObject(); for (int i = 0; i < gotHeader.Length; i++) { writer.WriteString(gotHeader[i], got[i]); } writer.WriteEndObject(); writer.WriteEndArray(); // await writer.FlushAsync(); writer.Dispose(); while (writer.BytesPending > 0) { System.Threading.Thread.Sleep(5); } jsonFile.Refresh(); /* Assert */ Assert.False(got.IsEmpty); }
public string[,] words; //a 2d string array of all of the data from the csv void OnEnable() { phrases = new List <Phrase>(); randomisedPhrases = new List <Phrase>(); words = TabReader.SplitCsvGrid(csv.text); ProcessWords(); Sphere(); }
public void GetTabStrings() { /* Arrange */ var tr = new TabReader(); /* Act */ var got = tr.ReadLineTabStrings(TAB_LINE_SIMPLE); Console.WriteLine(got.ToArray().ToPrettyString()); // TODO: replace with output.WriteLine logic /* Assert */ Assert.False(got.IsEmpty); }
public static void Read() { bool isok = false; TabReader tr = new TabReader("heros.txt", out isok); if (tr != null && isok) { for (int i = 0; i < tr.recordCount; i++) { TabHeros tc = new TabHeros(); tc.idx = i; tc.name = tr.GetString(i, "name"); tc.dir = tr.GetString(i, "dir"); tc.skingnames = GetDirectoryFileNames(string.Format("Resource\\{0}", tc.dir)); lsTabConfig.Add(tc); } } }