Esempio n. 1
0
        private static void ReadFromFile()
        {
            if (!File.Exists(filename))
            {
                return;
            }
            foreach (var line in File.ReadAllLines(filename))
            {
                string[] split = line.Split(';');

                DataType type = DataType.File;
                Enum.TryParse(split[2], out type);

                var entry = new EntryInfo()
                {
                    Person = split[0], KeyName = split[1], DataType = type
                };
                entry.Normalize();

                if (!entry.IsEmpty())
                {
                    entries.Add(entry);
                }
            }
        }
Esempio n. 2
0
        private void AppendToFile(EntryInfo ei)
        {
            string dataStr = $"{ei.Person};{ei.KeyName};{ei.DataType}";

            lock (fileLock)
            {
                File.AppendAllLines(filename, new[] { dataStr });
            }
        }