private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { source.Dispose(); } disposedValue = true; } }
/// <summary> /// Stops the data transport and disposes of the transport instance. /// </summary> /// <returns>true, if the operation was successful</returns> public bool StopTransport() { if (Interlocked.CompareExchange(ref _isTransportRunning, 0, 1) != 1) { return(false); } _transport.Dispose(); _transport = null; return(true); }
static void Main(string[] args) { var r = Parser.Default.ParseArguments <Compare2XmlFileCommandLineOptions>(args).MapResult( (Compare2XmlFileCommandLineOptions options) => { var diffCounter = 0; Console.WriteLine($"ReferenceXmlFile: {options.ReferenceXmlFile}"); Console.WriteLine($"XmlTextFile: {options.XmlTextFile}"); ISource refFile = Input.FromFile(options.ReferenceXmlFile).Build(); ISource testFile = Input.FromFile(options.XmlTextFile).Build(); IDifferenceEngine diff = new DOMDifferenceEngine(); diff.DifferenceListener += (comparison, outcome) => { Console.WriteLine($"Found a difference: {comparison}"); diffCounter += 1; }; diff.Compare(refFile, testFile); if (diffCounter == 0) { Console.WriteLine($"Identical {Environment.NewLine}"); } refFile.Dispose(); testFile.Dispose(); //if (diffCounter > 0) //{ // try // { // System.IO.File.Delete(options.XmlTextFile); // ystem.IO.File.Copy(options.ReferenceXmlFile, options.XmlTextFile); // Console.WriteLine("File overwritten {options.XmlTextFile}"); // } // catch(System.Exception ex) // { // Console.WriteLine($"Error {ex.Message}"); // } //} Console.WriteLine("Hit space"); Console.ReadKey(); return(diffCounter == 0 ? 0 : 1); }, errs => 123 ); Environment.Exit(r); }
public override void DisposeClient(ISource source) { source.Dispose(); }
private void CloseCommanddb() // пока не реализованно { source.Dispose(); }
public void DeleteSource(ISource source) { _sources.Remove(source); source.Dispose(); }