• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Folder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SearchItemByName

        protected ListItem SearchItemByName(List list, Folder folder, string pageName)
        {
            var context = list.Context;

            if (folder != null)
            {
                if (!folder.IsPropertyAvailable("ServerRelativeUrl"))
                {
                    folder.Context.Load(folder, f => f.ServerRelativeUrl);
                    folder.Context.ExecuteQueryWithTrace();
                }
            }

            var dQuery = new CamlQuery();

            string QueryString = "<View><Query><Where>" +
                             "<Eq>" +
                               "<FieldRef Name=\"FileLeafRef\"/>" +
                                "<Value Type=\"Text\">" + pageName + "</Value>" +
                             "</Eq>" +
                            "</Where></Query></View>";

            dQuery.ViewXml = QueryString;

            if (folder != null)
                dQuery.FolderServerRelativeUrl = folder.ServerRelativeUrl;

            var collListItems = list.GetItems(dQuery);

            context.Load(collListItems);
            context.ExecuteQueryWithTrace();

            return collListItems.FirstOrDefault();

        }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:35,代码来源:PublishingPageLayoutModelHandler.cs


示例2: InitializeClientContext

    static void InitializeClientContext() {

      // create new client context
      string targetSharePointSite = ConfigurationManager.AppSettings["targetSharePointSite"];
      clientContext = new ClientContext(targetSharePointSite);
      
      // get user name and secure password
      string userName = ConfigurationManager.AppSettings["accessAccountName"];
      string pwd = ConfigurationManager.AppSettings["accessAccountPassword"];
      SecureString spwd = new SecureString();
      foreach (char c in pwd.ToCharArray()) {
        spwd.AppendChar(c);
      }
    
        // create credentials for SharePoint Online using Office 365 user account
      clientContext.Credentials = new SharePointOnlineCredentials(userName, spwd);

      // initlaize static variables for client context, web and site
      siteCollection = clientContext.Site;
      clientContext.Load(siteCollection);
      site = clientContext.Web;
      clientContext.Load(site);
      siteRootFolder = site.RootFolder;
      clientContext.Load(siteRootFolder);
      clientContext.Load(site.Lists);

      TopNavNodes = site.Navigation.TopNavigationBar;
      clientContext.Load(TopNavNodes);
      clientContext.ExecuteQuery();

    }
开发者ID:CriticalPathTraining,项目名称:DSU365,代码行数:31,代码来源:Program.cs


示例3: GetTextureBytes

        public static bool GetTextureBytes(string fileName, Folder folder, bool skipCache, out byte[] bytes)
        {
            bytes = null;
            string filePath = GetFilePath(fileName, folder);
            if (filePath == null || !File.Exists(filePath))
            {
#if DEBUG
                Logger.LogInfo("Cannot find texture file at " + filePath);
#endif
                return false;
            }

            if (!skipCache && sm_cachedFiles.TryGetValue(filePath, out bytes))
                return true;

            try
            {
                bytes = File.ReadAllBytes(filePath);
            }
            catch (Exception e)
            {
                Logger.LogInfo("Unexpected " + e.GetType().Name + " reading texture file at " + filePath);
                return false;
            }

            sm_cachedFiles[filePath] = bytes;
            return true;
        }
开发者ID:bagukiri,项目名称:csl-traffic,代码行数:28,代码来源:FileManager.cs


示例4: RecursiveSharePointFolderVisitorInternal

 private void RecursiveSharePointFolderVisitorInternal(Folder folder, Action<File> visit)
 {
     folder.Context.Load(folder, f => f.Files, f => f.Folders);
     folder.Context.ExecuteQuery();
     folder.Files.ToList().ForEach(f => visit(f));
     folder.Folders.ToList().ForEach(f => Execute(f, visit));
 }
开发者ID:ronnieholm,项目名称:Bugfree.Spo.Cqrs,代码行数:7,代码来源:RecursiveSharePointFolderVisitor.cs


示例5: DefaultKnownFolders

 public DefaultKnownFolders(
                            MigrationsFolder alter_database,
                            MigrationsFolder up,
                            MigrationsFolder down,
                            MigrationsFolder run_first_after_up,
                            MigrationsFolder functions,
                            MigrationsFolder views,
                            MigrationsFolder sprocs,
                            MigrationsFolder indexes,
                            MigrationsFolder runAfterOtherAnyTimeScripts,        
                            MigrationsFolder permissions,
                            Folder change_drop
     )
 {
     this.alter_database = alter_database;
     this.up = up;
     this.down = down;
     this.run_first_after_up = run_first_after_up;
     this.functions = functions;
     this.views = views;
     this.sprocs = sprocs;
     this.indexes = indexes;
     this.runAfterOtherAnyTimeScripts = runAfterOtherAnyTimeScripts;
     this.permissions = permissions;
     this.change_drop = change_drop;
 }
开发者ID:keithbloom,项目名称:roundhouse,代码行数:26,代码来源:DefaultKnownFolders.cs


示例6: DirectoryTree

    public DirectoryTree(string rootPath)
    {
        this.RootPath = rootPath;
            var root = Directory.GetParent(rootPath);

            rootFolder = new Folder(rootPath);
    }
开发者ID:stoyanovalexander,项目名称:TheRepositoryOfAlexanderStoyanov,代码行数:7,代码来源:DirectoryTrees.cs


示例7: GetSerieData

        private static Series GetSerieData(Folder folder)
        {
            var s = new Series();
            s.TimeInterval = TimeInterval.Daily;
            foreach (var msg in folder.Messages)
            {
                var txt = msg.Body.Text;
                var exp = @"Pump Station Average Flow:(\s*\d{1,10}(\.){0,1}\d{0,3})\s*cfs";
                Regex re = new Regex(exp);
                var m = Regex.Match(txt, exp);
                if (m.Success)
                {
                    double d = Convert.ToDouble(m.Groups[1].Value);
                    var t = Reclamation.TimeSeries.Math.RoundToNearestHour(msg.Date.Value);

                    if (s.IndexOf(t) < 0)
                    {
                        s.Add(t, d);
                        //msg.Flags.Add(ImapX.Flags.MessageFlags.Seen);
                        msg.Flags.Add(ImapX.Flags.MessageFlags.Deleted);
                        Console.WriteLine(t.ToString() + " " + d.ToString("F2"));
                    }
                }
            }
            return s;
        }
开发者ID:usbr,项目名称:Pisces,代码行数:26,代码来源:Program.cs


示例8: GetAllMessages

        public static FindItemsResults<Item> GetAllMessages(ExchangeService service, Folder targetFolder, int start, int length)
        {
            //Create empty list for all mailbox messages:
            var listing = new List<EmailMessage>();

            //Create ItemView with correct pagesize and offset:
            ItemView view = new ItemView(length, start, OffsetBasePoint.Beginning);

            view.PropertySet = new PropertySet(EmailMessageSchema.Id,
                EmailMessageSchema.Subject,
                EmailMessageSchema.DateTimeReceived,
                EmailMessageSchema.From
                );

            view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);

            FindItemsResults<Item> findResults = service.FindItems(targetFolder.Id, view);

            //bool MoreItems = true;

            //while(MoreItems)
            //{
            //foreach (EmailMessage it in findResults.Items)
            //{
            //    listing.Add(it);
            //}
            //}

            //return View(listing.ToPagedList<EmailMessage>(pageNumber, pageSize));

            return findResults;
        }
开发者ID:liveaverage,项目名称:Web-Archive-View,代码行数:32,代码来源:ArchivesController.cs


示例9: TraverseDirectory

        private static void TraverseDirectory(Folder currentFolder)
        {
            try
            {
                DirectoryInfo currentDirecotoryInfo = new DirectoryInfo(currentFolder.Name);
                DirectoryInfo[] subDirectories = currentDirecotoryInfo.GetDirectories();

                foreach (var file in currentDirecotoryInfo.GetFiles())
                {
                    currentFolder.AddFile(file.Name, (int)file.Length);
                }

                foreach (var dir in subDirectories)
                {
                    currentFolder.AddFolder(dir.FullName);
                }

                foreach (var child in currentFolder.ChildFolders)
                {
                    TraverseDirectory(child);
                }
            }
            catch (UnauthorizedAccessException uae)
            {
                Console.WriteLine("Cannot access directory: {0}", uae.Message);
            }
            catch(DirectoryNotFoundException dnf)
            {
                Console.WriteLine("Directory not found: {0}", dnf.Message);
            }
        }
