コード例 #1
0
ファイル: Startup.cs プロジェクト: Artsdatabanken/ogapi
        private GraphInput GetGraphInput()
        {
            var ninMemApiData = Configuration["NinMemApiData"];

            IStorage storage;

            if (ninMemApiData.StartsWith("http"))
            {
                storage = new WebStorage(ninMemApiData);
            }
            else
            {
                storage = new LocalStorage(ninMemApiData);
            }

            var graphInputGetter = new GraphInputGetter(storage);

            return(graphInputGetter.Get().GetAwaiter().GetResult());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: daywee/RwsMoraviaHomework
        static async Task Main(string[] args)
        {
            // Initialize dependencies.
            var jsonSerializer = new JsonDocumentSerializer();
            var xmlSerializer  = new XmlDocumentSerializer();
            var converter      = new ConverterBase <Document>(new ISerializer <Document>[] { jsonSerializer, xmlSerializer, });

            var webStorage        = new WebStorage();
            var fileSystemStorage = new FileSystemStorage();
            var storageProvider   = new StorageProvider.Storage.StorageProvider(new IStorage[] { webStorage, fileSystemStorage, });

            var app = new Application(converter, storageProvider);

            // Run application.
            var fromUri = new Uri("https://gist.githubusercontent.com/daywee/155b9145f00967cffac2933869614d6c/raw/835a0feef86d671077a210b92e11f318abd0acb5/rwsDocument.json");

            string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var    toUri         = new Uri(Path.Combine(documentsPath, "rwsHomework.xml"));

            await app.Convert(fromUri, toUri);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: wincubate/police
        static void Main(string[] args)
        {
            //string sourceFilePath = @"..\..\..\..\Files\StockPositions1.csv";
            //string sourceFilePath = @"..\..\..\..\Files\StockPositions2.json";
            //string sourceFilePath = @"http://solid.wincubate.net/stockpositions.json";
            //string destinationFilePath = @"..\..\..\..\Files\Result.csv";
            //string destinationFilePath = @"..\..\..\..\Files\Result.json";
            //_writeStorage = new FileStorage( @"..\..\..\..\Files\StockPositions1.csv",@"..\..\..\..\Files\Result.json" );
            //_storage = new FileStorage();
            //_parser = new Parser();
            //_serializer = new CsvSerializer();

            IReadStorage  readStorage  = new WebStorage(@"http://solid.wincubate.net/stockpositions.json");
            IWriteStorage writeStorage = new ConsoleStorage();
            Parser        parser       = new JsonParser();
            ISerializer   serializer   = new JsonSerializer();

            StockAnalyzer analyzer = new StockAnalyzer(
                readStorage, writeStorage, parser, serializer
                );

            analyzer.Process();
        }