SenseNet.ContentRepository.Tests.NodeListTests.LoadOrCreateFile C# (CSharp) Метод

LoadOrCreateFile() приватный Метод

private LoadOrCreateFile ( string path ) : File
path string
Результат File
        private File LoadOrCreateFile(string path)
        {
            AccessProvider.ChangeToSystemAccount();
            var file = Node.LoadNode(path) as File;
            AccessProvider.RestoreOriginalUser();
            if (file != null)
                return file;

            var parentPath = RepositoryPath.GetParentPath(path);
            var parentFolder = (Folder)Node.LoadNode(parentPath) ?? LoadOrCreateFolder(parentPath);

            file = new File(parentFolder)
                       {
                           Name = RepositoryPath.GetFileName(path),
                           Binary = TestTools.CreateTestBinary()
                       };
            file.Save();
            AddPathToDelete(path);

            return file;
        }