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


C# Folder.Add方法代码示例

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


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

示例1: 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

示例2: CheckOverlayWithinBounds

        void CheckOverlayWithinBounds(Feature feature)
        {
            var errors = new List<string>();
            _geoArray = GeoArray.FromWellKnownText(feature.GetWellKnownText());
            OnPropertyChanged("GeoArray");
#if false
            if (_writeKML)
            {
                var kml = new KMLRoot();
                var folder = new Folder("Overlay Segment Test");
                var segments = _geoArray.Segments.ToArray();
                for (var segment = 0; segment < segments.Length; segment++)
                {
                    segments[segment].Placemark.name = string.Format("Segment {0}", segment);
                    folder.Add(segments[segment].Placemark);
                }
                kml.Document.Add(folder);
                var savePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "Overlay Segment Tests", "OverlaySegmentTest.kml");
                kml.Save(savePath);
                _writeKML = false;
            }
#endif
            if (_geoArray.HasCrossingSegments && !AreCrossingSegmentsAllowed) errors.Add("Perimeter segments may not cross");
            if (_locationBoundsRectangle != null && !_locationBoundsRectangle.Contains(feature.GetShape())) errors.Add("Perimeter must be within location bounds");
            var areaStyle = errors.Count > 0 ? _errorAreaStyle : _normalAreaStyle;
            _wpfMap.EditOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = areaStyle;
            _wpfMap.EditOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            Errors = errors.Count == 0 ? string.Empty : string.Join("\n", errors);
            HasErrors = errors.Count > 0;
            if (HasErrors) Debug.WriteLine(string.Format("Errors: {0}", Errors));
        }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:31,代码来源:EditablePolygonOverlayViewModel.cs

示例3: ProjectIsChangedAfterAddingDataItemInAFolder

 public void ProjectIsChangedAfterAddingDataItemInAFolder()
 {
     var project = CreateEmptyProject();
     var folder = new Folder();
     project.RootFolder.Items.Add(folder);
     project.IsChanged = false;
     folder.Add(new DataItem());
     Assert.IsTrue(project.IsChanged);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:9,代码来源:ProjectTest.cs

示例4: AddDataItemImplicitly

        public void AddDataItemImplicitly()
        {
            var folder = new Folder();

            var value = "test";

            folder.Add(value);

            Assert.AreEqual(1, folder.Items.Count);
            Assert.AreEqual(typeof(string), folder.DataItems.FirstOrDefault().ValueType);
            Assert.AreEqual(value, folder.DataItems.FirstOrDefault().Value);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:FolderTest.cs

示例5: Traverse

    static Folder Traverse(string root)
    {
        var folder = new Folder(root);

        foreach (string file in Directory.GetFiles(root))
            folder.Add(new File(file, new FileInfo(file).Length));

        foreach (string directory in Directory.GetDirectories(root))
            folder.AddFolder(Traverse(directory));

        return folder;
    }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:12,代码来源:Program.cs

示例6: Run

        public static void Run()
        {
            Folder dir1 = new Folder("dir1"),
                      dir2 = new Folder("dir2"),
                      dir3 = new Folder("dir3");

            File file1 = new File("file1"),
                file2 = new File("file2"),
                file3 = new File("file3"),
                file4 = new File("file4"),
                file5 = new File("file5");

            dir1.Add(file1);
            dir1.Add(dir2);
            dir2.Add(file3);
            dir2.Add(file4);
            dir2.Add(dir3);
            dir3.Add(file5);
            dir1.Add(file2);

            dir1.ls();
        }
开发者ID:mvladk,项目名称:dp2012,代码行数:22,代码来源:Before.cs

示例7: Create

        /// <summary>
        /// Creates a new empty folder 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)
        {
            Folder ff = null;

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

            // Create the new folder on disk.
            if (!Directory.Exists(ff.FolderInfo.FullName))
                Directory.CreateDirectory(ff.FolderInfo.FullName);

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

示例8: CloneProject

        public void CloneProject()
        {
            Project p = new Project();
            Folder f = new Folder();
            Folder f2 = new Folder();
            f.Add(f2);
            p.RootFolder.Items.Add(f);

            Project p2 = new Project();
            p2.RootFolder.Items.Add((Folder) f.DeepClone());
            Assert.AreEqual(p2.RootFolder.Items.Count, 1);
            Assert.AreEqual(p2.RootFolder.Folders.FirstOrDefault().Items.Count(), 1);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:ProjectTest.cs


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