コード例 #1
0
        private Task RenameVersion(IOwinContext context, int version, VersionDto versionDto)
        {
            var clientCredentials = context.Get <IClientCredentials>("ClientCredentials");

            _ruleData.RenameVersion(clientCredentials, version, versionDto.Name);
            return(Json(context, new PostResponseDto {
                Success = true
            }));
        }
コード例 #2
0
        public static RecipeVersionVM ToVM(this VersionDto dto)
        {
            RecipeVersionVM versionVm = new RecipeVersionVM
            {
                CreationDate = dto.CreationDate,
                VersionId    = dto.VersionId
            };

            return(versionVm);
        }
コード例 #3
0
        public IActionResult Get()
        {
            var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            var apiDescriptions = _apiVersionDescriptionProvider.ApiVersionDescriptions;
            var versionDto      = new VersionDto
            {
                AssemblyVersion      = assemblyVersion,
                SupportedApiVersions = _mapper.Map <List <VersionDescriptionDto> >(apiDescriptions)
            };

            return(Ok(versionDto));
        }
コード例 #4
0
        public VersionDto Version()
        {
            var versionDto = new VersionDto
            {
                Timestamp = DateTime.Now,
                Number    = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                DbPath    = Config.DbPath
            };

            Console.WriteLine($"Api Version: Timestamp: { versionDto.Timestamp }, Number: {versionDto.Number}");
            return(versionDto);
        }
コード例 #5
0
        public static VersionModel ToModel(this VersionDto versionDto)
        {
            if (versionDto == null)
            {
                throw new ArgumentNullException(nameof(versionDto));
            }

            return(new VersionModel
            {
                Build = versionDto.Build,
                Major = versionDto.Major,
                Minor = versionDto.Minor,
                Revision = versionDto.Revision
            });
        }
コード例 #6
0
        /// <summary>
        /// Méthode qui permet de créer une version liée à un ticket
        /// </summary>
        /// <param name="pParam">Paramètre pour la création</param>
        /// <remarks>JClaud 2015-07-21 Création</remarks>
        public void CreateVersionData(ParamCreationVersionDTO pParam)
        {
            //jc - Déclaration des variables
            //ServiceManager lService = LanceAuthentification(pParam.User);
            ServiceManager lServiceData = LanceAuthentification(CopyUserAsAPI(pParam.User));
            VersionDto     lVersionDto  = new VersionDto();

            //jc- affectation des variables a la cause
            lVersionDto.Entity.Name      = pParam.Version.VersionName;
            lVersionDto.Entity.Label     = pParam.Version.VersionNumber;
            lVersionDto.Entity.Name      = pParam.Version.VersionName;
            lVersionDto.Entity.ProjectId = pParam.Version.IdProjet;

            //jc- on enregistre la nouvelle cause
            lServiceData.Projects.CreateVersion(lVersionDto.Entity);
        }
コード例 #7
0
        public async Task <IActionResult> Get()
        {
            _logger.LogRequest("Checking versions");

            var assembly   = Assembly.GetExecutingAssembly();
            var apiVersion = assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion;

            var engines = await _engineService.GetCatapultEngines(EngineStatus.All);

            var providers = await _providerService.GetTaskProviders();

            var result = new VersionDto
            {
                ApiVersion    = apiVersion,
                Engines       = _mapper.Map <List <CatapultEngineDto> >(engines),
                TaskProviders = _mapper.Map <List <TaskProviderDto> >(providers)
            };

            _logger.LogResponse("Versions retrieved. Response body: {@result}", result);

            return(Ok(result));
        }
コード例 #8
0
ファイル: VersionEndpoint.cs プロジェクト: Bikeman868/Urchin
 private Task RenameVersion(IOwinContext context, int version, VersionDto versionDto)
 {
     var clientCredentials = context.Get<IClientCredentials>("ClientCredentials");
     _ruleData.RenameVersion(clientCredentials, version, versionDto.Name);
     return Json(context, new PostResponseDto { Success = true });
 }
