Пример #1
0
 public void Close()
 {
     if (Globals.debug)
     {
         debugInfo.Write();
     }
 }
Пример #2
0
        /// #NAME#: #DESCRIPTION#
        public void f_87c9e177_3406_4660_8e25_a4eccf856dac()
        {
            //INI CODE PRCGUID: 87c9e177-3406-4660-8e25-a4eccf856dac

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas  = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CFormProcesoActivo CFormProcesoActivo = new ARQODE_UI.GestorProcesos.CFormProcesoActivo(vm);
            if (CFormProcesoActivo.TV_ViewsVars.SelectedNode.Text.EndsWith(".json"))
            {
                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 = "Variables";
                CInputDialog.Label1.Text      = "Nueva variable de vista";
                vm.Cancel_events = false;
                if (CInputDialog.InputDialog.ShowDialog() == DialogResult.OK)
                {
                    if (CInputDialog.textBox1.Text != "")
                    {
                        String view_path = Path.Combine(
                            App_globals.AppDataSection(dPATH.VIEWS).FullName,
                            CFormProcesoActivo.TV_ViewsVars.SelectedNode.FullPath);
                        JSonFile JView = new JSonFile(view_path);
                        (JView.jActiveObj["Variables"] as JArray).Add(CInputDialog.textBox1.Text);
                        CFormProcesoActivo.TV_ViewsVars.SelectedNode.Nodes.Add(CInputDialog.textBox1.Text);
                        JView.Write();
                    }
                }
            }

            //END CODE PRCGUID: 87c9e177-3406-4660-8e25-a4eccf856dac
        }
Пример #3
0
        /// #NAME#: #DESCRIPTION#
        public void f_e0724caf_1ddf_4e3b_82ec_52f91b944f62()
        {
            //INI CODE PRCGUID: e0724caf-1ddf-4e3b-82ec-52f91b944f62

            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("{"))
            {
                if (CVentanaProcesos.TV_Processes.SelectedNode.FullPath.EndsWith(".json"))
                {
                    JObject JPrcMove            = JObject.Parse(Origin_path);
                    String  Origin_process_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, JPrcMove["Process path"].ToString());
                    String  Origin_process_guid = JPrcMove["Process guid"].ToString();

                    // open orign file
                    JSonFile jOriginFile = new JSonFile(Origin_process_path);
                    JToken   JOriginPrc  = jOriginFile.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", Origin_process_guid));

                    // open target file
                    String   Target_process_namespace = CVentanaProcesos.TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace(".json", "").Replace("\\", ".");
                    String   Target_process_path      = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                    JSonFile JTargetFile = new JSonFile(Target_process_path);
                    if (JTargetFile.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", Origin_process_guid)) == null)
                    {
                        CStructModifications csmod = new CStructModifications(sys, App_globals);
                        csmod.MoveProcess_byGuid(Origin_process_guid, Target_process_namespace);

                        (JTargetFile.jActiveObj["processes"] as JArray).Add(JOriginPrc);
                        JTargetFile.Write();

                        JOriginPrc.Remove();
                        jOriginFile.Write();
                    }
                    else
                    {
                        MessageBox.Show("Ya existe un proceso con el Guid " + Origin_process_guid + " en el fichero de procesos " + CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                    }
                }
                else
                {
                    MessageBox.Show("Debes seleccionar un fichero del árbol de procesos donde mover el proceso seleccionado.");
                }
            }

            //END CODE PRCGUID: e0724caf-1ddf-4e3b-82ec-52f91b944f62
        }
