Example #1
0
 public void buildDirectories(String text)
 {
     try
     {
         string[] directories = Directory.GetDirectories(text);
         string[] files       = Directory.GetFiles(text);
         this.view.Clear();
         foreach (string directory in directories)
         {
             this.view.Items.Add(getName(directory), (int)IMAGES_TYPE.FOLDER);
         }
         selectIcons(files);
         currentAdress = text;
     }
     catch (Exception)
     {
         if (isTXTorHTML(text))
         {
             //MessageBox.Show(text);
             TextPad textpad = new TextPad(text);
             textpad.ShowDialog();
             this.buildDirectories(this.currentAdress);
         }
     }
 }
Example #2
0
    public Find(TextPad NotePad)
    {
        int nSpace = Font.Height;

        this.NotePad = NotePad;

        Text        = "Find";
        ClientSize  = new Size(270, 90);
        Location    = NotePad.Location;
        MinimizeBox = false;
        MaximizeBox = false;
        Icon        = new Icon(GetType(), "TextPad.Images.APPLICATION.ICO");

        Caption          = new Label();
        Caption.Parent   = this;
        Caption.AutoSize = true;
        Caption.Text     = "Find what: ";
        Caption.Location = new Point(nSpace, nSpace + 3);

        Search              = new TextBox();
        Search.Parent       = this;
        Search.Location     = new Point(Caption.Right + 3, nSpace);
        Search.Size         = new Size(175, 50);
        Search.TextChanged += OnTextChanged;

        nSpace = Caption.Bottom + nSpace;

        MatchCase          = new CheckBox();
        MatchCase.Parent   = this;
        MatchCase.AutoSize = true;
        MatchCase.Location = new Point(nSpace - Caption.Bottom, nSpace + 2);
        MatchCase.Text     = "Match Case";

        FindButton          = new Button();
        FindButton.Parent   = this;
        FindButton.Location = new Point(MatchCase.Right, nSpace);
        FindButton.Text     = "Find";
        FindButton.Click   += OnFind;

        FindNextButton          = new Button();
        FindNextButton.Parent   = this;
        FindNextButton.Location = new Point(FindButton.Right + 3, nSpace);
        FindNextButton.Text     = "Find Next";
        FindNextButton.Enabled  = false;
        FindNextButton.Click   += OnFindNext;
    }
Example #3
0
    public GoTo(TextPad NotePad)
    {
        int nSpace = Font.Height;

        this.NotePad = NotePad;
        Text         = "Go To Line";
        ClientSize   = new Size(205, 90);
        Location     = NotePad.Location;
        MinimizeBox  = false;
        MaximizeBox  = false;
        Icon         = new Icon(GetType(), "TextPad.Images.APPLICATION.ICO");

        Caption          = new Label();
        Caption.Parent   = this;
        Caption.AutoSize = true;
        Caption.Text     = "Line Number: ";
        Caption.Location = new Point(nSpace, nSpace + 3);

        GoToLine           = new TextBox();
        GoToLine.Parent    = this;
        GoToLine.Location  = new Point(Caption.Right + 3, nSpace);
        GoToLine.Size      = new Size(100, 50);
        GoToLine.KeyPress += OnTextChanged;

        nSpace = Caption.Bottom + nSpace;

        GoToButton          = new Button();
        GoToButton.Parent   = this;
        GoToButton.AutoSize = true;
        GoToButton.Location = new Point(nSpace - Caption.Bottom + 10, nSpace);
        GoToButton.Text     = "OK";
        GoToButton.Enabled  = false;
        GoToButton.Click   += OnGotoLine;

        Cancel          = new Button();
        Cancel.Parent   = this;
        Cancel.AutoSize = true;
        Cancel.Location = new Point(GoToButton.Right + 5, nSpace);
        Cancel.Text     = "Cancel";
        Cancel.Click   += OnCancel;
    }
Example #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}");
            }
        }
Example #5
0
    public Replace(TextPad NotePad)
    {
        int nSpaceX = Font.Height;
        int nSpaceY = Font.Height;

        this.NotePad = NotePad;

        Text        = "Replace";
        ClientSize  = new Size(330, 155);
        Location    = NotePad.Location;
        MinimizeBox = false;
        MaximizeBox = false;
        Icon        = new Icon(GetType(), "TextPad.Images.APPLICATION.ICO");

        Caption          = new Label();
        Caption.Parent   = this;
        Caption.AutoSize = true;
        Caption.Text     = "Find what: ";
        Caption.Location = new Point(nSpaceX, nSpaceY + 3);

        Search              = new TextBox();
        Search.Parent       = this;
        Search.Location     = new Point(Caption.Right + 18, nSpaceY);
        Search.Size         = new Size(225, 50);
        Search.TextChanged += OnTextChanged;

        nSpaceY = Caption.Bottom + nSpaceY;

        Caption          = new Label();
        Caption.Parent   = this;
        Caption.AutoSize = true;
        Caption.Text     = "Replace with: ";
        Caption.Location = new Point(nSpaceX, nSpaceY + 3);

        ReplaceText          = new TextBox();
        ReplaceText.Parent   = this;
        ReplaceText.Location = new Point(Caption.Right + 2, nSpaceY);
        ReplaceText.Size     = new Size(225, 50);

        nSpaceY = Caption.Bottom + nSpaceY - Search.Bottom;

        MatchCase          = new CheckBox();
        MatchCase.Parent   = this;
        MatchCase.AutoSize = true;
        MatchCase.Location = new Point(nSpaceX, nSpaceY + 3);
        MatchCase.Text     = "Match Case";

        nSpaceY = MatchCase.Bottom;

        FindButton          = new Button();
        FindButton.Parent   = this;
        FindButton.Location = new Point(nSpaceX - 5, nSpaceY + nSpaceX);
        FindButton.Text     = "Find";
        FindButton.Click   += OnFind;

        FindNextButton          = new Button();
        FindNextButton.Parent   = this;
        FindNextButton.Location = new Point(FindButton.Right + 3, nSpaceY + nSpaceX);
        FindNextButton.Text     = "Find Next";
        FindNextButton.Enabled  = false;
        FindNextButton.Click   += OnFindNext;

        ReplaceButton          = new Button();
        ReplaceButton.Parent   = this;
        ReplaceButton.Location = new Point(FindNextButton.Right + 5, nSpaceY + nSpaceX);
        ReplaceButton.Text     = "Replace";
        ReplaceButton.Click   += OnReplace;

        ReplaceAllButton          = new Button();
        ReplaceAllButton.Parent   = this;
        ReplaceAllButton.Location = new Point(ReplaceButton.Right + 3, nSpaceY + nSpaceX);
        ReplaceAllButton.Text     = "Replace All";
        ReplaceAllButton.Click   += OnReplaceAll;
    }
Example #6
0
        private void textPadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var t = new TextPad();

            ShiftWM.Init(t, "TextPad", Resources.iconTextPad);
        }