コード例 #9
0
ファイル: ProcessDAL.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Updates version.
        /// </summary>
        /// <param name="dto">The DTO object.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.ArgumentException">The input DTO is null.</exception>
        public void UpdateVersion(VersionDto dto)
        {
            if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto"));

            const string CmdText =
                @"
IF EXISTS ( SELECT  ProcessId
            FROM    Versions
            WHERE   ProcessId = @ProcessId ) 
    UPDATE  Versions
    SET     VersioningStyle = @VersioningStyle ,
            StartingVersion = @StartingVersion ,
            NextVersionStateGuid = @NextVersionStateGuid ,
            PreviousVersionStateGuid = @PreviousVersionStateGuid ,
            IncludeVersionNumberInList = @IncludeVersionNumberInList ,
            IncludeVersionDateInList = @IncludeVersionDateInList,
            StateFilterGuid = @StateFilterGuid
    WHERE   ProcessId = @ProcessId
ELSE 
    INSERT  INTO Versions
            ( ProcessId ,
              VersioningStyle ,
              StartingVersion ,
              NextVersionStateGuid ,
              PreviousVersionStateGuid,
              StateFilterGuid
            )
    VALUES  ( @ProcessId ,
              @VersioningStyle ,
              @StartingVersion ,
              @NextVersionStateGuid ,
              @PreviousVersionStateGuid,
              @StateFilterGuid
            )";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                var cn = ctx.Connection;

                using (var cmd = new SqlCommand(CmdText, cn))
                {
                    cmd.Parameters.AddWithValue("@ProcessId", dto.ProcessId);
                    cmd.Parameters.AddWithValue("@VersioningStyle", dto.VersioningStyle.ToString());
                    cmd.Parameters.AddWithValue("@StartingVersion", dto.StartingVersion);
                    cmd.Parameters.AddWithValue("@NextVersionStateGuid", dto.NextVersionStateGuid);
                    cmd.Parameters.AddWithValue("@PreviousVersionStateGuid", dto.PreviousVersionStateGuid);
                    cmd.Parameters.AddWithValue("@IncludeVersionNumberInList", dto.IncludeVersionNumberInList);
                    cmd.Parameters.AddWithValue("@IncludeVersionDateInList", dto.IncludeVersionDateInList);
                    cmd.Parameters.AddWithValue("@StateFilterGuid", dto.StateFilterGuid);

                    cmd.ExecuteNonQuery();
                }
            }
        }
