ReadFile() public method

Reads the file, and returns an array of strings organised [Column][Row]
public ReadFile ( ) : string[][]
return string[][]
コード例 #1
0
        public DMCColourMap(bool createEmpty)
        {
            Colours = new Dictionary <Color, IColourInfo>();
            if (!createEmpty)
            {
                byte[]       bytes  = Encoding.ASCII.GetBytes(DMCColours.DmcToRgb);
                MemoryStream stream = new MemoryStream(bytes);
                CSVReader    reader = new CSVReader(stream);
                string[][]   text   = reader.ReadFile();

                for (int i = 0; i < reader.NumberOfRows; i++)
                {
                    int    r      = parse(text[2][i]);
                    int    g      = parse(text[3][i]);
                    int    b      = parse(text[4][i]);
                    string name   = text[1][i];
                    string dmcNum = text[0][i];
                    Color  c      = Color.FromArgb(255, r, g, b);
                    if (!Colours.ContainsKey(c))
                    {
                        Colours[c] = (new DMCColour(name, i, c, dmcNum));
                    }
                }
            }
        }
コード例 #2
0
        public DMCColourMap(bool createEmpty)
        {
            Colours = new Dictionary<Color, IColourInfo>();
            if (!createEmpty)
            {
                byte[] bytes = Encoding.ASCII.GetBytes(DMCColours.DmcToRgb);
                MemoryStream stream = new MemoryStream(bytes);
                CSVReader reader = new CSVReader(stream);
                string[][] text = reader.ReadFile();

                for (int i = 0; i < reader.NumberOfRows; i++)
                {
                    int r = parse(text[2][i]);
                    int g = parse(text[3][i]);
                    int b = parse(text[4][i]);
                    string name = text[1][i];
                    string dmcNum = text[0][i];
                    Color c = Color.FromArgb(255, r, g, b);
                    if (!Colours.ContainsKey(c)) Colours[c] = (new DMCColour(name, i, c, dmcNum));
                }
            }
        }