コード例 #1
0
        /// <summary>
        /// Download file
        /// </summary>
        /// <param name="sourceFile"></param>
        /// <param name="destinationFile"></param>
        /// <returns></returns>
        public async Task DownloadFileAync(Uri sourceFile, string destinationFile)
        {
            DirectoryHelpers.DirectoryCreateIfNotExist(Path.GetDirectoryName(destinationFile));

            using (var webClient = new WebClient())
            {
                try
                {
                    await webClient.DownloadFileTaskAsync(sourceFile, destinationFile);

                    _log.LogTrace($"Finished download of source file {sourceFile} {destinationFile}.");
                }
                catch (Exception exp)
                {
                    _log.LogError($"Download of source file failed {sourceFile} failed.", exp);

                    if (File.Exists(destinationFile))
                    {
                        File.Delete(destinationFile);
                    }

                    throw;
                }
            }
        }
コード例 #2
0
    protected void UpdateImage()
    {
        // clear output directory
        DirectoryHelpers.ClearDirectory(Output);

        int      caseCount = 0;
        int      layerCount = 0;
        double   weightLoad = 0.0, weightTotal = 0.0;
        Vector3D bbLoad   = Vector3D.Zero;
        Vector3D bbTotal  = Vector3D.Zero;
        string   fileGuid = Guid.NewGuid().ToString() + ".glb";

        PalletStacking.GenerateExport(
            DimCase, WeightCase, BitmapTexture,
            DimPallet, WeightPallet,
            MaxPalletHeight,
            BoxPositions,
            ChkbMirrorLength.Checked, ChkbMirrorWidth.Checked,
            ChkbInterlayerBottom.Checked, ChkbInterlayersIntermediate.Checked, ChkbInterlayerTop.Checked,
            Path.Combine(Output, fileGuid),
            ref caseCount, ref layerCount,
            ref weightLoad, ref weightTotal,
            ref bbLoad, ref bbTotal
            );

        XModelDiv.InnerHtml = string.Format("<x-model class=\"x-model\" src=\"./Output/{0}\"/>", fileGuid);

        loadedPallet.Update();
    }
コード例 #3
0
 protected override void OnBegin(StartArgs arg)
 {
     _type = arg.Type;
     _name = arg.Name;
     //Creating scripts folder for test code.
     _testScriptsPath = DirectoryHelpers.CreateOrGetFolderPath(_sharedSettings.ProjectTestRootPath + "/" + _name, "Scripts");
 }
コード例 #4
0
        public IActionResult Index()
        {
            DirectoryEntry    de = new DirectoryEntry("LDAP://DC=skyrr,DC=local");
            DirectorySearcher ds = new DirectorySearcher(de);

            //ds.Filter = "(&(objectCategory=Person)(!(UserAccountControl:1.2.840.113556.1.4.803:=2))(|(manager=*)(directreports=*)))";
            ds.Filter = "(&(objectCategory=Person)(!(UserAccountControl:1.2.840.113556.1.4.803:=2))(&(!(manager=*))(directreports=*)))";

            var dsResults = ds.FindAll();

            var users = new List <UserViewModel>();

            foreach (SearchResult sr in dsResults)
            {
                ResultPropertyCollection      userProps = sr.Properties;
                ResultPropertyValueCollection resultPropertyValueCollection = userProps["mail"];
                var user = new UserViewModel(
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "displayname"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "mail"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "telephonenumber"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "mobile"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "title"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "department"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "company"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "physicaldeliveryofficename"),
                    DirectoryHelpers.GetSingleStringPropertyCollectionValue(userProps, "description"),
                    null,
                    ""
                    );

                users.Add(user);
            }

            return(View(users));
        }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // clear output directory
            DirectoryHelpers.ClearDirectory(Output);

            try
            {
                string filePath = Server.MapPath(@"~\Images\Texture.png");
                if (File.Exists(filePath))
                {
                    BitmapTexture = new Bitmap(filePath);
                }
            }
            catch (Exception ex)
            {
                string message = ex.ToString();
            }
            DimCaseCtrl         = DimCase;
            WeightCaseCtrl      = WeightCase;
            DimPalletCtrl       = DimPallet;
            WeightPalletCtrl    = WeightPallet;
            MaxPalletHeightCtrl = MaxPalletHeight;

            BTRefresh_Click(null, null);
        }
        ExecuteKeyPad();
    }
コード例 #6
0
        /// <summary>
        /// Gets the checksum of the manifest for the specified module.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <returns>The checksum.</returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Will be thrown if the <see cref="EModule"/> passed to the function is not a valid value.
        /// </exception>
        protected virtual string GetRemoteModuleManifestChecksum(EModule module)
        {
            string checksum;

            switch (module)
            {
            case EModule.Launcher:
            case EModule.Game:
            {
                checksum = ReadRemoteFile(DirectoryHelpers.FixURL(this.FileManifestHandler.GetManifestChecksumURL((EManifestType)module))).RemoveLineSeparatorsAndNulls();
                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException
                      (
                          nameof(module),
                          module,
                          "An invalid module value was passed to GetRemoteModuleManifestChecksum."
                      );
            }
            }

            return(checksum.RemoveLineSeparatorsAndNulls());
        }
コード例 #7
0
        private void DisplayInitialStartupDialog()
        {
            Log.Info("This instance is the first start of the application in this folder.");

            var text = LocalizationCatalog.GetString
                       (
                "This appears to be the first time you're starting the launcher.\n" +
                "Is this the location where you would like to install the game?"
                       ) + $"\n\n{DirectoryHelpers.GetLocalLauncherDirectory()}";

            using (var shouldInstallHereDialog = new MessageDialog
                                                 (
                       this,
                       DialogFlags.Modal,
                       MessageType.Question,
                       ButtonsType.OkCancel,
                       text
                                                 ))
            {
                if (shouldInstallHereDialog.Run() == (int)ResponseType.Ok)
                {
                    // Yes, install here
                    Log.Info("User accepted installation in this directory. Installing in current directory.");

                    this.TagfileService.CreateLauncherTagfile();
                }
                else
                {
                    // No, don't install here
                    Log.Info("User declined installation in this directory. Exiting...");
                    Environment.Exit(2);
                }
            }
        }
コード例 #8
0
ファイル: ImageServices.cs プロジェクト: Stefoajc/RealEstate
        public void SaveToFileSystem(List <ImageFileSystemDTO> images, bool isForSlider)
        {
            var physicalDirPath = Path.GetDirectoryName(Path.Combine(HttpRuntime.AppDomainAppPath.TrimEnd('\\'), images[0].ImageRelPath.TrimStart('\\')));

            DirectoryHelpers.CreateDirectory(physicalDirPath);

            foreach (var image in images)
            {
                var physicalImagePath =
                    Path.Combine(HttpRuntime.AppDomainAppPath.TrimEnd('\\'), image.ImageRelPath.TrimStart('\\'));
                using (Image img = Image.FromStream(image.ImageFile.InputStream))
                {
                    //Resize image for usage in the site
                    var width  = isForSlider ? 2200 : 870;
                    var height = isForSlider ? 800 : 580;

                    //SaveOriginal Image
                    ImageHelpers.SaveOriginal(img, physicalImagePath);
                    //Save image in webP format
                    ImageHelpers.SaveAsWebP(img, physicalImagePath, width, height);
                    //Resize the image and Save It
                    ImageHelpers.SaveToFileSystem(img, physicalImagePath, height, width, ImageFormat.Jpeg);
                }
            }
        }
コード例 #9
0
        public override void Execute(IEnumerable <IManga> mangas)
        {
            var list     = mangas.ToList();
            var isSingle = list.Count == 1;
            var text     = isSingle ? string.Format("Удалить мангу {0}?", list[0].Name) :
                           ("Удалить мангу?" + Environment.NewLine + string.Join(Environment.NewLine, list.Select(l => $" - {l}")));

            var dialogResult = Dialogs.ShowYesNoDialog("Удаление манги", text,
                                                       "Манга и история её обновлений будет удалена.", isSingle ? $"Удалить папку {list[0].Folder}" : "Удалить связанные папки");

            if (dialogResult.Item1)
            {
                Library.ThreadAction(() =>
                {
                    foreach (var manga in list)
                    {
                        Library.Remove(manga);

                        if (dialogResult.Item2)
                        {
                            DirectoryHelpers.DeleteDirectory(manga.GetAbsoulteFolderPath());
                        }
                    }
                }).LogException();
            }
        }