コード例 #10
0
        static void Main(string[] args)
        {
            Console.Title = "Patch maker";
            if (args.Count() == 0)
            {
                Console.WriteLine("Please pass as argument the client folder");
                Console.WriteLine("Example: dotnet.exe PatchMaker.dll \"C:\\FumbiClient\"");
                Console.ReadKey();
                return;
            }

            char key;

            do
            {
                Console.Write($"\rClient folder is '{args[0]}'? (Y/N):");
                key = Console.ReadKey().KeyChar;
                if (key == 'n' || key == 'N')
                {
                    return;
                }
            } while (key != 'Y' && key != 'y');

            Console.WriteLine("\nLoading patch info...");

            //var currentFolder = Path.Combine(args[0], @".\");
            VersionDto version;
            var        fileList   = new List <FileInfoDto>();
            var        changeList = new List <FileInfoDto>();
            var        curPatch   = 0;
            var        d          = new XmlSerializer(typeof(VersionDto));

            try
            {
                using (var fr = File.OpenRead(versionXml))
                {
                    version = d.Deserialize(fr) as VersionDto;
                }
            }catch (FileNotFoundException e)
            {
                version        = new VersionDto();
                version.Patchs = Array.Empty <PatchDto>();
            }

            foreach (var patch in version.Patchs)
            {
                foreach (var file in patch.Files)
                {
                    if (fileList.Exists(p => p.Name == file.Name))
                    {
                        var sfile = fileList.Find(p => p.Name == file.Name);
                        sfile.CRC = file.CRC;
                        continue;
                    }

                    fileList.Add(new FileInfoDto {
                        Name = file.Name, CRC = file.CRC
                    });                                                                // copy
                }

                curPatch++;
            }

            Console.WriteLine($"Version.xml have {curPatch} patchs.");
            Console.WriteLine("Making a file tree...");

            var    files = Directory.EnumerateFiles(args[0], "*.*", SearchOption.AllDirectories);
            var    crc   = new Crc32();
            string hash;
            var    counter = 0;

            foreach (var filei in files)
            {
                var file = Path.GetRelativePath(args[0], filei);

                if (file.ToLower() == versionXml.ToLower() ||
                    Path.GetExtension(file).ToLower() == ".s4")
                {
                    continue;
                }

                hash = String.Empty;
                using (FileStream fs = File.OpenRead(filei))
                    foreach (byte b in crc.ComputeHash(fs))
                    {
                        hash += b.ToString("x2").ToLower();
                    }

                counter++;
                Console.Write($"\rScanned files {counter}, changes found {changeList.Count}");
                if (fileList.Exists(p => p.Name.ToLower() == file.ToLower()) &&
                    fileList.Find(p => p.Name.ToLower() == file.ToLower()).CRC == hash)
                {
                    continue;
                }

                changeList.Add(new FileInfoDto {
                    Name = file, CRC = hash
                });
            }

            Console.WriteLine($"\nFound {changeList.Count} changes on files.");

            if (changeList.Any())
            {
                var patches = version.Patchs.ToList();
                var patch   = new PatchDto();
                patch.Version = curPatch.ToString();
                patch.Files   = changeList.ToArray();
                patches.Add(patch);
                version.Patchs = patches.ToArray();
            }


            Console.WriteLine("Saving changes...");

            using (var fs = File.OpenWrite(versionXml))
                d.Serialize(fs, version);

            Console.WriteLine("Changes saved.");
            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
        }
コード例 #11
0
        public override WidgetResult Show(IssueDto issue = null)
        {
            var filter = IsSessionFilter() || CurrentCard.CardType != ProjectTemplatePageType.Custom && "app/changelog/view".Equals(CurrentCard.Url, StringComparison.InvariantCultureIgnoreCase) ? HttpSessionManager.GetFilter(CurrentCard.Id, IssuesFilter.CreateProjectFilter(CurrentUser.Entity.Id, CurrentProject.Entity.Id)) : CurrentCard.Filter;

            HttpSessionManager.SetFilter(CurrentCard.Id, filter);
            var workspaceProjects = new List <int>();

            int?currentProjectId = 0;

            int versionId = 0;

            HttpSessionManager.Set <List <UserIssuesView> >(null, Constants.ChangelogSessionView);

            // Safety check required because of http://gemini.countersoft.com/project/DEV/21/item/5088
            PageSettings pageSettings = null;

            try
            {
                if (CurrentCard.Options.ContainsKey(AppGuid))
                {
                    pageSettings = CurrentCard.Options[AppGuid].FromJson <PageSettings>();

                    if (pageSettings.PageData != null)
                    {
                        currentProjectId = pageSettings.PageData.projectId;

                        versionId = pageSettings.PageData.versionId;
                    }
                }
            }
            catch (Exception ex)  {}

            var activeProjects = ProjectManager.GetActive();

            var viewableProjects = new List <ProjectDto>();

            if (activeProjects == null || activeProjects.Count == 0)
            {
                activeProjects = new List <ProjectDto>();
            }
            else
            {
                viewableProjects = ProjectManager.GetAppViewableProjects(this);
            }

            if (!viewableProjects.Any(s => s.Entity.Id == currentProjectId.Value))
            {
                currentProjectId = viewableProjects.Count > 0 ? viewableProjects.First().Entity.Id : 0;
            }

            UserContext.Project = ProjectManager.Get(currentProjectId);

            IEnumerable <Countersoft.Gemini.Commons.Entity.Version> versions = null;

            // get all versions that are released or not according to settings passed (BUT - NEVER show archived projects)
            versions = Cache.Versions.GetAll().Where(v => v.ProjectId == currentProjectId && v.Released == true && v.Archived == false).OrderBy(o => o.Sequence);

            if (versionId == 0)
            {
                VersionDto version = VersionManager.GetFirstChangeLogVersion(UserContext.Project.Entity.Id);

                if (version != null)
                {
                    versionId = version.Entity.Id;
                }
                else
                {
                    versionId = versions.Count() > 0 ? versions.First().Id : 0;
                }
            }

            Changelog.Models.ChangelogpAppModel model = BuildModelData(versionId, versions);

            model.ProjectList = new SelectList(viewableProjects, "Entity.Id", "Entity.Name", currentProjectId.GetValueOrDefault());

            if (pageSettings == null)
            {
                pageSettings = new PageSettings();
            }

            pageSettings.PageData.versionId = versionId;

            pageSettings.PageData.projectId = currentProjectId.GetValueOrDefault();

            CurrentCard.Options[AppGuid] = pageSettings.ToJson();

            return(new WidgetResult()
            {
                Success = true, Markup = new WidgetMarkup("views/Changelog.cshtml", model)
            });
        }
