Ejemplo n.º 1
0
        public static List <SolutionModel> GetSolution(Action <CommandFilter> match)
        {
            var command = _dbBaseProvider.CreateCommandStruct("Solutions", CommandMode.Inquiry);

            command.Columns = "SlnID,SlnName,Namespace,RefNamespace,Url,GameID,SerUseScript,CliUseScript,IsDParam,RespContentType";
            command.OrderBy = "SlnID ASC";
            command.Filter  = _dbBaseProvider.CreateCommandFilter();
            if (match != null)
            {
                match(command.Filter);
            }
            command.Parser();
            var list = new List <SolutionModel>();

            using (var reader = _dbBaseProvider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters))
            {
                while (reader.Read())
                {
                    SolutionModel model = new SolutionModel();
                    model.SlnID           = reader["SlnID"].ToInt();
                    model.GameID          = reader["GameID"].ToInt();
                    model.SlnName         = reader["SlnName"].ToNotNullString();
                    model.Namespace       = reader["Namespace"].ToNotNullString();
                    model.RefNamespace    = reader["RefNamespace"].ToNotNullString();
                    model.Url             = reader["Url"].ToNotNullString();
                    model.SerUseScript    = reader["SerUseScript"].ToNotNullString();
                    model.CliUseScript    = reader["CliUseScript"].ToNotNullString();
                    model.IsDParam        = reader["IsDParam"].ToBool();
                    model.RespContentType = reader["RespContentType"].ToInt();
                    list.Add(model);
                }
            }
            return(list);
        }
        private FileInfo CreateProjectFile(DirectoryInfo root, SolutionModel model)
        {
            string projectRoot = string.Format("{0}/{1}/", root.FullName, model.ProjectName);
            var directoryInfo = new DirectoryInfo(projectRoot);

            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }

            var projectModel = new ProjectModel(model.TestProjectGuid)
            {
                ProjectAssemblyName = model.ProjectAssemblyName,
                ProjectName = model.ProjectName,
                ProjectRootNameSpace = model.ProjectRootNameSpace,
                TargetFramework = model.TargetFramework,
                ReleaseOutputPath = string.Format("../../output/Release/{0}", model.ProjectName),
                DebugOutputPath = string.Format("../../output/Debug/{0}", model.ProjectName),
                ProjectType = model.ProjectType
            };

            projectModel.ProjectOutputType = projectModel.ProjectTypeToProjectOutputType(model.ProjectType);
            projectModel.AddCoreReferences();

            var projectFile = new FileInfo(projectRoot + projectModel.ProjectName + ".csproj");
            File.WriteAllText(projectFile.FullName, TemplateRenderer.Render(ProjectTemplate, projectModel));

            return projectFile;
        }
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            propertiesSelectedByUser = false;

            IIdentifier identifier = fileModel.InnerMost<IIdentifier>(selection);
            IClassDeclaration classDeclaration = identifier.ParentConstruct.As<IClassDeclaration>();
            if (classDeclaration.ExistsTextuallyInFile && classDeclaration.IsInUserCode() && !classDeclaration.IsPrivate())
            {
                IConstructEnumerable<IMemberDeclaration> propertiesForWrapping = GetPropertiesForWrapping(classDeclaration);
                if (!propertiesForWrapping.Any())
                {
                    CreateViewModelWithoutUserSelectedProperties(classDeclaration).NavigateTo();
                }
                else
                {
                    ConfirmOccurencesDialog confirmOccurencesDialog = fileModel.UIProcess.Get<ConfirmOccurencesDialog>();
                    confirmOccurencesDialog.ShowIfOccurencesToConfirmIn("Select properties for wrapping", "Select which properties to be wrapped",
                        () => ConfirmPropertyDeclarationsToBeWrappedAndContinueWrapping(classDeclaration, propertiesForWrapping));
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///		Carga los datos de la solución de un archivo
        /// </summary>
        public SolutionModel Load(ProjectDefinitionModelCollection definitions, string fileName)
        {
            SolutionModel solution = new SolutionModel(fileName);

            // Carga los proyectos
            if (System.IO.File.Exists(fileName))
            {
                MLFile fileML = new XMLParser().Load(fileName);

                foreach (MLNode nodeML in fileML.Nodes)
                {
                    if (nodeML.Name == TagSolution)
                    {
                        foreach (MLNode childML in nodeML.Nodes)
                        {
                            switch (childML.Name)
                            {
                            case TagFolder:
                                solution.Folders.Add(LoadFolder(solution, definitions, childML));
                                break;

                            case TagProject:
                                solution.Projects.Add(LoadProject(solution, definitions, childML));
                                break;
                            }
                        }
                    }
                }
            }
            // Devuelve la solución
            return(solution);
        }
Ejemplo n.º 5
0
 private void RecurceAddModels(List <FormModelDto> forms, List <TypeForm> typeForms, List <SolutionModel> models, TypeForm parent, ref int i, ref int parentId)
 {
     foreach (var typeForm in typeForms.Where(f => f.ParentId == parent?.Id))
     {
         var model = new SolutionModel();
         model.Id       = i;
         model.IdModel  = -1;
         model.Expanded = true;
         model.Text     = typeForm.DisplayName;
         model.ParentId = typeForm.ParentId == null ? 0 : parentId;
         var formsAdd = forms.Where(f => f.TypeFormId == typeForm.Id).ToArray();
         if (formsAdd.Length > 0)
         {
             models.Add(model);
         }
         parentId = i;
         i++;
         foreach (var formModelDto in formsAdd)
         {
             var solFormDto = new SolutionModel();
             solFormDto.Id           = i;
             solFormDto.Text         = formModelDto.Caption;
             solFormDto.ParentId     = model.Id;
             solFormDto.Expanded     = true;
             solFormDto.IdModel      = formModelDto.Id;
             solFormDto.TableName    = formModelDto.TableName;
             solFormDto.VueComponent = string.IsNullOrEmpty(formModelDto.VueComponent)
                 ? "DesignerDictionary"
                 : formModelDto.VueComponent;
             models.Add(solFormDto);
             i++;
         }
         RecurceAddModels(forms, typeForms, models, typeForm, ref i, ref parentId);
     }
 }
        /// <summary>
        ///		Carga los datos de una solución
        /// </summary>
        internal SolutionModel Load(string fileName)
        {
            SolutionModel solution = new SolutionModel();
            MLFile        fileML   = new LibMarkupLanguage.Services.XML.XMLParser().Load(fileName);

            // Carga los datos de la solución
            if (fileML != null)
            {
                foreach (MLNode rootML in fileML.Nodes)
                {
                    if (rootML.Name == TagRoot)
                    {
                        // Asigna las propiedades
                        solution.FileName               = fileName;
                        solution.GlobalId               = rootML.Attributes[TagId].Value;
                        solution.Name                   = rootML.Nodes[TagName].Value.TrimIgnoreNull();
                        solution.Description            = rootML.Nodes[TagDescription].Value.TrimIgnoreNull();
                        solution.LastParametersFileName = rootML.Nodes[TagFileParameters].Value.TrimIgnoreNull();
                        // Carga los objetos
                        LoadConnections(solution, rootML);
                        LoadDeployments(solution, rootML);
                        LoadStorages(solution, rootML);
                        LoadFolders(solution, rootML);
                    }
                }
            }
            // Devuelve la solución
            return(solution);
        }
Ejemplo n.º 7
0
 /// <summary>
 ///		Carga los datos de un proyecto
 /// </summary>
 private ProjectModel LoadProject(SolutionModel solution, ProjectDefinitionModelCollection definitions, MLNode nodeML)
 {
     return(new ProjectModel(solution,
                             definitions.Search(nodeML.Nodes[TagModule].Value,
                                                nodeML.Nodes[TagType].Value),
                             System.IO.Path.Combine(solution.PathBase, nodeML.Nodes[TagFileName].Value)));
 }
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            IMemberDeclaration memberDeclaration = fileModel.InnerMost<IMemberDeclaration>(selection);
            if (memberDeclaration.ExistsTextuallyInFile && !memberDeclaration.Identifier.CodeSpan.Intersects(selection))
            {
                memberDeclaration.Identifier.Select();
            }
            else
            {
                ITypeDeclaration typeDeclaration = fileModel.InnerMost<ITypeDeclaration>(selection);

                if (typeDeclaration.ExistsTextuallyInFile)
                {
                    NavigateToTypeDeclaration(typeDeclaration, selection);
                }
            }
        }
Ejemplo n.º 9
0
 public SolutionFolderViewModel(SolutionModel solution, SolutionFolderModel folderParent, SolutionFolderModel folder)
 {
     _solution     = solution;
     _folderParent = folderParent;
     _folder       = folder;
     InitProperties();
 }
Ejemplo n.º 10
0
        /// <summary>
        ///		Carga los datos de la definición de la web
        /// </summary>
        private SolutionFolderModel LoadFolder(SolutionModel solution, MLNode nodeML)
        {
            SolutionFolderModel folder = new SolutionFolderModel(solution);

            // Carga los datos del nodo
            foreach (MLNode childML in nodeML.Nodes)
            {
                switch (childML.Name)
                {
                case TagName:
                    folder.Name = childML.Value;
                    break;

                case TagDescription:
                    folder.Description = childML.Value;
                    break;

                case TagFolder:
                    folder.Folders.Add(LoadFolder(solution, childML));
                    break;

                case TagFile:
                    folder.Projects.Add(LoadProject(solution, childML.Value));
                    break;
                }
            }
            // Devuelve la carpeta cargada
            return(folder);
        }
Ejemplo n.º 11
0
        /// <summary>
        ///		Crea un proyecto
        /// </summary>
        public ProjectModel Create(SolutionModel solution, SolutionFolderModel folder, string path)
        {
            ProjectModel project = new ProjectModel(solution);

            // Asigna el directorio y nombre de archivo
            if (!path.EndsWith(ProjectModel.FileName))
            {
                // Crea el directorio
                LibCommonHelper.Files.HelperFiles.MakePath(path);
                // Asigna el nobmre de archivo
                project.File.FullFileName = System.IO.Path.Combine(path, "WebDefinition.wdx");
            }
            else
            {
                project.File.FullFileName = path;
            }
            // Añade el proyecto a la solución
            if (folder != null)
            {
                folder.Projects.Add(project);
            }
            else
            {
                solution.Projects.Add(project);
            }
            // Graba la solución
            new SolutionBussiness().Save(solution);
            // Devuelve el proyecto
            return(project);
        }
Ejemplo n.º 12
0
        /// <summary>
        ///		Abre la ventana para crear / modificar un archivo
        /// </summary>
        public SystemControllerEnums.ResultType OpenFormUpdateFile(SolutionModel solution, ProjectModel project, FileModel folderParent, FileModel file)
        {
            SystemControllerEnums.ResultType result = SystemControllerEnums.ResultType.Yes;

            // Abre la ventana de nuevo archivo
            if (file == null)
            {
                FileNewView frmNewView = new FileNewView(project, folderParent);

                // Muestra el diálogo de creación de archivo
                result = DocWriterPlugin.MainInstance.HostPluginsController.HostViewsController.ShowDialog(frmNewView);
                // Obtiene el archivo
                if (result == SystemControllerEnums.ResultType.Yes)
                {
                    file = frmNewView.ViewModel.File;
                }
            }
            // Si se ha creado un nuevo archivo (o es una modificación, abre el formulario de modificación)
            if (result == SystemControllerEnums.ResultType.Yes)
            {
                OpenFormDocument(solution, file);
            }
            // Devuelve el resultado
            return(result);
        }
Ejemplo n.º 13
0
        public async Task Init(SolutionModel solutionModel)
        {
            IList <ProjectInfo> projectInfos = new List <ProjectInfo>(solutionModel.Projects.Count);

            foreach (var projectModel in solutionModel.Projects)
            {
                var projectId          = ProjectId.CreateFromSerialized(projectModel.Id);
                var documentInfos      = new List <DocumentInfo>(projectModel.Documents.Count);
                var projectReferences  = new List <ProjectReference>(projectModel.ProjectToProjectReferences.Count);
                var metadataReferences = new List <MetadataReference>(projectModel.ProjectAssemblyReferences.Count);

                foreach (var documentModel in projectModel.Documents)
                {
                    documentInfos.Add(DocumentInfo.Create(DocumentId.CreateNewId(projectId), documentModel.Name, null, SourceCodeKind.Regular, null, documentModel.Path));
                }
                foreach (var projectReference in projectModel.ProjectToProjectReferences)
                {
                    projectReferences.Add(new ProjectReference(ProjectId.CreateFromSerialized(projectReference.Id)));
                }
                foreach (var projectAssemblyReference in projectModel.ProjectAssemblyReferences)
                {
                    metadataReferences.Add(MetadataReference.CreateFromFile(projectAssemblyReference.LibraryPath));
                }

                var projectInfo = ProjectInfo.Create(projectId, VersionStamp.Default, projectModel.Name,
                                                     projectModel.AssemblyName, LanguageNames.CSharp, projectModel.FilePath, null, null, null,
                                                     documentInfos, projectReferences, metadataReferences, null);
                projectInfos.Add(projectInfo);
            }
            _adhocWorkspace.AddSolution(SolutionInfo.Create(SolutionId.CreateFromSerialized(solutionModel.Id),
                                                            VersionStamp.Default, solutionModel.FilePath, projectInfos));
        }
Ejemplo n.º 14
0
        /// <summary>
        ///		Abre el formulario de modificación del archivo al que hace referencia un documento
        /// </summary>
        private void OpenFormUpdateReference(SolutionModel solution, FileModel file)
        {
            ReferenceModel reference = new ReferenceBussiness().Load(file);
            bool           found     = false;

            // Busca el archivo al que se hace referencia
            if (!reference.FileNameReference.IsEmpty())
            {
                string fileName = new ReferenceBussiness().GetFileName(solution, reference);

                // Si existe el archivo, lo abre
                if (System.IO.File.Exists(fileName))
                {
                    // Abre el formulario del documento al que se hace referencia
                    OpenFormDocument(solution, new FileFactory().GetInstance(file.Project, fileName));
                    // Indica que se ha encontrado el archivo
                    found = true;
                }
            }
            // Si no se ha encontrado el archivo al que se hace referencia, se pregunta al usuaro si quiere abrir el XML
            if (!found &&
                DocWriterPlugin.MainInstance.HostPluginsController.ControllerWindow.ShowQuestion("No existe el archivo al que se hace referencia. ¿Desea abrir el código del archivo?"))
            {
                OpenFormFile(file);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        ///		Abre el formulario de documentos
        /// </summary>
        private void OpenFormDocument(SolutionModel solution, FileModel file)
        {
            if (file.IsImage)
            {
                DocWriterPlugin.MainInstance.HostPluginsController.ShowImage(file.FullFileName);
            }
            else
            {
                switch (file.FileType)
                {
                case FileModel.DocumentType.Unknown:
                case FileModel.DocumentType.File:
                    OpenFormFile(file);
                    break;

                case FileModel.DocumentType.Reference:
                    OpenFormUpdateReference(solution, file);
                    break;

                case FileModel.DocumentType.Folder:
                    DocWriterPlugin.MainInstance.HostPluginsController.ControllerWindow.ShowMessage("No se pueden abrir carpetas");
                    break;

                default:
                    DocumentView view = new DocumentView(solution, file);

                    DocWriterPlugin.MainInstance.HostPluginsController.LayoutController.ShowDocument("DOCWRITER_DOCUMENT_" + file.GlobalId, file.Title, view);
                    break;
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 载入事件处理
        /// </summary>
        protected override void OnLoad()
        {
            using (LoadingModeScope.CreateScope())
            {
                SolutionModel model = new SolutionModel
                {
                    Solution = TargetConfig
                };

                model.RepairByLoaded();
                model.ResetStatus();
                model.OnSolutionLoad();

                TargetConfig.Projects.CollectionChanged    += ConfigCollectionChanged;
                TargetConfig.Enums.CollectionChanged       += ConfigCollectionChanged;
                TargetConfig.ApiItems.CollectionChanged    += ConfigCollectionChanged;
                TargetConfig.NotifyItems.CollectionChanged += ConfigCollectionChanged;
                TargetConfig.Entities.CollectionChanged    += EntitiesCollectionChanged;

                foreach (var cfg in TargetConfig.Enums)
                {
                    GlobalTrigger.OnLoad(cfg);
                }
                foreach (var cfg in TargetConfig.ApiItems)
                {
                    GlobalTrigger.OnLoad(cfg);
                }
                foreach (var cfg in TargetConfig.NotifyItems)
                {
                    GlobalTrigger.OnLoad(cfg);
                }
            }
        }
Ejemplo n.º 17
0
        private void StoreAllSolutions(GRBModel model)
        {
            _model.Solutions.Clear();

            for (var i = 0; i < model.SolCount; i++)
            {
                model.Parameters.SolutionNumber = i;

                var vars = model.GetVars();

                var solution = new SolutionModel();
                var currentSolutionObjective = 0.0;

                for (var j = 0; j < model.NumVars; ++j)
                {
                    var sv = vars[j];

                    var name       = sv.VarName;
                    var splitName  = name.Split('_');
                    var id         = int.Parse(splitName[1]);
                    var lod        = int.Parse(splitName[3]);
                    var visibility = sv.Xn;

                    solution.AddEntry(id, lod, visibility);

                    var objective = sv.Obj * sv.Xn;
                    currentSolutionObjective += objective;
                }

                solution.Objective = currentSolutionObjective;
                _model.Solutions.Add(solution);
            }
        }
Ejemplo n.º 18
0
        private async Task RunBattery(SolutionModel solution, BatteryModel battery)
        {
            // Verificam daca exista deja rezultate pentru bateria si solutia data si daca exista le suprascriem
            VerifyIfResultExists(solution.Id, battery.Id);
            var result = new ResultModel
            {
                SolutionId = solution.Id,
                BatteryId  = battery.Id
            };

            _context.Results.Add(result);
            await _context.SaveChangesAsync();

            foreach (var test in battery.Tests)
            {
                var testResult = CodeRunner.RunCode(solution.Code, test, solution.ProgrammingLanguage.LanguageCode);
                testResult.ResultId = result.Id;
                testResult.TestId   = test.Id;
                var expectedOutput = test.ExpectedOutput.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace("\n", "").Replace(" ", "");
                var resultedOutput = testResult.ResultedOutput.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace("\t", "").Replace("\n", "").Replace(" ", "");
                var pointsGiven    = expectedOutput.Equals(resultedOutput) ? test.Points : 0;
                testResult.PointsGiven = pointsGiven;
                if (testResult.ExecutionTime <= solution.Challenge.ExecutionTimeLimit && testResult.Memory <= solution.Challenge.MemoryLimit)
                {
                    // inserare in tabelul de rezultate ale testelor
                    _context.TestResults.Add(testResult);
                    _context.SaveChanges();
                }
            }
        }
Ejemplo n.º 19
0
        private void FileOpen_Click(object sender, RoutedEventArgs e)
        {
            using (var fbd = new System.Windows.Forms.OpenFileDialog())
            {
                fbd.Filter      = "Visual Studio Solution|*.sln";
                fbd.Multiselect = false;

                if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                if (!File.Exists(fbd.FileName))
                {
                    CurrentSolution = null;
                    return;
                }
                var fi = new FileInfo(fbd.FileName);
                CurrentSolution = new SolutionModel
                {
                    FileInfo = fi,
                    Name     = fbd.FileName.Split('.')[0]
                };
                ProjectList          = SlnParserService.GetProjects(CurrentSolution.FileInfo.FullName);
                SelectedProjectModel = ProjectList.FirstOrDefault();
            }
        }
Ejemplo n.º 20
0
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan  selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            propertiesSelectedByUser = false;

            IIdentifier       identifier       = fileModel.InnerMost <IIdentifier>(selection);
            IClassDeclaration classDeclaration = identifier.ParentConstruct.As <IClassDeclaration>();

            if (classDeclaration.ExistsTextuallyInFile && classDeclaration.IsInUserCode() && !classDeclaration.IsPrivate())
            {
                IConstructEnumerable <IMemberDeclaration> propertiesForWrapping = GetPropertiesForWrapping(classDeclaration);
                if (!propertiesForWrapping.Any())
                {
                    CreateViewModelWithoutUserSelectedProperties(classDeclaration).NavigateTo();
                }
                else
                {
                    ConfirmOccurencesDialog confirmOccurencesDialog = fileModel.UIProcess.Get <ConfirmOccurencesDialog>();
                    confirmOccurencesDialog.ShowIfOccurencesToConfirmIn("Select properties for wrapping", "Select which properties to be wrapped",
                                                                        () => ConfirmPropertyDeclarationsToBeWrappedAndContinueWrapping(classDeclaration, propertiesForWrapping));
                }
            }
        }
        /// <summary>
        ///		Obtiene los nodos para los datos de conexión de una solución
        /// </summary>
        private MLNodesCollection GetConnectionsNodes(SolutionModel solution)
        {
            MLNodesCollection nodesML = new MLNodesCollection();

            // Añade los datos
            foreach (ConnectionModel connection in solution.Connections)
            {
                MLNode nodeML = nodesML.Add(TagConnection);

                // Añade los datos
                nodeML.Attributes.Add(TagId, connection.GlobalId);
                nodeML.Nodes.Add(TagName, connection.Name);
                nodeML.Nodes.Add(TagDescription, connection.Description);
                nodeML.Attributes.Add(TagType, connection.Type.ToString());
                nodeML.Attributes.Add(TagTimeoutExecuteScript, connection.TimeoutExecuteScript.TotalMinutes);
                // Añade los parámetros
                foreach ((string key, string value) in connection.Parameters.Enumerate())
                {
                    MLNode parameterML = nodeML.Nodes.Add(TagParameter);

                    // Añade los atributos
                    parameterML.Attributes.Add(TagName, key);
                    parameterML.Attributes.Add(TagValue, value);
                }
            }
            // Devuelve la colección de nodos
            return(nodesML);
        }
        /// <summary>
        ///		Carga los datos de conexión
        /// </summary>
        private void LoadConnections(SolutionModel solution, MLNode rootML)
        {
            foreach (MLNode nodeML in rootML.Nodes)
            {
                if (nodeML.Name == TagConnection)
                {
                    ConnectionModel connection = new ConnectionModel(solution);

                    // Asigna las propiedades
                    connection.GlobalId             = nodeML.Attributes[TagId].Value;
                    connection.Name                 = nodeML.Nodes[TagName].Value.TrimIgnoreNull();
                    connection.Description          = nodeML.Nodes[TagDescription].Value.TrimIgnoreNull();
                    connection.Type                 = nodeML.Attributes[TagType].Value.GetEnum(ConnectionModel.ConnectionType.Spark);
                    connection.TimeoutExecuteScript = TimeSpan.FromMinutes(nodeML.Attributes[TagTimeoutExecuteScript].Value.GetInt(40));
                    // Carga los parámetros
                    foreach (MLNode childML in nodeML.Nodes)
                    {
                        if (childML.Name == TagParameter)
                        {
                            connection.Parameters.Add(childML.Attributes[TagName].Value.TrimIgnoreNull(), childML.Attributes[TagValue].Value.TrimIgnoreNull());
                        }
                    }
                    // Añade los datos a la solución
                    solution.Connections.Add(connection);
                }
            }
        }
Ejemplo n.º 23
0
        public async Task <IActionResult> SubmitSolutionAsync(int pid, [FromForm] string lang, [FromForm] string code)
        {
            var user = HttpContext.Session.GetString("user");

            if (user is null)
            {
                return(Unauthorized("Not logged in."));
            }
            if (code.Length > maxSolutionSize)
            {
                return(StatusCode(StatusCodes.Status413PayloadTooLarge,
                                  $"Solution size should be less than {maxSolutionSize} bytes."));
            }
            if (!SolutionModel.LangMap.ContainsKey(lang))
            {
                return(BadRequest("No such language."));
            }
            var viewAll = await UserModel.Authorization.CanViewAllProblemsAsync(user);

            if (!viewAll)
            {
                if (await ProblemModel.IsProblemRestrictedAsync(pid))
                {
                    return(StatusCode(StatusCodes.Status403Forbidden, "This problem is private now."));
                }
            }
            if (!await ProblemModel.IsProblemExists(pid))
            {
                return(NotFound("No such problem."));
            }
            var submit_id = await SolutionModel.SubmitProblemAsync(user, pid, SolutionModel.LangMap[lang], code);

            return(Ok(submit_id));
        }
 public DocWriterCompilerProcessor(string source, SolutionModel solution, ProjectModel project, string pathGeneration, bool minimize) : base(source)
 {
     Solution       = solution;
     Project        = project;
     PathGeneration = pathGeneration;
     Minimize       = minimize;
 }
Ejemplo n.º 25
0
        /// <summary>
        ///		Carga los datos de una solución
        /// </summary>
        public SolutionModel Load(string fileName)
        {
            SolutionModel solution = new SolutionModel();
            MLFile        fileML   = new XMLParser().Load(fileName);

            // Asigna las propiedades
            solution.FullFileName = fileName;
            // Carga los proyectos
            if (fileML != null)
            {
                foreach (MLNode nodeML in fileML.Nodes)
                {
                    if (nodeML.Name.Equals(TagFilesRoot))
                    {
                        foreach (MLNode childML in nodeML.Nodes)
                        {
                            switch (childML.Name)
                            {
                            case TagFile:
                                solution.Projects.Add(LoadProject(solution, childML.Value));
                                break;

                            case TagFolder:
                                solution.Folders.Add(LoadFolder(solution, childML));
                                break;
                            }
                        }
                    }
                }
            }
            // Devuelve la solución
            return(solution);
        }
        public ActionResult NoteEdit(SolutionModel model)
        {
            CourseServices service = new CourseServices();

            service.EditNote(model);
            return(RedirectToAction("TaskSolutions", new { TaskId = model.TaskId }));
        }
Ejemplo n.º 27
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                int    id           = Convert.ToInt32((string)GridView1.DataKeys[e.RowIndex].Values[0].ToString());
                string SlnName      = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("SlnName")).Text;
                string Namespace    = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Namespace")).Text;
                string RefNamespace = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("RefNamespace")).Text;
                string url          = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Url")).Text;
                string gameid       = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("gameid")).Text;

                SolutionModel mode = new SolutionModel();
                mode.SlnID        = id;
                mode.SlnName      = SlnName;
                mode.Namespace    = Namespace;
                mode.RefNamespace = RefNamespace;
                mode.Url          = url;
                mode.GameID       = Convert.ToInt32(gameid);
                if (DbDataLoader.Update(mode))
                {
                    GridView1.EditIndex = -1;
                    BindData();
                }
            }

            catch (Exception erro)
            {
                Response.Write("错误信息:" + erro.Message);
            }
        }
