Beispiel #1
0
        /// <summary>
        /// Creates a new instance of NETImort.
        /// </summary>
        /// <param name="Destination">An instance of a Project to which all entities
        ///                           are added.</param>
        public NETImport(ProjectCore Destination, ImportSettings ImportSettings)
        {
            xProject        = Destination;
            xImportSettings = ImportSettings;

            dstOperatorMethodsMap.Add("op_UnaryPlus", "operator +");
            dstOperatorMethodsMap.Add("op_UnaryNegation", "operator -");
            dstOperatorMethodsMap.Add("op_LogicalNot", "operator !");
            dstOperatorMethodsMap.Add("op_OnesComplement", "operator ~");
            dstOperatorMethodsMap.Add("op_Increment", "operator ++");
            dstOperatorMethodsMap.Add("op_Decrement", "operator --");
            dstOperatorMethodsMap.Add("op_True", "operator true");
            dstOperatorMethodsMap.Add("op_False", "operator false");
            dstOperatorMethodsMap.Add("op_Addition", "operator +");
            dstOperatorMethodsMap.Add("op_Subtraction", "operator -");
            dstOperatorMethodsMap.Add("op_Multiply", "operator *");
            dstOperatorMethodsMap.Add("op_Division", "operator /");
            dstOperatorMethodsMap.Add("op_Modulus", "operator %");
            dstOperatorMethodsMap.Add("op_BitwiseAnd", "operator &");
            dstOperatorMethodsMap.Add("op_BitwiseOr", "operator |");
            dstOperatorMethodsMap.Add("op_ExclusiveOr", "operator ^");
            dstOperatorMethodsMap.Add("op_LeftShift", "operator <<");
            dstOperatorMethodsMap.Add("op_RightShift", "operator >>");
            dstOperatorMethodsMap.Add("op_Equality", "operator ==");
            dstOperatorMethodsMap.Add("op_Inequality", "operator !=");
            dstOperatorMethodsMap.Add("op_LessThan", "operator <");
            dstOperatorMethodsMap.Add("op_GreaterThan", "operator >");
            dstOperatorMethodsMap.Add("op_LessThanOrEqual", "operator <=");
            dstOperatorMethodsMap.Add("op_GreaterThanOrEqual", "operator >=");
        }
Beispiel #2
0
        public void Launch(ProjectCore project)
        {
            if (project == null)
            {
                return;
            }

            if (project.Language.Name != "C#")
            {
                MessageBox.Show("The " + project.Language.Name + " language is not supported.",
                                "Assembly Importer", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string fileName;

            using (OpenFileDialog dialog = new OpenFileDialog()) {
                dialog.Filter = "Assemblies (*.exe, *.dll)|*.exe;*.dll";
                if (dialog.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                fileName = dialog.FileName;
            }

            ImportSettings settings = new ImportSettings();

            using (ImportSettingsForm settingsForm = new ImportSettingsForm(settings)) {
                if (settingsForm.ShowDialog() == DialogResult.OK && project.NewProject())
                {
                    NETImport importer = new NETImport(project, settings);
                    importer.ImportAssembly(fileName);
                }
            }
        }
Beispiel #3
0
        public void ShowDialog(ProjectCore project)
        {
            this.project = project;

            UpdateTexts();
            UpdateValues();
            ShowDialog();
        }
Beispiel #4
0
        /// <exception cref="ArgumentNullException">
        /// <paramref name="project"/> is null.
        /// </exception>
        protected ProjectGenerator(ProjectCore project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            this.project = project;
        }
Beispiel #5
0
        /// <exception cref="ArgumentNullException">
        /// <paramref name="project"/> is null.
        /// </exception>
        public Generator(ProjectCore project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            projectGenerator = CreateProjectGenerator(project);
        }
Beispiel #6
0
        public virtual async Task <ActionResult> Index()
        {
            var navigationProperties = new[] { nameof(DataLayer.Project.Commits) };
            var projects             = await ProjectCore.GetListAsync(prj => prj.UserId == UserIdentity.Id, navigationProperties).ConfigureAwait(false);

            foreach (var project in projects)
            {
                if (project.IsGitRepo)
                {
                    project.Commits = await GitHubApiHelper.GetCommitsAsync(project).ConfigureAwait(false);
                }
            }

            return(View(projects));
        }
Beispiel #7
0
        protected virtual ProjectGenerator CreateProjectGenerator(ProjectCore project)
        {
            Language language = project.Language;

            if (language == CSharpLanguage.Instance)
            {
                return(new CSharpProjectGenerator(project));
            }
            if (language == JavaLanguage.Instance)
            {
                return(new JavaProjectGenerator(project));
            }

            throw new ArgumentException("The project is invalid: unknown language.");
        }
Beispiel #8
0
        public virtual async Task <ActionResult> Create(Project model)
        {
            model.CreatedAt = DateTime.UtcNow;
            model.UserId    = UserIdentity.Id;
            if (model.IsGitRepo)
            {
                model.Name += " [Git]";
            }

            model = await ProjectCore.CreateAsync(model, true).ConfigureAwait(false);

            if (model == null)
            {
                return(RedirectToAction(MVC.Project.Actions.Create()));
            }

            return(RedirectToAction(MVC.Project.Actions.Details(model.Id)));
        }
Beispiel #9
0
        public virtual async Task <ActionResult> Details(Guid id)
        {
            var navigationProperties = new[] { nameof(DataLayer.Project.Commits) };
            var project = await ProjectCore.GetAsync(id, navigationProperties).ConfigureAwait(false);

            if (project == null)
            {
                return(RedirectToAction(MVC.Home.Actions.Index()));
            }

            if (project.IsGitRepo)
            {
                project.Commits = await GitHubApiHelper.GetCommitsAsync(project).ConfigureAwait(false);
            }

            foreach (var commit in project.Commits)
            {
                commit.Project = null;
            }
            project.Commits = project.Commits.OrderByDescending(c => c.CreatedAt).ToList();

            return(View(MVC.Project.Views.Details, project));
        }
Beispiel #10
0
 /// <exception cref="ArgumentNullException">
 /// <paramref name="project"/> is null.
 /// </exception>
 internal JavaProjectGenerator(ProjectCore project) : base(project)
 {
 }
Beispiel #11
0
 public ProjectController(ProjectCore ACore)
 {
     FCore = ACore;
 }
 /// <exception cref="ArgumentNullException">
 /// <paramref name="project"/> is null.
 /// </exception>
 internal CSharpProjectGenerator(ProjectCore project) : base(project)
 {
 }