Пример #4
0
        /// #NAME#: #DESCRIPTION#
        public void f_Nuevo_proceso()
        {
            //INI CODE PRCGUID: Nuevo proceso

            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 = "Nuevo proceso";
            CInputDialog.Label1.Text      = "Nombre del proceso";

            vm.Cancel_events = false;
            DialogResult dr = CInputDialog.InputDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                if (CInputDialog.textBox1.Text.Trim() != "")
                {
                    ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

                    TreeView TV_Processes = (TreeView)view.getCtrl("TV_Processes");
                    String   Process_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, TV_Processes.SelectedNode.FullPath);

                    // abrir plantilla
                    DirectoryInfo pprocs = Globals.AppDataSection(dPATH.PROCESSES);
                    if (pprocs.GetFiles("base_process.json").Length > 0)
                    {
                        // crear proceso usando la plantilla

                        JSonFile jplantilla_unit_proc = new JSonFile(pprocs.GetFiles("base_unit_process.json")[0].FullName);
                        jplantilla_unit_proc.jActiveObj[dPROCESS.GUID]        = Guid.NewGuid().ToString();
                        jplantilla_unit_proc.jActiveObj[dPROCESS.NAME]        = CInputDialog.textBox1.Text;
                        jplantilla_unit_proc.jActiveObj[dPROCESS.DESCRIPTION] = "";

                        // añadir el proceso a la lista de procesos del fichero
                        JSonFile jProcessFile = new JSonFile(Process_path);
                        (jProcessFile.get("processes") as JArray).Add(jplantilla_unit_proc.jActiveObj);
                        jProcessFile.Write();
                    }
                    else
                    {
                        MessageBox.Show("Plantilla de proceso 'base_process.json' no encontrada en: " + pprocs.FullName);
                    }
                }
            }

            //END CODE PRCGUID: Nuevo proceso
        }
Пример #5
0
        /// #NAME#: #DESCRIPTION#
        public void f_a6099e20_957f_477e_9ff5_92c4fc54e87c()
        {
            //INI CODE PRCGUID: a6099e20-957f-477e-9ff5-92c4fc54e87c

            ARQODE_UI.GestorProgramas.CVentanaProgramas     CVentanaProgramas     = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorControles.CFormControlesEventos CFormControlesEventos = new ARQODE_UI.GestorControles.CFormControlesEventos(vm);
            if ((CFormControlesEventos.TV_Controles.SelectedNode != null) && (CFormControlesEventos.TV_Controles.SelectedNode.Nodes.Count == 0))
            {
                String view_name = CFormControlesEventos.TV_Controles.SelectedNode.Parent.FullPath.Replace("\\", ".").Replace(".json", "");
                String view_file = Path.Combine(
                    App_globals.AppDataSection(dPATH.VIEWS).FullName,
                    CFormControlesEventos.TV_Controles.SelectedNode.Parent.FullPath);
                if (File.Exists(view_file))
                {
                    JSonFile jView    = new JSonFile(view_file);
                    JToken   JControl = jView.jActiveObj.SelectToken(String.Format("$.Controls[?(@.Guid == '{0}')]", CFormControlesEventos.TV_Controles.SelectedNode.Text));

                    if (JControl != null)
                    {
                        JObject JEvents = new JObject();
                        for (int i = 0; i < CFormControlesEventos.DG_EventosControl.RowCount; i++)
                        {
                            if ((CFormControlesEventos.DG_EventosControl[0, i].Value != null) && (CFormControlesEventos.DG_EventosControl[1, i].Value != null))
                            {
                                JProperty JEvent = new JProperty(CFormControlesEventos.DG_EventosControl[0, i].Value.ToString(),
                                                                 CFormControlesEventos.DG_EventosControl[1, i].Value.ToString());
                                JEvents.Add(JEvent);
                            }
                        }

                        if (JControl["Events"] != null)
                        {
                            JControl["Events"].Replace(JEvents);
                        }
                        else
                        {
                            JControl["Events"] = JEvents;
                        }

                        jView.Write();
                    }
                }
            }


            //END CODE PRCGUID: a6099e20-957f-477e-9ff5-92c4fc54e87c
        }
Пример #6
0
        /// <summary>
        /// Replace prc namespace in program files by namespace
        /// </summary>
        /// <param name="fi"></param>
        /// <param name="to_path"></param>
        private bool replace_prc_namespace_in_programs_by_namespace(FileInfo fi, String prc_namespace, String to_path)
        {
            JSonFile jProgram = new JSonFile(fi.FullName);
            bool     changed  = false;

            foreach (JToken Jnode in jProgram.getNodes(String.Format("$.Logic[?(@.Namespace == '{0}')]", prc_namespace)))
            {
                if (replace_in_programs)
                {
                    Jnode["Namespace"] = to_path;
                }
                changed = true;
            }
            if ((changed) && (replace_in_programs))
            {
                jProgram.Write();
            }
            return(changed);
        }
