-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bf7b19
commit 604985c
Showing
3 changed files
with
60 additions
and
153 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.IO; | ||
using Platform.IO; | ||
using Platform.Data.Doublets.Memory.United.Generic; | ||
|
||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member | ||
|
||
namespace Platform.Data.Doublets.Xml | ||
{ | ||
public class XmlExporterCLI : ICommandLineInterface | ||
{ | ||
public void Run(params string[] args) | ||
{ | ||
var linksFile = ConsoleHelpers.GetOrReadArgument(0, "Links file", args); | ||
var exportFile = ConsoleHelpers.GetOrReadArgument(1, "Xml file", args); | ||
|
||
if (File.Exists(exportFile)) | ||
{ | ||
Console.WriteLine("Entered xml file does already exists."); | ||
} | ||
else | ||
{ | ||
using (var cancellation = new ConsoleCancellation()) | ||
{ | ||
using (var memoryAdapter = new UnitedMemoryLinks<uint>(linksFile)) | ||
{ | ||
{ | ||
Console.WriteLine("Press CTRL+C to stop."); | ||
var links = memoryAdapter.DecorateWithAutomaticUniquenessAndUsagesResolution(); | ||
if (cancellation.NotRequested) | ||
{ | ||
var storage = new DefaultXmlStorage<uint>(links); | ||
var exporter = new XmlExporter<uint>(storage); | ||
exporter.Export(linksFile, exportFile, cancellation.Token).Wait(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |