Example #1
0
 static void Prefix(LSItem __instance, ref bool __state)
 {
     __state = false;
     if (__instance._name == modItemName)
     {
         __instance._name = string.Empty;
         __state          = true;
     }
 }
Example #2
0
        static void Postfix(LSItem __instance, ref bool __state, BitmapFont ____font, bool ____selected)
        {
            if (__state)
            {
                float xDraw = __instance.x + 10 + 10;

                ____font.Draw(GetName(____selected ? 0.5f : 0.7f), xDraw, __instance.y, Color.White, 0.8f);
                __instance._name = modItemName;
            }
        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);
        }
 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;
 }