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


C# OS.runCommand方法代码示例

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


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

示例1: BuildDirectoryDrawList

 private List<LSItem> BuildDirectoryDrawList(Folder f, int recItteration, int indentOffset, OS os)
 {
     var list = new List<LSItem>();
     var commandSeperationDelay = 0.019;
     for (var index1 = 0; index1 < f.folders.Count; ++index1)
     {
         var myIndex = index1;
         var lsItem = new LSItem
         {
             DisplayName = "/" + f.folders[index1].name,
             Clicked = () =>
             {
                 var num = 0;
                 for (var index = 0; index < os.navigationPath.Count - recItteration; ++index)
                 {
                     Action action = () => os.runCommand("cd ..");
                     if (num > 0)
                         os.delayer.Post(ActionDelayer.Wait(num*commandSeperationDelay), action);
                     else
                         action();
                     ++num;
                 }
                 Action action1 = () => os.runCommand("cd " + f.folders[myIndex].name);
                 if (num > 0)
                     os.delayer.Post(ActionDelayer.Wait(num*commandSeperationDelay), action1);
                 else
                     action1();
             },
             indent = indentOffset
         };
         list.Add(lsItem);
         indentOffset += 30;
         if (os.navigationPath.Count - 1 >= recItteration && os.navigationPath[recItteration] == index1)
             list.AddRange(BuildDirectoryDrawList(f.folders[index1], recItteration + 1, indentOffset, os));
         indentOffset -= 30;
     }
     for (var index1 = 0; index1 < f.files.Count; ++index1)
     {
         var myIndex = index1;
         var lsItem = new LSItem
         {
             DisplayName = f.files[index1].name,
             Clicked = () =>
             {
                 var num = 0;
                 for (var index = 0; index < os.navigationPath.Count - recItteration; ++index)
                 {
                     Action action = () => os.runCommand("cd ..");
                     if (num > 0)
                         os.delayer.Post(ActionDelayer.Wait(num*commandSeperationDelay), action);
                     else
                         action();
                     ++num;
                 }
                 Action action1 = () => os.runCommand("cat " + f.files[myIndex].name);
                 if (num > 0)
                     os.delayer.Post(ActionDelayer.Wait(num*commandSeperationDelay), action1);
                 else
                     action1();
             },
             indent = indentOffset
         };
         list.Add(lsItem);
     }
     if (f.folders.Count == 0 && f.files.Count == 0)
     {
         var lsItem = new LSItem
         {
             IsEmtyDisplay = true,
             indent = indentOffset
         };
         list.Add(lsItem);
     }
     return list;
 }
开发者ID:strangea,项目名称:OpenHacknet,代码行数:75,代码来源:DisplayModuleLSHelper.cs


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