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


C# FileNode类代码示例

本文整理汇总了C#中FileNode的典型用法代码示例。如果您正苦于以下问题:C# FileNode类的具体用法?C# FileNode怎么用?C# FileNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: RefreshDevices

        private void RefreshDevices()
        {
            tv_dirs.Nodes.Clear();
            lv_files.Clear();

            if ( devices != null )
            {
                foreach ( Device dev in devices ) dev.Close();
            }

            devices = Device.GetPhysicalDevices();

            foreach ( Device dev in devices )
            {
                TreeNode root_node = new TreeNode( dev.DeviceName );
                root_node.ImageIndex = 0;
                root_node.SelectedImageIndex = 0;
                tv_dirs.Nodes.Add( root_node );
                List< FileSystem > filesystems = dev.GetFileSystems();

                foreach ( FileSystem fs in filesystems )
                {
                    FileNode node = new FileNode( fs.GetRootDir(), true );
                    root_node.Nodes.Add( node );
                }

                root_node.Expand();
            }
        }
开发者ID:pbalint,项目名称:Playground,代码行数:29,代码来源:MainWindow.cs

示例2: OAVSProjectItem

        public OAVSProjectItem(FileNode fileNode)
        {
            if (fileNode == null)
                throw new ArgumentNullException("fileNode");

            this._fileNode = fileNode;
        }
开发者ID:tunnelvisionlabs,项目名称:MPFProj10,代码行数:7,代码来源:OAVSProjectItem.cs

示例3: OpenDirectory

        public void OpenDirectory(string path)
        {
            this.directory = null;
            BeginUpdate();
            Items.Clear();
            try

            {
                foreach (string fileName in Directory.GetFiles(path))
                {
                    string ext = Path.GetExtension(fileName).ToLower();
                    if (supportedExtensions.Contains(ext))
                    {
                        FileNode node = new FileNode(fileName);
                        node.ImageIndex = GetIconName(fileName);
                        Items.Add(node);
                    }

                }
            }
            catch (Exception)
            {

            }
            finally
            {
                EndUpdate();
            }
        }
开发者ID:aspose-3d,项目名称:Aspose.3D-for-.NET,代码行数:29,代码来源:FileListView.cs

示例4: ApplyLogRecordsFilter

        public void ApplyLogRecordsFilter(FileNode fileNode = null)
        {
            var selectedNodes = _fileBrowser.SelectedItems.OfType<FileNode>().ToArray();
            if (fileNode != null && !selectedNodes.Contains(fileNode))
            {
                return;
            }

            var logRecords = _logTableService.LogTable.Records;

            var oldRecords = logRecords.ToArray();

            var filteredRecords = FilterRecords(Filter, selectedNodes).ToArray();

            _dispatcherService.Invoke(() =>
            {
                using (logRecords.SuspendChangeNotifications())
                {
                    logRecords.ReplaceRange(filteredRecords);
                }

                foreach (var record in logRecords.Except(oldRecords))
                {
                    record.FileNode.IsExpanded = true;
                }
            }, true);
        }
开发者ID:sk8tz,项目名称:LogViewer,代码行数:27,代码来源:FilterService.cs

示例5: ShouldListEntireTree

        public void ShouldListEntireTree()
        {
            // arrange
            IFile childFile;
            IFile rootFile;
            IFile folder = mockWalker.MockFolder("2", "folder",
                childFile = Utils.MockFile("3", "file.txt", "text/plain")
                );
            IFile rootFolder = mockWalker.MockFolder("root", "root",
                rootFile = Utils.MockFile("4", "hello.png", "image/png"),
                folder);

            IFileNode expected = new FileNode(
                Utils.MockFolder("root", "root"),  new[]
            {
                new FileNode(rootFile),
                new FileNode(folder, new List<IFileNode>
                {
                    new FileNode(childFile)
                })
            });

            // act
            var result = walker.ListRecurse("root");

            // assert
            Assert.AreEqual(expected, result);
        }
开发者ID:ngeor,项目名称:GoogleDriveOfflineBackup,代码行数:28,代码来源:WalkerExtensionsTest.cs

