Exemple #1
0
        private static IEnumerable <FormatViewDefinition> ViewsOf_FileSystemTypes(CustomControl[] sharedControls)
        {
#if UNIX
            if (ExperimentalFeature.IsEnabled("PSUnixFileStat"))
            {
                yield return(new FormatViewDefinition("childrenWithUnixStat",
                                                      TableControl.Create()
                                                      .GroupByProperty("PSParentPath", customControl: sharedControls[0])
                                                      .AddHeader(Alignment.Left, label: "UnixMode", width: 10)
                                                      .AddHeader(Alignment.Left, label: "User", width: 16)
                                                      .AddHeader(Alignment.Left, label: "Group", width: 16)
                                                      .AddHeader(Alignment.Right, label: "LastWriteTime", width: 18)
                                                      .AddHeader(Alignment.Right, label: "Size", width: 14)
                                                      .AddHeader(Alignment.Left, label: "Name")
                                                      .StartRowDefinition(wrap: true)
                                                      .AddPropertyColumn("UnixMode")
                                                      .AddPropertyColumn("User")
                                                      .AddPropertyColumn("Group")
                                                      .AddScriptBlockColumn(scriptBlock: @"'{0:d} {0:HH}:{0:mm}' -f $_.LastWriteTime")
                                                      .AddPropertyColumn("Size")
                                                      .AddPropertyColumn("NameString")
                                                      .EndRowDefinition()
                                                      .EndTable()));
            }
#endif

            yield return(new FormatViewDefinition("children",
                                                  TableControl.Create()
                                                  .GroupByProperty("PSParentPath", customControl: sharedControls[0])
                                                  .AddHeader(Alignment.Left, label: "Mode", width: 7)
                                                  .AddHeader(Alignment.Right, label: "LastWriteTime", width: 26)
                                                  .AddHeader(Alignment.Right, label: "Length", width: 14)
                                                  .AddHeader(Alignment.Left, label: "Name")
                                                  .StartRowDefinition(wrap: true)
                                                  .AddPropertyColumn("ModeWithoutHardLink")
                                                  .AddPropertyColumn("LastWriteTimeString")
                                                  .AddPropertyColumn("LengthString")
                                                  .AddPropertyColumn("NameString")
                                                  .EndRowDefinition()
                                                  .EndTable()));

            yield return(new FormatViewDefinition("childrenWithHardlink",
                                                  TableControl.Create()
                                                  .GroupByProperty("PSParentPath", customControl: sharedControls[0])
                                                  .AddHeader(Alignment.Left, label: "Mode", width: 7)
                                                  .AddHeader(Alignment.Right, label: "LastWriteTime", width: 26)
                                                  .AddHeader(Alignment.Right, label: "Length", width: 14)
                                                  .AddHeader(Alignment.Left, label: "Name")
                                                  .StartRowDefinition(wrap: true)
                                                  .AddPropertyColumn("Mode")
                                                  .AddPropertyColumn("LastWriteTimeString")
                                                  .AddPropertyColumn("LengthString")
                                                  .AddPropertyColumn("NameString")
                                                  .EndRowDefinition()
                                                  .EndTable()));

            yield return(new FormatViewDefinition("children",
                                                  ListControl.Create()
                                                  .GroupByProperty("PSParentPath", customControl: sharedControls[0])
                                                  .StartEntry(entrySelectedByType: new[] { "System.IO.FileInfo" })
                                                  .AddItemProperty(@"Name")
                                                  .AddItemProperty("LengthString", label: "Length")
                                                  .AddItemProperty(@"CreationTime")
                                                  .AddItemProperty(@"LastWriteTime")
                                                  .AddItemProperty(@"LastAccessTime")
                                                  .AddItemProperty(@"Mode")
                                                  .AddItemProperty(@"LinkType")
                                                  .AddItemProperty(@"Target")
                                                  .AddItemProperty(@"VersionInfo")
                                                  .EndEntry()
                                                  .StartEntry()
                                                  .AddItemProperty(@"Name")
                                                  .AddItemProperty(@"CreationTime")
                                                  .AddItemProperty(@"LastWriteTime")
                                                  .AddItemProperty(@"LastAccessTime")
                                                  .AddItemProperty(@"Mode")
                                                  .AddItemProperty(@"LinkType")
                                                  .AddItemProperty(@"Target")
                                                  .EndEntry()
                                                  .EndList()));

            yield return(new FormatViewDefinition("children",
                                                  WideControl.Create()
                                                  .GroupByProperty("PSParentPath", customControl: sharedControls[0])
                                                  .AddPropertyEntry("Name")
                                                  .AddPropertyEntry("Name", format: "[{0}]", entrySelectedByType: new[] { "System.IO.DirectoryInfo" })
                                                  .EndWideControl()));
        }