コード例 #12
0
        public ActionResult GetChangelog(int versionId, int projectId)
        {
            UserContext.Project = ProjectManager.Get(projectId);

            IssuesFilter filter = null;

            if (Request.Form.Keys.Count > 0)
            {
                filter = new IssuesFilter();

                string[] sort = Request.Form[0].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

                StringBuilder sortField = new StringBuilder();

                StringBuilder sortDirection = new StringBuilder();

                for (int i = 0; i < sort.Length; i += 2)
                {
                    sortField.Append(sort[i]);

                    sortField.Append('|');

                    sortDirection.Append(sort[i + 1] == "0" ? (int)SortDirection.Ascending : (int)SortDirection.Descending);

                    sortDirection.Append('|');
                }

                filter.SortField = sortField.ToString();

                filter.SortOrder = sortDirection.ToString();

                filter.ShowSequenced = false;
            }

            if (filter == null)
            {
                filter = HttpSessionManager.GetFilter(CurrentCard.Id, new IssuesFilter());

                filter.ShowSequenced = false;
            }

            IEnumerable <Countersoft.Gemini.Commons.Entity.Version> versions = Cache.Versions.GetAll().Where(v => v.ProjectId == projectId && v.Released == true && v.Archived == false).OrderBy(o => o.Sequence);

            // get all versions that are released or not according to settings passed (BUT - NEVER show archived projects)
            if (!versions.Any(s => s.Id == versionId))
            {
                VersionDto newVersion = VersionManager.GetFirstChangeLogVersion(UserContext.Project.Entity.Id);

                if (newVersion != null)
                {
                    versionId = newVersion.Entity.Id;
                }
                else
                {
                    versionId = versions.Count() > 0 ? versions.First().Id : 0;
                }
            }

            var version = VersionManager.Get(versionId);

            List <IssueDto> issues = new List <IssueDto>();

            if (version != null && version.Entity.Released)
            {
                issues = IssueManager.GetRoadmap(UserContext.Project.Entity.Id, filter, versionId);
            }

            Changelog.Models.ChangelogpAppModel model = BuildModelData(versionId, versions, filter);

            model.Issues = issues;

            return(JsonSuccess(new { success = true, grid = RenderPartialViewToString(this, "~/Views/Shared/DisplayTemplates/IssueDto.cshtml", model), statusBar = RenderPartialViewToString(this, AppManager.Instance.GetAppUrl("20A79C86-9FB4-4160-A4FD-29E37E185673", "views/StatusBar.cshtml"), model), versions = RenderPartialViewToString(this, AppManager.Instance.GetAppUrl("20A79C86-9FB4-4160-A4FD-29E37E185673", "views/VersionProgress.cshtml"), model) }));
        }