Пример #7
0
        /// #NAME#: #DESCRIPTION#
        public void f_781150d3_d1ed_4245_8fe9_9fe26a594e2f()
        {
            //INI CODE PRCGUID: 781150d3-d1ed-4245-8fe9-9fe26a594e2f

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

            String nombre_programa = Clipboard.GetText();

            if (nombre_programa != "")
            {
                // montamos el proceso destino:
                JObject JNewProc_2_program = new JObject();
                JNewProc_2_program.Add("Namespace", "System.Call");
                JNewProc_2_program.Add("Guid", "Call");
                JNewProc_2_program.Add("Name", "Call " + nombre_programa);
                JNewProc_2_program.Add("Description", "");

                JObject JConf = new JObject();
                JConf.Add("program", nombre_programa);
                JNewProc_2_program.Add("Configuration", JConf);


                JObject JIn = new JObject();
                JNewProc_2_program.Add("Inputs", JIn);

                JObject JOut = new JObject();
                JNewProc_2_program.Add("Outputs", JOut);

                // obtienes el programa
                String rutaPrograma = Path.Combine(
                    App_globals.AppDataSection(dPATH.CODE).FullName,
                    CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath);

                JSonFile jprograma = new JSonFile(rutaPrograma);
                (jprograma.jActiveObj["Logic"] as JArray).Add(JNewProc_2_program);
                jprograma.Write();
            }


            //END CODE PRCGUID: 781150d3-d1ed-4245-8fe9-9fe26a594e2f
        }
Пример #8
0
        /// #NAME#: #DESCRIPTION#
        public void f_c3697a76_651b_43ca_b89e_a035993a9d23()
        {
            //INI CODE PRCGUID: c3697a76-651b-43ca-b89e-a035993a9d23

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas  = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            ARQODE_UI.GestorProcesos.CFormProcesoActivo CFormProcesoActivo = new ARQODE_UI.GestorProcesos.CFormProcesoActivo(vm);
            if ((CFormProcesoActivo.TV_ViewsVars.SelectedNode != null) &&
                (CFormProcesoActivo.TV_ViewsVars.SelectedNode.Nodes.Count == 0))
            {
                JSonFile jView = new JSonFile(Path.Combine(
                                                  App_globals.AppDataSection(dPATH.VIEWS).FullName,
                                                  CFormProcesoActivo.TV_ViewsVars.SelectedNode.Parent.FullPath));
                JToken Jnode = jView.jActiveObj["Variables"].FirstOrDefault(x => x.ToString() == CFormProcesoActivo.TV_ViewsVars.SelectedNode.Text);
                Jnode.Remove();
                jView.Write();

                CFormProcesoActivo.TV_ViewsVars.SelectedNode.Remove();
            }

            //END CODE PRCGUID: c3697a76-651b-43ca-b89e-a035993a9d23
        }
Пример #9
0
        /// <summary>
        /// Replace program events
        /// </summary>
        /// <param name="fi"></param>
        /// <param name="from_path"></param>
        /// <param name="to_path"></param>
        private void replace_in_events(FileInfo fi, string from_path, string to_path)
        {
            JSonFile jView   = new JSonFile(fi.FullName);
            bool     changed = false;

            foreach (JToken Jnode in jView.getNodes("$.Controls[?(@.Events)]"))
            {
                foreach (JProperty jp in ((JObject)Jnode["Events"]).Properties())
                {
                    if (jp.Value.ToString().Equals(from_path))
                    {
                        jp.Value = to_path;
                        changed  = true;
                    }
                }
            }
            if (changed)
            {
                jView.Write();
            }
        }
