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);
}
}
}
}