Person Require People File
This commit is contained in:
		| @ -196,7 +196,7 @@ internal abstract class Person | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
|     internal static Models.Person[] GetPeople(Properties.IStorage storage, int personBirthdayFirstYear, string personBirthdayFormat, string personKeyFormat) | ||||
|     internal static Models.Person[] GetPeople(Properties.IStorage storage, int personBirthdayFirstYear, string personBirthdayFormat, string personKeyFormat, bool personRequirePeopleFile) | ||||
|     { | ||||
|         List<Models.Person> results = new(); | ||||
|         string json; | ||||
| @ -210,18 +210,15 @@ internal abstract class Person | ||||
|         if (!Directory.Exists(peopleSingletonDirectory)) | ||||
|             _ = Directory.CreateDirectory(peopleSingletonDirectory); | ||||
|         if (!Directory.Exists(peopleContentDirectory)) | ||||
|             localKnownPeopleFile = string.Empty; | ||||
|         else | ||||
|         { | ||||
|             files = Directory.GetFiles(peopleContentDirectory, "*People*.txt", SearchOption.TopDirectoryOnly); | ||||
|             if (files.Any()) | ||||
|                 localKnownPeopleFile = files[0]; | ||||
|             else | ||||
|                 localKnownPeopleFile = string.Empty; | ||||
|         } | ||||
|         files = Directory.GetFiles(peopleSingletonDirectory, "*.json", SearchOption.TopDirectoryOnly); | ||||
|         if (!files.Any() && string.IsNullOrEmpty(localKnownPeopleFile)) | ||||
|             _ = Directory.CreateDirectory(peopleContentDirectory); | ||||
|         files = Directory.GetFiles(peopleContentDirectory, "*People*.txt", SearchOption.TopDirectoryOnly); | ||||
|         if (!files.Any() && personRequirePeopleFile) | ||||
|             throw new Exception("Copy \"KnownPeople.txt\" file from server!"); | ||||
|         if (files.Any()) | ||||
|             localKnownPeopleFile = files[0]; | ||||
|         else | ||||
|             localKnownPeopleFile = string.Empty; | ||||
|         files = Directory.GetFiles(peopleSingletonDirectory, "*.json", SearchOption.TopDirectoryOnly); | ||||
|         foreach (string file in files) | ||||
|         { | ||||
|             fileInfo = new(file); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user