示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.B))
     {
         Debug.LogError("写入数据");
         CsvFileWriter.WriteAll(data, fullPath, Encoding.GetEncoding("gbk"));
     }
 }
示例#2
0
        public static bool TestWithGrid(string inputFile, string outputFile)
        {
            var dataGrid = CsvFileReader.ReadAll(inputFile, Encoding.GetEncoding("gbk"));

            if (dataGrid != null)
            {
                PrintDataGrid(dataGrid);

                CsvFileWriter.WriteAll(dataGrid, outputFile, Encoding.GetEncoding("gbk"));

                return(CompareFile(inputFile, outputFile));
            }
            else
            {
                Console.WriteLine("Failed loading data from inputFile");
                return(false);
            }
        }
    /// <summary>
    /// Run through each row calculating the row total and using it as the demoninator
    ///     for each cell probability value.
    /// </summary>
    private void WriteProbabilities()
    {
        for (int i = 0; i < rowIds.Count; i++)
        {
            for (int j = 0; j < columnIds.Count; j++)
            {
                var value = gridData[i][j];

                if (IsNumeric(value))
                {
                    var listID = ConvertToListID(i, j);
                    var probab = Probabilities[listID];

                    gridData[i][j] = probab.ToString();
                }
            }
        }
        CsvFileWriter.WriteAll(gridData, csvPath + csvProbabsFile, System.Text.Encoding.GetEncoding("gbk"));
    }