Beispiel #1
0
		private void ExtractAndStartApplication(string updateFilePath, string applicationFilePath)
		{
			var extractor = new ZipFileExtractor(updateFilePath);
			extractor.ExtractTo(Environment.CurrentDirectory);

			Process.Start(applicationFilePath);
		}
Beispiel #2
0
        private void ExtractAndStartApplication(string updateFilePath, string applicationFilePath)
        {
            var extractor = new ZipFileExtractor(updateFilePath);

            extractor.ExtractTo(Environment.CurrentDirectory);

            Process.Start(applicationFilePath);
        }
        public void TestGetFrameworksFromZipFile()
        {
            var             zipFIleExtractor    = new ZipFileExtractor();
            var             csvService          = new CsvService(null);
            var             applicationSettings = new AppServiceSettings();
            LarsDataService larsDataService     = new LarsDataService(applicationSettings, csvService, new HttpService(null), zipFIleExtractor, new AngleSharpService(), null, new HttpService(null));
            var             path = larsDataService.GetListOfCurrentFrameworks();

            Assert.IsTrue(path.Count > 100);
        }
Beispiel #4
0
        private static int Main(string[] args)
        {
            var cmdLineParams = new CmdLineParams();

            try
            {
                using (var parser = new CommandLineParser(cmdLineParams))
                {
                    parser.Parse();
                    if (parser.HasErrors)
                    {
                        Console.WriteLine(parser.UsageInfo.GetErrorsAsString(78));
                        return(-1);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.ToString());
                return(-1);
            }
            try
            {
                if (cmdLineParams.ExtractFile)
                {
                    bool result = ZipFileExtractor.ExtractFilesFromZipFiles(cmdLineParams);
                    if (result)
                    {
                        return(0);
                    }
                    else
                    {
                        return(-1);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error Occured {0}", ex.Message);
            }
            return(0);
        }
Beispiel #5
0
        public void ShouldFailToUnzipStream(string filePath, string fileName, string content)
        {
            ZipFileExtractor zipFileExtractor = new ZipFileExtractor();

            using (var memoryStream = new MemoryStream())
            {
                using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
                {
                    var frameworkFile = archive.CreateEntry(filePath);

                    using (var entryStream = frameworkFile.Open())
                        using (var streamWriter = new StreamWriter(entryStream))
                        {
                            streamWriter.Write(content);
                        }
                }

                var frmeworksString = zipFileExtractor.ExtractFileFromStream(memoryStream, fileName);
                frmeworksString.Should().BeNull();
            }
        }