当前位置: 首页>>代码示例>>C#>>正文


C# Folder.Save方法代码示例

本文整理汇总了C#中Folder.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Folder.Save方法的具体用法?C# Folder.Save怎么用?C# Folder.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateChildFolder

 public FolderId CreateChildFolder(IFolderDataBase folderData, FolderId parentFolderId)
 {
     Folder folder = new Folder(CurrentExchangeService);
     folder.DisplayName = folderData.DisplayName;
     folder.FolderClass = folderData.FolderType;
     folder.Save(parentFolderId);
     return FindFolder(folderData, parentFolderId);
 }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:8,代码来源:FolderOperatorImpl.cs

示例2: AddFolder

        /// <summary>
        /// Method is creating new folder under specified root folder.
        /// </summary>
        /// <param name="folderName">Name of the folder to create.</param>
        /// <param name="folderRoot">Root folder under which new folder will be created.</param>
        internal void AddFolder(string folderName, Folder folderRoot)
        {
            ExchangeService ewsSession = this.GetSessionVariable();

            Folder folder = new Folder(ewsSession);
            folder.DisplayName = folderName;
            folder.FolderClass = "IPF.Note";
            folder.Save(folderRoot.Id);
        }
开发者ID:IvanFranjic,项目名称:XEws,代码行数:14,代码来源:XEwsFolderCmdlet.cs

示例3: AddFolder

        public Folder AddFolder(string name, string rootId = null)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Invalid parameter", "name");

            var f = new Folder()
            {
                Name = name,
                Root = Folder.GetRoot(rootId)
            };

            f.Save();

            return f;
        }
开发者ID:b1thunt3r,项目名称:BitForm,代码行数:15,代码来源:BitFormFactory.cs

示例4: CrossDomain_RenameSubtree

        public void CrossDomain_RenameSubtree()
        {
            DistributedApplication.ClusterChannel.Purge();

            var fileContent = "File text";

            var folder = new Folder(TestRoot);
            folder.Save();
            var folderId = folder.Id;
            var folderPath = folder.Path;
            var folderName = folder.Name;

            var file = new File(folder);
            file.Binary.SetStream(Tools.GetStreamFromString(fileContent));
            file.Save();
            var fileId = file.Id;
            var filePath = file.Path;
            var fileName = file.Name;

            var foldersAfterCreate = AllEngine_LoadNode(folderPath);
            var filesAfterCreate = AllEngine_LoadNode(filePath);
            var cacheKeysAfterCreate = AllEngine_GetCacheKeys();

            folder = Node.Load<Folder>(folderId);
            folder.Name = "Renamed";
            folder.Save();
            var newFolderPath = RepositoryPath.Combine(TestRoot.Path, folder.Name);
            var newFilePath = RepositoryPath.Combine(newFolderPath, file.Name);

            var foldersAfterRenameOld = AllEngine_LoadNode(folderPath);
            var filesAfterRenameOld = AllEngine_LoadNode(filePath);
            var foldersAfterRenameNew = AllEngine_LoadNode(newFolderPath);
            var filesAfterRenameNew = AllEngine_LoadNode(newFilePath);
            var cacheKeysAfterRename = AllEngine_GetCacheKeys();
            var filecontents = AllEngine_GetFileContents(newFilePath);

            Node.ForceDelete(folderId);

            var foldersAfterDeleteOld = AllEngine_LoadNode(folderPath);
            var filesAfterDeleteOld = AllEngine_LoadNode(filePath);
            var foldersAfterDeleteNew = AllEngine_LoadNode(folderPath);
            var filesAfterDeleteNew = AllEngine_LoadNode(filePath);
            var cacheKeysAfterDelete = AllEngine_GetCacheKeys();

            DistributedApplication.ClusterChannel.Purge();

            Assert.IsTrue(foldersAfterCreate.Distinct().Count() == 1, "#equality1 foldersAfterCreate");
            Assert.IsTrue(foldersAfterCreate.Distinct().First() == folderId, "#value1 foldersAfterCreate");
            Assert.IsTrue(filesAfterCreate.Distinct().Count() == 1, "#equality2 filesAfterCreate");
            Assert.IsTrue(filesAfterCreate.Distinct().First() == fileId, "#value2 filesAfterCreate");

            Assert.IsTrue(foldersAfterRenameOld.Distinct().Count() == 1, "#equality3 foldersAfterRenameOld");
            Assert.IsTrue(foldersAfterRenameOld.Distinct().First() == 0, "#value3 foldersAfterRenameOld");
            Assert.IsTrue(filesAfterRenameOld.Distinct().Count() == 1, "#equality4 filesAfterRenameOld");
            Assert.IsTrue(filesAfterRenameOld.Distinct().First() == 0, "#value4 filesAfterRenameOld");
            Assert.IsTrue(foldersAfterRenameNew.Distinct().Count() == 1, "#equality5 foldersAfterRenameNew");
            Assert.IsTrue(foldersAfterRenameNew.Distinct().First() == folderId, "#value5 foldersAfterRenameNew");
            Assert.IsTrue(filesAfterRenameNew.Distinct().Count() == 1, "#equality6 filesAfterRenameNew");
            Assert.IsTrue(filesAfterRenameNew.Distinct().First() == fileId, "#value6 filesAfterRenameNew");
            Assert.IsTrue(filecontents.Distinct().Count() == 1, "#equality7 filecontents");
            Assert.IsTrue(filecontents.Distinct().First() == fileContent, "#value7 filecontents");

            Assert.IsTrue(foldersAfterDeleteOld.Distinct().Count() == 1, "#equality8 foldersAfterDeleteOld");
            Assert.IsTrue(foldersAfterDeleteOld.Distinct().First() == 0, "#value8 foldersAfterDeleteOld");
            Assert.IsTrue(filesAfterDeleteOld.Distinct().Count() == 1, "#equality9 filesAfterDeleteOld");
            Assert.IsTrue(filesAfterDeleteOld.Distinct().First() == 0, "#value9 filesAfterDeleteOld");
            Assert.IsTrue(foldersAfterDeleteNew.Distinct().Count() == 1, "#equality10 foldersAfterDeleteNew");
            Assert.IsTrue(foldersAfterDeleteNew.Distinct().First() == 0, "#value10 foldersAfterDeleteNew");
            Assert.IsTrue(filesAfterDeleteNew.Distinct().Count() == 1, "#equality11 filesAfterDeleteNew");
            Assert.IsTrue(filesAfterDeleteNew.Distinct().First() == 0, "#value11 filesAfterDeleteNew");
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:71,代码来源:CrossDomainTests.cs

示例5: FindImHistoryFolder

        private Folder FindImHistoryFolder()
        {
            FolderView folderView = new FolderView(_pageSize, 0);
            folderView.PropertySet = new PropertySet(BasePropertySet.IdOnly);
            folderView.PropertySet.Add(FolderSchema.DisplayName);
            folderView.PropertySet.Add(FolderSchema.ChildFolderCount);

            folderView.Traversal = FolderTraversal.Shallow;
            Folder imHistoryFolder = null;

            FindFoldersResults findFolderResults;
            bool foundImHistoryFolder = false;
            do
            {
                findFolderResults = _exchangeService.FindFolders(WellKnownFolderName.MsgFolderRoot, folderView);
                foreach (Folder folder in findFolderResults)
                {
                    if (folder.DisplayName.ToLower() == "conversation history")
                    {
                        imHistoryFolder = folder;
                        foundImHistoryFolder = true;
                    }
                }
                folderView.Offset += _pageSize;
            } while (findFolderResults.MoreAvailable && !foundImHistoryFolder);

            if(!foundImHistoryFolder)
            {
                imHistoryFolder = new Folder(_exchangeService);
                imHistoryFolder.DisplayName = "Conversation History";
                imHistoryFolder.Save(WellKnownFolderName.MsgFolderRoot);
            }

            return imHistoryFolder;
        }
开发者ID:dziegelbauer,项目名称:LyncHistoryTool,代码行数:35,代码来源:MainFrm.cs

示例6: Group_Bug1882_MixedMembership

        public void Group_Bug1882_MixedMembership()
        {
            Group group;
            User user;

            var domainNode = Node.LoadNode("/Root/IMS/BuiltIn");

            var testFolder = Node.LoadNode("/Root/TestFolder_Bug1882");
            if (testFolder == null)
            {
                testFolder = new Folder(Repository.Root);
                testFolder.Name = "TestFolder_Bug1882";
                testFolder.Save();
                AddPathToDelete("/Root/TestFolder_Bug1882");
            }

            group = Node.Load<Group>("/Root/IMS/BuiltIn/G1");
            if (group == null)
            {
                group = new Group(domainNode);
                group.Name = "G1";
                group.Save();
                AddPathToDelete("/Root/IMS/BuiltIn/G1");
            }
            testFolder.Security.SetPermission(group, true, PermissionType.AddNew, PermissionValue.Allow);

            group = Node.Load<Group>("/Root/IMS/BuiltIn/G2");
            if (group == null)
            {
                group = new Group(domainNode);
                group.Name = "G2";
                group.Save();
                AddPathToDelete("/Root/IMS/BuiltIn/G2");
            }
            testFolder.Security.SetPermission(group, true, PermissionType.Approve, PermissionValue.Allow);

            user = Node.Load<User>("/Root/IMS/BuiltIn/U1");
            if (user == null)
            {
                user = new User(domainNode);
                user.Name = "U1";
                user.Save();
                AddPathToDelete("/Root/IMS/BuiltIn/U1");
            }
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user, PermissionType.AddNew), "#1");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user, PermissionType.Approve), "#2");

            user = Node.Load<User>("/Root/IMS/BuiltIn/U2");
            if (user == null)
            {
                user = new User(domainNode);
                user.Name = "U2";
                user.Save();
                AddPathToDelete("/Root/IMS/BuiltIn/U2");
            }
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user, PermissionType.AddNew), "#3");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user, PermissionType.Approve), "#4");

            //--

            var group1 = Node.Load<Group>("/Root/IMS/BuiltIn/G1");
            var group2 = Node.Load<Group>("/Root/IMS/BuiltIn/G2");
            var user1 = Node.Load<User>("/Root/IMS/BuiltIn/U1");
            var user2 = Node.Load<User>("/Root/IMS/BuiltIn/U2");

            group1.AddMember(user1);
            group1.Save();

            Assert.IsTrue(testFolder.Security.HasPermission((IUser)user1, PermissionType.AddNew), "#5");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user1, PermissionType.Approve), "#6");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user2, PermissionType.AddNew), "#7");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user2, PermissionType.Approve), "#8");

            group2.AddMember(user2);
            group2.Save();

            Assert.IsTrue(testFolder.Security.HasPermission((IUser)user1, PermissionType.AddNew), "#9");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user1, PermissionType.Approve), "#10");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user2, PermissionType.AddNew), "#11");
            Assert.IsTrue(testFolder.Security.HasPermission((IUser)user2, PermissionType.Approve), "#12");

            group1 = Node.Load<Group>("/Root/IMS/BuiltIn/G1");
            group1.AddMember(Node.Load<Group>("/Root/IMS/BuiltIn/G2"));
            group1.Save();

            Assert.IsTrue(testFolder.Security.HasPermission((IUser)user1, PermissionType.AddNew), "#13");
            Assert.IsFalse(testFolder.Security.HasPermission((IUser)user1, PermissionType.Approve), "#14");
            Assert.IsTrue(testFolder.Security.HasPermission((IUser)user2, PermissionType.AddNew), "#15");
            Assert.IsTrue(testFolder.Security.HasPermission((IUser)user2, PermissionType.Approve), "#16");

            //--

            group = Node.Load<Group>("/Root/IMS/BuiltIn/G3");
            if (group == null)
            {
                group = new Group(domainNode);
                group.Name = "G3";
                group.Save();
                AddPathToDelete("/Root/IMS/BuiltIn/G3");
            }
//.........这里部分代码省略.........
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:101,代码来源:GroupTest.cs

示例7: LoadOrCreateFolder

        public static Folder LoadOrCreateFolder(string path)
        {
            var folder = (Folder)Node.LoadNode(path);
            if (folder != null)
                return folder;

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

            folder = new Folder(parentFolder) { Name = RepositoryPath.GetFileName(path) };
            folder.Save();

            return folder;
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:14,代码来源:TestTools.cs

示例8: CreatePlayGround

        private static void CreatePlayGround()
        {
            DestroyPlayground();

            // /Root
            //      |
            //      +-ContentTemplates
            //      |   |
            //      |   +-File
            //      |   |   |
            //      |   |   +-file1.txt
            //      |   |
            //      |   +-ContentList
            //      |       |
            //      |       +-list1
            //      |
            //      +-CTemplateTests
            //          |
            //          +-CtSite
            //          |   |
            //          |   +-ContentTemplates
            //          |   |   |
            //          |   |   +-File
            //          |   |       |
            //          |   |       +-file1.txt
            //          |   |
            //          |   +-CtWorkspace1
            //          |   |   |
            //          |   |   +-ContentTemplates
            //          |   |   |   |
            //          |   |   |   +-ContentList
            //          |   |   |       |
            //          |   |   |       +-list1
            //          |   |   +-CtList1
            //          |   |   |   |
            //          |   |   |   +-ContentTemplates
            //          |   |   |       |
            //          |   |   |       +-File
            //          |   |   |           |
            //          |   |   |           +-file1.txt
            //          |   |   +-CtList2
            //          |   | 
            //          |   +-CtWorkspace2
            //          | 
            //          +-CtWorkspace3

            //global template folder
            var ctfGlobal = Node.LoadNode(Repository.ContentTemplateFolderPath);
            if (ctfGlobal == null)
            {
                ctfGlobal = new SystemFolder(Node.LoadNode("/Root")) {Name = Repository.ContentTemplatesFolderName};
                ctfGlobal.Save();
            }

            //create GLOBAL content template type folders
            var folderGlobalCtFile1 = Node.Load<Folder>(RepositoryPath.Combine(ctfGlobal.Path, "File"));
            if (folderGlobalCtFile1 == null)
            {
                folderGlobalCtFile1 = new Folder(ctfGlobal) { Name = "File" };
                folderGlobalCtFile1.Save();
            }
            var folderGlobalCtList1 = Node.Load<Folder>(RepositoryPath.Combine(ctfGlobal.Path, "ContentList"));
            if (folderGlobalCtList1 == null)
            {
                folderGlobalCtList1 = new Folder(ctfGlobal) { Name = "ContentList" };
                folderGlobalCtList1.Save();
            }

            //create GLOBAL content templates
            _fileGlobalTemplate1 = Node.Load<File>(RepositoryPath.Combine(folderGlobalCtFile1.Path, _testFileName));
            if (_fileGlobalTemplate1 == null)
            {
                _fileGlobalTemplate1 = new File(folderGlobalCtFile1) { Name = _testFileName, Index = 30 };
                _fileGlobalTemplate1.Save();
            }
            _listGlobalTemplate1 = Node.Load<ContentList>(RepositoryPath.Combine(folderGlobalCtList1.Path, _testListTemplateName));
            if (_listGlobalTemplate1 == null)
            {
                _listGlobalTemplate1 = new ContentList(folderGlobalCtList1) { Name = _testListTemplateName, Index = 30 };
                _listGlobalTemplate1.Save();
            }

            //create site, workspace and list
            var site = new Site(TestRoot) {Name = "CtSite"};
            site.UrlList.Add("mytemplatetestinterneturl", "Forms");
            site.Save();

            var ws = new Workspace(site) { Name = "CtWorkspace2", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("ContentList"), ContentType.GetByName("Workspace"), ContentType.GetByName("File") } };
            ws.Save();

            ws = new Workspace(TestRoot) { Name = "CtWorkspace3", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("ContentList"), ContentType.GetByName("Workspace"), ContentType.GetByName("File") } };
            ws.Save();

            ws = new Workspace(site) { Name = "CtWorkspace1", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("ContentList"), ContentType.GetByName("Workspace") } };
            ws.Save();

            _list1 = new ContentList(TestWorkspace) { Name = "CtList1", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("File") } };
            _list1.Save();
            _list2 = new ContentList(TestWorkspace) { Name = "CtList2", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("File") } };
            _list2.Save();
