Mono.Terminal.LineEditor.History.History C# (CSharp) Method

History() public method

public History ( string app, int size ) : System
app string
size int
return System
            public History(string app, int size)
            {
                if (size < 1)
                    throw new ArgumentException("size");

                if (app != null)
                {
                    string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                    //Console.WriteLine (dir);
                    if (!Directory.Exists(dir))
                    {
                        try
                        {
                            Directory.CreateDirectory(dir);
                        }
                        catch
                        {
                            app = null;
                        }
                    }
                    if (app != null)
                        histfile = Path.Combine(dir, app) + ".history";
                }

                history = new string[size];
                head = tail = cursor = 0;

                if (File.Exists(histfile))
                {
                    using (StreamReader sr = File.OpenText(histfile))
                    {
                        string line;

                        while ((line = sr.ReadLine()) != null)
                        {
                            if (line != "")
                                Append(line);
                        }
                    }
                }
            }