Ejemplo n.º 28
0
        public IActionResult Index(SolutionModel model)
        {
            FilterContainer <Solution.Domain.Solution> container = FilterContainerBuilder.Build <Solution.Domain.Solution>();

            container.And(n => n.OrganizationId == CurrentUser.OrganizationId);
            if (model.Name.IsNotEmpty())
            {
                container.And(n => n.Name == model.Name);
            }
            if (!model.IsSortBySeted)
            {
                model.SortBy        = "Name";
                model.SortDirection = (int)SortDirection.Asc;
            }

            if (model.GetAll)
            {
                model.Page     = 1;
                model.PageSize = WebContext.PlatformSettings.MaxFetchRecords;
            }
            else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0)
            {
                model.PageSize = CurrentUser.UserSettings.PagingLimit;
            }
            model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize;
            PagedList <Solution.Domain.Solution> result = _solutionService.QueryPaged(x => x
                                                                                      .Page(model.Page, model.PageSize)
                                                                                      .Where(container)
                                                                                      .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))
                                                                                      );

            model.Items      = result.Items;
            model.TotalItems = result.TotalItems;
            return(DynamicResult(model));
        }
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan  selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            IMemberDeclaration memberDeclaration = fileModel.InnerMost <IMemberDeclaration>(selection);

            if (memberDeclaration.ExistsTextuallyInFile && !memberDeclaration.Identifier.CodeSpan.Intersects(selection))
            {
                memberDeclaration.Identifier.Select();
            }
            else
            {
                ITypeDeclaration typeDeclaration = fileModel.InnerMost <ITypeDeclaration>(selection);

                if (typeDeclaration.ExistsTextuallyInFile)
                {
                    NavigateToTypeDeclaration(typeDeclaration, selection);
                }
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SolutionModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Solutions set ");
            strSql.Append("SlnName=@SlnName,Namespace=@Namespace,RefNamespace=@RefNamespace,Url=@Url,GameID=@GameID");
            strSql.Append(" where SlnID=@SlnID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SlnID",        SqlDbType.Int,     4),
                new SqlParameter("@SlnName",      SqlDbType.VarChar, 0),
                new SqlParameter("@Namespace",    SqlDbType.VarChar, 0),
                new SqlParameter("@RefNamespace", SqlDbType.VarChar, 0),
                new SqlParameter("@Url",          SqlDbType.VarChar, 0),
                new SqlParameter("@GameID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.SlnID;
            parameters[1].Value = model.SlnName;
            parameters[2].Value = model.Namespace;
            parameters[3].Value = model.RefNamespace;
            parameters[4].Value = model.Url;
            parameters[5].Value = model.GameID;
            int rows = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 31
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SolutionModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Solutions(");
            strSql.Append("SlnName,Namespace,RefNamespace,Url,GameID)");
            strSql.Append(" values (");
            strSql.Append("@SlnName,@Namespace,@RefNamespace,@Url,@GameID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SlnName",      SqlDbType.VarChar, 0),
                new SqlParameter("@Namespace",    SqlDbType.VarChar, 0),
                new SqlParameter("@RefNamespace", SqlDbType.VarChar, 0),
                new SqlParameter("@Url",          SqlDbType.VarChar, 0),
                new SqlParameter("@GameID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.SlnName;
            parameters[1].Value = model.Namespace;
            parameters[2].Value = model.RefNamespace;
            parameters[3].Value = model.Url;
            parameters[4].Value = model.GameID;
            object obj = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 32
0
 public void NewSolution(SolutionModel model)
 {
     if (db.Rozwiązania.Count() > 0)
     {
         db.Rozwiązania.Add(new Rozwiązania()
         {
             IdRozwiązania    = db.Rozwiązania.Max(x => x.IdRozwiązania) + 1,
             IdUcznia         = model.StudentId,
             IdZadania        = model.TaskId,
             TreśćRozwiązania = model.Solution,
             DataWstawienia   = DateTime.Now,
             NazwaPliku       = model.FileName,
             Rozszerzenie     = model.FileName.Split(new Char[] { '.' }).Last()
         });
     }
     else
     {
         db.Rozwiązania.Add(new Rozwiązania()
         {
             IdRozwiązania    = 1,
             IdUcznia         = model.StudentId,
             IdZadania        = model.TaskId,
             TreśćRozwiązania = model.Solution,
             DataWstawienia   = DateTime.Now,
             NazwaPliku       = model.FileName,
             Rozszerzenie     = model.FileName.Split(new Char[] { '.' }).Last()
         });
     }
     db.SaveChanges();
 }
Ejemplo n.º 33
0
 public IActionResult Code([Bind("Code,ChallengeId")] SolutionModel solution, int language)
 {
     if (ModelState.IsValid)
     {
         var programmingLanguage = _context.ProgrammingLanguages.FirstOrDefault(s => s.LanguageCode == language);
         // salvam codul deja scris pentru restaurare
         SaveCodeFunc(solution.Code, solution.ChallengeId, programmingLanguage.Id);
         var userId = _userManager.GetUserId(User);
         // preluam sesiunea de coding din baza de date
         var codingSession = _context.CodingSessions
                             .Include(s => s.Challenge)
                             .ThenInclude(s => s.Contest)
                             .FirstOrDefault(s => s.ApplicationUserId == userId && s.ChallengeId == solution.ChallengeId);
         if (codingSession == null)
         {
             return(NotFound());
         }
         // formare solutie
         solution.ApplicationUserId     = userId;
         solution.ReceiveDateTime       = DateTime.Now;
         solution.ProgrammingLanguageId = programmingLanguage.Id;
         solution.Duration = DateTime.Now - codingSession.Challenge.Contest.StartDate;
         _context.Add(solution);
         _context.SaveChanges();
         return(RedirectToAction("VerifySubmit", "Solution", new { id = solution.Id }));
     }
     return(NotFound());
 }
Ejemplo n.º 34
0
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            return fileModel.MemberIdentifierAt(selection).ExistsTextuallyInFile;
        }
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            IConstructEnumerable<IFieldDeclaration> fields = FindFields(fileModel, selection);
            return fields.Exist() && ImplementsINotifyPropertyChanged(fields.First().EnclosingClass);
        }
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            IMemberDeclaration member = fileModel.InnerMost<IMemberDeclaration>(selection);
            return member.ExistsTextuallyInFile && member.Identifier.CodeSpan.Intersects(selection);
        }
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            IIdentifier identifier = fileModel.InnerMost<IIdentifier>(selection);
            IClassDeclaration classDeclaration = identifier.ParentConstruct.As<IClassDeclaration>();
            return classDeclaration.ExistsTextuallyInFile && classDeclaration.IsInUserCode() && !classDeclaration.IsPrivate();
        }
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            IUsingDirectiveSection section = fileModel.InnerMost<IUsingDirectiveSection>(selection);

            return section.Exists && !section.Enclosing<INamespaceDeclaration>().Exists;
        }
