Exemplo n.º 1
0
        private void OnMenuEditDLL(object sender, EventArgs e)
        {
            // open file dialog
            OpenFileDialog fd = new OpenFileDialog
            {
                Filter      = "Component (*.dll)|*.dll|All Files|*.*",
                FilterIndex = 0
            };

            if (DialogResult.OK == fd.ShowDialog())
            {
                // make a copy
                string filePathCopy = Path.ChangeExtension(Path.GetTempFileName(), "dll");
                File.Copy(fd.FileName, filePathCopy, true);
                // form plugin editor
                FormPluginEditor editorForm = new FormPluginEditor
                {
                    PluginPath = filePathCopy,
                    OutputPath = fd.FileName
                };
                if (DialogResult.OK == editorForm.ShowDialog())
                {
                }
                // try and delete copy file
                try { File.Delete(filePathCopy); }
                catch (Exception /*ex*/) { }
            }
        }
Exemplo n.º 2
0
 public void OnToolStripEditComponentCode(object sender, EventArgs e)
 {
     try
     {
         if (!(treeView.SelectedNode.Tag is NodeTag nodeTag))
         {
             return;
         }
         PPDataContext           db       = new PPDataContext();
         Pic.DAL.SQLite.TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, nodeTag.TreeNode);
         if (null == treeNode)
         {
             return;
         }
         Document doc = treeNode.Documents(db)[0];
         if (null == doc)
         {
             return;
         }
         Pic.DAL.SQLite.Component comp = doc.Components[0];
         if (null == comp)
         {
             return;
         }
         // output Guid / path
         Guid   outputGuid = Guid.NewGuid();
         string outputPath = Pic.DAL.SQLite.File.GuidToPath(db, outputGuid, "dll");
         // form plugin editor
         FormPluginEditor editorForm = new FormPluginEditor();
         editorForm.PluginPath = doc.File.Path(db);
         editorForm.OutputPath = outputPath;
         if (DialogResult.OK == editorForm.ShowDialog())
         {
             _log.Info("Component successfully modified!");
             doc.File.Guid = outputGuid;
             db.SubmitChanges();
             // clear component cache in plugin viewer
             ComponentLoader.ClearCache();
             // update pluginviewer
             pluginViewCtrl.PluginPath = outputPath;
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Exemplo n.º 3
0
 private void toolStripMenuItemEditDLL_Click(object sender, EventArgs e)
 {
     // open file dialog
     OpenFileDialog fd = new OpenFileDialog();
     fd.Filter = "Component (*.dll)|*.dll|All Files|*.*";
     fd.FilterIndex = 0;
     if (DialogResult.OK == fd.ShowDialog())
     {
         // make a copy
         string filePathCopy = Path.ChangeExtension(Path.GetTempFileName(), "dll");
         System.IO.File.Copy(fd.FileName, filePathCopy, true);
         // form plugin editor
         FormPluginEditor editorForm = new FormPluginEditor();
         editorForm.PluginPath = filePathCopy;
         editorForm.OutputPath = fd.FileName;
         if (DialogResult.OK == editorForm.ShowDialog()) { }
         // try and delete copy file
         try { System.IO.File.Delete(filePathCopy); }
         catch (Exception /*ex*/) { }
     }
 }
Exemplo n.º 4
0
 private void toolStripEditComponentCode_Click(object sender, EventArgs e)
 {
     try
     {
         NodeTag nodeTag = _treeViewCtrl.SelectedNode.Tag as NodeTag;
         if (null == nodeTag) return;
         PPDataContext db = new PPDataContext();
         Pic.DAL.SQLite.TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, nodeTag.TreeNode);
         if (null == treeNode) return;
         Pic.DAL.SQLite.Document doc = treeNode.Documents(db)[0];
         if (null == doc) return;
         Pic.DAL.SQLite.Component comp = doc.Components[0];
         if (null == comp) return;
         // output Guid / path
         Guid outputGuid = Guid.NewGuid();
         string outputPath = Pic.DAL.SQLite.File.GuidToPath(db, outputGuid, "dll");
         // form plugin editor
         FormPluginEditor editorForm = new FormPluginEditor();
         editorForm.PluginPath = doc.File.Path(db);
         editorForm.OutputPath = outputPath;
         if (DialogResult.OK == editorForm.ShowDialog())
         {
             _log.Info("Component successfully modified!");
             doc.File.Guid = outputGuid;
             db.SubmitChanges();
             // clear component cache in plugin viewer
             ComponentLoader.ClearCache();
             // update pluginviewer
             _pluginViewCtrl.PluginPath = outputPath;
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }