Esempio n. 1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                string path = Path.Combine(Globals.CurrentProject, treeView1.SelectedNode.FullPath);
                var dlg = new AskDlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    if (Directory.Exists(path))
                    {

                        if (!dlg.Awnser.Contains("."))
                        {
                            Directory.CreateDirectory(Path.Combine(path, dlg.Awnser));
                            Globals.TreeViewLoaded = false;
                            return;
                        }

                        if (dlg.Awnser.Contains("."))
                        {
                            var p = Path.Combine(path, dlg.Awnser);
                            File.WriteAllText(p, " ");
                            Globals.TreeViewLoaded = false;
                            return;
                        }
                    }

                }
            }
        }
Esempio n. 2
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {

                AskDlg dlg = new AskDlg();
                dlg.Quiestion = "Name:";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    var sel1 = treeView1.SelectedNode.Parent;
                    var sel2 = treeView1.SelectedNode;
                    var sel = "";
                    if (sel1 != null)
                    {
                        if (dlg.Awnser.Contains("."))
                        {
                            sel = sel2.FullPath.Replace(Global.CurrentProjectFile.Name + "\\", "");

                        }
                        else
                        {
                            sel = sel1.FullPath.Replace(Global.CurrentProjectFile.Name + "\\", "");
                        }
                    }

                    if (sel == "")
                    {
                        Global.CurrentProjectFile.Files.Add(dlg.Awnser);
                    }
                    else
                    {
                        Global.CurrentProjectFile.Files.Add(sel + "\\" + dlg.Awnser);
                    }

                    var p = Path.Combine(Global.CurrentProjectFilePath, "files", sel, dlg.Awnser);

                    if (!dlg.Awnser.Contains("."))
                    {
                        Directory.CreateDirectory(p);
                    }
                    else
                    {
                        File.Create(p);
                    }
                }
                Global.Save();
                buffer = null;
            }
            catch (Exception ee)
            {

            }
        }