Ejemplo n.º 1
0
        /// #NAME#: #DESCRIPTION#
        public void f_d7c92550_523c_4cb7_9223_c8da10a35e3d()
        {
            //INI CODE PRCGUID: d7c92550-523c-4cb7-9223-c8da10a35e3d

            ARQODE_UI.GestorProcesos.CVentanaProcesos CVentanaProcesos = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);
            if (CVentanaProcesos.TV_Processes.SelectedNode != null)
            {
                TreeNode NProcActivo = CVentanaProcesos.TV_Processes.SelectedNode;

                ARQODE_UI.ARQODE_UI.CInputDialog CInputDialog = new ARQODE_UI.ARQODE_UI.CInputDialog(vm);
                CInputDialog.InputDialog.AcceptButton = CInputDialog.BAceptar;
                CInputDialog.InputDialog.CancelButton = CInputDialog.BCancelar;

                CInputDialog.InputDialog.Text = "Renombrar carpeta";
                CInputDialog.Label1.Text      = "Nombre de la carpeta";
                CInputDialog.textBox1.Text    = NProcActivo.Text;

                vm.Cancel_events = false;
                DialogResult dr = CInputDialog.InputDialog.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

                    String di_antiguo = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, NProcActivo.FullPath);
                    String di_nuevo   = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName,
                                                     NProcActivo.FullPath.Substring(0, NProcActivo.FullPath.LastIndexOf("\\")));

                    if (di_antiguo.EndsWith(".json"))
                    {
                        String nombre_f = (CInputDialog.textBox1.Text.ToLower().EndsWith(".json")) ? CInputDialog.textBox1.Text : CInputDialog.textBox1.Text + ".json";

                        String from_path = NProcActivo.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");
                        String to_path   = from_path.Substring(0, from_path.IndexOf(".") + 1) + nombre_f.Replace(".json", "");

                        CStructModifications csmod = new CStructModifications(sys, App_globals);
                        csmod.MoveProcess_byNamespace(from_path, to_path);

                        di_nuevo = Path.Combine(di_nuevo, nombre_f);
                        File.Move(di_antiguo, di_nuevo);
                        NProcActivo.Text = nombre_f;
                    }
                    else
                    {
                        di_nuevo = Path.Combine(di_nuevo, CInputDialog.textBox1.Text);
                        if (Directory.Exists(di_antiguo))
                        {
                            DirectoryInfo di_ant = new DirectoryInfo(di_antiguo);
                            di_ant.MoveTo(di_nuevo);
                        }
                        else
                        {
                            Directory.CreateDirectory(di_nuevo);
                        }
                        NProcActivo.Text = CInputDialog.textBox1.Text;
                    }
                }
            }

            //END CODE PRCGUID: d7c92550-523c-4cb7-9223-c8da10a35e3d
        }
Ejemplo n.º 2
0
        /// #NAME#: #DESCRIPTION#
        public void f_e0ac24cc_d14e_4e0c_bb6b_da7a4942a916()
        {
            //INI CODE PRCGUID: e0ac24cc-d14e-4e0c-bb6b-da7a4942a916

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CVentanaProcesos   CVentanaProcesos  = new ARQODE_UI.GestorProcesos.CVentanaProcesos(vm);

            String Origin_path = Clipboard.GetText();

            if ((!Origin_path.StartsWith("{")) && (CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Contains(dPROCESS.FOLDER + "\\")))
            {
                DirectoryInfo pprocs           = App_globals.AppDataSection(dPATH.PROCESSES);
                String        Origin_full_path = Path.Combine(pprocs.FullName, Origin_path.Replace(".", "\\") + ".json");

                if (File.Exists(Origin_full_path))
                {
                    FileInfo fi = new FileInfo(Origin_full_path);
                    String   Target_full_path = Path.Combine(Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath), fi.Name);
                    String   Target_path      = (CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "") + "." + fi.Name).Replace(".json", "").Replace("\\", ".");

                    // Replace old program path ocurrencies
                    CStructModifications csmod = new CStructModifications(sys, App_globals);
                    csmod.MoveProcess_byNamespace(Origin_path, Target_path);

                    // File move
                    File.Move(Origin_full_path, Target_full_path);

                    CVentanaProcesos.contextMenu_Procesos.Items[2].Enabled = false;
                }
                else
                {
                    MessageBox.Show("Debe cortar un programa del árbol de programas antes de pegarlo");
                }
            }
            else
            {
                MessageBox.Show("Debe pegar el programa dentro del árbol de programas");
            }

            //END CODE PRCGUID: e0ac24cc-d14e-4e0c-bb6b-da7a4942a916
        }