示例#1
0
        public CsvFile(string _fileName, System.IO.Stream fileStream, CtfEditorGamePage _page)
            : base(_fileName, fileStream, _page)
        {
            using (CsvStreamReader reader = new CsvStreamReader(fileStream))
            {
                lines = reader.ReadToEnd().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                string[] values = lines[parentPage.lineIndex].Split(',');
                foreach (CtfEntryInfo entryInfo in parentPage.ctfEntryInfo)
                {
                    try
                    {
                        entry.Add(entryInfo.id, reader.ReadEntryData(entryInfo.type, values[entryInfo.id], entryInfo.name));
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message + Environment.NewLine +
                                            entryInfo.id + " " + entryInfo.name + " " + values[entryInfo.id]);
                    }
                }

                parentPage.files.Add(this);
            }
        }
        public CsvFile(string _fileName, System.IO.Stream fileStream, CtfEditorGamePage _page)
            : base(_fileName, fileStream, _page)
        {
            using (CsvStreamReader reader = new CsvStreamReader(fileStream))
            {
                lines = reader.ReadToEnd().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                string[] values = lines[parentPage.lineIndex].Split(',');
                foreach (CtfEntryInfo entryInfo in parentPage.ctfEntryInfo)
                {
                    try
                    {
                        entry.Add(entryInfo.id, reader.ReadEntryData(entryInfo.type, values[entryInfo.id], entryInfo.name));
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message + Environment.NewLine +
                            entryInfo.id + " " + entryInfo.name + " " + values[entryInfo.id]);
                    }
                }

                parentPage.files.Add(this);
            }
        }