Ejemplo n.º 39
0
        public SolutionExplorerTool()
        {
            InitializeComponent();
            this.Title = "Solution Explorer";

            // Set the image list.
            this.m_LinuxImageList = Associations.ImageList as LinuxImageList;

            // Set the solution model.
            m_Log.Debug("Setting solution model to tool window.");
            this.c_TreeView.HeaderHidden = true;
            this.m_CurrentModel = new SolutionModel(this);
            LinuxNativePool.Instance.Retain(this.m_CurrentModel);
            this.c_TreeView.SetModel(this.m_CurrentModel);
            m_Log.Debug("Solution model has been initialized.");
        }
        private FileInfo[] CreateProjectAssets(DirectoryInfo root, SolutionModel model)
        {
            var files = new List<FileInfo>();

            FileInfo solutionFile;
            if (model.IncludeResharper)
            {
                solutionFile = new FileInfo(string.Format("{0}/resharper.settings", root.FullName));
                File.WriteAllText(solutionFile.FullName, TemplateRenderer.Render(ResharperSettingsTemplate, model));
                files.Add(solutionFile);
            }
            if (model.IncludeStylecop)
            {
                solutionFile = new FileInfo(string.Format("{0}/Settings.StyleCop", root.FullName));
                File.WriteAllText(solutionFile.FullName, TemplateRenderer.Render(StyleCopTemplate, model));
                files.Add(solutionFile);
            }
            return files.ToArray();
        }
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            IPropertyDeclaration propertyDeclaration = fileModel.InnerMost<IPropertyDeclaration>(selection);

            if (IsFieldBackedPropertyWithSetterInsideClass(propertyDeclaration))
            {
                return EnclosingClassImplementsINotifyPropertyChanged(propertyDeclaration);
            }

            return false;
        }