Пример #10
0
        /// <summary>
        /// Replace var list in program IOC
        /// </summary>
        /// <param name="fi"></param>
        /// <param name="ReplacementVarList"></param>
        private void replace_in_programs_IOC(FileInfo fi, Dictionary <String, String> ReplacementVarList)
        {
            JSonFile jProgram = new JSonFile(fi.FullName);
            bool     changed  = false;

            // Loop into processes
            foreach (JToken Jnode in jProgram.getNode("$.Logic") as JArray)
            {
                // Loop into replacements
                foreach (String key in ReplacementVarList.Keys)
                {
                    // Replace Inputs, Outputs & Configuration
                    change_prop_in_array(Jnode["Inputs"] as JObject, ReplacementVarList[key], key, ref changed);
                    change_prop_in_array(Jnode["Outputs"] as JObject, ReplacementVarList[key], key, ref changed);
                    change_prop_in_array(Jnode["Configuration"] as JObject, ReplacementVarList[key], key, ref changed);
                }
            }
            if (changed)
            {
                jProgram.Write();
            }
        }
Пример #11
0
        /// <summary>
        /// Replace prc name in program files
        /// </summary>
        /// <param name="fi"></param>
        /// <param name="to_path"></param>
        private bool replace_prc_in_programs(FileInfo fi, String prc_guid, JObject prc_base)
        {
            JSonFile jProgram = new JSonFile(fi.FullName);
            bool     changed  = false;

            foreach (JToken Jnode in jProgram.getNodes(String.Format("$.Logic[?(@.Guid == '{0}')]", prc_guid)))
            {
                if (replace_in_programs)
                {
                    Jnode["Name"] = prc_base["Name"];
                }
                changed = true;

                // update program IOC changes from prc base
                Update_program_process_IOC(prc_base, Jnode as JObject);
            }
            if ((changed) && (replace_in_programs))
            {
                jProgram.Write();
            }
            return(changed);
        }
Пример #12
0
        /// #NAME#: #DESCRIPTION#
        public void f_246c3776_b78e_4702_b593_78ce31b6fef7()
        {
            //INI CODE PRCGUID: 246c3776-b78e-4702-b593-78ce31b6fef7

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

            JToken JProc = ((KeyValuePair <String, JToken>)CVentanaProcesos.LProcess.SelectedItem).Value;

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            CStructModifications csmod = new CStructModifications(sys, App_globals);
            String    prc_guid         = JProc["Guid"].ToString();
            ArrayList program_refs     = csmod.FindProcessInPrograms(prc_guid);

            if (program_refs.Count <= 0)
            {
                // Remove process
                String   prc_path = Path.Combine(App_globals.AppDataSection(dPATH.CODE).FullName, CVentanaProcesos.TV_Processes.SelectedNode.FullPath);
                JSonFile jProcess = new JSonFile(prc_path);
                JToken   jPrc     = jProcess.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", prc_guid));
                if (jPrc != null)
                {
                    jPrc.Remove();
                    jProcess.Write();
                }
            }
            else
            {
                //String message = "";
                //DirectoryInfo pprog = App_globals.DataSection(dPATH.PROGRAM);
                //foreach (String program in program_refs) { message += program.Replace(pprog.FullName + "\\", "") + "\r\n"; }
                //MessageBox.Show("Antes de eliminar este proceso debe eliminar las siguientes referencias en programas: \r\n" + message);

                String call_buscar_referencias = Config_str("Call a buscar referencias");
                vm.CallProgram(event_desc, call_buscar_referencias);
            }

            //END CODE PRCGUID: 246c3776-b78e-4702-b593-78ce31b6fef7
        }