コード例 #10
0
        public override CompileResult Compile(string compilerPath, string inputDirectory, string additionalArguments)
        {
            if (compilerPath == null)
            {
                throw new ArgumentNullException(nameof(compilerPath));
            }

            if (inputDirectory == null)
            {
                throw new ArgumentNullException(nameof(inputDirectory));
            }

            if (!File.Exists(compilerPath))
            {
                return(new CompileResult(false, $"Compiler not found! Searched in: {compilerPath}"));
            }

            if (!Directory.Exists(inputDirectory))
            {
                return(new CompileResult(false, $"Input directory not found! Searched in: {inputDirectory}"));
            }

            this.CompilationDirectory = $"{inputDirectory}\\{CompilationDirectoryName}";

            if (Directory.Exists(this.CompilationDirectory))
            {
                DirectoryHelpers.SafeDeleteDirectory(this.CompilationDirectory, true);
            }

            Directory.CreateDirectory(this.CompilationDirectory);

            // Build compiler arguments
            var outputDirectory = this.CompilationDirectory;
            var arguments       = this.BuildCompilerArguments(inputDirectory, outputDirectory, additionalArguments);

            // Find compiler directory
            var directoryInfo = new FileInfo(compilerPath).Directory;

            if (directoryInfo == null)
            {
                return(new CompileResult(false, $"Compiler directory is null. Compiler path value: {compilerPath}"));
            }

            // Prepare process start information
            var processStartInfo = this.SetCompilerProcessStartInfo(compilerPath, directoryInfo, arguments);
            var compilerOutput   = ExecuteCompiler(processStartInfo, this.MaxProcessExitTimeOutInMilliseconds);

            outputDirectory = this.ChangeOutputFileAfterCompilation(outputDirectory);
            if (!compilerOutput.IsSuccessful)
            {
                return(new CompileResult(false, $"Compiled file is missing. Compiler output: {compilerOutput.Output}"));
            }

            if (!string.IsNullOrWhiteSpace(compilerOutput.Output))
            {
                return(new CompileResult(true, compilerOutput.Output, outputDirectory));
            }

            return(new CompileResult(outputDirectory));
        }
        protected override DisassembleResult DisassembleFile(string compiledFilePath)
        {
            var compiledFilesToDisassemble =
                Directory.GetFiles(this.workingDirectory, JavaCompiledFilesSearchPattern, SearchOption.AllDirectories);

            var result = new DisassembleResult(compiledFilesToDisassemble.Length > 0);

            var disassembledCode = new StringBuilder();

            foreach (var compiledFile in compiledFilesToDisassemble)
            {
                var currentDisassembleResult =
                    this.Disassembler.Disassemble(compiledFile, this.DisassemblerAdditionalArguments);
                if (!currentDisassembleResult.IsDisassembledSuccessfully)
                {
                    result.IsDisassembledSuccessfully = false;
                    break;
                }

                disassembledCode.AppendLine(currentDisassembleResult.DisassembledCode);
            }

            if (result.IsDisassembledSuccessfully)
            {
                result.DisassembledCode = disassembledCode.ToString();
            }

            DirectoryHelpers.SafeDeleteDirectory(this.workingDirectory, true);

            return(result);
        }
コード例 #12
0
        public IExecutionResult <TResult> SafeExecute <TInput, TResult>(IExecutionContext <TInput> executionContext)
            where TResult : ISingleCodeRunResult, new()
        {
            this.WorkingDirectory = DirectoryHelpers.CreateTempDirectoryForExecutionStrategy();

            try
            {
                return(this.Execute <TInput, TResult>(executionContext));
            }
            finally
            {
                Task.Run(() =>
                {
                    try
                    {
                        // TODO
                        DirectoryHelpers.SafeDeleteDirectory(this.WorkingDirectory, true);
                    }
                    catch (Exception ex)
                    {
                        this.logger.Error("executionStrategy.SafeDeleteDirectory has thrown an exception:", ex);
                    }
                });
            }
        }