コード例 #13
0
ファイル: Roadmap.cs プロジェクト: countersoft/App-Roadmap
        public override WidgetResult Show(IssueDto issue = null)
        {
            var filter = IsSessionFilter() || CurrentCard.CardType != ProjectTemplatePageType.Custom && "app/roadmap/view".Equals(CurrentCard.Url, StringComparison.InvariantCultureIgnoreCase) ? HttpSessionManager.GetFilter(CurrentCard.Id, IssuesFilter.CreateProjectFilter(CurrentUser.Entity.Id, CurrentProject.Entity.Id)) : CurrentCard.Filter;

            HttpSessionManager.SetFilter(CurrentCard.Id, filter);

            int? currentProjectId   = 0;
            bool includeSubversions = false;

            int versionId = 0;

            HttpSessionManager.Set <List <UserIssuesView> >(null, Constants.RoadmapSessionView);

            // Safety check required because of http://gemini.countersoft.com/project/DEV/21/item/5088
            PageSettings pageSettings = null;

            try
            {
                if (CurrentCard.Options.ContainsKey(AppGuid))
                {
                    pageSettings = CurrentCard.Options[AppGuid].FromJson <PageSettings>();

                    if (pageSettings.PageData != null)
                    {
                        currentProjectId = pageSettings.PageData.projectId;

                        versionId          = pageSettings.PageData.versionId;
                        includeSubversions = pageSettings.PageData.includeSubversions;
                    }
                }
            }
            catch
            {
            }

            //If no project is selected, select the first workspace project.
            if ((!currentProjectId.HasValue || currentProjectId.Value == 0) && filter.Projects.HasValue())
            {
                try
                {
                    var workspaceProjects = filter.Projects.Split('|');

                    if (workspaceProjects.Count() > 0)
                    {
                        currentProjectId = Convert.ToInt32(workspaceProjects[0]);
                    }
                }
                catch
                {
                }
            }

            var viewableProjects = ProjectManager.GetAppViewableProjects(this).ToList();

            if (!viewableProjects.Any(s => s.Entity.Id == currentProjectId.Value))
            {
                currentProjectId = viewableProjects.Count > 0 ? viewableProjects.First().Entity.Id : 0;
            }

            UserContext.Project = ProjectManager.Get(currentProjectId);

            IEnumerable <Countersoft.Gemini.Commons.Entity.Version> versions = null;

            // get all versions that are released or not according to settings passed (BUT - NEVER show archived projects)
            versions = Cache.Versions.GetAll().Where(v => v.ProjectId == currentProjectId && v.Released == false && v.Archived == false).OrderBy(o => o.Sequence);

            if (versionId == 0)
            {
                VersionDto version = VersionManager.GetFirstRoadmapVersion(UserContext.Project.Entity.Id);

                if (version != null)
                {
                    versionId = version.Entity.Id;
                }
                else
                {
                    versionId = versions.Count() > 0 ? versions.First().Id : 0;
                }
            }

            List <IssueDto> issues;

            issues = IssueManager.GetRoadmap(UserContext.Project.Entity.Id, filter, versionId);
            if (includeSubversions)
            {
                var child = versions.Where(v => v.ParentId == versionId).ToList();
                AddChildVersions(versions.ToList(), UserContext.Project.Entity.Id, filter, child, ref issues);
            }

            RoadmapAppModel model = BuildModelData(versionId, versions, issues);

            model.ProjectList        = new SelectList(viewableProjects, "Entity.Id", "Entity.Name", currentProjectId.GetValueOrDefault());
            model.IncludeSubVersions = includeSubversions;

            if (pageSettings == null)
            {
                pageSettings = new PageSettings();
            }

            pageSettings.PageData.versionId = versionId;

            pageSettings.PageData.projectId = currentProjectId.GetValueOrDefault();

            CurrentCard.Options[AppGuid] = pageSettings.ToJson();

            //var view = RenderPartialViewToString(this, "~/views/Roadmap.cshtml", model);
            return(new WidgetResult()
            {
                Success = true, Markup = new WidgetMarkup("views/Roadmap.cshtml", model)
            });
        }