Пример #13
0
        /// <summary>
        /// Replace in files
        /// </summary>
        /// <param name="fi"></param>
        /// <param name="from_path"></param>
        /// <param name="to_path"></param>
        private bool replace_in_programs_calls_IOC(FileInfo fi, string from_path, string to_path)
        {
            JSonFile jProgram = new JSonFile(fi.FullName);
            bool     changed  = false;

            // Search in calls
            foreach (JToken Jnode in jProgram.getNodes("$.Logic[?(@.Guid == 'Call')]"))
            {
                if (Jnode["Configuration"]["program"].ToString().Equals(from_path))
                {
                    if (replace_in_programs)
                    {
                        Jnode["Name"] = "Call " + to_path;
                        Jnode["Configuration"]["program"] = to_path;
                    }
                    changed = true;
                }
            }

            // Search in IOC only if to_path is filled
            if ((to_path != "") && (jProgram.jActiveObj["Logic"].ToString().Contains(from_path)))
            {
                // entrarpor las configuraciones
                foreach (JToken Jnode in jProgram.getNode("$.Logic") as JArray)
                {
                    // Replace Inputs, Outputs & Configuration
                    change_prop_in_array(Jnode["Inputs"] as JObject, to_path, from_path, ref changed);
                    change_prop_in_array(Jnode["Outputs"] as JObject, to_path, from_path, ref changed);
                    change_prop_in_array(Jnode["Configuration"] as JObject, to_path, from_path, ref changed);
                }
            }
            if ((changed) && (replace_in_programs))
            {
                jProgram.Write();
            }

            return(changed);
        }
Пример #14
0
 public void Write()
 {
     prcInfo.Write();
 }
Пример #15
0
        /// <summary>
        /// Export process to code folder in vs project
        /// </summary>
        /// <param name="fi"></param>
        /// <param name="mapedFile"></param>
        private void Export_Process(FileInfo fi)
        {
            #region Mapped process template file

            FileInfo f_prc_template = new DirectoryInfo(SYS_MAPS_PATH).GetFiles(dGLOBALS.MAPS_PROCESS)[0];
            String   prc_template   = File.ReadAllText(f_prc_template.FullName);
            #endregion

            #region Loop into processes

            JSonFile jProcess = new JSonFile(fi.FullName);
            if ((jProcess.jActiveObj[dPROCESS.PROCESSES] != null) && (fi.Name != "base_process.json"))
            {
                String functions      = "";
                String base_processes = "";

                #region create path to code

                // export code to
                String code_path   = (system_app) ? System_code_path : dEXPORTCODE.VS_CODE_PATH;
                String codeMapPath = Path.Combine(APP_VSPROJECT_PATH, code_path);

                String processes_path = DAPP_PRC.FullName;
                String file_path      = fi.FullName.Replace(processes_path, "");
                String relative_path  = "";
                String filename       = "";
                foreach (String dir in file_path.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (!dir.Contains(".json"))
                    {
                        relative_path = Path.Combine(relative_path, dir);
                        if (!Directory.Exists(Path.Combine(codeMapPath, relative_path)))
                        {
                            Directory.CreateDirectory(Path.Combine(codeMapPath, relative_path));
                        }
                    }
                    else
                    {
                        filename = dir.Replace(".json", ".cs");
                    }
                }
                #endregion

                #region Get code from logic and insert into process file

                foreach (JToken Jnode in jProcess.jActiveObj[dPROCESS.PROCESSES] as JArray)
                {
                    // Get code from logic
                    String Guid       = Jnode[dPROCESS.GUID].ToString();
                    String Name       = (Jnode[dPROCESS.NAME] != null) ? Jnode[dPROCESS.NAME].ToString() : "";
                    String Desciption = (Jnode[dPROCESS.DESCRIPTION] != null) ? Jnode[dPROCESS.DESCRIPTION].ToString() : "";
                    String prc_code   = CLogicEditor.get_Code_from_logic(ARQODE_PATH, Guid);

                    if ((prc_code == "") && (Jnode[dPROCESS.CODE] != null) && (Jnode[dPROCESS.CODE].ToString() != ""))
                    {
                        prc_code = System.Text.UTF8Encoding.UTF8.GetString(Convert.FromBase64String(Jnode[dPROCESS.CODE].ToString()));
                    }
                    if (prc_code != "")
                    {
                        // Save into current process
                        Jnode[dPROCESS.CODE] = Convert.ToBase64String(System.Text.UTF8Encoding.UTF8.GetBytes(prc_code));

                        // write replaced template file to mapped folder. Renaming guid to valid function name
                        functions += dEXPORTCODE.F_TEMPLATE.
                                     Replace(dEXPORTCODE.F_NAME, Name).
                                     Replace(dEXPORTCODE.F_DESCRIPTION, Desciption).
                                     Replace(dEXPORTCODE.F_FUNCTION_NAME, Utils.escape_sc(Guid)).
                                     Replace(dEXPORTCODE.F_CODE, prc_code);
                    }

                    #region Save base process string

                    JToken base_prc = Jnode.DeepClone();
                    if (Jnode[dPROCESS.CODE] != null)
                    {
                        ((JObject)base_prc).Property(dPROCESS.CODE).Remove();
                    }
                    base_processes += "public static string BP_" + Utils.escape_sc(Guid) +
                                      " { get { return \"" +
                                      Convert.ToBase64String(System.Text.UTF8Encoding.UTF8.GetBytes(base_prc.ToString()))
                                      + "\"; } } \r\n";
                    #endregion
                }
                jProcess.Write();
                #endregion

                if (functions != "")
                {
                    #region Save process file

                    prc_template = prc_template
                                   .Replace(dEXPORTCODE.F_FUNCTIONS, functions)            // Replace functions
                                   .Replace(dEXPORTCODE.F_BASE_PROCESSES, base_processes); // Replace base processs strings

                    File.WriteAllText(Path.Combine(codeMapPath, Path.Combine(relative_path, filename)), prc_template);
                    #endregion

                    #region Insert into VS project file

                    // Add node if not founded else remove from pj_compile list
                    if (!pj_compile_items.ContainsKey(Path.Combine(code_path, Path.Combine(relative_path, filename))))
                    {
                        XmlNode      xnode = x_pj.CreateNode(XmlNodeType.Element, dEXPORTCODE.VS_PJ_ITEM_COMPILE, null);
                        XmlAttribute xatt  = x_pj.CreateAttribute(dEXPORTCODE.VS_PJ_ATT_INCLUDE);
                        xatt.Value = Path.Combine(code_path, Path.Combine(relative_path, filename));
                        xnode.Attributes.Append(xatt);
                        x_item_group.AppendChild(xnode);
                        changes_in_pj = true;
                    }
                    else
                    {
                        pj_compile_items.Remove(Path.Combine(code_path, Path.Combine(relative_path, filename)));
                    }
                    #endregion
                }
            }
            #endregion
        }