Ejemplo n.º 42
0
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            IMemberDeclaration memberDeclaration = fileModel.MemberIdentifierAt(selection);
            if (memberDeclaration.ExistsTextuallyInFile)
            {
                IMemberDeclaration nextMember = memberDeclaration.NextMember();
                if (nextMember.ExistsTextuallyInFile)
                {
                    nextMember.Identifier.NavigateTo();
                }
            }
        }
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            IPropertyDeclaration propertyDeclaration = fileModel.InnerMost<IPropertyDeclaration>(selection);

            if (IsFieldBackedPropertyWithSetterInsideClass(propertyDeclaration) && EnclosingClassImplementsINotifyPropertyChanged(propertyDeclaration))
            {
                IConstructLanguage language = propertyDeclaration.Language;
                string methodInvocationName = language.Name == LanguageNames.CSharp ? "OnPropertyChanged" : "RaisePropertyChangedEvent";
                IMethodInvocation methodInvocation =
                    language.MethodInvocation(
                        language.None<IExpression>(),
                        language.Identifier(methodInvocationName),
                        language.None<ITypeArguments>(),
                        language.Arguments(
                            language.Argument(language.StringLiteral(propertyDeclaration.Identifier.Name))));

                IAccessor setter = propertyDeclaration.Setter();
                List<IStatement> ifBlockStatements = new List<IStatement>(setter.Block.ChildStatements);
                ifBlockStatements.Add(language.ExpressionStatement(methodInvocation));

                IIfStatement ifStatement =
                    language.IfStatement(
                        language.BinaryExpression(
                            language.MemberAccess(language.None<IExpression>(),
                            propertyDeclaration.BackingField().Identifier),
                        Operator.NotEqual,
                        language.Expression("value")),
                        language.Block(ifBlockStatements));

                IBlock newBlock = language.Block(ifStatement);
                setter.Block = newBlock;
            }
        }
        public override bool CanExecute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return false;
            }

            IMemberDeclaration memberDeclaration = fileModel.InnerMost<IMemberDeclaration>(selection);
            if (memberDeclaration.ExistsTextuallyInFile && !memberDeclaration.Identifier.CodeSpan.Intersects(selection))
            {
                return memberDeclaration.Is<IMethodDeclaration>() || memberDeclaration.Is<IPropertyDeclaration>() ||
                       memberDeclaration.Is<IConstructorDeclaration>() || memberDeclaration.Is<IStaticConstructorDeclaration>();
            }
            else
            {
                return fileModel.InnerMost<ITypeDeclaration>(selection).ExistsTextuallyInFile;
            }
        }
        public void DoWork(SolutionModel model)
        {
            // create folders under root path
            var rootDirectoryInfo = new DirectoryInfo(model.RootPath);
            CreateFolderStructure(rootDirectoryInfo);
            CreateSolutionAssets(rootDirectoryInfo, model);

            // create files under root/src path
            rootDirectoryInfo = new DirectoryInfo(string.Format("{0}/src/", model.RootPath));
            CreateSolutionFile(rootDirectoryInfo, model);
            CreateProjectFile(rootDirectoryInfo, model);
            if (model.IncludeTestProject)
            {
                CreateTestProjectFile(rootDirectoryInfo, model);
            }
            CreateProjectAssets(rootDirectoryInfo, model);

            if (model.InitiliazeGit)
            {
                GitService.InitGitRepository(rootDirectoryInfo);
            }
        }
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            IConstructEnumerable<IFieldDeclaration> fields = FindFields(fileModel, selection);
            if (fields.Exist())
            {
                IConstructLanguage language = fields.Language;

                foreach (IFieldDeclaration field in fields)
                {
                    IPropertyDeclaration property = language.Property(
                        language.None<IDocComment>(),
                        language.None<IAttributes>(),
                        language.Modifiers(Modifiers.Public),
                        language.TypeName(field.TypeName.Type),
                        language.None<IIdentifier>());

                    NamingPolicy propertyNamingPolicy = property.PrimaryNamingPolicy(fileModel.UserSettings);
                    string propertyName = propertyNamingPolicy.MakeMemberNameUniqueInScope(field, field.Identifier.Name);

                    property.Identifier = language.Identifier(propertyName);

                    IAccessor getter = language.FieldGetter(field.Identifier);
                    IAccessor setter = CreateSetter(language, propertyName, field);

                    property.Accessors = language.Enumerable(new List<IAccessor>() { getter, setter });

                    field.EnclosingClass.Insert(property);
                }
            }
        }
        public override void Execute(SolutionModel solutionModel, SelectionContext context)
        {
            FileModel fileModel;
            CodeSpan selection;

            if (!solutionModel.IsEditorSelection(context, out fileModel, out selection))
            {
                return;
            }

            IUsingDirectiveSection mainSection = fileModel.InnerMost<IUsingDirectiveSection>(selection);

            if (mainSection.Exists)
            {
                HashSet<IUsingDirectiveSection> sections = new HashSet<IUsingDirectiveSection>();
                foreach (IUsingDirectiveSection section in fileModel.All<IUsingDirectiveSection>())
                {
                    INamespaceDeclaration nameSpaceItems = section.Enclosing<INamespaceDeclaration>();

                    //we are interested only in top level namespaces
                    if (nameSpaceItems.Exists && !nameSpaceItems.Enclosing<INamespaceDeclaration>().Exists)
                    {
                        sections.Add(section);
                    }
                }

                foreach (IUsingDirectiveSection section in sections)
                {
                    section.Insert(mainSection.Directives, fileModel);
                }
            }

            foreach (IUsingDirective directive in mainSection.Directives)
            {
                directive.Remove();
            }
        }
        private FileInfo[] CreateSolutionAssets(DirectoryInfo root, SolutionModel model)
        {
            var files = new List<FileInfo>();

            FileInfo solutionFile;

            if (model.IncludeGitAttribute)
            {
                solutionFile = new FileInfo(string.Format("{0}/.gitattributes", root.FullName));
                File.WriteAllText(solutionFile.FullName, TemplateRenderer.Render(GitAttributeTemplate, model));
                files.Add(solutionFile);
            }
            if (model.IncludeGitIgnore)
            {
                solutionFile = new FileInfo(string.Format("{0}/.gitignore", root.FullName));
                File.WriteAllText(solutionFile.FullName, TemplateRenderer.Render(GitIgnoreTemplate, model));
                files.Add(solutionFile);
            }
            if (model.IncludeReadme)
            {
                solutionFile = new FileInfo(string.Format("{0}/README.md", root.FullName));
                File.WriteAllText(solutionFile.FullName, TemplateRenderer.RenderAndRenderContent(ReadmeTemplate, model));
                files.Add(solutionFile);
            }
            if (model.IncludeLicense)
            {
                solutionFile = new FileInfo(string.Format("{0}/License.txt", root.FullName));
                File.WriteAllText(solutionFile.FullName, model.LicenseText);
                files.Add(solutionFile);
            }
            return files.ToArray();
        }
        private FileInfo CreateSolutionFile(DirectoryInfo root, SolutionModel model)
        {
            var templateToRender = model.IncludeTestProject ? SolutionWithTestTemplate : SolutionTemplate;
            var solutionFile = new FileInfo(string.Format("{0}{1}.sln", root.FullName, model.SolutionName));

            File.WriteAllText(solutionFile.FullName, TemplateRenderer.Render(templateToRender, model));

            return solutionFile;
        }
        private FileInfo CreateProjectFile(DirectoryInfo root, SolutionModel model)
        {
            string projectRoot = string.Format("{0}/{1}/", root.FullName, model.ProjectName);
            var directoryInfo = new DirectoryInfo(projectRoot);
            var projectTemplate = ProjectTemplate;

            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }

            var projectModel = new ProjectModel(model.TestProjectGuid)
            {
                ProjectAssemblyName = model.ProjectAssemblyName,
                ProjectName = model.ProjectName,
                ProjectRootNameSpace = model.ProjectRootNameSpace,
                TargetFramework = model.TargetFramework,
                ReleaseOutputPath = string.Format("../../output/Release/{0}", model.ProjectName),
                DebugOutputPath = string.Format("../../output/Debug/{0}", model.ProjectName),
                ProjectType = model.ProjectType
            };

            projectModel.ProjectOutputType = projectModel.ProjectTypeToProjectOutputType(model.ProjectType);
            projectModel.AddCoreReferences();

            if (projectModel.ProjectOutputType == "Exe")
            {
                File.WriteAllText(projectRoot + "Program.cs", TemplateRenderer.Render(ConsoleProgramClass, projectModel));
            }
            else if (model.ProjectType == "WPF")
            {
                projectTemplate = WpfProjectTemplate;
                File.WriteAllText(projectRoot + "App.xaml", TemplateRenderer.Render(AppXaml, projectModel));
                File.WriteAllText(projectRoot + "App.xaml.cs", TemplateRenderer.Render(AppXamlCs, projectModel));
                File.WriteAllText(projectRoot + "MainWindow.xaml", TemplateRenderer.Render(MainWindowXaml, projectModel));
                File.WriteAllText(projectRoot + "MainWindow.xaml.cs", TemplateRenderer.Render(MainWindowXamlCs, projectModel));
            }
            else if (model.ProjectType == "WinForms")
            {
                File.WriteAllText(projectRoot + "Form1.cs", TemplateRenderer.Render(Form1Cs, projectModel));
                File.WriteAllText(projectRoot + "Form1.Designer.cs", TemplateRenderer.Render(Form1DesignerCs, projectModel));
                File.WriteAllText(projectRoot + "Program.cs", TemplateRenderer.Render(ProgramCs, projectModel));
            }

            var projectFile = new FileInfo(projectRoot + projectModel.ProjectName + ".csproj");

            File.WriteAllText(projectFile.FullName, TemplateRenderer.Render(projectTemplate, projectModel));

            return projectFile;
        }
 public override bool ShouldShowVisualAidTag(SolutionModel solutionModel, SelectionContext context)
 {
     return true;
 }