开发者ID:nader-dab,项目名称:CSharp-Homeworks,代码行数:31,代码来源:Program.cs


示例10: FolderForPath

        public Folder FolderForPath(string path)
        {
            Folder folder = new Folder();

            if (path == null || path == "")
            {
                return folder;
            }

            folder.FolderPath = path;
            folder.FolderName = Path.GetFileName(path);

            foreach (Folder mf in MediaFolders())
            {
                if (path.Contains(mf.FolderPath))
                {
                    folder.MediaFolderId = mf.FolderId;
                }
            }

            if (folder.IsMediaFolder() || serverSettings.MediaFolders == null)
            {
                int folderId = this.database.GetScalar<int>("SELECT FolderId FROM Folder WHERE FolderName = ? AND ParentFolderId IS NULL", folder.FolderName);
                folder.FolderId = folderId == 0 ? (int?)null : folderId;
            }
            else
            {
                folder.ParentFolderId = GetParentFolderId(folder.FolderPath);

                int folderId = this.database.GetScalar<int>("SELECT FolderId FROM Folder WHERE FolderName = ? AND ParentFolderId = ?", folder.FolderName, folder.ParentFolderId);
                folder.FolderId = folderId == 0 ? (int?)null : folderId;
            }

            return folder;
        }
开发者ID:einsteinx2,项目名称:WaveBox,代码行数:35,代码来源:FolderRepository.cs


示例11: UpdateFolder

        async Task UpdateFolder(StorageFolder storageFolder)
        {
            var folder = await databaseConnection.Table<Folder>().Where(p => p.Path == storageFolder.Path).FirstOrDefaultAsync();

            if (folder == null)
            {
                folder = new Folder() { LastUpdateTime = DateTime.Now, CheckedToday = true, Path = storageFolder.Path };
                await databaseConnection.InsertAsync(folder);

                await UpdateFilesInFolder(folder.Id, storageFolder);
            }
            else
            {
                var dateChanged = (await storageFolder.GetBasicPropertiesAsync()).DateModified;
                if (dateChanged > folder.LastUpdateTime)
                {
                    await UpdateFilesInFolder(folder.Id, storageFolder);
                    folder.LastUpdateTime = DateTime.Now;
                }

                folder.CheckedToday = true;
                await databaseConnection.UpdateAsync(folder);
            }

            foreach (var subFolder in await storageFolder.GetFoldersAsync())
                await UpdateFolder(subFolder);
        }
开发者ID:JulianMH,项目名称:music-3,代码行数:27,代码来源:LocalLibrarySource.cs


示例12: Initialize

        public virtual void Initialize()
        {
            context = Mock.Of<ITypeDescriptorContext>();

            solution = new Solution();
            project = new Project { Name = "project", PhysicalPath = @"c:\projects\solution\project\project.csproj" };
            folder = new Folder();
            item = new Item { Data = { CustomTool = "", IncludeInVSIX = "false", CopyToOutputDirectory = CopyToOutput.DoNotCopy, ItemType = "None" }, PhysicalPath = @"c:\projects\solution\project\assets\icon.ico" };
            folder.Items.Add(item);
            project.Items.Add(folder);
            project.Data.AssemblyName = "project";
            solution.Items.Add(project);

            serviceProvider = new Mock<IServiceProvider>();
            componentModel = new Mock<IComponentModel>();
            picker = new Mock<ISolutionPicker>();
            var uriProvider = new PackUriProvider();

            var pack = new ResourcePack(item);

            var uriService = new Mock<IUriReferenceService>();
            uriService.Setup(u => u.CreateUri<ResourcePack>(It.IsAny<ResourcePack>(), "pack")).Returns(uriProvider.CreateUri(pack));

            serviceProvider.Setup(s => s.GetService(typeof(SComponentModel))).Returns(componentModel.Object);
            serviceProvider.Setup(s => s.GetService(typeof(ISolution))).Returns(solution);
            serviceProvider.Setup(s => s.GetService(typeof(IUriReferenceService))).Returns(uriService.Object);
            componentModel.Setup(c => c.GetService<Func<ISolutionPicker>>()).Returns(new Func<ISolutionPicker>(() => { return picker.Object; }));

            picker.Setup(p => p.Filter).Returns(Mock.Of<IPickerFilter>());
        }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:30,代码来源:ImageUriEditorSpec.cs


