Ejemplo n.º 1
0
        public bool CreateProjectStat(int projectId)
        {
            try
            {
                //get the project
                var _project = uow.ProjectRepository.FindById(projectId);

                if (_project == null)
                {
                    return(false);
                }

                else
                {
                    var _projectStat = new ProjectStat()
                    {
                        ProjectId    = projectId,
                        BackersNo    = 0,
                        MoneyPledged = 0,
                        SharesNo     = 0,
                        CommentsNo   = 0
                    };

                    uow.ProjectStatRepository.Insert(_projectStat, true);
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads files
        /// </summary>
        private void LoadFilesBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            IsBusy = true;

            string projectPath = e.Argument.ToString();

            _projectStat = new ProjectStatReader(projectPath, _textExtractorsWithReaders.SelectMany(x => x.Item1.FileExtensionFor()).Distinct().ToList(), this).GetProjectStat();

            if (_projectStat == null)
            {
                MessageBox.Show("The path: " + projectPath + " does not exists.", "Folder not found", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // populate list
            if (_projectStat == null)
            {
                return;
            }

            // populate counts
            Dictionary <string, FileStatReaderBase> extensionFileReaderBases = new Dictionary <string, FileStatReaderBase>();

            foreach (var tuple in _textExtractorsWithReaders)
            {
                foreach (string extension in tuple.Item1.FileExtensionFor())
                {
                    extensionFileReaderBases.Add(extension.ToLowerInvariant(), tuple.Item2);
                }
            }

            foreach (FileStat fileStat in _projectStat.FileStats)
            {
                extensionFileReaderBases[fileStat.IndexerFile.Extension].UpdateFileStatCount(fileStat);
            }

            e.Result = _projectStat;
        }
Ejemplo n.º 3
0
        public void LoadStats(ProjectStat projectStat)
        {
            if (projectStat == null)
            {
                return;
            }

            SourceFile             = projectStat.TotalFilesCount;
            Lines                  = projectStat.TotalLines;
            LinesOfCode            = projectStat.TotalLinesOfCode;
            LinesOfComments        = projectStat.TotalLinesOfComment;
            LinesOfCodeAndComments = projectStat.TotalLinesOfCodeAndComment;
            BlankLines             = projectStat.EmptyLines;

            NotifyPropertyChanged(() => Title);

            NotifyPropertyChanged(() => SourceFile);
            NotifyPropertyChanged(() => Lines);
            NotifyPropertyChanged(() => LinesOfCode);
            NotifyPropertyChanged(() => LinesOfComments);
            NotifyPropertyChanged(() => LinesOfCodeAndComments);
            NotifyPropertyChanged(() => BlankLines);
        }