示例6: TestMetadata

        public void TestMetadata()
        {
            Dictionary<string, string> metadata = new Dictionary<string, string>();
            metadata.Add(FileOp.NextCIdentifierString(random), FileOp.NextNormalString(random));
            metadata.Add(FileOp.NextCIdentifierString(random), FileOp.NextNormalString(random));

            Test.Info("Metadata is =====================");
            foreach (var keyValue in metadata)
            {
                Test.Info("name:{0}  value:{1}", keyValue.Key, keyValue.Value);
            }

            DMLibDataInfo sourceDataInfo = new DMLibDataInfo(string.Empty);
            FileNode fileNode = new FileNode(DMLibTestBase.FileName)
            {
                SizeInByte = DMLibTestBase.FileSizeInKB * 1024L,
                Metadata = metadata
            };
            sourceDataInfo.RootNode.AddFileNode(fileNode);

            var result = this.ExecuteTestCase(sourceDataInfo, new TestExecutionOptions<DMLibDataInfo>());

            Test.Assert(result.Exceptions.Count == 0, "Verify no exception is thrown.");
            Test.Assert(DMLibDataHelper.Equals(sourceDataInfo, result.DataInfo), "Verify transfer result.");
        }
开发者ID:ggais,项目名称:azure-storage-net-data-movement,代码行数:25,代码来源:MetadataTest.cs

示例7: read

    public override FileNode read(string path, string flags, int offset, int length)
    {
        if (path == "")
        {
            return this.myroot;
        }
        else if (getWorkPathArray(path)[1] == "ctl")
        {
            return null;
        }
        else if (getWorkPathArray(path)[1] == "new")
        {
            return null;
        }
        else
        {
            int count = 0;

            while(count < this.myWindows.Count && this.myWindows[count].Name != getWorkPathArray(path)[1])
            {
                count++;
            }

            if(this.myWindows[count].Name == getWorkPathArray(path)[1])
            {
                FileNode winNode = new FileNode(getWorkPathArray(path)[1], fileTypes.Directory);
                return winNode;
            }
            else
                return null;
        }
    }
开发者ID:Softsurve,项目名称:Silver-Iodide,代码行数:32,代码来源:WinFS.cs