コード例 #13
0
        protected void RemovePropertySourceAnnotationsFromMainClass(string submissionFilePath)
        {
            string extractionDirectory = DirectoryHelpers.CreateTempDirectoryForExecutionStrategy();

            string mainClassFilePath = FileHelpers.ExtractFileFromZip(
                submissionFilePath,
                this.MainClassFileName,
                extractionDirectory);

            string mainClassContent = File.ReadAllText(mainClassFilePath);

            Regex propertySourceMatcher = new Regex(PropertySourcePattern);

            while (propertySourceMatcher.IsMatch(mainClassContent))
            {
                mainClassContent = Regex.Replace(mainClassContent, PropertySourcePattern, string.Empty);
            }

            File.WriteAllText(mainClassFilePath, mainClassContent);
            string pomXmlFolderPathInZip = Path
                                           .GetDirectoryName(FileHelpers
                                                             .GetFilePathsFromZip(submissionFilePath)
                                                             .FirstOrDefault(f => f.EndsWith(this.MainClassFileName)));

            FileHelpers.AddFilesToZipArchive(submissionFilePath, pomXmlFolderPathInZip, mainClassFilePath);
            DirectoryHelpers.SafeDeleteDirectory(extractionDirectory, true);
        }
コード例 #14
0
        public async Task DownloadReadmanga()
        {
            var rm = Mangas.CreateFromWeb(new Uri(@"http://readmanga.me/black_butler_anthology_comic_dj____rainbow_butler"));
            var sw = new Stopwatch();

            sw.Start();
            rm.PropertyChanged += RmOnDownloadChanged;
            DirectoryHelpers.DeleteDirectory(rm.GetAbsoulteFolderPath());
            await rm.Download();

            sw.Stop();
            Log.Add($"manga loaded {sw.Elapsed.TotalSeconds}, iscompleted = {rm.IsDownloaded}, lastpercent = {lastPercent}");
            Assert.IsTrue(Directory.Exists(rm.GetAbsoulteFolderPath()));
            var files = Directory.GetFiles(rm.GetAbsoulteFolderPath(), "*", SearchOption.AllDirectories);

            Assert.AreEqual(212, files.Length);
            var fileInfos = files.Select(f => new FileInfo(f)).ToList();

            Assert.AreEqual(67470935, fileInfos.Sum(f => f.Length));

            // Количество повторяющихся картинок на мангу - не больше одной на главу.
            Assert.IsTrue(rm.Volumes.Sum(v => v.Container.Count()) >= fileInfos.GroupBy(f => f.Length).Max(g => g.Count()));
            Assert.IsTrue(rm.IsDownloaded);
            Assert.AreEqual(100, lastPercent);
        }
コード例 #15
0
        public void SafeDeleteDirectory_Recursive_ShouldSafeDeleteExistingNonEmptyDirectoryWithSubDirectoriesOnly()
        {
            Smock.Run(context =>
            {
                // Arrange
                const string DirPath = @"C:\existing-dir";
                const bool Recursive = true;

                var fileSystem = new MockFileSystem();
                fileSystem.AddDirectory(DirPath);
                fileSystem.AddDirectory(Path.Combine(DirPath, "sub-directory-1"));
                fileSystem.AddDirectory(Path.Combine(DirPath, "sub-directory-2"));

                var directoriesCountBeforeDelete = fileSystem.AllDirectories.Count();

                SetupFileSystemMocks(context, fileSystem);

                // Act
                DirectoryHelpers.SafeDeleteDirectory(DirPath, recursive: Recursive);

                // Assert
                Assert.False(fileSystem.Directory.Exists(DirPath));
                Assert.Equal(directoriesCountBeforeDelete - 3, fileSystem.AllDirectories.Count());
            });
        }
コード例 #16
0
        public void SafeDeleteDirectory_NonRecursive_ShouldThrowOnExistingNonEmptyDirectoryWithFilesOnly()
        {
            Smock.Run(context =>
            {
                // Arrange
                const string DirPath = @"C:\existing-dir";
                const bool Recursive = false;

                var fileSystem = new MockFileSystem();
                fileSystem.AddDirectory(DirPath);
                fileSystem.AddFile(Path.Combine(DirPath, "text-file.txt"), new MockFileData("Text content"));
                fileSystem.AddFile(
                    Path.Combine(DirPath, "binary-file.txt"),
                    new MockFileData(new byte[] { 0x22, 0x51, 0x32, 0x00 }));

                var filesCountBeforeDelete = fileSystem.AllFiles.Count();

                SetupFileSystemMocks(context, fileSystem);

                // Act and Assert (cannot Assert.Throws() because it doesn't work with Smocks)
                try
                {
                    DirectoryHelpers.SafeDeleteDirectory(DirPath, recursive: Recursive);
                }
                catch (IOException)
                {
                    Assert.True(fileSystem.Directory.Exists(DirPath));
                    Assert.Equal(filesCountBeforeDelete, fileSystem.AllFiles.Count());
                }
            });
        }
