예제 #1
0
        private IEnumerator load2(string url, string key1, string key2, OnValues2 cb)
        {
            yield return(load(url, (string text) =>
            {
                var dic = new Dictionary <int, Dictionary <int, CsvValue> >();
                string[] keys = null;
                using (StringReader sr = new StringReader(text))
                {
                    string line;
                    bool is_head_line = true;
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (is_head_line)
                        {
                            is_head_line = false;
                            keys = line2items(line);
                        }
                        else
                        {
                            var csv_value = new CsvValue();
                            csv_value.parseLine(
                                Path.GetFileName(url), keys, line2items(line));
                            csv_value.findKey(key1);
                            csv_value.findKey2(key2);
                            if (!dic.ContainsKey(csv_value.key))
                            {
                                dic[csv_value.key] = new Dictionary <int, CsvValue>();
                            }
                            dic[csv_value.key][csv_value.key2] = csv_value;
                        }
                    }
                }

                cb(dic);
            }));
        }
예제 #2
0
 public void parse2(string url, string key1, string key2, OnValues2 cb)
 {
     StartCoroutine(load2(url, key1, key2, cb));
 }