Exemplo n.º 1
0
    /*===============================================================*/

    /*===============================================================*/
    /// <summary>
    /// @author Hironari Ushiyama
    /// @brief CSVを読み込み,CSVのデータテーブルを生成し, 配列に格納する関数
    /// @param string CSVファイル名 拡張子は抜かす
    /// @param string[] CSV内容格納配列
    /// </summary>
    public void ArrayInput(string file, string[] array)
    {
        // ローダーの生成
        CSVLoader loader = new CSVLoader( );
        // 配列カウント用 index
        int index = 0;
        // CSVを読み込み,CSVのデータテーブルを生成
        CSVTable csvTable = loader.LoadCSV(file);

        foreach (CSVRecord record in csvTable.Records)
        {
            foreach (string header in csvTable.Headers)
            {
                array[index] = record.GetField(header);
                index++;
                // CSV の内容をデバッグ確認できます
                //Debug.Log( header + " : " + record.GetField( header ) );
            }
        }
    }
    public static void Add(string key, string[] values)
    {
        CheckValues(ref values);

        if (csvLoader == null)
        {
            csvLoader = new CSVLoader();
        }

        csvLoader.LoadCSV();
        csvLoader.Add(key, values);
        csvLoader.LoadCSV();

        UpdateDictionaries();
    }
Exemplo n.º 3
0
        public void FHIRDataset_Test1()
        {
            var           mapping = CreateTestMapping();
            DummFHIRStore store   = new DummFHIRStore();
            var           file    = @".\TestData\data.csv";
            var           parser  = new FHIRParser(store);

            var dataset = CSVLoader.LoadCSV(file, true, ',');

            parser.Parse(mapping, dataset);
            parser.Flush();

            var resource = parser.GetResource("00126030000001001");

            Assert.IsNotNull(resource);
            Assert.IsTrue(resource is ResearchSubject);

            store.SaveJson("test.json");


            mapping.ToJson("mapping.json");
        }
Exemplo n.º 4
0
    public static void Add(string key, string value)
    {
        if (value.Contains("\""))
        {
            value.Replace('"', '\"');
        }

        if (csvLoader == null)
        {
            csvLoader = new CSVLoader();
        }

        csvLoader.LoadCSV();
        csvLoader.Add(key, value);
        csvLoader.LoadCSV();

        UpdateDictionaries();
    }
    public static void Add(string key, string value) //Process the new value and add on necessary regex to identify it in the CSV file, and then add it to the CSV
    {
        if (value.Contains("\""))
        {
            value.Replace('"', '\"');
        }

        if (csvLoader == null)
        {
            csvLoader = new CSVLoader();
        }

        csvLoader.LoadCSV();
        csvLoader.Add(key, value);
        csvLoader.LoadCSV();

        UpdateDictionaries();
    }