public UDSHandler(ProjectHandler project, XmlElement source) { Parent = project; Contracts = new List<ContractHandler>(); AllContracts = new List<ContractHandler>(); XmlHelper ph = new XmlHelper(project.Preference); List<string> list = new List<string>(); foreach (XmlElement e in ph.GetElements("Property/Contract")) { string name = e.GetAttribute("Name"); list.Add(name); } XmlHelper h = new XmlHelper(source); foreach (XmlElement contractElement in h.GetElements("Contract")) { ContractHandler ch = new ContractHandler(contractElement); if (list.Contains(ch.Name)) Contracts.Add(ch); AllContracts.Add(ch); } }
internal UDTHandler(ProjectHandler project, XmlElement source) { Parent = project; Tables = new List<UDTTable>(); AllUDTTables = new List<UDTTable>(); _allUDTs = new List<string>(); XmlHelper h = new XmlHelper(source); XmlHelper ph = new XmlHelper(project.Preference); List<string> list = new List<string>(); foreach (XmlElement e in ph.GetElements("Property/UDT")) { string name = e.GetAttribute("Name"); list.Add(name.ToLower()); _allUDTs.Add(name); } foreach (XmlElement tableElement in h.GetElements("TableName")) { UDTTable table = new UDTTable(tableElement.InnerText); if (list.Contains(table.Name.ToLower())) Tables.Add(table); _allUDTs.Add(table.Name.ToLower()); AllUDTTables.Add(table); } }
public static void PushStaticResources([Required] string environment, string packagedirectory) { var ph = new ProjectHandler().Initialize(); if (String.IsNullOrWhiteSpace(packagedirectory)) { packagedirectory = System.IO.Directory.GetCurrentDirectory(); } Console.WriteLine("Pushing from: {0}", packagedirectory); try { var resp = new SalesforceRepository(ph.GetContext(environment), null, new StaticResourcesOnlyDeploymentStrategy()); var options = new DeployOptions() { CheckOnly = false, IgnoreWarnings = false, PerformeRetrive = false, RollbackOnError = true }; var id = resp.Deploy(packagedirectory, options); Salesforce.Migrations.Assistant.Library.MetaDataService.DeployResult result = SalesforceRepositoryHelpers.WaitDeployResult(id, resp.GetContext, new CancellationToken()); if (result.details.componentFailures != null) { foreach (DeployMessage item in result.details.componentFailures) { if (!string.IsNullOrWhiteSpace(item.problem)) { Console.WriteLine(item.problem); } } } if (result.done == true && result.success == true) { Console.WriteLine("Deployment completed successfully with no errors!"); } } catch (Exception ex) { Log.Error(ex.Message); throw; } }
private void WriteToZipFile() { // //Note: This doesnt actually save the zip file until it closes fileModified = true; string filepath = path.Replace(Environment.CurrentDirectory + "\\", "").Replace("\\", "/");; if (New_JsonEditor.jet == null) { New_JsonEditor.jet = new ZipFile(CurrentProjectVariables.PathToProjectClassFile + "\\" + CurrentProjectVariables.ProjectName + ".jet"); } ProjectHandler.UpdateFileInZip(New_JsonEditor.jet, filepath, Editor_TextBox.Text); }
private void New_JsonEditor_FormClosing(object sender, FormClosingEventArgs e) { ProjectHandler.SaveProject(); Serializer.SaveSettings(); foreach (string t in tabFilePaths) { if (!t.Contains("Backups")) { CheckIfModified(t); } } JsonEditorHandler.jeditor = null; }
private void StartUp() { //string std = DeserializeConfig().CurrentGame; gameName = CurrentProjectVariables.GameName; jetName = ReturnJetName(gameName); gameDir = CurrentProjectVariables.GamePath; if (gameName != "BTDB" && gameName != "" && gameName != null) { password = "******"; CurrentProjectVariables.JetPassword = password; ProjectHandler.SaveProject(); } steamJetPath = gameDir + "\\Assets\\" + jetName; }
public string GetResults(int referenceIndexToShow) { ProjectHandler projHandler = GameObject.FindObjectOfType <ProjectHandler>(); string results; // Generate trajectory info results = "Traj pts: " + trajectories.Count + "\n"; switch (trajectories.Count) { case 0: results = results + "()---< EMPTY"; break; default: results = results + "("; for (int i = 0; i < trajectories.Count; i++) { results = results + trajectories[i].labelStart + "-->" + trajectories[i].labelEnd + ", "; } results = results + ")"; break; } // Generate match rating and info text, and notes string trajMatchRatingTxt = "Match Rating: "; string trajMatchInfoTxt = "\nMatches: "; //foreach (RawImage img in projHandler.trajSetOverlays) { img.enabled = true; } //projHandler.activeDataWindow.texture = projHandler.crimeSceneStageView; //foreach (Trajectory traj in this.trajectories) { // Vector3 dispFromCenter = traj.transform.position - currentScene.centerObject.obj.position; // traj.transform.position = currentScene.centerObject.objCopy.position + dispFromCenter; // traj.transform.GetComponent<MeshRenderer>().enabled = traj.IsVisibleOnActivation(); // traj.transform.GetComponent<MeshRenderer>().enabled = true; //} if (referenceIndexToShow < matches.Count) { // Add match info to results text trajMatchRatingTxt = trajMatchRatingTxt + "(" + matches[referenceIndexToShow].setLabel + ")-" + this.ReturnMatchRatingWithReferenceSet(matches[referenceIndexToShow]) + "; "; trajMatchInfoTxt = trajMatchInfoTxt + ". " + matches[referenceIndexToShow].comments; } return(results + "\n\n" + trajMatchRatingTxt + "\n" + trajMatchInfoTxt); }
public void RunAllEnvironments() { var ph = new ProjectHandler().Initialize(); foreach (string salesForcePullEnvionment in ph.GetPullEnviroments()) { var ctx = ph.GetContext(salesForcePullEnvionment); if (ctx != null) { var resp = new SalesforceRepository(ctx, new DateTimeDirectoryStrategy()); resp.SaveLocal( ((fp, i) => fp.fullName.Contains("CP_") && fp.lastModifiedDate >= DateTime.Now.AddDays(-15)), CancellationToken.None); } } }
private static void CreatePendingInvitations(ProjectHandler projectHandler) { projectHandler.AddPendingInvitation(new Message { Resource = "project", Method = "invite", Fields = new Fields { PendingInvitation = new PendingInvitation { Username = "******", ProjectId = 1 } } }); }
private void Save_Button_Click(object sender, EventArgs e) { Serializer.cfg.useExternalEditor = useExternalEditor.Checked; Serializer.cfg.enableSplash = EnableSplash.Checked; Serializer.cfg.disableUpdates = DisableUpdates_CB.Checked; Serializer.cfg.autoFormatJSON = AutoFormatJSON_CB.Checked; Serializer.cfg.UseDeveloperMode = UseDeveloperMode.Checked; CurrentProjectVariables.UseNKHook = UseNKH_CB.Checked; Serializer.SaveSettings(); ProjectHandler.SaveProject(); ConsoleHandler.append_CanRepeat("Settings saved!!!"); DeveloperMode.ControlDeveloperMode(); this.Close(); }
public void CreateWithAssemblyTest() { #warning Failed because the assembly name was wrong. string assemblyName = Assembly.GetExecutingAssembly().FullName; //was hardcoded: "NArrange.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"; ProjectHandlerConfiguration configuration = new ProjectHandlerConfiguration(); configuration.AssemblyName = assemblyName; configuration.ParserType = "NArrange.Core.MSBuildProjectParser"; ProjectHandler handler = new ProjectHandler(configuration); Assert.IsNotNull(handler.ProjectParser, "Project parser was not created."); Assert.That(handler.ProjectParser, Is.InstanceOf(typeof(MSBuildProjectParser))); }
public static void PullAllEnvironments([Required][DefaultValue("1")] int daysbehind, [Optional] string pullfoldername) { var ph = new ProjectHandler().Initialize(); int daysBack = System.Math.Abs(daysbehind) * (-1); foreach (string salesForcePullEnvionment in ph.GetPullEnviroments()) { var ctx = ph.GetContext(salesForcePullEnvionment); if (ctx != null) { var resp = GetRepository(ph, salesForcePullEnvionment, pullfoldername); resp.SaveLocal(((fp, i) => fp.fullName.Contains("CP_") && fp.lastModifiedDate >= DateTime.Now.AddDays(daysBack)), CancellationToken.None); } } }
private static SalesforceRepository GetRepository(ProjectHandler ph, string environment, string pullfoldername) { SalesforceRepository resp = null; if (String.IsNullOrWhiteSpace(pullfoldername)) { resp = new SalesforceRepository(ph.GetContext(environment), new DateTimeDirectoryStrategy()); } else { var strategy = new FlatDirectoryStrategy(pullfoldername); resp = new SalesforceRepository(ph.GetContext(environment), strategy); } return(resp); }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { exit = true; ConsoleHandler.append("Closing toolbox"); ProjectHandler.SaveProject(); Serializer.cfg.EnableConsole = ConsoleHandler.console.Visible; Serializer.SaveSettings(); if (New_JsonEditor.isJsonError) { MessageBox.Show("One or more of your files has a JSON error! If you dont fix it your mod wont work and it will crash your game"); } //Application.Exit(); }
public void PushDeployAllFiles() { var ph = new ProjectHandler().Initialize(); var resp = new SalesforceRepository(ph.GetContext("Dev58 SandBox"), null, new VisualForceDeploymentStrategy()); var options = new DeployOptions() { CheckOnly = false, IgnoreWarnings = false, PerformeRetrive = false, RollbackOnError = true }; resp.Deploy(@"D:\\salesforce.migrations\\solution\\Dev54 SandBox\\_current", options); }
public void DetermineMatches() { ProjectHandler projHandler = GameObject.FindObjectOfType <ProjectHandler>(); matches.Clear(); if (projHandler.trajRefSets.Count > 0) { List <TrajectoryRefSet> acceptableMatches = new List <TrajectoryRefSet>(); foreach (TrajectoryRefSet trajRef in projHandler.trajRefSets) { if (this.ReturnMatchAccuracyWithReferenceSet(trajRef) > trajRef.accuracyRequirement) { acceptableMatches.Add(trajRef); } } int numOfTopPicksFound = 0; float tempMatchRating = 0; TrajectoryRefSet tempTopRef = null; while ((numOfTopPicksFound < defaultNumOfRefsToShow) && (acceptableMatches.Count > 0)) { foreach (TrajectoryRefSet trajRef in acceptableMatches) { float rating = ReturnMatchRatingWithReferenceSet(trajRef); if (rating > tempMatchRating) { tempMatchRating = rating; tempTopRef = trajRef; } } if (tempTopRef && !matches.Contains(tempTopRef)) { matches.Add(tempTopRef); } acceptableMatches.Remove(tempTopRef); tempTopRef = null; numOfTopPicksFound++; } } }
public void Compile() { if (!IsGameRunning(gameName)) { this.Text = "Compiling " + CurrentProjectVariables.ProjectName; Filename_TB.Text = ReturnJetName(gameName); if (gameName == "BTDB") { if (rememberedPassword != null && rememberedPassword != "") { password = rememberedPassword; Serializer.SaveSettings(); CurrentProjectVariables.JetPassword = password; ProjectHandler.SaveProject(); } if (password == null || password.Length <= 0) { var getpas = new Get_BTDB_Password(); getpas.launch = launch; getpas.isExtracting = false; getpas.projName = projName; getpas.destPath = destPath; getpas.Show(); this.Close(); } else { backgroundThread = new Thread(Compile_OnThread); backgroundThread.Start(); } } else { backgroundThread = new Thread(Compile_OnThread); backgroundThread.Start(); } } else { ConsoleHandler.force_append_Notice("Game is currently running. Please close the game and try again..."); this.Close(); } }
public JsonResult Create([FromBody] CreateProjectCommand command, [FromServices] ProjectHandler handler, [FromServices] TimeHandler timeHandler) { //Verificar se passou algum comando if (command is null) { return new JsonResult(NotFound()) { StatusCode = 404 } } ; try { //Executa o processor de criação de projeto var resultProject = (GenericCommandResult)handler.Handle(command); //Verificar se ocorreu com sucesso if (resultProject.Success) { //Retorna um objeto do Tipo Projeto var project = (Project)resultProject.Data; //inicia a fase de colocar o usuario na tabela de tempo no projeto foreach (var item in command.User_Id) { var user = _userRepository.GetById(item); //criar o tempo do projeto por usuario var resultTime = timeHandler.Handle(new CreateTimeCommand(project.Id, user.Id, null, null)); } //Transformo o retorno para mostrar os dados de forma mais organizada var projectDTO = new ProjectDTO(project.Id, project.Title, project.Description); return(Json(projectDTO)); } //Caso não consiga inserir retornar a messagem return(Json("Not insert project")); } catch (Exception ex) { //Retorna algum erro exceção return(new JsonResult(BadRequest()) { StatusCode = 400, Value = new GenericCommandResult(false, "ops! Algo de errado ocorreu, ", ex.Message + ex.InnerException) }); } }
private void buttonCloseProject_Click(object sender, EventArgs e) { DialogResult result = MetroMessageBox.Show(this, "\nDo u want to save your current project ?", "Exit?", MessageBoxButtons.YesNoCancel); if (result == DialogResult.No) { closeProject = true; this.Hide(); OnNotifyPropertyChanged("close"); } else if (result == DialogResult.Yes) { closeProject = true; ProjectHandler.saveProject(); this.Hide(); OnNotifyPropertyChanged("close"); } }
public JsonResult Update([FromBody] UpdateProjectCommand command, [FromServices] ProjectHandler handler, [FromServices] TimeHandler timeHandler) { //Verificar se passou algum comando if (command is null) { return new JsonResult(NotFound()) { StatusCode = 404 } } ; try { //Executa o processor de atualização de projeto var resultProject = (GenericCommandResult)handler.Handle(command); //Verificar se ocorreu com sucesso if (resultProject.Success) { var project = (Project)resultProject.Data; foreach (var item in command.User_Id) { var user = _userRepository.GetById(item); var time = _userTimeRepository.getTimeByProjectByUser(project.Id, item); if (time != null) { var resultTime = timeHandler.Handle(new UpdateTimeCommand(time.Id, project.Id, user.Id, time.Started_at, time.Ended_at)); } } var projectDTO = new ProjectDTO(project.Id, project.Title, project.Description); return(Json(projectDTO)); } return(Json("Not update project")); } catch (Exception ex) { return(new JsonResult(BadRequest()) { StatusCode = 400, Value = new GenericCommandResult(false, "ops! Algo de errado ocorreu, ", ex.Message + ex.InnerException) }); } } }
private void loadProjects_Click(object sender, EventArgs e) { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = "c:\\"; openFileDialog.Filter = "Project Files | *.xml"; openFileDialog.FilterIndex = 0; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { ProjectHandler.loadProject(openFileDialog.FileName); this.Hide(); MainForm main = new MainForm(); main.PropertyChanged += MainChanged; main.Show(); } } }
public void UpdateProject_Failure_Test() { ProjectViewModel pjVM = new ProjectViewModel(); pjVM.ProjectName = "testproj2"; pjVM.StartDate = DateTime.Now; pjVM.EndDate = DateTime.Now.AddDays(1); pjVM.Priority = 10; pjVM.UserId = 1; pjVM.ProjectId = 1; Project pj1 = new Project(); pj1.ProjectName = "testproj1"; pj1.StartDate = DateTime.Now; pj1.EndDate = DateTime.Now.AddDays(1); pj1.Priority = 10; pj1.UserId = 1; pj1.ProjectId = 1; Project pj2 = new Project(); pj2.ProjectName = "testproj2"; pj2.StartDate = DateTime.Now; pj2.EndDate = DateTime.Now.AddDays(1); pj2.Priority = 10; pj2.UserId = 1; pj2.ProjectId = 2; List <Project> projList = new List <Project>(); projList.Add(pj1); projList.Add(pj2); IQueryable <Project> Projects = projList.AsQueryable(); var mockRepo = new Mock <IProjectRepository>(); mockRepo.Setup(p => p.GetAllProject()).Returns(Projects); mockRepo.Setup(p => p.GetProjectById(pjVM.ProjectId)).Returns(pj1); var handler = new ProjectHandler(mockRepo.Object); Assert.That(() => handler.UpdateProject(pjVM), Throws.TypeOf <CustomException>()); mockRepo.Verify(mock => mock.GetProjectById(pjVM.ProjectId), Times.Once()); }
// //Closing stuff // public void CloseTab(string path) { /*if(jet != null) * ProjectHandler.SaveZipFile(jet);*/ int i = tabFilePaths.IndexOf(path); int indexBeforeDelete = tabControl1.SelectedIndex; tabControl1.TabPages.Remove(tabPages[i]); tabControl1.TabPages.Remove(tabPages[i]); if (indexBeforeDelete + 1 <= tabControl1.TabPages.Count) { tabControl1.SelectedIndex = indexBeforeDelete; } else { tabControl1.SelectedIndex = indexBeforeDelete - 1; } if (!path.Contains("Backups")) { CheckIfModified(path); } if (!saveOpenFileList) { tabFilePaths.RemoveAt(i); CurrentProjectVariables.JsonEditor_OpenedTabs.RemoveAt(i); ProjectHandler.SaveProject(); tabPages.RemoveAt(i); userControls.RemoveAt(i); } if (tabControl1.TabPages.Count <= 0) { this.Close(); } }
public void AddProject_Test() { ProjectViewModel pjVM = new ProjectViewModel(); pjVM.ProjectName = "testproj3"; pjVM.StartDate = DateTime.Now; pjVM.EndDate = DateTime.Now.AddDays(1); pjVM.Priority = 10; pjVM.UserId = 1; Project pj1 = new Project(); pj1.ProjectName = "testproj1"; pj1.StartDate = DateTime.Now; pj1.EndDate = DateTime.Now.AddDays(1); pj1.Priority = 10; pj1.UserId = 1; pj1.ProjectId = 1; Project pj2 = new Project(); pj2.ProjectName = "testproj2"; pj2.StartDate = DateTime.Now; pj2.EndDate = DateTime.Now.AddDays(1); pj2.Priority = 10; pj2.UserId = 1; pj2.ProjectId = 2; List <Project> projList = new List <Project>(); projList.Add(pj1); projList.Add(pj2); IQueryable <Project> Projects = projList.AsQueryable(); var mockRepo = new Mock <IProjectRepository>(); mockRepo.Setup(p => p.GetAllProject()).Returns(Projects); var handler = new ProjectHandler(mockRepo.Object); handler.AddProject(pjVM); mockRepo.Verify(mock => mock.GetAllProject(), Times.Once()); }
private void createProjectBtn_Click(object sender, EventArgs e) { using (var saveFileDialog = new SaveFileDialog()) { if (viewModel.projectName == "") { saveFileDialog.FileName = "Untitled Project"; } else { saveFileDialog.FileName = viewModel.projectName; } saveFileDialog.Filter = "Xml File|*.xml"; saveFileDialog.Title = "Save Project"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { ProjectHandler.createNewProject(viewModel.projectName, saveFileDialog.FileName); viewModel.success = true; this.Close(); } } }
public async Task <Survey> hostSurvey() { try { String res = await RestHelper.hostSurvey(this.survey); Survey survey = JsonConvert.DeserializeObject <Survey>(res); if (survey != null) { this.survey.host = survey.host; this.survey.id = survey.id; this.survey.model.id = survey.model.id; ProjectHandler.saveProject(); return(survey); } } catch (Exception e) { Console.WriteLine(e.StackTrace); return(null); } return(new Survey()); }
public void Reference(Project project, IFile file) { if (!_fs.FileExists(file.Fullpath)) { Console.WriteLine("Could not reference unexisting project {0}", file.Fullpath); return; } if (!tryOpen(project.Content.ToString())) { return; } var relativePath = PathExtensions.GetRelativePath( project.File, file.Fullpath).Replace("/", "\\"); if (alreadyReferenced(relativePath)) { return; } var handler = new ProjectHandler(); handler.Read(file.Fullpath, _getTypesProviderByProject); var parent = getReferenceGroup(project.File); var node = _document.CreateNode(XmlNodeType.Element, "ProjectReference", parent.NamespaceURI); var fileAttribute = _document.CreateAttribute("Include"); fileAttribute.Value = relativePath; node.Attributes.Append(fileAttribute); node.AppendChild(createNode("Project", "{" + handler.Guid.ToString() + "}", parent)); node.AppendChild(createNode("Name", Path.GetFileNameWithoutExtension(file.Fullpath), parent)); parent.AppendChild(node); project.SetContent(_document.OuterXml); }
private void NewProject(string gameName) { if (projNoGame) { return; } if (isGamePathValid(gameName) == false) { string gameDir = GetGameDir(gameName); if (!Guard.IsStringValid(gameDir)) { ConsoleHandler.append("The game directory wasn't found. Cancelling project creation."); return; } CurrentProjectVariables.GameName = gameName; CurrentProjectVariables.GamePath = gameDir; if (Guard.IsStringValid(CurrentProjectVariables.PathToProjectClassFile)) { ProjectHandler.SaveProject(); } SaveGamePath(gameName, gameDir); Serializer.SaveSettings(); if (!Validate_Backup(gameName)) { CreateBackup(gameName); } } var setProjName = new SetProjectName(); setProjName.Show(); }
private void AddText(string path, bool isFromZip) { if (!File.Exists(path)) { CloseTab(path); return; } string unformattedText = ""; if (!isFromZip) { unformattedText = File.ReadAllText(path); } else { if (jet == null) { jet = new ZipFile(CurrentProjectVariables.PathToProjectClassFile + "\\" + CurrentProjectVariables.ProjectName + ".jet"); } unformattedText = ProjectHandler.ReadTextFromZipFile(jet, path); } try { JToken jt = JToken.Parse(unformattedText); string formattedText = jt.ToString(Formatting.Indented); userControls[userControls.Count - 1].Editor_TextBox.Text = formattedText; } catch (Exception) { ConsoleHandler.append_CanRepeat("File contains invalid json. Unable to format.."); userControls[userControls.Count - 1].Editor_TextBox.Text = unformattedText; } }
public ProjectController() { _projectHandler = new ProjectHandler(new DataContext()); }
public int CreateProject(CreateProjectModel model) { ProjectHandler handler = new ProjectHandler(new ProjectDataAccess()); return(handler.CreateProject(model)); }
private void saveButton_Click(object sender, EventArgs e) { ProjectHandler.saveProject(); MessageBox.Show("Project Successfully Saved"); }