示例#1
0
        private void deleteFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFileFolders.SelectedNode == null)
            {
                return;
            }

            TreeNode TN = treeFileFolders.SelectedNode;

            if (MessageBox.Show(this, "Do you want to delete the folder " + TN.FullPath + " including files?", Program.AppTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }

            string FullPath = TN.FullPath;

            if (TN.Parent == null)
            {
                treeFileFolders.Nodes.Remove(TN);
            }
            else
            {
                TN.Parent.Nodes.Remove(TN);
            }

            PackageDataUtilities.DeleteFolder(Package, FullPath);

            Modified = true;
        }
示例#2
0
        private void addmultipleFilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFileFolders.SelectedNode == null)
            {
                return;
            }

            OpenFileDialog cmdlg = new OpenFileDialog();

            cmdlg.Filter          = "All files|*.*";
            cmdlg.Title           = "Browse for source files";
            cmdlg.Multiselect     = true;
            cmdlg.CheckFileExists = true;
            if (cmdlg.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            foreach (string filename in cmdlg.FileNames)
            {
                PKGFile file = new PKGFile();
                file.FileName   = Path.GetFileName(filename);
                file.FolderName = treeFileFolders.SelectedNode.FullPath;
                if (file.FolderName.EndsWith("\\") == false)
                {
                    file.FolderName += "\\";
                }
                file.SrcFile         = filename;
                file.ID              = "";
                file.InstallThisFile = true;
                PackageDataUtilities.AddNewFile(Package, file);
            }
            LoadFileList();
        }
示例#3
0
 void NewPackage()
 {
     this.Text           = Program.AppTitle + " (Untitled)";
     CurrentFile         = "";
     Package             = new PKGRootData();
     Package.Folders     = new List <PKGFolder>();
     Package.Files       = new List <PKGFile>();
     Package.Description = "";
     Package.Title       = "new package";
     Package.HeaderID    = "FoxPackageScriptV1";
     Package.Outputfile  = "New Package.foxpkg";
     Package.Script      = Resources.PackageScriptTemplate;
     Package.PackageID   = Guid.NewGuid().ToString();
     Package.NoReceipt   = false;
     Package.VersionID   = 1;
     PackageDataUtilities.AddNewFolder(Package, "%SYSTEMROOT%");
     PackageDataUtilities.AddNewFolder(Package, "%SYSTEMROOT%\\SYSTEM32");
     PackageDataUtilities.AddNewFolder(Package, "%USERPROFILE%");
     PackageDataUtilities.AddNewFolder(Package, "%TEMP%");
     PackageDataUtilities.AddNewFolder(Package, "%PUBLIC%");
     PackageDataUtilities.AddNewFolder(Package, "%PROGRAMFILES%");
     PackageDataUtilities.AddNewFolder(Package, "%PROGRAMDATA%");
     PackageDataUtilities.AddNewFolder(Package, "%LOCALAPPDATA%");
     PackageDataUtilities.AddNewFolder(Package, "%APPDATA%");
     PackageDataUtilities.AddNewFolder(Package, "%COMMONPROGRAMFILES%");
     PackageDataUtilities.AddNewFolder(Package, "%INSTALLPATH%");
     Directory.SetCurrentDirectory(Program.AppPath);
 }
示例#4
0
        private void addFolderFromSystemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFileFolders.SelectedNode == null)
            {
                return;
            }

            string folder = treeFileFolders.SelectedNode.FullPath;

            if (folder.EndsWith("\\") == false)
            {
                folder += "\\";
            }

            FolderBrowserDialog fldr = new FolderBrowserDialog();

            fldr.Description         = "Browse for files to add to " + folder;
            fldr.ShowNewFolderButton = false;
            if (fldr.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            foreach (string filename in Directory.EnumerateFiles(fldr.SelectedPath, "*.*", SearchOption.AllDirectories))
            {
                PKGFile file = new PKGFile();
                file.FileName = Path.GetFileName(filename);
                string p = Path.GetDirectoryName(filename);
                p = p.Substring(fldr.SelectedPath.Length);
                if (p.StartsWith("\\") == true)
                {
                    p = p.Substring(1);
                }
                p = folder + p;
                if (p.EndsWith("\\") == false)
                {
                    p += "\\";
                }

                file.FolderName = p;
                if (file.FolderName.EndsWith("\\") == false)
                {
                    file.FolderName += "\\";
                }
                file.SrcFile         = filename;
                file.ID              = "";
                file.InstallThisFile = true;
                PackageDataUtilities.AddNewFile(Package, file);
                CreateFileFolder(file.FolderName);
            }

            LoadFileList();
        }
示例#5
0
        private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFileFolders.SelectedNode == null)
            {
                return;
            }

            TreeNode          TN = treeFileFolders.SelectedNode;
            frmFileProperties fp = new frmFileProperties(TN.FullPath);

            if (fp.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            PackageDataUtilities.AddNewFile(Package, fp.file);
            CreateFileFolder(fp.file.FolderName);
            LoadFileList();
        }
示例#6
0
        private void propertiesToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (treeFileFolders.SelectedNode == null)
            {
                return;
            }

            TreeNode  TN     = treeFileFolders.SelectedNode;
            PKGFolder folder = PackageDataUtilities.Findfolder(Package, TN.FullPath);

            if (folder == null)
            {
                return;
            }
            frmPropertiesFolder frm = new frmPropertiesFolder(folder);

            if (frm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                Modified = true;
            }
        }
示例#7
0
        void NewFolder(TreeNode TN)
        {
            string     FP   = TN == null ? "" : TN.FullPath;
            string     PATH = TN == null ? "" : TN.Name;
            frmAskText frm  = new frmAskText("Create folder", "Create folder to " + (PATH == "" ? "\\" : PATH), "", false);

            if (frm.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            TreeNode ntn = new TreeNode(frm.ReturnedText, 0, 0);

            ntn.Name = frm.ReturnedText;
            if (TN != null)
            {
                TN.Nodes.Add(ntn);
            }
            else
            {
                treeFileFolders.Nodes.Add(ntn);
            }
            PackageDataUtilities.AddNewFolder(Package, ntn.FullPath);
            Modified = true;
        }
示例#8
0
        private void renameFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeFileFolders.SelectedNode == null)
            {
                return;
            }

            TreeNode   TN   = treeFileFolders.SelectedNode;
            string     FP   = TN == null ? "" : TN.FullPath;
            string     PATH = TN == null ? "" : TN.Name;
            frmAskText frm  = new frmAskText("Rename folder", "Rename folder " + PATH, PATH, false);

            if (frm.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            foreach (TreeNode tn in TN.Parent != null ? TN.Parent.Nodes : treeFileFolders.Nodes)
            {
                if (frm.ReturnedText.ToLower() == tn.Name.ToLower())
                {
                    if (MessageBox.Show(this, "The folder " + frm.ReturnedText + " already exists. Do you want to merge the 2 folders?", Program.AppTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }
                    else
                    {
                        tn.Remove();
                        break;
                    }
                }
            }
            PackageDataUtilities.RenameFolder(Package, FP, frm.ReturnedText);
            Modified = true;
            treeFileFolders.SelectedNode.Name = frm.ReturnedText;
            treeFileFolders.SelectedNode.Text = frm.ReturnedText;
        }