示例8: DoValidation

 private void DoValidation(FileNode fileNode, int expectedErrors)
 {
     PropertyInfo fileNameInfo = typeof(FileNode).GetProperty("FileName");
     FileValidationAttribute attr = new FileValidationAttribute();
     List<ValidationError> errors = new List<ValidationError>();
     attr.Validate(fileNode, fileNameInfo, errors, ServiceProvider);
     Assert.AreEqual(expectedErrors, errors.Count);
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:8,代码来源:FileValidationAttributeFixture.cs

示例9: LoadImage

 private void LoadImage(FileNode node, ListView targetListView)
 {
     var key = node.File.FullName;
     var item = targetListView.Items.Add(key, node.File.Name, DefaultImageKey);
     node.BlockingLoadImage();
     ImageList.Images.Add(key, node.Image);
     item.ImageKey = key;
 }
开发者ID:mrtgold,项目名称:ImageBrowser,代码行数:8,代码来源:ListViewFileSet_BlockingLoadAllImages.cs

示例10: WaitUntilFileCreated

        public static void WaitUntilFileCreated(string rootPath, FileNode fileNode, DataAdaptor<DMLibDataInfo> dataAdaptor, DMLibDataType dataType, int timeoutInSec = 300)
        {
            Func<bool> checkFileCreated = null;

            if (dataType == DMLibDataType.Local)
            {
                string filePath = dataAdaptor.GetAddress() + fileNode.GetLocalRelativePath();
                checkFileCreated = () =>
                {
                    return File.Exists(filePath);
                };
            }
            else if (dataType == DMLibDataType.PageBlob ||
                     dataType == DMLibDataType.AppendBlob)
            {
                CloudBlobDataAdaptor blobAdaptor = dataAdaptor as CloudBlobDataAdaptor;

                checkFileCreated = () =>
                {
                    CloudBlob cloudBlob = blobAdaptor.GetCloudBlobReference(rootPath, fileNode);
                    return cloudBlob.Exists(options: HelperConst.DefaultBlobOptions);
                };
            }
            else if (dataType == DMLibDataType.BlockBlob)
            {
                CloudBlobDataAdaptor blobAdaptor = dataAdaptor as CloudBlobDataAdaptor;

                checkFileCreated = () =>
                {
                    CloudBlockBlob blockBlob = blobAdaptor.GetCloudBlobReference(rootPath, fileNode) as CloudBlockBlob;
                    try
                    {
                        return blockBlob.DownloadBlockList(BlockListingFilter.All, options: HelperConst.DefaultBlobOptions).Any();
                    }
                    catch (StorageException)
                    {
                        return false;
                    }
                };
            }
            else if (dataType == DMLibDataType.CloudFile)
            {
                CloudFileDataAdaptor fileAdaptor = dataAdaptor as CloudFileDataAdaptor;

                checkFileCreated = () =>
                {
                    CloudFile cloudFile = fileAdaptor.GetCloudFileReference(rootPath, fileNode);
                    return cloudFile.Exists(options: HelperConst.DefaultFileOptions);
                };
            }
            else
            {
                Test.Error("Unexpected data type: {0}", DMLibTestContext.SourceType);
            }

            MultiDirectionTestHelper.WaitUntil(checkFileCreated, timeoutInSec);
        }
开发者ID:ggais,项目名称:azure-storage-net-data-movement,代码行数:57,代码来源:MultiDirectionTestHelper.cs

示例11: EnsureCanWriteToAValidFile

 public void EnsureCanWriteToAValidFile()
 {
     string fileName = Path.GetTempFileName();
     FileNode fileNode = new FileNode(fileName);
     using (File.Create(fileName))
     {
     }
     DoValidation(fileNode, 0);
     if (File.Exists(fileName)) File.Delete(fileName);
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:10,代码来源:FileValidationAttributeFixture.cs

示例12: printAllFileEntries

        public static void printAllFileEntries(FileNode Root)
        {
            Console.WriteLine("Node: " + Root.NodeName);
            foreach (RARC.FileEntry f in Root.Files) {
                Console.WriteLine("  Entry:" + f.FileName);
            }

            foreach (RARC.FileNode n in Root.ChildNodes)
                printAllFileEntries(n);
        }
开发者ID:pho,项目名称:WindViewer,代码行数:10,代码来源:RARC.cs

示例13: ShouldCopyChildren

        public void ShouldCopyChildren()
        {
            IFileBase fileInfo = Mock.Of<IFileBase>(f => f.Id == "parent");
            IFileBase childFileInfo = Mock.Of<IFileBase>(f => f.Id == "child");
            FileNode fileNode = new FileNode(fileInfo, new List<IFileNode>
            {
                new FileNode(childFileInfo)
            });

            Assert.AreEqual("child", fileNode.Children[0].Id);
        }
开发者ID:ngeor,项目名称:GoogleDriveOfflineBackup,代码行数:11,代码来源:FileNodeTest.cs

示例14: AddOneFileInBytes

        public static void AddOneFileInBytes(DirNode dirNode, string fileName, long fileSizeInB, FileAttributes? fa = null, DateTime? lmt = null)
        {
            FileNode fileNode = new FileNode(fileName)
            {
                SizeInByte = fileSizeInB,
                FileAttr = fa,
                LastModifiedTime = lmt,
            };

            dirNode.AddFileNode(fileNode);
        }
开发者ID:ggais,项目名称:azure-storage-net-data-movement,代码行数:11,代码来源:DMLibDataHelper.cs

示例15: FileCount_FolderWithOneFile

        public void FileCount_FolderWithOneFile()
        {
            IFileBase fileInfo = Utils.MockFolder("root", "root");
            IFileBase childFileInfo = Utils.MockFile("file", "file", "text/plain");
            IFileNode fileNode = new FileNode(fileInfo, new List<IFileNode>
            {
                new FileNode(childFileInfo)
            });

            Assert.AreEqual(1, fileNode.FileCount());
        }
开发者ID:ngeor,项目名称:GoogleDriveOfflineBackup,代码行数:11,代码来源:FileNodeTest.cs


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