예제 #1
0
        public void ResetList()
        {
            if (lvitems.LargeImageList == null)
            {
                lvitems.LargeImageList = new ImageList();
                lvitems.LargeImageList.TransparentColor = SkinEngine.LoadedSkin.ControlColor;
                lvitems.LargeImageList.ImageSize        = new Size(42, 42);
                FileSkimmer.GetAllTypes(lvitems.LargeImageList);
            }


            lvitems.Items.Clear();

            if (currentdir == "__system")
            {
                //List all drives
                foreach (var dir in Mounts)
                {
                    var item = FileSkimmer.ConstructItemAsMount(dir);
                    item.ImageKey = "Mount";
                    lvitems.Items.Add(item);
                }
            }
            else if (DirectoryExists(currentdir))
            {
                var up = new ListViewItem();
                up.ImageKey = "UpOne";
                up.Text     = "Up one";
                up.Tag      = "__..";
                lvitems.Items.Add(up);


                foreach (var dir in GetDirectories(currentdir))
                {
                    var item = FileSkimmer.ConstructItem(GetDirectoryInfo(dir));
                    item.ImageKey = "Directory";
                    lvitems.Items.Add(item);
                }

                foreach (var dir in GetFiles(currentdir))
                {
                    if (dir.EndsWith(cbfiletypes.SelectedItem as string))
                    {
                        var item = FileSkimmer.ConstructItem(GetFileInfo(dir));
                        item.ImageKey = FileSkimmerBackend.GetFileType(dir).ToString();
                        lvitems.Items.Add(item);
                    }
                }
            }
        }
예제 #2
0
 public Image GetImage(string path)
 {
     return(Applications.FileSkimmer.GetImage(FileSkimmerBackend.GetFileType(path)));
 }
예제 #3
0
        public void ResetList()
        {
            pinnedItems.Nodes.Clear();
            List <string> Pinned = new List <string>();

            if (FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
            {
                Pinned = JsonConvert.DeserializeObject <List <string> >(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
            }
            var node = new TreeNode();

            node.Text = "Pinned";
            PopulatePinned(node, Pinned.ToArray());
            pinnedItems.Nodes.Add(node);
            node.ExpandAll();

            if (lvitems.LargeImageList == null)
            {
                lvitems.LargeImageList = new ImageList();
                lvitems.LargeImageList.TransparentColor = SkinEngine.LoadedSkin.ControlColor;
                lvitems.LargeImageList.ImageSize        = new Size(42, 42);
                GetAllTypes(lvitems.LargeImageList);
            }



            lvitems.Items.Clear();
            if (currentdir == "__system")
            {
                //List all drives
                foreach (var dir in Mounts)
                {
                    var item = ConstructItemAsMount(dir);
                    item.ImageKey = "Mount";
                    lvitems.Items.Add(item);
                }
            }
            else if (DirectoryExists(currentdir))
            {
                var up = new ListViewItem();
                up.Text     = "Up one";
                up.ImageKey = "UpOne";
                up.Tag      = "__..";
                lvitems.Items.Add(up);


                foreach (var dir in GetDirectories(currentdir))
                {
                    var item = ConstructItem(GetDirectoryInfo(dir));
                    item.ImageKey = "Directory";
                    lvitems.Items.Add(item);
                }

                foreach (var dir in GetFiles(currentdir))
                {
                    var item = ConstructItem(GetFileInfo(dir));
                    item.ImageKey = FileSkimmerBackend.GetFileType(dir).ToString();
                    lvitems.Items.Add(item);
                }
            }
        }
예제 #4
0
        public void OpenFile(string path)
        {
            try
            {
                switch (FileSkimmerBackend.GetFileType(path))
                {
                case FileType.TextFile:
                    if (!Shiftorium.UpgradeInstalled("textpad"))
                    {
                        throw new Exception();
                    }

                    var txt = new TextPad();
                    AppearanceManager.SetupWindow(txt);
                    txt.LoadFile(path);
                    break;

                case FileType.Executable:
                    //NYI
                    throw new Exception();

                case FileType.Lua:
                    try
                    {
                        var runner = new Engine.Scripting.LuaInterpreter();
                        runner.ExecuteFile(path);
                    }
                    catch (Exception ex)
                    {
                        Infobox.Show("{LUA_ERROR}", ex.Message);
                    }
                    break;

                case FileType.JSON:
                    //NYI
                    throw new Exception();

                case FileType.Filesystem:
                    MountPersistent(path);
                    //If this doesn't fail...
                    FileSkimmerBackend.OpenDirectory((Mounts.Count - 1).ToString() + ":");
                    break;

                case FileType.Skin:
                    if (!Shiftorium.UpgradeInstalled("skinning"))
                    {
                        throw new Exception();
                    }

                    var sl = new Skin_Loader();
                    AppearanceManager.SetupWindow(sl);
                    sl.LoadedSkin = JsonConvert.DeserializeObject <Skin>(ReadAllText(path));
                    sl.SetupUI();
                    break;

                case FileType.Image:
                    if (!Shiftorium.UpgradeInstalled("artpad_open"))
                    {
                        throw new Exception();
                    }

                    var ap = new Artpad();
                    AppearanceManager.SetupWindow(ap);
                    ap.LoadPicture(path);
                    break;

                default:
                    throw new Exception();
                }
            }
            catch
            {
                Infobox.Show("{NO_APP_TO_OPEN}", "{NO_APP_TO_OPEN_EXP}");
            }
        }
예제 #5
0
 public static FileType GetFileType(string path)
 {
     return(FileSkimmerBackend.GetFileType(path));
 }