示例13: sumFileSize

    private static long sumFileSize(Folder rootFolder, Folder searchFolder)
    {
        long sum = 0;

        if (rootFolder.Name == searchFolder.Name)
        {
            sum = rootFolder.FolderSize;
            return sum;
        }

        foreach (var folder in rootFolder.Folders)
        {
            if (folder.Name == searchFolder.Name)
            {
                sum = folder.FolderSize;
                return sum;
            }
            else
            {
                sumFileSize(folder, searchFolder);
            }
        }

        return sum;
    }
开发者ID:hristian-dimov,项目名称:TelerikAcademy,代码行数:25,代码来源:Program.cs


示例14: CheckGroup

 private void CheckGroup(Folder groupFolder, List<ActivityBase> activities)
 {
     // Create for each remaining sub folder a merge activity (too much nesting).
     activities.AddRange(groupFolder.SubFolders
         .Where(FilterOtherProgramFolders)
         .Select(f => new MergeFolderActivity(groupFolder, f)));
 }
开发者ID:PhotoArchive,项目名称:core,代码行数:7,代码来源:DirectoryStructureAnalyzer.cs


示例15: FillDirectoryTree

 private static void FillDirectoryTree(string path, Folder folder)
 {
     try
     {
         // Append files
         var files = Directory.GetFiles(path);
         foreach (var file in files)
         {
             string fileName = GetName(file);
             FileInfo fileInfo = new FileInfo(file);
             folder.AddFile(new File(fileName, fileInfo.Length));
         }
         // Append dirs recursively
         var dirs = Directory.GetDirectories(path);
         foreach (var dir in dirs)
         {
             string dirName = GetName(dir);
             Folder newFolder = new Folder(dirName);
             folder.AddFolder(newFolder);
             FillDirectoryTree(dir, newFolder);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
开发者ID:klimentt,项目名称:Telerik-Academy,代码行数:27,代码来源:FilesAndFolders.cs


示例16: GetTasks

        public static IEnumerable<Task> GetTasks(Folder[] folders = null)
        {
            var stringOptions = new string[] { "", null, "   ", "kevin", DateTime.Now.ToLongDateString(), "you rock the house with cheese" };
            folders = folders ?? new Folder[] { null, new Folder("foo", Colors.Red) };
            List<Folder> folderOptions = folders.ToList();
            if (!folderOptions.Contains(null))
            {
                folderOptions.Add(null);
            }

            var dateOptions = new DateTime?[] { null, DateTime.Now, DateTime.Now.AddDays((Util.Rnd.NextDouble() - .5) * 100) };

            foreach (TimeSpan? estimate in new TimeSpan?[] { null, TimeSpan.FromDays(Util.Rnd.NextDouble() * 10), TimeSpan.FromDays(Util.Rnd.NextDouble() * 10) })
            {
                foreach (bool? important in new bool?[] { true, false, null })
                {
                    foreach (var description in stringOptions)
                    {
                        foreach (var completeData in dateOptions)
                        {
                            foreach (var folder in folderOptions)
                            {
                                foreach (var dueDate in dateOptions)
                                {
                                    yield return new Task() { Description = description, Due = dueDate, Folder = folder, Completed = completeData, Estimate = estimate, IsImportant = important, };
                                }
                            }
                        }
                    }
                }
            }

        }
开发者ID:x-skywalker,项目名称:Tasks.Show,代码行数:33,代码来源:TestUtil.cs


示例17: Main

 static void Main()
 {
     string rootDir = @"C:\Windows";
     Folder winFolder = new Folder("Windows");
     FillDirectoryTree(rootDir, winFolder);
     PrintSize(winFolder);
 }
开发者ID:klimentt,项目名称:Telerik-Academy,代码行数:7,代码来源:FilesAndFolders.cs


示例18: AsyncUpload

        public override void AsyncUpload(Folder parent, string filePath)
        {
            if (!IsAuthenticated)
            {
                throw new FilesOnlineAuthenticationException("You must login before you can upload files.");
            }

            if (!System.IO.File.Exists(filePath))
            {
                throw new FilesOnlineException("Specified upload file does not exist on this machine.");
            }

            if (parent == null)
            {
                throw new FilesOnlineException("Not all parameters were supplied or were invalid.");
            }

            if ((threadUpload != null) && threadUpload.IsAlive)
            {
                throw new FilesOnlineException(
                    "Only one file can be upload at a time. Please wait for the current file to finish upload.");
            }

            fileUploader = new FileUploader(string.Format(Constants.BoxAPIUploadUrl, User.Sid), this) {Proxy = Proxy};
            fileUploader.SetField("location", parent.Id.ToString());
            fileUploading = filePath;
            threadUpload = new Thread(Upload);
            threadUpload.Start();
            Busy = true;
        }
开发者ID:preguntoncojonero,项目名称:mylifevn,代码行数:30,代码来源:BoxNetFilesOnlineProvider.cs


示例19: Create

        /// <summary>
        /// Creates a new empty Lua script in the specified project, in the specified folder.
        /// </summary>
        /// <param name="data">The solution creation data, usually derived from the user's input in a NewSolutionForm.</param>
        /// <returns>A new solution that can be loaded.</returns>
        public override Moai.Platform.Management.File Create(string name, Project project, Folder folder)
        {
            File f = null;

            // Determine where to place the file.
            if (folder == null)
            {
                // Place the file in the root of the project
                f = new File(project, project.ProjectInfo.DirectoryName, name);
                project.AddFile(f);
            }
            else
            {
                // Place the file in the specified folder
                f = new File(project, project.ProjectInfo.DirectoryName, System.IO.Path.Combine(folder.FolderInfo.Name, name));
                folder.Add(f);
            }

            // Write the contents of the data into the file.
            using (System.IO.StreamWriter writer = new System.IO.StreamWriter(f.FileInfo.FullName))
            {
                writer.WriteLine("-- An empty script file.");
                writer.WriteLine();
            }

            return f;
        }
开发者ID:rudybear,项目名称:moai-ide,代码行数:32,代码来源:ScriptTemplate.cs


示例20: AddFolder

        /// <summary>
        /// Add the folder into the media library.
        /// </summary>
        public void AddFolder(string path)
        {
            // make sure the folder isnt already in the list
            bool exists = false;
            this.Foreach (delegate (TreeModel model, TreePath tree_path, TreeIter iter)
            {
                Folder node = (Folder) model.GetValue (iter, 0);
                if (node.Path == path) exists = true;
                return exists;
            });

            // add the folder if it isnt already in the list
            if (exists)
                library.MainPage.ThrowError ("The folder is already in the library:\n" + path);
            else
            {
                Folder folder = new Folder (path);
                this.AppendValues (root_iter, folder);
                library.MainPage.DataManager.AddFolder (folder);

                // load the files within the directory
                Progress progress = new Progress (library.MediaBox);
                progress.Start (Utils.FileCount (path));
                progress.Push ("Waiting in queue:  " + Utils.GetFolderName (path));

                // queue process
                delegate_queue.Enqueue (delegate {
                    addDirRecurse (path, progress, folder);
                    progress.End ();
                });
            }
        }
开发者ID:gsterjov,项目名称:fusemc,代码行数:35,代码来源:Store.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FolderBrowserDialog类代码示例发布时间:2022-05-24
下一篇:
C# FocusedRowChangedEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap