Exemplo n.º 1
0
 /// <summary>
 /// Check integrity in program processes
 /// </summary>
 /// <param name="fi"></param>
 /// <param name="FindedPrograms"></param>
 /// <returns></returns>
 private bool check_integrity_in_process(FileInfo fi, ref ArrayList FindedPrograms)
 {
     try
     {
         JSonFile jProgram     = new JSonFile(fi.FullName);
         String   program_path = fi.FullName.Replace(Globals.AppDataSection(dPATH.PROGRAM).FullName + "\\", "").Replace("\\", ".").Replace(".json", "");
         TErrors  er           = new TErrors(Globals, program_path);
         foreach (JObject prc_node in jProgram.jActiveObj["Logic"] as JArray)
         {
             if (prc_node.Properties().Count() > 0)
             {
                 TProcess prc = new TProcess(sys, Globals, prc_node);
                 if (!CDataIntegrity.CheckAllVariables(prc, ref er))
                 {
                     FindedPrograms.Add(String.Format("Program: {0}: \r\n   -> Process: {1} \r\n   -> {2}",
                                                      program_path, prc.Name, er.getErrors().ToString()));
                 }
             }
         }
     }
     catch (Exception exc)
     {
         FindedPrograms.Add(exc.Message);
     }
     return(false);
 }
Exemplo n.º 2
0
        CView.CtrlStruct fireCtrl_str; // Controls struct who fire the event
        #endregion

        #region initialize

        /// <summary>
        /// Load all information from UI to work with
        /// </summary>
        /// <param name="viewManager"></param>
        /// <param name="eventDesc"></param>
        public CLogic(CSystem csystem, CViewsManager views_manager, CEventDesc eventDesc)
        {
            sys        = csystem;
            vm         = views_manager;
            Globals    = sys.Globals;
            errors     = sys.ProgramErrors;
            debug      = sys.ProgramDebug;
            event_desc = eventDesc;
            if (event_desc != null)
            {
                view = (event_desc.View_Guid != "") ? vm.getFirstView_byGuid(event_desc.View_Guid) : null;
                if (view != null)
                {
                    mainCtrl     = view.mainControl();
                    fireCtrl_str = view.getCtrlStruct(eventDesc.Control_Name);
                }
                fireCtrl = (Control)event_desc.fireCtrl;
                args     = event_desc.args;
            }
            MainView = ((view != null) && (Globals.get_str(dGLOBALS.MAIN_VIEW) == view.Name)) ? view : vm.getFirstView(Globals.get_str(dGLOBALS.MAIN_VIEW));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check all inputs in process
        /// </summary>
        /// <returns></returns>
        public static bool CheckAllVariables(TProcess prc, ref TErrors errors)
        {
            bool no_Input_errors = true;

            foreach (JToken input in prc.BaseInputs)
            {
                if ((!input.ToString().StartsWith("-")) && ((prc.Inputs.Count() == 0) || (prc.Inputs[input.ToString()].ToString() == "")))
                {
                    no_Input_errors = false;
                    errors.noInputs = String.Format("Error: no input '{0}' found in current program.", input.ToString());
                }
            }
            bool no_configs_errors = true;

            foreach (JToken conf in prc.BaseConfiguration)
            {
                if ((!conf.ToString().StartsWith("-")) && ((prc.Configuration.Count() == 0) || (prc.Configuration[conf.ToString()].ToString() == "")))
                {
                    no_configs_errors      = false;
                    errors.noConfiguration = String.Format("Error: no configuration '{0}' found in current program.", conf.ToString());
                }
            }

            bool no_outputs_errors = true;

            foreach (JToken output in prc.BaseOutputs)
            {
                if ((!output.ToString().StartsWith("-")) && ((prc.Outputs.Count() == 0) || (prc.Outputs[output.ToString()].ToString() == "")))
                {
                    no_outputs_errors = false;
                    errors.noOutputs  = String.Format("Error: no output '{0}' found out current program.", output.ToString());
                }
            }

            return(no_Input_errors && no_configs_errors && no_outputs_errors);
        }