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


C# Folder类代码示例

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


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


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