/// <summary> /// This method provides a fluid factory for asynchronously storing the structure to the filesystem /// </summary> /// <param name="filename"></param> /// <param name="instance"></param> /// <returns></returns> public static Task <PublicSuffixDatabase> StoreAsync(string filename, PublicSuffix instance) => new PublicSuffixDatabase() .WithCustomTopLevelDomains(instance.CustomTopLevelDomains()) .WithLastRefreshTimeStamp(instance.LastRefresh()) .WithNextRefreshTimeStamp(instance.NextRefresh()) .WithTopLevelDomains(instance.TopLevelDomains()) .WriteToFileAsync(filename);
/// <summary> /// This method instantites and populates the class from an existing external instaance /// then write the file to the filesystem for persistence /// </summary> /// <param name="filename"></param> /// <param name="instance"></param> public PublicSuffixDatabase(string filename, PublicSuffix instance) { // Set the custom top-level domains into the instance CustomTopLevelDomains = instance.CustomTopLevelDomains(); // Set the last refreshed timestamp into the instance LastRefresh = instance.LastRefresh(); // Set the next refresh timestamp into the instance NextRefresh = instance.NextRefresh(); // Set the top-level domains into the instance TopLevelDomains = instance.TopLevelDomains(); // Write the file to the filesystem WriteToFile(filename); }
/// <summary> /// This method provides a fluid factory for storing the structure to the filesystem /// </summary> /// <param name="filename"></param> /// <param name="instance"></param> /// <returns></returns> public static PublicSuffixDatabase Store(string filename, PublicSuffix instance) => new PublicSuffixDatabase(filename, instance);