This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using System.IO; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Security.AccessControl; | |
IPAddress GetMyExternalIpAddress() { | |
var dnsQuery = new ProcessStartInfo("nslookup", "myip.opendns.com. resolver1.opendns.com") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instances of this class are not thread-safe | |
// E.g. only one thread can safely call Save and DisposeAsync | |
// | |
interface IAsyncSaveService { | |
// this function schedules save operation to be performed | |
// implementers of this interface must ensure, that only one save operation can run at the same time | |
// saveOperation is considered completed when the task it returned is completed | |
void Save(Func<Task> saveOperation); | |
// after a call to this function no calls to Save are allowed and must throw ObjectDisposedException | |
// this function can be called any number of times |
NewerOlder