Пример #16
0
 public void Close()
 {
     debugInfo.Write();
 }
Пример #17
0
 /// <summary>
 /// Save program json
 /// </summary>
 public void Save()
 {
     progInfo.Write();
 }
Пример #18
0
        /// #NAME#: #DESCRIPTION#
        public void f_Asignar_proceso()
        {
            //INI CODE PRCGUID: Asignar proceso
            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);

            if ((CVentanaProgramas.ArbolProgramas.SelectedNode != null) && (CVentanaProgramas.ArbolProgramas.SelectedNode.Text.EndsWith(".json")))
            {
                // obtenemos el proceso a incluir
                ListBox LProcess = (ListBox)view.getCtrl("LProcess");
                JToken  JProc    = ((KeyValuePair <String, JToken>)LProcess.SelectedItem).Value;

                // obtenemos la ruta del proceso
                TreeView TV_Processes = (TreeView)view.getCtrl("TV_Processes");
                if (TV_Processes.SelectedNode != null)
                {
                    String prc_namespace = TV_Processes.SelectedNode.FullPath.Replace(dPROCESS.FOLDER + "\\", "").Replace("\\", ".").Replace(".json", "");

                    // montamos el proceso destino:
                    JObject JNewProc_2_program = new JObject();
                    JNewProc_2_program.Add("Namespace", prc_namespace);
                    JNewProc_2_program.Add("Guid", JProc["Guid"].ToString());
                    JNewProc_2_program.Add("Name", JProc["Name"].ToString());
                    JNewProc_2_program.Add("Description", JProc["Description"].ToString());

                    JObject JConf = new JObject();
                    if (JProc["Configuration"].Count() > 0)
                    {
                        foreach (JToken jitem in (JArray)JProc["Configuration"])
                        {
                            JConf.Add(jitem.ToString(), "");
                        }
                    }
                    JNewProc_2_program.Add("Configuration", JConf);
                    JObject JIn = new JObject();
                    if (JProc["Inputs"].Count() > 0)
                    {
                        foreach (JToken jitem in (JArray)JProc["Inputs"])
                        {
                            JIn.Add(jitem.ToString(), "");
                        }
                    }
                    JNewProc_2_program.Add("Inputs", JIn);
                    JObject JOut = new JObject();
                    if (JProc["Outputs"].Count() > 0)
                    {
                        foreach (JToken jitem in (JArray)JProc["Outputs"])
                        {
                            JOut.Add(jitem.ToString(), "");
                        }
                    }
                    JNewProc_2_program.Add("Outputs", JOut);

                    // obtienes el programa
                    String rutaPrograma = Path.Combine(
                        App_globals.AppDataSection(dPATH.CODE).FullName,
                        CVentanaProgramas.ArbolProgramas.SelectedNode.FullPath);

                    JSonFile jprograma = new JSonFile(rutaPrograma);
                    (jprograma.jActiveObj["Logic"] as JArray).Add(JNewProc_2_program);
                    jprograma.Write();
                }
            }


            //END CODE PRCGUID: Asignar proceso
        }
Пример #19
0
        /// #NAME#: #DESCRIPTION#
        public void f_df797af7_6e48_40b0_96c3_7278d4d71ab7()
        {
            //INI CODE PRCGUID: df797af7-6e48-40b0-96c3-7278d4d71ab7

            ARQODE_UI.GestorProcesos.CFormProceso CFormProceso = new ARQODE_UI.GestorProcesos.CFormProceso(vm);
            JToken JProc = (JToken)CFormProceso.Proceso;

            JProc["Description"] = CFormProceso.TBDescription.Text;

            // Load inputs
            JArray JInputs = new JArray();

            foreach (String input in CFormProceso.TBInputs.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                JInputs.Add(input.Trim());
            }
            JProc["Inputs"] = JInputs;

            // Load outputs
            JArray JOutputs = new JArray();

            foreach (String output in CFormProceso.TBOutputs.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                JOutputs.Add(output.Trim());
            }
            JProc["Outputs"] = JOutputs;

            // Load configuration
            JArray JConfiguration = new JArray();

            foreach (String config in CFormProceso.TBConfiguration.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                JConfiguration.Add(config.Trim());
            }
            JProc["Configuration"] = JConfiguration;

            // Load configuration
            JArray JDefault_Configuration = new JArray();

            foreach (String def_config in CFormProceso.TBDefault_Configuration.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                if (def_config.Contains(":"))
                {
                    String[] name_value = def_config.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                    JDefault_Configuration.Add(new JObject(new JProperty(name_value[0].Trim(), name_value[1].Trim())));
                }
                else
                {
                    MessageBox.Show("Error in Default config format. Correct samples: default operator: sum, allow null: false, max intents: 4");
                }
            }
            JProc["Default_Configuration"] = JDefault_Configuration;

            // Process info
            if ((JProc["Name"].ToString() != CFormProceso.TBName.Text) && (!CFormProceso.TBName.Text.Trim().Equals("")))
            {
                JProc["Name"] = CFormProceso.TBName.Text;
            }

            ARQODE_UI.GestorProgramas.CVentanaProgramas CVentanaProgramas = new ARQODE_UI.GestorProgramas.CVentanaProgramas(vm);
            CStructModifications csmod = new CStructModifications(sys, App_globals);

            csmod.SaveProcess(JProc as JObject);

            //Replace process
            JSonFile JProcesses = new JSonFile(CFormProceso.FicheroProceso.ToString());
            JToken   JOld_prce  = JProcesses.getNode(String.Format("$.processes[?(@.Guid == '{0}')]", JProc["Guid"].ToString()));

            JOld_prce.Replace(JProc);
            JProcesses.Write();


            //END CODE PRCGUID: df797af7-6e48-40b0-96c3-7278d4d71ab7
        }
Пример #20
0
 public void Close()
 {
     errorInfo.Write();
 }
Пример #21
0
 public void Write()
 {
     tracerInfo.Write();
 }