Exemplo n.º 1
0
 public CalculatorReplLoop(ICalculator calculator, IInputService inputService, IOutputService outputService, IInputParserService parsingService)
 {
     this.calculator = calculator;
     this.inputService = inputService;
     this.outputService = outputService;
     this.parsingService = parsingService;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Shows the help message.
        /// </summary>
        public static void Execute(IOutputService outputService)
        {
            var resourceName = string.Format("{0}.Actions.Help.txt", typeof(ShowHelpAction).Assembly.GetName().Name);

            //  Load the resource.
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
            {
                if(stream == null)
                    throw new InvalidOperationException("Unable to access resource " + resourceName);
                using (var reader = new StreamReader(stream))
                {
                    outputService.WriteMessage(reader.ReadToEnd());
                }
            }

            outputService.WriteMessage("To get help:");
            outputService.WriteMessage("    srm help");
            outputService.WriteMessage("");
            outputService.WriteMessage("To install a server:");
            outputService.WriteMessage("    srm install <path to SharpShell server> <parameters>");
            outputService.WriteMessage("Parameters:");
            outputService.WriteMessage("    -codebase: Optional. Installs a server from a file location, not the GAC.");
            outputService.WriteMessage("");
            outputService.WriteMessage("To uninstall a server:");
            outputService.WriteMessage("    srm uninstall <path to SharpShell server>");
            outputService.WriteMessage("");
        }
Exemplo n.º 3
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="ShaderPerf"/> class.
        /// </summary>
        /// <param name="outputService">The output service.</param>
        public ShaderPerf(IOutputService outputService)
        {
            if (outputService == null)
                throw new ArgumentNullException(nameof(outputService));

            _outputService = outputService;
        }
 public PowerShellTaskFactory(IOutputService outputService, ICommandErrorReporter errorReporter, ICommandLogParser logParser, IShellCommandRunner commandRunner)
 {
     this.outputService = outputService;
     this.errorReporter = errorReporter;
     this.logParser = logParser;
     this.commandRunner = commandRunner;
 }
Exemplo n.º 5
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="GameContentBuildLogger"/> class.
        /// </summary>
        public GameContentBuildLogger(IOutputService outputService)
        {
            if (outputService == null)
                throw new ArgumentNullException(nameof(outputService));

            _outputService = outputService;
        }
Exemplo n.º 6
0
 public FruitMixer(IFruitProvider provider, IFruitPrompter prompter, IFruitPicker picker, IOutputService outputService, IDbHandler dbHandler)
 {
     _provider = provider;
     _prompter = prompter;
     _picker = picker;
     _outputService = outputService;
     _dbHandler = dbHandler;
 }
Exemplo n.º 7
0
 public NaggerRunner(ITimeService timeService,
     IInputService inputService, IOutputService outputService, IRemoteRunner remoteRunner, ISettingsService settingsService)
 {
     _timeService = timeService;
     _inputService = inputService;
     _outputService = outputService;
     _remoteRunner = remoteRunner;
     _settingsService = settingsService;
 }
Exemplo n.º 8
0
 public JiraRunner(IOutputService outputService, ITaskService taskService, ITimeService timeService,
     IProjectService projectService, IInputService inputService)
 {
     _outputService = outputService;
     _taskService = taskService;
     _timeService = timeService;
     _projectService = projectService;
     _inputService = inputService;
 }
Exemplo n.º 9
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildLogger"/> class.
        /// </summary>
        /// <param name="outputService">The output service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="outputService"/> is <see langword="null"/>.
        /// </exception>
        public BuildLogger(IOutputService outputService)
        {
            if (outputService == null)
                throw new ArgumentNullException(nameof(outputService));

            _outputService = outputService;
            _stringBuilder = new StringBuilder();
            Verbosity = LoggerVerbosity.Normal;
        }
Exemplo n.º 10
0
 public FileMonitor(ISolutionFilesService solutionFilesService, IGlobMatcher globMatcher, IFileChangeSubscriber fileChangeSubscriber, IOutputService outputService)
 {
     this.solutionFilesService = solutionFilesService;
     this.globMatcher = globMatcher;
     this.fileChangeSubscriber = fileChangeSubscriber;
     this.outputService = outputService;
     this.monitoredFilesField = new ConcurrentDictionary<string, MonitoredFile>();
     this.monitoredProjectsField = new ConcurrentDictionary<string, MonitoredFile>();
 }
        public DefaultFileEventListenerFactory(ISolutionFilesService solutionFilesService, IVsFileChangeEx fileChangeService, IOutputService outputService, ICommandErrorReporter errorReporter)
        {
            this.solutionFilesService = solutionFilesService;
            this.fileChangeService = fileChangeService;
            this.outputService = outputService;

            this.globMatcher = new RegexGlobMatcher();
            this.onChangeTaskDispatcher = new SynchronousOnChangeTaskDispatcher(this.outputService);
            this.actionFactory = new PowerShellGooseActionFactory(new PowerShellTaskFactory(this.outputService, errorReporter, new JsonCommandLogParser()), new PowerShellCommandBuilder());
        }
Exemplo n.º 12
0
        /// <summary>
        /// Enables the event log.
        /// </summary>
        public static void Execute(IOutputService outputService)
        {
            //  SRM runs as an admin, so using the event logger will create the event log.
            //  The event log will be created successfully as we have elevated priviledges.
            var logger = new EventLogLogger();
            logger.LogMessage("Enabling the Event Log for SharpShell.");

            //  Let the user know we're in business.
            outputService.WriteSuccess("Event log enabled.");
        }
Exemplo n.º 13
0
        internal BuildLogger(IApp app, Document doc, ScintillaControl sci, BuildOptions options)
        {
            this.app = app;
            this.doc = doc;
            this.sci = sci;
            this.options = options;

            app.CloseView("ErrorList");
            this.err = app.GetService<IErrorListService>();
            this.output = app.GetService<IOutputService>();
        }
Exemplo n.º 14
0
        private static void SetConfig(IOutputService outputService, List<string> parameters)
        {
            //  We must have a key and value.
            if (parameters.Count != 2)
            {
                outputService.WriteError(string.Format("Incorrect syntax. Use: srm config <setting> <value>"));
                return;
            }

            //  Get the setting and value.
            var setting = parameters[0];
            var value = parameters[1];

            //  Get the config.
            var config = SystemConfigurationProvider.Configuration;

            //  Set the setting.
            if (string.Compare("LoggingMode", setting, StringComparison.OrdinalIgnoreCase) == 0)
            {
                //  Try and parse the setting. If we fail, show an error.
                LoggingMode mode;
                if (Enum.TryParse(value, true, out mode) == false)
                {
                    const LoggingMode allFlags = LoggingMode.Disabled | LoggingMode.Debug | LoggingMode.EventLog | LoggingMode.File;
                    outputService.WriteError(string.Format("Invalid value '{0}'. Acceptible values are: {1}", value, allFlags));
                    return;
                }

                //  Set the logging mode.
                config.LoggingMode = mode;

                //  Save back to the registry.
                SystemConfigurationProvider.Save();

                //  Update the user.
                outputService.WriteSuccess(string.Format("Set LoggingMode to {0}", mode));
            }
            else if (string.Compare("LogPath", setting, StringComparison.OrdinalIgnoreCase) == 0)
            {
                //  Set the path.
                config.LogPath = value;

                //  Save back to the registry.
                SystemConfigurationProvider.Save();

                //  Update the user.
                outputService.WriteSuccess(string.Format("Set LogPath to {0}", value));
            }
            else
            {
                //  Show an error.
                outputService.WriteError(string.Format("{0} is not a valid config setting. Valid settings are LoggingMode and LogPath.", value));
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        /// <param name="outputService">The output service.</param>
        /// <param name="parameters">The parameters.</param>
        public static void Execute(IOutputService outputService, IEnumerable<string> parameters)
        {
            //  Enumerate the parameters.
            var parametersList = parameters.ToList();

            //  If we have no parameters, we show config.
            if (parametersList.Any() == false)
                ShowConfig(outputService);
            else
                SetConfig(outputService, parametersList);

        }
Exemplo n.º 16
0
        public SolutionEventListener(IVsSolution solution, IFileEventListenerFactory fileEventListenerFactory, IOutputService outputService)
        {
            this.solution = solution;
            this.fileEventListenerFactory = fileEventListenerFactory;
            this.outputService = outputService;

            this.fileEventListeners = new ConcurrentDictionary<string, List<WatchItem>>();

            this.monitorCookie = 0;
            if (this.solution != null)
            {
                this.solution.AdviseSolutionEvents(this, out this.monitorCookie);
            }
        }
        public void InitializeTest()
        {
            // Create fake dependencies
            this.notificationConfigurationService = A.Fake<INotificationConfigurationService>();
            this.bitcoinExchangeRatesService = A.Fake<IBitcoinExchangeRatesService>();
            this.smtpService = A.Fake<ISmtpService>();
            this.outputService = A.Fake<IOutputService>();

            // Create test subject
            this.bitcoinPriceNotificationRobot = new BitcoinPriceNotificationRobot(
                this.notificationConfigurationService,
                this.bitcoinExchangeRatesService,
                this.smtpService,
                this.outputService);
        }
Exemplo n.º 18
0
        protected override void Initialize()
        {
            var solution = (IVsSolution)this.GetService(typeof(SVsSolution));

            this.solutionFilesService = new SolutionFilesService(solution);
            this.outputService = this.outputService ?? new OutputService(this);
            this.fileChangeService = this.fileChangeService ?? (IVsFileChangeEx)this.GetService(typeof(SVsFileChangeEx));

            var errorListProviderFacade = new GooseErrorListProviderFacade(this, this.solutionFilesService);
            var errorTaskHandler = new GooseErrorTaskHandler(errorListProviderFacade);
            this.errorReporter = new CommandErrorReporter(errorTaskHandler, new JsonCommandLogParser());

            var fileEventListenerFactory = new DefaultFileEventListenerFactory(solutionFilesService, this.fileChangeService, this.outputService, errorReporter);
            this.solutionEventListener = this.solutionEventListener ?? new SolutionEventListener(solution, fileEventListenerFactory, this.outputService);
            base.Initialize();
        }
Exemplo n.º 19
0
        private static void ShowConfig(IOutputService outputService)
        {
            //  Get the config.
            var config = SystemConfigurationProvider.Configuration;

            //  If config is not present, let the user know and we're done.
            if (config.IsConfigurationPresent == false)
            {
                outputService.WriteMessage("SharpShell configuration not present on this system.");
                return;
            }

            //  Show the config.
            outputService.WriteMessage(string.Format("Logging Mode: {0}", config.LoggingMode));
            outputService.WriteMessage(string.Format("Log Path: {0}", config.LogPath));
        }
Exemplo n.º 20
0
        public MonitoringApp(string host, string machineName)
        {
            _monitoringServices = new List<IMonitoringService>
            {
                new CpuMonitoringService(),
                new MemoryMonitoringService(),
                new DiskMonitoringService(),
                new NetworkMonitoringService()
            };

            _idService = new MacAddressIdService();
            _transportService = new HttpTransportService(host);
            _outputService = new ConsoleOutputService();
            _cpuNameService = new WMICpuNameService();

            InitServerInfo(machineName);
        }
Exemplo n.º 21
0
        private static void MakeAllObjectPublic(IKBService kbserv, IOutputService output)
        {
            bool ToContinue = true;
            int  cant       = 0;

            do
            {
                ToContinue = false;
                cant       = 1;
                foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll())
                {
                    ObjectVisibility objVisibility = obj.GetPropertyValue <ObjectVisibility>("ObjectVisibility");
                    if (objVisibility != ObjectVisibility.Public && Functions.isRunable(obj) && !(obj is Transaction))
                    {
                        obj.SetPropertyValue("ObjectVisibility", ObjectVisibility.Public);
                        Functions.SaveObject(output, obj);
                        ToContinue = true;
                        cant      += 1;
                    }
                }
                output.AddLine("Cambio " + cant.ToString());
            } while (ToContinue);
        }
Exemplo n.º 22
0
        private static void CleanSDT(Artech.Genexus.Common.Objects.Attribute a, IOutputService output, KBObject objRef)
        {
            if (objRef is SDT)
            {
                output.AddLine("Cleaning SDT references to " + a.Name + " in " + objRef.Name);
                SDTStructurePart sdtstruct = objRef.Parts.Get <SDTStructurePart>();

                foreach (IStructureItem structItem in sdtstruct.Root.Items)
                {
                    try
                    {
                        SDTItem sdtItem = (SDTItem)structItem;

                        EntityKey myKey = KBDoctorCore.Sources.Utility.KeyOfBasedOn_CompatibleConEvo3(sdtItem);

                        if (sdtItem.BasedOn != null && myKey == a.Key)
                        {
                            output.AddLine("..." + sdtItem.Name + " based on  " + a.Name);
                            eDBType type   = sdtItem.Type;
                            int     length = sdtItem.Length;
                            bool    signed = sdtItem.Signed;
                            string  desc   = sdtItem.Description;
                            int     dec    = sdtItem.Decimals;

                            //Modifico la variable, para que no se base en el atributo.
                            sdtItem.AttributeBasedOn = null;
                            sdtItem.Type             = type;
                            sdtItem.Decimals         = dec;
                            sdtItem.Description      = desc;
                            sdtItem.Length           = length;
                            sdtItem.Signed           = signed;
                        }
                    }
                    catch (Exception e) { output.AddErrorLine(e.Message); };
                }
            }
        }
Exemplo n.º 23
0
        public static void ClassUsed()
        {
            IKBService kbserv = UIServices.KB;

            string title      = "KBDoctor - Classes Used";
            string outputFile = Functions.CreateOutputFile(kbserv, title);

            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Class", "Error" });

            StringCollection UsedClasses  = new StringCollection();
            StringCollection ThemeClasses = new StringCollection();

            //Reviso todos los objeto para ver las class usadas en cada control
            LoadUsedClasses(kbserv, output, UsedClasses);


            foreach (string sd in UsedClasses)
            {
                writer.AddTableData(new string[] { sd, "" });
                output.AddLine("Application Class used " + sd);
            }

            writer.AddTableData(new string[] { "-----------------", "--------------", "---" });

            writer.AddFooter();
            writer.Close();
            output.EndSection(title, true);

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
Exemplo n.º 24
0
        public override bool Execute()
        {
            bool      isSuccess = true;
            Stopwatch watch     = null;

            OutputSubscribe();
            IOutputService output = CommonServices.Output;

            output.StartSection("Clean process");
            try
            {
                watch = new Stopwatch();
                watch.Start();

                if (KB == null)
                {
                    output.AddErrorLine("No hay ninguna KB abierta en el contexto actual, asegúrese de incluír la tarea OpenKnowledgeBase antes de ejecutar la comparación de navegaciones.");
                    isSuccess = false;
                }
                else
                {
                    CommonServices.Output.AddLine(Objects);
                    //API.PreProcessPendingObjects(KB, output, CodigoGX.GetObjects(base.KB.DesignModel, this.Objects));
                }
            }
            catch (Exception e)
            {
                output.AddErrorLine(e.Message);
                isSuccess = false;
            }
            finally
            {
                output.EndSection("Clean process", isSuccess);
                OutputUnsubscribe();
            }
            return(isSuccess);
        }
Exemplo n.º 25
0
        public MainViewModel(
            IAudioService audioService,
            ICalibrationService calibrationService,
            IDictionaryService dictionaryService,
            IKeyboardService keyboardService,
            ISuggestionStateService suggestionService,
            ICapturingStateManager capturingStateManager,
            ILastMouseActionStateManager lastMouseActionStateManager,
            IInputService inputService,
            IOutputService outputService,
            IWindowManipulationService mainWindowManipulationService,
            List<INotifyErrors> errorNotifyingServices)
        {
            Log.Debug("Ctor called.");

            this.audioService = audioService;
            this.calibrationService = calibrationService;
            this.dictionaryService = dictionaryService;
            this.keyboardService = keyboardService;
            this.suggestionService = suggestionService;
            this.capturingStateManager = capturingStateManager;
            this.lastMouseActionStateManager = lastMouseActionStateManager;
            this.inputService = inputService;
            this.outputService = outputService;
            this.mainWindowManipulationService = mainWindowManipulationService;
            this.errorNotifyingServices = errorNotifyingServices;

            calibrateRequest = new InteractionRequest<NotificationWithCalibrationResult>();

            SelectionMode = SelectionModes.Key;
            Keyboard = new Alpha();

            SelectKeyboardOnKeyboardSetChanges();
            AttachScratchpadEnabledListener();

            HandleFunctionKeySelectionResult(KeyValues.LeftShiftKey); //Set initial shift state to on
        }
Exemplo n.º 26
0
        public override bool Execute()
        {
            bool      isSuccess = true;
            Stopwatch watch     = null;

            OutputSubscribe();
            IOutputService output = CommonServices.Output;

            output.StartSection("Compare navigations");
            try
            {
                watch = new Stopwatch();
                watch.Start();

                if (KB == null)
                {
                    output.AddErrorLine("No hay ninguna KB abierta en el contexto actual, asegúrese de incluír la tarea OpenKnowledgeBase antes de ejecutar la comparación de navegaciones.");
                    isSuccess = false;
                }
                else
                {
                    CommonServices.Output.AddLine(string.Format(KB.Name, KB.Location));
                    isSuccess = API.CompareNavigations(KB, output);
                }
            }
            catch (Exception e)
            {
                output.AddErrorLine(e.Message);
                isSuccess = false;
            }
            finally
            {
                output.EndSection("Compare navigations", isSuccess);
                OutputUnsubscribe();
            }
            return(isSuccess);
        }
Exemplo n.º 27
0
        public override bool Execute()
        {
            bool      isSuccess = true;
            Stopwatch watch     = null;

            OutputSubscribe();
            IOutputService output = CommonServices.Output;

            output.StartSection("Save Objects WSDL");
            try
            {
                watch = new Stopwatch();
                watch.Start();

                if (KB == null)
                {
                    output.AddErrorLine("No hay ninguna KB abierta en el contexto actual.");
                    isSuccess = false;
                }
                else
                {
                    CommonServices.Output.AddLine(string.Format(KB.Name, KB.Location));
                    API.SaveObjectsWSDL(KB, output);
                }
            }
            catch (Exception e)
            {
                output.AddErrorLine(e.Message);
                isSuccess = false;
            }
            finally
            {
                output.EndSection("Save Objects WSDL", isSuccess);
                OutputUnsubscribe();
            }
            return(isSuccess);
        }
Exemplo n.º 28
0
        public override bool Execute()
        {
            bool      isSuccess = true;
            Stopwatch watch     = null;

            OutputSubscribe();
            IOutputService output = CommonServices.Output;

            output.StartSection("Objects Without InOut ");
            try
            {
                watch = new Stopwatch();
                watch.Start();

                if (KB == null)
                {
                    output.AddErrorLine("No hay ninguna KB abierta en el contexto actual, asegúrese de incluír la tarea OpenKnowledgeBase antes de ejecutar la limpieza de variables.");
                    isSuccess = false;
                }
                else
                {
                    output.AddLine("KBDoctor", string.Format(KB.Name, KB.Location));
                    API.ObjectsWithoutINOUT(KB, output);
                }
            }
            catch (Exception e)
            {
                output.AddErrorLine(e.Message);
                isSuccess = false;
            }
            finally
            {
                output.EndSection("Objects Without InOut ", isSuccess);
                OutputUnsubscribe();
            }
            return(isSuccess);
        }
        public override bool Execute()
        {
            bool      isSuccess = true;
            Stopwatch watch     = null;

            OutputSubscribe();
            IOutputService output = CommonServices.Output;

            try
            {
                watch = new Stopwatch();
                watch.Start();

                if (KB == null)
                {
                    output.AddErrorLine("No hay ninguna KB abierta en el contexto actual.");
                    isSuccess = false;
                }
                else
                {
                    CommonServices.Output.AddLine(string.Format(KB.Name, KB.Location));
                    List <string[]> list = new List <string[]>();
                    API.RemoveObjectsNotCalled(KB.DesignModel, output, out list);
                }
            }
            catch (Exception e)
            {
                output.AddErrorLine(e.Message);
                isSuccess = false;
            }
            finally
            {
                output.EndSection("Remove attributes without table", isSuccess);
                OutputUnsubscribe();
            }
            return(isSuccess);
        }
Exemplo n.º 30
0
        public override bool Execute()
        {
            bool      isSuccess = true;
            Stopwatch watch     = null;

            OutputSubscribe();
            IOutputService output = CommonServices.Output;

            output.StartSection("Check bld objects in KB");
            try
            {
                watch = new Stopwatch();
                watch.Start();

                if (KB == null)
                {
                    output.AddErrorLine("No hay ninguna KB abierta en el contexto actual. Ejecute una tarea OpenKB antes.");
                    isSuccess = false;
                }
                else
                {
                    output.AddLine("KBDoctor", string.Format(KB.Name, KB.Location));
                    API.CheckBldObjects(KB);
                }
            }
            catch (Exception e)
            {
                output.AddErrorLine(e.Message);
                isSuccess = false;
            }
            finally
            {
                output.EndSection("Check bld objects in KB", isSuccess);
                OutputUnsubscribe();
            }
            return(isSuccess);
        }
Exemplo n.º 31
0
        public static void RemoveAttributeWithoutTable()
        {
            IKBService kbserv = UIServices.KB;

            string title = "KBDoctor - Remove attributes without table";

            try
            {
                string outputFile = Functions.CreateOutputFile(kbserv, title);

                IOutputService output = CommonServices.Output;
                output.StartSection("KBDoctor", title);

                List <string[]> lineswriter;
                KBDoctorCore.Sources.API.RemoveAttributesWithoutTable(kbserv.CurrentModel, output, out lineswriter);
                KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

                writer.AddHeader(title);
                writer.AddTableHeader(new string[] { "", "Attribute", "Description", "Data type" });
                foreach (string[] line in lineswriter)
                {
                    writer.AddTableData(line);
                }
                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                output.EndSection("KBDoctor", title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
Exemplo n.º 32
0
        private static List <string> MostReferencedInFolder(Table tbl)
        {
            IOutputService output = CommonServices.Output;
            List <string>  list   = new List <string>();

            foreach (EntityReference refe in tbl.GetReferencesTo())
            {
                KBObject objRef = KBObject.Get(tbl.Model, refe.From);
                if (objRef != null)
                {
                    bool read, insert, update, delete, isBase;

                    ReferenceTypeInfo.ReadTableInfo(refe.LinkTypeInfo, out read, out insert, out update, out delete, out isBase);

                    string updated = (update || delete || insert) ? "UPDATED" : "";

                    if (objRef.Parent is Folder)
                    {
                        list.Add("FOLDER:" + objRef.Parent.Name + " |  " + updated);
                    }
                    if (objRef.Parent is Module)
                    {
                        list.Add("MODULE:" + objRef.Parent.Name + " |  " + updated);
                    }
                }
            }
            output.AddLine(" ");
            output.AddLine("============> " + tbl.Name);

            list.Sort();
            foreach (string s in list)
            {
                output.AddLine(s);
            }
            return(list);
        }
Exemplo n.º 33
0
 internal static void ObjectsWithVarNotBasedOnAtt(List <KBObject> objs, IOutputService output)
 {
     foreach (KBObject obj in objs)
     {
         string  vnames    = "";
         Boolean hasErrors = false;
         Boolean SaveObj   = false;
         if (isGenerated(obj) && (obj is Transaction || obj is WebPanel || obj is WorkPanel || obj is Procedure))
         {
             string        pic2 = (string)obj.GetPropertyValue("ATT_PICTURE");
             VariablesPart vp   = obj.Parts.Get <VariablesPart>();
             if (vp != null)
             {
                 foreach (Variable v in vp.Variables)
                 {
                     if ((!v.IsStandard) && Utility.VarHasToBeInDomain(v))
                     {
                         string attname = (v.AttributeBasedOn == null) ? "" : v.AttributeBasedOn.Name;
                         string domname = (v.DomainBasedOn == null) ? "" : v.DomainBasedOn.Name;
                         if (attname == "" && domname == "")
                         {
                             string vname = v.Name.ToLower();
                             vnames   += vname + " ";
                             hasErrors = true;
                         }
                     }
                 }
             }
             if (hasErrors)
             {
                 OutputError err = new OutputError("Variables not based in attributes or domain: " + vnames, MessageLevel.Error, new KBObjectPosition(vp));
                 output.Add("KBDoctor", err);
             }
         }
     }
 }
Exemplo n.º 34
0
        public bool ExecReviewObjects(CommandData cmdData)
        {
            IOutputService output = CommonServices.Output;

            output.SelectOutput("KBDoctor");
            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;
            KBModel kbModel = UIServices.KB.CurrentModel;

            List <KBObject> selectedObjects = new List <KBObject>();

            foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                if (obj != null)
                {
                    selectedObjects.Add(obj);
                }
            }
            Thread thread = new Thread(() => KBDoctorCore.Sources.API.PreProcessPendingObjects(UIServices.KB.CurrentKB, output, selectedObjects));

            thread.Start();
            return(true);
        }
Exemplo n.º 35
0
        internal static void ListAttributes()
        {
            IKBService kbserv = UIServices.KB;
            // Dictionary<string, string> myDict = new Dictionary<string, string>();

            string title      = "KBDoctor - List Attributes";
            string outputFile = Functions.CreateOutputFile(kbserv, title);

            IOutputService output = CommonServices.Output;

            output.StartSection(title);


            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Attribute", "Description", "Data type", "Domain", "Subtype", "Title", "Column Title", "Contextual", "IsFormula" });

            foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel))
            {
                string Picture       = Functions.ReturnPicture(a);
                string domlink       = a.DomainBasedOn == null ? " ": Functions.linkObject(a.DomainBasedOn);
                string superTypeName = a.SuperTypeKey == null? " ": a.SuperType.Name;
                output.AddLine("Procesing " + a.Name);
                string isFormula = a.Formula == null ? "" : "*";
                writer.AddTableData(new string[] { Functions.linkObject(a), a.Description, Picture, domlink, superTypeName, a.Title, a.ColumnTitle, a.ContextualTitleProperty, isFormula });
            }

            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
Exemplo n.º 36
0
        public bool ExecReviewModuleOrFolder(CommandData cmdData)
        {
            IOutputService output = CommonServices.Output;

            output.SelectOutput("KBDoctor");
            List <KBObject> selectedModulesFolders = GetObjects(cmdData);
            List <KBObject> selectedObjects        = new List <KBObject>();

            foreach (KBObject obj in selectedModulesFolders)
            {
                List <KBObject> objsInContainer = new List <KBObject>();
                if (obj is Artech.Architecture.Common.Objects.Module)
                {
                    objsInContainer = KBDoctorCore.Sources.Utility.ModuleObjects((Artech.Architecture.Common.Objects.Module)obj);
                }
                else
                {
                    if (obj is Folder)
                    {
                        objsInContainer = KBDoctorCore.Sources.Utility.FolderObjects((Folder)obj);
                    }
                }
                foreach (KBObject objSelected in objsInContainer)
                {
                    if (!selectedObjects.Contains(objSelected))
                    {
                        selectedObjects.Add(objSelected);
                    }
                }
            }

            Thread thread = new Thread(() => KBDoctorCore.Sources.API.PreProcessPendingObjects(UIServices.KB.CurrentKB, output, selectedObjects));

            thread.Start();
            return(true);
        }
Exemplo n.º 37
0
 //
 public static bool CompareNavigations(KnowledgeBase KB, IOutputService output)
 {
     Utility.CreateModuleNamesFile(KB);
     Navigation.ReplaceModulesInNVGFiles(KB, output);
     return(Navigation.CompareLastNVGDirectories(KB, output));
 }
Exemplo n.º 38
0
        //
        public static void PreProcessPendingObjects(KnowledgeBase KB, IOutputService output, List <KBObject> objs)
        {
            FileIniDataParser fileIniData = new FileIniDataParser();

            output.Clear();
            output.SelectOutput("KBDoctor");
            output.StartSection("KBDoctor", "Review_Objects", "Review Objects");


            InitializeIniFile(KB);

            IniData parsedData  = fileIniData.ReadFile(KB.UserDirectory + "\\KBDoctor.ini");
            string  SectionName = "ReviewObject";

            List <KBObject> atts = new List <KBObject>();

            foreach (KBObject obj in objs)
            {
                List <KBObject> objlist = new List <KBObject>();
                objlist.Add(obj);
                if (Utility.isRunable(obj) && !Utility.IsGeneratedByPattern(obj))
                {
                    //Check objects with parameteres without inout
                    if (parsedData[SectionName]["ParamINOUT"].ToLower() == "true")
                    {
                        Objects.ParmWOInOut(objlist, output);
                    }

                    //Clean variables not used
                    if (parsedData[SectionName]["CleanUnusedVariables"].ToLower() == "true")
                    {
                        CleanKB.CleanKBObjectVariables(obj, output);
                    }

                    //Check commit on exit
                    if (parsedData[SectionName]["CheckCommitOnExit"].ToLower() == "true")
                    {
                        Objects.CommitOnExit(objlist, output);
                    }

                    //Is in module
                    if (parsedData[SectionName]["CheckModule"].ToLower() == "true")
                    {
                        Objects.isInModule(objlist, output);
                    }

                    //With variables not based on attributes
                    if (parsedData[SectionName]["VariablesBasedAttOrDomain"].ToLower() == "true")
                    {
                        Objects.ObjectsWithVarNotBasedOnAtt(objlist, output);
                    }

                    //Code commented
                    if (parsedData[SectionName]["CodeCommented"].ToLower() == "true")
                    {
                        Objects.CodeCommented(objlist, output);
                    }

                    //Check complexity metrics
                    //maxNestLevel  6 - ComplexityLevel  30 - MaxCodeBlock  500 - parametersCount  6
                    int maxNestLevel = 7;
                    Int32.TryParse(parsedData[SectionName]["MaxNestLevel"], out maxNestLevel);

                    int complexityLevel = 30;
                    complexityLevel = Int32.Parse(parsedData[SectionName]["MaxComplexity"]);

                    int maxCodeBlock = 500;
                    maxCodeBlock = Int32.Parse(parsedData[SectionName]["MaxBlockSize"]);

                    int maxParametersCount = 6;
                    maxParametersCount = Int32.Parse(parsedData[SectionName]["MaxParameterCount"]);

                    Objects.CheckComplexityMetrics(objlist, output, maxNestLevel, complexityLevel, maxCodeBlock, maxParametersCount);



                    /*
                     * Tiene todas las referencias?
                     * Tiene calls que pueden ser UDP
                     * Mas de un parametro de salida
                     * Constantes en el código
                     * Nombre "poco claro" / Descripcion "poco clara"
                     * Si es modulo, revisar que no tenga objetos publicos no llamados
                     * Si es modulo, revisar que no tenga objetos privados llamados desde fuera
                     * Si es modulo, Valor de la propiedad ObjectVisibility <> Private
                     */
                }
                if (obj is Artech.Genexus.Common.Objects.Attribute && parsedData[SectionName]["AttributeBasedOnDomain"].ToLower() == "true")
                {
                    atts.Add(obj);
                    //Attribute Has Domain
                    Objects.AttributeHasDomain(objlist, output);
                }
                if (obj is SDT && parsedData[SectionName]["SDTBasedAttOrDomain"].ToLower() == "true")
                {
                    //SDTItems Has Domain
                    Objects.SDTBasedOnAttDomain(objlist, output);
                }
            }
            if (atts.Count > 0 && parsedData[SectionName]["AttributeWithoutTable"].ToLower() == "true")
            {
                // Attributes without table
                Objects.AttributeWithoutTable(atts, output);
            }

            output.EndSection("KBDoctor", "Review_Objects", true);
        }
Exemplo n.º 39
0
 //
 public static void PrepareCompareNavigations(KnowledgeBase KB, IOutputService output)
 {
     Navigation.PrepareComparerNavigation(KB, output);
 }
 private void FactoryService()
 => _outputService = new OutputService(_outputRepositoryMock.Object, _busHandlerMock.Object);
Exemplo n.º 41
0
 public CommandService(ITimeService timeService, IOutputService outputService)
 {
     _timeService = timeService;
     _outputService = outputService;
 }
Exemplo n.º 42
0
 //
 public static void CleanKBObject(KBObject obj, IOutputService output)
 {
     CleanKB.CleanObject(obj, output);
 }
Exemplo n.º 43
0
 //
 public static void RemoveObjectsNotCalled(KBModel kbmodel, IOutputService output, out List <string[]> lineswriter)
 {
     CleanKB.RemoveObjectsNotCalled(kbmodel, output, out lineswriter);
 }
Exemplo n.º 44
0
        private static void CleanVariablesBasedInAttribute(Artech.Genexus.Common.Objects.Attribute a, IOutputService output, KBObject objRef)
        {
            output.AddLine("Cleaning variables references to " + a.Name + " in " + objRef.Name);

            VariablesPart vp = objRef.Parts.Get <VariablesPart>();

            if (vp != null)
            {
                foreach (Variable v in vp.Variables)
                {
                    if (!v.IsStandard)
                    {
                        if ((v.AttributeBasedOn != null) && (a.Name == v.AttributeBasedOn.Name))
                        {
                            output.AddLine("&" + v.Name + " based on  " + a.Name);
                            eDBType type   = v.Type;
                            int     length = v.Length;
                            bool    signed = v.Signed;
                            string  desc   = v.Description;
                            int     dec    = v.Decimals;

                            //Modifico la variable, para que no se base en el atributo.
                            v.AttributeBasedOn = null;
                            v.Type             = type;
                            v.Decimals         = dec;
                            v.Description      = desc;
                            v.Length           = length;
                            v.Signed           = signed;
                        }
                    }
                }
            }
        }
Exemplo n.º 45
0
 public PowerShellTaskFactory(IOutputService outputService, ICommandErrorReporter errorReporter, ICommandLogParser logParser)
     : this(outputService, errorReporter, logParser, new PowerShellCommandRunner())
 {
 }
Exemplo n.º 46
0
        //--------------------------------------------------------------
        /// <summary>
        /// Creates a new content builder.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public XnaContentBuilder(IEditorService editor)
        {
            if (editor == null)
                throw new ArgumentNullException(nameof(editor));

            _outputService = editor.Services.GetInstance<IOutputService>().ThrowIfMissing();

            //_buildLogger = new BuildLogger(outputService);
            _tempDirectoryHelper = new TempDirectoryHelper(editor.ApplicationName, "XnaContentBuilder");
            CreateBuildProject();
        }
Exemplo n.º 47
0
 public BarLogic(IOutputService outputService, ICalculateService calculateService)
 {
     _outputService = outputService;
     _calculateService = calculateService;
 }
Exemplo n.º 48
0
        private static void OutputMenuNodes(IOutputService outputService, MenuItemViewModelCollection menuItems, int level = 0)
        {
            if (menuItems == null || menuItems.Count == 0)
                return;

            var indent = Indent(level);
            foreach (var menuItem in menuItems)
            {
                outputService.WriteLine(Invariant($"{indent}\"{menuItem.CommandItem.Name}\""), NodesView);
                OutputMenuNodes(outputService, menuItem.Submenu, level + 1);
            }
        }
Exemplo n.º 49
0
        private static void OutputToolBarNodes(IOutputService outputService, ToolBarItemViewModelCollection toolBarItems, int level = 0)
        {
            if (toolBarItems == null || toolBarItems.Count == 0)
                return;

            var indent = Indent(level);
            foreach (var toolBarItem in toolBarItems)
            {
                outputService.WriteLine(Invariant($"{indent}\"{toolBarItem.CommandItem.Name}\""), NodesView);
            }
        }
Exemplo n.º 50
0
 public EventMonitoringService(IOutputService outputService, Action<EventMonitoringService> handler)
 {
     _eventHandler = handler;
     _sessionSwitchEventHandler = HandleLock;
     _outputService = outputService;
 }
Exemplo n.º 51
0
 //
 public static void CleanKBObjectVariables(KBObject obj, IOutputService output)
 {
     CleanKB.CleanKBObjectVariables(obj, output);
 }
Exemplo n.º 52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Application"/> class.
 /// </summary>
 /// <param name="outputService">The output service.</param>
 public Application(IOutputService outputService)
 {
     this.outputService = outputService;
 }
Exemplo n.º 53
0
 //
 public static void RemoveAttributesWithoutTable(KBModel kbmodel, IOutputService output, out List <string[]> lineswriter)
 {
     CleanKB.RemoveAttributesWithoutTable(kbmodel, output, out lineswriter);
 }
Exemplo n.º 54
0
 public EventMonitoringService(IOutputService outputService, Action <EventMonitoringService> handler)
 {
     _eventHandler = handler;
     _sessionSwitchEventHandler = HandleLock;
     _outputService             = outputService;
 }
Exemplo n.º 55
0
 //
 public static void CleanKBObjects(KnowledgeBase kb, IEnumerable <KBObject> kbojs, IOutputService output)
 {
     CleanKB.CleanObjects(kb, kbojs, output);
 }
Exemplo n.º 56
0
 //
 public static void CompareWSDL(KnowledgeBase KB, IOutputService output)
 {
     Navigation.CompareWSDLDirectories(KB, output);
 }
Exemplo n.º 57
0
 //
 public static void SaveObjectsWSDL(KnowledgeBase KB, IOutputService output)
 {
     Navigation.SaveObjectsWSDL(KB, output, false);
 }
Exemplo n.º 58
0
 //
 public static List <KBObject> ObjectsWithoutINOUT(KnowledgeBase KB, IOutputService output)
 {
     return(Objects.ParmWOInOut(KB, output));
 }
Exemplo n.º 59
0
 InitializeLogger(IOutputService outputService)
 {
     Instance = outputService.Create(THE_GUID, "My Logger");
     Instance.WriteLine("Logger initialized!");
 }
Exemplo n.º 60
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="ModelDocument"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="documentType">The type of the document.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> or <paramref name="documentType"/> is <see langword="null"/>.
        /// </exception>
        internal ModelDocument(IEditorService editor, DocumentType documentType)
          : base(editor, documentType)
        {
            _modelsExtension = editor.Extensions.OfType<ModelsExtension>().FirstOrDefault().ThrowIfMissing();
            _useDigitalRuneGraphics = _modelsExtension.UseDigitalRuneGraphics;

            var services = Editor.Services;
            _documentService = services.GetInstance<IDocumentService>().ThrowIfMissing();
            _statusService = services.GetInstance<IStatusService>().ThrowIfMissing();
            _outputService = services.GetInstance<IOutputService>().ThrowIfMissing();
            _animationService = services.GetInstance<IAnimationService>().ThrowIfMissing();
            _monoGameService = services.GetInstance<IMonoGameService>().ThrowIfMissing();
            _outlineService = services.GetInstance<IOutlineService>().WarnIfMissing();
            _propertiesService = services.GetInstance<IPropertiesService>().WarnIfMissing();
            _errorService = services.GetInstance<IErrorService>().WarnIfMissing();

            Editor.ActiveDockTabItemChanged += OnEditorDockTabItemChanged;

            UpdateProperties();
            UpdateOutline();
        }