コード例 #17
0
        public void SafeDeleteDirectory_Recursive_ShouldSafeDeleteExistingNonEmptyDirectoryWithFilesOnly()
        {
            Smock.Run(context =>
            {
                // Arrange
                const string DirPath = @"C:\existing-dir";
                const bool Recursive = true;

                var fileSystem = new MockFileSystem();
                fileSystem.AddDirectory(DirPath);
                fileSystem.AddFile(Path.Combine(DirPath, "text-file.txt"), new MockFileData("Text content"));
                fileSystem.AddFile(
                    Path.Combine(DirPath, "binary-file.txt"),
                    new MockFileData(new byte[] { 0x22, 0x51, 0x32, 0x00 }));

                SetupFileSystemMocks(context, fileSystem);

                // Act
                DirectoryHelpers.SafeDeleteDirectory(DirPath, recursive: Recursive);

                // Assert
                Assert.False(fileSystem.Directory.Exists(DirPath));
                Assert.False(fileSystem.AllFiles.Any());
            });
        }
コード例 #18
0
        public void SafeDeleteDirectory_NonRecursive_ShouldThrowOnExistingNonEmptyDirectoryWithSubDirectoriesOnly()
        {
            Smock.Run(context =>
            {
                // Arrange
                const string DirPath = @"C:\existing-dir";
                const bool Recursive = false;

                var fileSystem = new MockFileSystem();
                fileSystem.AddDirectory(DirPath);
                fileSystem.AddDirectory(Path.Combine(DirPath, "sub-directory-1"));
                fileSystem.AddDirectory(Path.Combine(DirPath, "sub-directory-2"));

                var directoriesCountBeforeDelete = fileSystem.AllDirectories.Count();

                SetupFileSystemMocks(context, fileSystem);

                // Act and Assert (cannot Assert.Throws() because it doesn't work with Smocks)
                try
                {
                    DirectoryHelpers.SafeDeleteDirectory(DirPath, recursive: Recursive);
                }
                catch (IOException)
                {
                    Assert.True(fileSystem.Directory.Exists(DirPath));
                    Assert.Equal(directoriesCountBeforeDelete, fileSystem.AllDirectories.Count());
                }
            });
        }
コード例 #19
0
ファイル: Volume.cs プロジェクト: meteorsnows/MangaReader
        public override Task Download(string mangaFolder = null)
        {
            if (!DirectoryHelpers.ValidateSettingPath(mangaFolder))
            {
                throw new DirectoryNotFoundException($"Попытка скачивания в папку {mangaFolder}, папка не существует.");
            }
            var volumeFolder = Path.Combine(mangaFolder, DirectoryHelpers.RemoveInvalidCharsFromName(this.Folder));

            if (!Directory.Exists(volumeFolder))
            {
                Directory.CreateDirectory(volumeFolder);
            }

            this.InDownloading = this.Container.ToList();
            if (this.OnlyUpdate)
            {
                this.InDownloading = History.GetItemsWithoutHistory(this);
            }

            var tasks = this.InDownloading.Select(c =>
            {
                c.OnlyUpdate = this.OnlyUpdate;
                return(c.Download(volumeFolder));
            });

            return(Task.WhenAll(tasks));
        }
