示例#1
0
        protected override void Initialise()
        {
            base.Initialise();

            FileExplorerRender = new FileExplorer(this.Body, this)
            {
                NodeViewType = NodeViewType.Medium_Icons
            };
            BackColor           = "cornflowerblue";
            Body.Style.Overflow = Bridge.Html5.Overflow.Auto;
        }
示例#2
0
        public static FileExplorerNode CreateNode(string path, NodeViewType nvt, FileExplorer parent, bool IsFile = false)
        {
            var fen = new FileExplorerNode()
            {
                IsFile = IsFile, nodeViewType = nvt
            };

            fen.parent    = parent;
            fen.Name      = Path.GetFileName(path);
            fen.Directory = Path.GetDirectoryName(path);
            fen.FullPath  = path;
            fen.Icon      = IconRepository.GetIconByFileName(fen.Name);

            fen.CreateHtmlNode();

            return(fen);
        }
示例#3
0
        private void IncrementLine()
        {
            string cmd = CommandInput.Value;

            if (cmd.Length > 0)
            {
                CommandInput.Value = "";

                var SpanText = new HTMLSpanElement();
                FillHorizontalControlWithParent(SpanText, 2);
                SpanText.Style.WhiteSpace = WhiteSpace.NoWrap;
                SetCommandLineElement(SpanText);
                SpanText.InnerHTML = cmd;
                SpanText.Style.Top = (Global.ParseInt(CommandInput.Style.Height) * Line) + 3 + "px";
                CommandPanel.AppendChild(SpanText);
                CommandLines.Add(SpanText);
            }
            Line++;
            CommandInput.Style.Top = (Global.ParseInt(CommandInput.Style.Height) * Line) + "px";
            CommandPanel.ScrollTop = CommandPanel.ScrollHeight;

            if (cmd.ToLower() == "clear")
            {
                Reset();
            }
            else if (cmd.ToLower() == "toggle bodyoverlay")
            {
                ShowBodyOverLay = !ShowBodyOverLay;
            }
            else if (cmd.ToLower().StartsWith("cd "))
            {
                currentcd += "\\" + cmd.Substring(3);
                Text       = "Console - Path: " + currentcd;
            }
            else if (cmd.ToLower().StartsWith("dir"))
            {
                string location;

                if (cmd.ToLower().StartsWith("dir "))
                {
                    location = cmd.Substring("dir ".Length);
                }
                else
                {
                    location = currentcd;
                }

                foreach (string item in Directory.GetDirectories(location))
                {
                    WriteLine(item);
                }
                foreach (string item in Directory.GetFiles(location))
                {
                    WriteLine(item);
                }
            }
            else if (cmd.ToLower().StartsWith("createfile "))
            {
                string pathAndFile = currentcd + @"\" + cmd.Substring("createfile ".Length);

                File.WriteAllText(pathAndFile, "");

                FileExplorer.FileChangeAt(Path.GetDirectoryName(pathAndFile));
            }
            else if (cmd.ToLower().StartsWith("deletefile "))
            {
                string pathAndFile = currentcd + @"\" + cmd.Substring("deletefile ".Length);

                File.Delete(pathAndFile);

                FileExplorer.FileChangeAt(Path.GetDirectoryName(pathAndFile));
            }
            else if (cmd.ToLower().StartsWith("createdir "))
            {
                string pathAndFile = currentcd + @"\" + cmd.Substring("createdir ".Length);

                Directory.Create(pathAndFile);

                FileExplorer.FileChangeAt(Path.GetDirectoryName(pathAndFile));
            }
        }