//.........这里部分代码省略.........
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:101,代码来源:ContentTemplateTest.cs

示例9: Node_FolderSave_WithSameName

		public void Node_FolderSave_WithSameName()
		{
			string guid = Guid.NewGuid().ToString();
			Folder folder = new Folder(this.TestRoot);
			folder.Name = guid;
			folder.Save();
			Folder folder2 = new Folder(this.TestRoot);
			folder2.Name = guid;
			folder2.Save();
		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:10,代码来源:NodeTest.cs

示例10: Node_CanFolderSave

		public void Node_CanFolderSave()
		{
			Folder folder = new Folder(this.TestRoot);
			//folder.Name = "TestFolder";
			//folder.UrlName = "TestFolder";
			folder.Save();
			Assert.IsTrue(folder.Id > 0);
		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:8,代码来源:NodeTest.cs

示例11: BinaryData_RenameNodeWithBinaryData

        public void BinaryData_RenameNodeWithBinaryData()
        {
			string rootName = "BinaryTestFolder";
			string rootPath = RepositoryPath.Combine(this.TestRoot.Path, rootName);

			if (Node.Exists(rootPath))
                Node.ForceDelete(rootPath);

			Folder binaryTestFolder = new Folder(this.TestRoot);
			binaryTestFolder.Name = rootName;
            binaryTestFolder.Save();

            TestNodeWithBinaryProperty tn1 = new TestNodeWithBinaryProperty(binaryTestFolder);

            tn1.Name = "OriginalName";
            tn1.Note = "This is the first test node. Nice, isn't it?";

            BinaryData firstBinary = new BinaryData();
            firstBinary.SetStream(new MemoryStream(new byte[] { 65, 66, 67, 68, 69 }));
            tn1.FirstBinary = firstBinary;

            BinaryData secondBinary = new BinaryData();
            secondBinary.SetStream(new MemoryStream(new byte[] { 97, 98, 99 }));
            tn1.SecondBinary = secondBinary;

            tn1.Save();

			// Drop the in-memory node and load from the Repository
            int testNodeId = tn1.Id;
            tn1 = null;
            TestNodeWithBinaryProperty loadedNode = (TestNodeWithBinaryProperty)Node.LoadNode(testNodeId);

            Stream firstStream = loadedNode.FirstBinary.GetStream();
            Stream secondStream = loadedNode.SecondBinary.GetStream();

            byte[] firstBuffer = new byte[firstStream.Length];
            byte[] secondBuffer = new byte[secondStream.Length];

            firstStream.Read(firstBuffer, 0, (int)firstStream.Length);
            secondStream.Read(secondBuffer, 0, (int)secondStream.Length);

            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(firstBuffer) == "ABCDE", "The first binary had became corrupt after save.");
            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(secondBuffer) == "abc", "The second binary had became corrupt after save.");
            
            // Close and dispost streams
            firstStream.Close();
            firstStream.Dispose();
            firstStream = null;
            secondStream.Close();
            secondStream.Dispose();
            secondStream = null;

            // The buffers should still hold  the data
            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(firstBuffer) == "ABCDE", "The first binary had became corrupt after save.");
            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(secondBuffer) == "abc", "The second binary had became corrupt after save.");

            firstBuffer = null;
            secondBuffer = null;

            // Get the stream again
            firstStream = loadedNode.FirstBinary.GetStream();
            secondStream = loadedNode.SecondBinary.GetStream();

            firstBuffer = new byte[firstStream.Length];
            secondBuffer = new byte[secondStream.Length];

            firstStream.Read(firstBuffer, 0, (int)firstStream.Length);
            secondStream.Read(secondBuffer, 0, (int)secondStream.Length);

            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(firstBuffer) == "ABCDE", "The first binary had became corrupt after save.");
            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(secondBuffer) == "abc", "The second binary had became corrupt after save.");

            // Close and dispost streams
            firstStream.Close();
            firstStream.Dispose();
            firstStream = null;
            secondStream.Close();
            secondStream.Dispose();
            secondStream = null;

            // The buffers should still hold  the data
            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(firstBuffer) == "ABCDE", "The first binary had became corrupt after save.");
            Assert.IsTrue(System.Text.Encoding.ASCII.GetString(secondBuffer) == "abc", "The second binary had became corrupt after save.");

            // Change the name
            loadedNode.Name = "ModifiedName";
            loadedNode.Save();
            loadedNode = null;

            // Load the node again
            loadedNode = (TestNodeWithBinaryProperty)Node.LoadNode(testNodeId);

            Assert.IsTrue(loadedNode.Name == "ModifiedName");

            // Get the stream again
            firstStream = loadedNode.FirstBinary.GetStream();
            secondStream = loadedNode.SecondBinary.GetStream();

            firstBuffer = new byte[firstStream.Length];
            secondBuffer = new byte[secondStream.Length];
