/// <summary>
        /// Adds the information as an override to the ready to submit list
        /// </summary>
        private void addOverride()
        {
            if (checkValid())
            {
                OverrideRequest ov = new OverrideRequest()
                {
                    RequestDate   = DateTime.Now,
                    ModelNum      = modelText,
                    Description   = string.IsNullOrWhiteSpace(description) ? "no description entered" : description,
                    State         = 0,
                    Sender        = string.Format("{0} {1}", _navigationService.user.FirstName, _navigationService.user.LastName),
                    OverrideTime  = (decimal)overrideTime,
                    OverrideRoute = (int)overrideRoute,
                    ModelTime     = (decimal)modelTime,
                    ModelRoute    = _modelRouteInt,
                    ModelBase     = model.Base,

                    ReviewDate = new DateTime(1900, 1, 1),
                    Reviewer   = ""
                };

                // Since the observable collection was created on the UI thread
                // we have to add the override to the list using a delegate function.
                App.Current.Dispatcher.Invoke(delegate
                {
                    overridesToSubmit.Add(ov);
                });
            }
        }
Exemple #2
0
        public async Task <ActionResult <BoolResult> > Override([FromBody] OverrideRequest request)
        {
            if (!await _authManager.HasAppPermissionsAsync(MenuUtils.AppPermissions.PluginsAdd))
            {
                return(Unauthorized());
            }

            // _pluginManager.UnInstall(request.PluginId);

            var filePath   = _pathManager.GetTemporaryFilesPath(request.FileName);
            var pluginPath = _pathManager.GetPluginPath(request.PluginId);

            DirectoryUtils.DeleteDirectoryIfExists(pluginPath);
            DirectoryUtils.CreateDirectoryIfNotExists(pluginPath);
            _pathManager.ExtractZip(filePath, pluginPath);


            // var pluginPath = _pathManager.GetPluginPath(request.PluginId);
            // DirectoryUtils.CreateDirectoryIfNotExists(pluginPath);
            // _pathManager.ExtractZip(filePath, pluginPath);

            return(new BoolResult
            {
                Value = true
            });
        }
Exemple #3
0
        public override int Execute(CancellationToken cancellationToken)
        {
            var target    = string.IsNullOrWhiteSpace(output) ? Path.Combine(WorkingDirectory, ".gitversion") : output;
            var targetDir = new FileInfo(target).Directory;

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OpenTap.Sdk.New.Resources.GitVersionTemplate.txt"))
                using (var reader = new StreamReader(stream))
                {
                    foreach (var packageXml in GetPackageXmlFiles(targetDir, (dirName) => dirName != "bin"))
                    {
                        var filename = packageXml.FullName;
                        log.Info($"Found {filename}. Do you want to enable automatic version update using a '.gitversion' file?");

                        var request = new OverrideRequest();
                        UserInput.Request(request, true);

                        if (request.Override == RequestEnum.Yes)
                        {
                            var text = File.ReadAllText(filename);
                            text = Regex.Replace(text, "(<Package.*?Version=\")(.*?)(\".*?>)", (m) => $"{m.Groups[1].Value}$(GitVersion){m.Groups[3].Value}");
                            File.WriteAllText(filename, text);
                        }
                    }
                    WriteFile(target, reader.ReadToEnd());
                }

            return(0);
        }
Exemple #4
0
        /// <summary>
        /// Updates the override request review date and reviewer.
        /// Should be surrounded by a try catch
        /// </summary>
        /// <param name="mod"></param>
        private void updateOverride(OverrideRequest or)
        {
            or.ReviewDate = DateTime.Now;
            or.Reviewer   = string.Format("{0} {1}", _navigationService.user.FirstName, _navigationService.user.LastName);

            _serviceProxy.updateOverrideRequest(or);
        }