コード例 #20
0
        /// <summary>
        /// Verifies the integrity of the file in the manifest entry.
        /// </summary>
        /// <param name="entry">The manifest entry to test.</param>
        /// <returns><c>true</c>, if file was complete and undamaged, <c>false</c> otherwise.</returns>
        public static bool IsFileIntegrityIntact(this ManifestEntry entry)
        {
            var localPath = $"{DirectoryHelpers.GetLocalGameDirectory()}{entry.RelativePath}";

            if (!File.Exists(localPath))
            {
                return(false);
            }

            var fileInfo = new FileInfo(localPath);

            if (fileInfo.Length != entry.Size)
            {
                return(false);
            }

            using (Stream file = File.OpenRead(localPath))
            {
                string localHash = MD5Handler.GetStreamHash(file);
                if (localHash != entry.Hash)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #21
0
        public async Task ShouldDownloadBigFileFromAzure()
        {
            var path = DirectoryHelpers.GetNewTestFolder()[0];

            var settings = new StorageSettings {
                ConnectionString = Constants.ConnectionString
            };
            var progress = new Progress <StorageProgressDto>();

            var azureStorageClient = AzureStorageClientBuilder.Build(settings);
            await azureStorageClient.DownloadDirectoryAsync(path, Constants.AzureFileShareWithBigFile, progress);

            var fileEntries = Directory.GetFileSystemEntries(path, "*.*", SearchOption.AllDirectories);
            var directories = fileEntries
                              .Where(fileEntry => File.GetAttributes(fileEntry).HasFlag(FileAttributes.Directory)).ToList();
            var files = fileEntries.Except(directories).ToList();

            Assert.AreEqual(1, fileEntries.Length);
            Assert.AreEqual(0, directories.Count);
            Assert.AreEqual(1, files.Count);

            var fileInfo = new FileInfo(files[0]);

            Assert.AreEqual(52428800, fileInfo.Length);
            Assert.AreEqual("bigFile.dat", fileInfo.Name);
        }
コード例 #22
0
        public void CheckNotAllowedSettingFolders([Values(
                                                       "test"
                                                       , @"manga\manga.name"
                                                       , @"root\..\sub"
                                                       , @"root\..\"
                                                       , @"root\.."
                                                       , @".\..\"
                                                       , @".\.."
                                                       , @".\"
                                                       , @".\..\some.folder"
                                                       )]
                                                  string name, [Values(
                                                                    true
                                                                    , true
                                                                    , true
                                                                    , false
                                                                    , false
                                                                    , false
                                                                    , false
                                                                    , false
                                                                    , true
                                                                    )]
                                                  bool allowed)
        {
            var path = Path.Combine(TestContext.CurrentContext.TestDirectory, name);

            Directory.CreateDirectory(path);
            Assert.AreEqual(allowed, DirectoryHelpers.ValidateSettingPath(path));
        }
コード例 #23
0
        public void CopyToWithNullDirectory()
        {
            // Setup
            var source = new TestDirectory(_fileSystem, @"\Root\Directory\Sub1");

            // Execute
            DirectoryHelpers.CopyTo(a_this: source, a_destination: null);
        }
コード例 #24
0
        /// <inheritdoc />
        public override bool CanProvideBanner()
        {
            var bannerURL = $"{this.Configuration.RemoteAddress}/launcher/banner.png";

            bannerURL = DirectoryHelpers.FixURL(bannerURL);

            return(DoesRemoteFileExist(bannerURL));
        }
コード例 #25
0
        /// <inheritdoc />
        public override bool IsPlatformAvailable(ESystemTarget platform)
        {
            var remote = $"{this.Configuration.RemoteAddress}/game/{platform}/.provides";

            remote = DirectoryHelpers.FixURL(remote);

            return(DoesRemoteFileExist(remote));
        }
コード例 #26
0
        public void CopyToWithNullThis()
        {
            // Setup
            var dest = new TestDirectory(_fileSystem, @"\Root\Directory\SubA");

            // Execute
            DirectoryHelpers.CopyTo(a_this: null, a_destination: dest);
        }
コード例 #27
0
ファイル: ConfigHandler.cs プロジェクト: zzanggu/Launchpad
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigHandler"/> class and initalizes it.
        /// </summary>
        private ConfigHandler()
        {
            this.Configuration = new ConfigurationBuilder <ILaunchpadConfiguration>()
                                 .UseIniFile(DirectoryHelpers.GetConfigPath())
                                 .Build();

            InitializeConfigurationFile();
        }
コード例 #28
0
        public void SafeDeleteDirectory_ShouldNotThrowOnNonExistingDirectory()
        {
            var path            = DirectoryHelpers.CreateTempDirectory();
            var nonExistingPath = $"{path}000";

            Assert.False(Directory.Exists(nonExistingPath));
            DirectoryHelpers.SafeDeleteDirectory(nonExistingPath);
        }
コード例 #29
0
        public void SafeDeleteDirectory_ShouldSafeDeleteExistingDirectory()
        {
            var path = DirectoryHelpers.CreateTempDirectory();

            Assert.True(Directory.Exists(path));
            DirectoryHelpers.SafeDeleteDirectory(path);
            Assert.False(Directory.Exists(path));
        }
コード例 #30
0
        public static void CreateFileInPackage(string filePath, string content)
        {
            var directoryPath = DirectoryHelpers.CreateDirectoryForFile(filePath);

            CreateInitFile(directoryPath);

            FileHelpers.WriteAllText(filePath, content);
        }