//.........这里部分代码省略.........
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:101,代码来源:BinaryDataTest.cs

示例12: BinaryData_RenameFileNode

        public void BinaryData_RenameFileNode()
        {
			string rootName = "BinaryTestFolder";
			string rootPath = RepositoryPath.Combine(this.TestRoot.Path, rootName);

			if (Node.Exists(rootPath))
                Node.ForceDelete(rootPath);

			Folder folder = new Folder(this.TestRoot);
			folder.Name = rootName;
			folder.Save();

            Stream stream;

            const int TESTBINARY_SIZE = 512 * 1024; // 512k
            byte[] testBinaryArray = new byte[TESTBINARY_SIZE];
            int i;
            for (i=0; i < TESTBINARY_SIZE; i++) testBinaryArray[i] = Convert.ToByte(i % 256);

            BinaryData testBinary = new BinaryData();
            testBinary.FileName = "test.txt";
            testBinary.SetStream(new MemoryStream(testBinaryArray));

            File file = new File(folder);
            file.Name = "OriginalName";
            file.Binary = testBinary;

            file.Save();

            stream = file.Binary.GetStream();

            file = null;

            int readByte;
            i = 0;
            while ((readByte = stream.ReadByte()) != -1)
            {
                Assert.IsTrue(readByte == i % 256);
                i++;
            }
            Assert.IsTrue(i == TESTBINARY_SIZE);

            file = (File)File.LoadNode(RepositoryPath.Combine(rootPath, "OriginalName"));
            file.Name = "NewName";
            file.Save();

            file = (File)File.LoadNode(RepositoryPath.Combine(rootPath, "NewName"));
            stream = file.Binary.GetStream();

            file = null;

            i = 0;
            while ((readByte = stream.ReadByte()) != -1)
            {
                Assert.IsTrue(readByte == i % 256);
                i++;
            }

			if (Node.Exists(rootPath))
                Node.ForceDelete(rootPath);

            Assert.IsTrue(i == TESTBINARY_SIZE);

        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:64,代码来源:BinaryDataTest.cs

示例13: CreateStructure

        //========================================================================= Structure
        
        private static void CreateStructure(int folders, int filesPerFolders, int averageSizeInBytes)
        {
            var node = Node.LoadNode("/Root/Timing_TestRoot");
            if (node != null)
                node.Delete();

            var testRoot = new Folder(Repository.Root);
            testRoot.Name = "Timing_TestRoot";
            testRoot.Save();

            var sctuFolder = new Folder(testRoot);
            sctuFolder.Name = "STU";
            sctuFolder.Save();

            var sourceFolder = new Folder(testRoot);
            sourceFolder.Name = "Source";
            sourceFolder.Save();

            var targetFolder = new Folder(testRoot);
            targetFolder.Name = "Target";
            targetFolder.Save();

            for (var i = 0; i < folders; i++)
            {
                var folder = new Folder(sourceFolder);
                folder.Name = "SubFolder" + i;
                folder.Save();
                CreateManyFiles(folder, filesPerFolders, 20);
            }

            // Timing_TestRoot
            //     SCTU
            //     Target
            //     Source
            //         Subfolder1
            //             [files]
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:39,代码来源:TimingTests.cs

示例14: LoadOrCreateFolder

		private Folder LoadOrCreateFolder(string path)
		{
			Folder folder = (Folder)Node.LoadNode(path);
			if (folder != null)
				return folder;

			string parentPath = RepositoryPath.GetParentPath(path);
			Folder parentFolder = (Folder)Node.LoadNode(parentPath);
			if (parentFolder == null)
				parentFolder = LoadOrCreateFolder(parentPath);

			folder = new Folder(parentFolder);
			folder.Name = RepositoryPath.GetFileName(path);
			folder.Save();
			AddPathToDelete(path);

			return folder;
		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:18,代码来源:PermissionTest.cs

示例15: TransactionScope_Commit_UseCase1

        public void TransactionScope_Commit_UseCase1()
        {
            string name = "CommitTest-" + Guid.NewGuid().ToString();
			AddPathToDelete("/Root/" + name);

            TransactionScope.Begin();

            var folder = new Folder(Repository.Root);
            folder.Name = name;
            folder.Save();

            TransactionScope.Commit();

			folder = (Folder)Node.LoadNode(folder.Id);
            Assert.IsNotNull(folder);
            Assert.AreEqual(name, folder.Name);
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:17,代码来源:TransactionScopeTest.cs


注:本文中的Folder.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。