static ApplicationInfo() { Applicaition = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); ApplicationData = IOUtility.CombinePath(Environment.SpecialFolder.ApplicationData, Name); CommonApplicationData = IOUtility.CombinePath(Environment.SpecialFolder.CommonApplicationData, Name); Directory = AppDomain.CurrentDomain.BaseDirectory; RunningInMono = Type.GetType(MonoRuntimeType) != null; }
public async Task ExtractContainerAsync(string outputDirecotry, IProgress <double> progress = null, CancellationToken cancellationToken = default) { if (!Directory.Exists(outputDirecotry)) { _ = Directory.CreateDirectory(outputDirecotry); } PackagePartCollection parts = _package.GetParts(); int index = 0; int count = parts.Count(); Progress <double> innerProgress = new Progress <double> { }; innerProgress.ProgressChanged += (o, e) => { double percent = (index + e) / count; progress.Report(percent); }; if (progress == null) { innerProgress = null; } foreach (PackagePart part in parts) { if (cancellationToken.IsCancellationRequested) { cancellationToken.ThrowIfCancellationRequested(); } string name = part.Uri.ToString(); string path = IOUtility.CombinePath(outputDirecotry, name); using FileStream fs = File.OpenWrite(path); await GetAsync(name, fs, innerProgress); index++; } }
protected override void Establish_That() { _specialFolder = Environment.SpecialFolder.ApplicationData; _path = Random.NextString(); _combinedPath = IOUtility.CombinePath(_specialFolder, _path); }
protected override void Because_Of() { _combinedPath = IOUtility.CombinePath(_paths); }
protected override void Because_Of() { _result = IOUtility.CombinePath(_specialFolder, _path); }