Beispiel #1
0
 /// <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);
Beispiel #2
0
 /// <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);
 }
Beispiel #3
0
 /// <summary>
 /// This method searches the custom top-level domains
 /// </summary>
 /// <param name="source"></param>
 /// <param name="isValid"></param>
 /// <param name="topLevelDomain"></param>
 /// <param name="domain"></param>
 private static void searchCustomTopLevelDomains(string source, out bool isValid, out string topLevelDomain,
                                                 out string domain) =>
 processSearchResults(source, _publicSuffixDatabase.CustomTopLevelDomains(), out isValid, out topLevelDomain,
                      out domain);