private void btnAddFilter_Click(object sender, EventArgs e) { string text = textBoxName.Text; Filter hasFilter = ProjectUtils.GetFilter(text); if (hasFilter != null) { InfoDialog.ShowDialog(this, "This filter already exists!", "Error!"); return; } if (Globals.IsStringValid(text)) { TreeNode newNode = new TreeNode(text); newNode.ContextMenuStrip = _filterStrip; newNode.ImageIndex = newNode.SelectedImageIndex = newNode.StateImageIndex = 1; _node.Nodes.Add(newNode); Filter newSubFilter = _filter.AddSubFilter(text); string fullPath = string.Format("{0}\\{1}", ProjectUtils.GetProjectDirectory(), newSubFilter.GetFilterDirectory()); Directory.CreateDirectory(fullPath); _node.ExpandAll(); Close(); } }
// 因为音频播放是异步的,方便及时增加播放后的回调内容 public void addCallbackToEffectClip(System.String clipName = "", callback method = null) { if (method == null) { ProjectUtils.Warn("addCallbackToEffectClip Lost method"); return; } ; // 适配,当 audio 刚刚加入队列时, _effectClipObj 并未被赋值 if (!clipName.Trim().Equals("")) { // 避免同名对象进入而使得 callback 没有成功绑定 for (int i = _effectClipPlayList.Count - 1; i >= 0; i--) { AudioPlayObj obj = _effectClipPlayList[i]; if (obj.clip.name == clipName) { obj.handle += method; return; } } } }
public ProjectSettingsWizardForm() { InitializeComponent(); textBoxGameinfoPath.Text = ProjectUtils.GetGameInfoPath(); textBoxStudiomdlPath.Text = ProjectUtils.GetStudioModelPath(); }
public void Initialize() { Observable.EveryUpdate() .Where(_ => Input.GetKeyDown(KeyCode.R)) .Subscribe(_ => ProjectUtils.RefreshScene()) .AddTo(disposables); }
public MainWindowViewModel() { SplashScreenType = typeof(SplashScreenWindow); projectUtils = ProjectUtils.GetInstance(); //MetadataLocator.Default = MetadataLocator.Create().AddMetadata<PrefixEnumWithExternalMetadata>(); Modules = new List <ModuleMenu>(); CreateProjectCommand = new DelegateCommand(CreateProject); OpenProjectCommand = new DelegateCommand(OpenProject); CloseProjectCommand = new DelegateCommand(CloseProject); SaveProjectCommand = new DelegateCommand(SaveProject); NewItemCommand = new DelegateCommand <object>(NewMenuItem); EditItemCommand = new DelegateCommand <object>(EditMenuItem); DelItemCommand = new DelegateCommand <object>(DelMenuItem); var rightMemuItem = new List <SubMenuBase> { }; GetRightMenuList(rightMemuItem); InternetMenuItems = new ObservableCollection <SubMenuBase>(rightMemuItem); //InternetLinkEnabled = InternetLinkHelper.GetInternetLink(); }
public void DeleteTemplate(string name) { var proInst = ProjectUtils.GetInstance(); var temp = proInst.GetProjectTowerTemplate().Where(item => item.Name == name).First(); if (temp == null) { MessageBox.Show("无法获取模板详情"); return; } if (MessageBox.Show("确认删除此模板?", "警告", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return; } string path = proInst.GetProjectlTowerTemplatePath(temp.Name, temp.TowerType); if (File.Exists(path)) { File.Delete(path); } proInst.DeleteProjectTowerTemplate(temp); TowerTemplates.Remove(TowerTemplates.First(item => item.Name == name)); }
private void ApplyNecessaryChangesToSolution() { try { // Migrate solution from old configuration names to: Debug, ExportDebug and ExportRelease DotNetSolution.MigrateFromOldConfigNames(GodotSharpDirs.ProjectSlnPath); var msbuildProject = ProjectUtils.Open(GodotSharpDirs.ProjectCsProjPath) ?? throw new Exception("Cannot open C# project"); // NOTE: The order in which changes are made to the project is important // Migrate to MSBuild project Sdks style if using the old style ProjectUtils.MigrateToProjectSdksStyle(msbuildProject, ProjectAssemblyName); ProjectUtils.EnsureGodotSdkIsUpToDate(msbuildProject); if (msbuildProject.HasUnsavedChanges) { // Save a copy of the project before replacing it FileUtils.SaveBackupCopy(GodotSharpDirs.ProjectCsProjPath); msbuildProject.Save(); } } catch (Exception e) { GD.PushError(e.ToString()); } }
public StruTemplateLibGeneralViewModel() { doSearch(); SearchCommand = new DelegateCommand(doSearch); globalInfo = GlobalInfo.GetInstance(); proUtils = ProjectUtils.GetInstance(); }
private void MenuStripFilterOnDelete(object sender, EventArgs e) { TreeNode node = projectTreeView.GetNodeAt(projectTreeView.PointToClient(filterMenuStrip.Bounds.Location)); if (node == null) { return; } if (node.Text == ProjectUtils.GetProjectName()) { ProjectUtils.RemoveProject(true); projectTreeView.Nodes.Clear(); return; } ProjectUtils.RemoveFilter(node.Text, true); ProjectUtils.SaveProject(); TreeNode parentNode = node.Parent; if (parentNode == null) { return; } parentNode.Nodes.Remove(node); }
private void RemoveFile(TreeNode node, bool bDelete = false) { if (node == null) { return; } TreeNode parent = node.Parent; if (parent == null || (node.Nodes.Count > 0)) { return; } string path = ProjectUtils.GetFilePathForTreeNodeItem(node.Parent.Text, node.Text); if (ProjectUtils.RemoveFile(node.Text, node.Parent.Text)) { WindowHandler.DeregisterWindow(node.Text, node.Parent.Text); parent.Nodes.Remove(node); if (bDelete && File.Exists(path)) { try { File.Delete(path); } catch { LoggingUtils.LogEvent(string.Format("Unable to delete file {0}!", path)); } } } }
public void AddWindow(string name, string filter) { if (!tabEditor.Visible) { tabEditor.Visible = true; } TabPage tab = FindPage(filter, name); if (tab != null) { tabEditor.SelectTab(tab); return; } RichQCEditor textBox = new RichQCEditor(); string pathToFile = ProjectUtils.GetFilePathForTreeNodeItem(filter, name); if (!string.IsNullOrEmpty(pathToFile)) { textBox.Text = File.ReadAllText(pathToFile); } tab = new TabPage(name); tab.Name = filter; textBox.Parent = tab; textBox.Dock = DockStyle.Fill; tabEditor.TabPages.Add(tab); tabEditor.SelectTab(tab); }
/// <summary> /// This method creates a new project in the given path /// </summary> /// <param name="projectName">The name of the project</param> /// <param name="projectPath">The path of the project</param> private void CreateProject(string projectName, string projectPath) { try { if (projectName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1) { throw new Exception(MSG_ERR_INVALID_PRJ_NAME); } Boolean pathExists = Directory.Exists(projectPath), prjDirExists = pathExists ? Directory.Exists(Path.Combine(projectPath, projectName)) : false, prjIsEmpty = prjDirExists ? Directory.GetDirectories(projectPath).Length + Directory.GetFiles(projectPath).Length == 0 : true; if (pathExists) //&& prjIsEmpty) { ProjectUtils.InitProject(projectName, projectPath); } else if (!pathExists) { throw new Exception(MSG_ERR_NEW_PRJ_MISS_DIR); } Console.WriteLine(MSG_INF_NEW_PRJ, projectName, projectPath); } catch (Exception exc) { throw exc; } }
private void btnCreateProj_Click(object sender, EventArgs e) { if (ProjectUtils.CreateProject(textBoxProjectName.Text, textBoxProjectPath.Text, textBoxGameinfoPath.Text, textBoxStudiomdlPath.Text)) { Close(); } }
private void menuFileNew_Click(object sender, EventArgs e) { TreeNode activeNode = projectTreeView.SelectedNode; if (activeNode == null) { return; } if (activeNode.ContextMenuStrip != filterMenuStrip) { return; } Filter filter = ProjectUtils.GetFilter(activeNode.Text); if (filter == null) { return; } NewFileWizardForm newFileForm = new NewFileWizardForm(activeNode, filter, fileMenuStrip); newFileForm.ShowDialog(this); }
/// <summary> /// 将电气目录和结构目录中这个序列和每个塔的子目录建立好 /// 将电气计算的Eexel模板和结构计算的模板复制到相应的目录下,便于后续计算 /// </summary> /// <param name="seqence"></param> /// <param name="tower"></param> /// <returns></returns> protected void CopyTmeplateToDesDir(int index) { TowerSerial tower = TowerSerials[index]; //建立电气计算下的目录 string elecDirPath = ProjectUtils.GetInstance().ProjectPath + "\\" + ConstVar.ElecCalsStr + "\\" + SequenceName; if (!Directory.Exists(elecDirPath)) { Directory.CreateDirectory(elecDirPath); } elecDirPath += "\\" + tower.TowerName; if (!Directory.Exists(elecDirPath)) { Directory.CreateDirectory(elecDirPath); } //安装目录UserData里面复制电气模板 string scrPath = Directory.GetCurrentDirectory() + "\\" + ConstVar.UserDataStr + "\\" + (tower.TowerType == 1 ? ConstVar.ElecLoadLineTowerTemplateFileName : ConstVar.ElecLoadCornerTowerTemplateFileName); string destPath = elecDirPath + "\\" + ConstVar.ElecLoadTemplateFileName; File.Copy(scrPath, destPath); }
private void Start() { controlledRoot.transform.parent = transform; controlledRoot.transform.localPosition = Vector3.zero; var goalPosition = Vector3.zero; var goalSize = minSize; Observable.EveryUpdate() .TakeUntilDestroy(this) .Where(_ => cameraState.pointsOfInterest.Count > 0) .Select(_ => cameraState.pointsOfInterest .Where(pt => pt != null) .Select(pt => (Vector2)pt.position)) .Select(pts => ProjectUtils.CreateRectFromContainingPoints(pts)) .Select(rect => rect.CreateEncapsulatingRect(controlledCamera.aspect)) .Subscribe(rect => { Vector3 position = rect.center; position.z = -10; goalPosition = position; goalSize = Mathf.Max(minSize, rect.width / 2f); }); Observable.EveryUpdate() .TakeUntilDestroy(this) .Subscribe(_ => { controlledRoot.position = Vector3.Lerp(controlledRoot.position, goalPosition, 2 * Time.deltaTime); controlledCamera.orthographicSize = Mathf.Lerp(controlledCamera.orthographicSize, goalSize, 3 * Time.deltaTime); }); }
public override void Command2(SubMenuBase menu) { var saveFileDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "Result Files (*.calc)|*.calc", }; if (saveFileDialog.ShowDialog() != true) { return; } GlobalInfo globalInfo = GlobalInfo.GetInstance(); //StruCalsParas中塔位数据,是在点击这个塔位的页面后才加载的GlobalInfo中, //下面代码针对的是,没有打开这个塔位的页面而直接进行计算的情况 if (globalInfo.StruCalsParas.Where(item => item.TowerName == ((SubMenuBase)menu).Title && item.SequenceName == ((StrCalsModuleSubMenu)menu).Sequence).Count() <= 0) { if (((StrCalsModuleSubMenu)menu).Sequence == "") { ProjectUtils.GetInstance().ReadStruCalsTowerParas(((SubMenuBase)menu).Title); } else { ProjectUtils.GetInstance().ReadStruCalsTowerParas(((SubMenuBase)menu).Title, ((StrCalsModuleSubMenu)menu).Sequence); } } StruCalsParasCompose paras = globalInfo.StruCalsParas.Where(para => para.TowerName == ((SubMenuBase)menu).Title && para.SequenceName == ((StrCalsModuleSubMenu)menu).Sequence).FirstOrDefault(); if (paras == null) { return; } ConvertSpecToWorkCondition(paras.Template, paras.WorkConditions, true); string path = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 5); for (int i = 0; i < paras.HPSettingsParas.Count(); i++) { LoadComposeBase loadCompose; if (paras.BaseParas.Type == TowerTypeEnum.LineTower) { loadCompose = new LoadComposeLineTower(paras.BaseParas, paras.LineParas.ToArray(), paras.HPSettingsParas[i], paras.Template, paras.ElectricalLoadFilePath); } else if (paras.BaseParas.Type == TowerTypeEnum.LineCornerTower) { loadCompose = new LoadComposeLineCornerTower(paras.BaseParas, paras.LineParas.ToArray(), paras.HPSettingsParas[i], paras.Template, paras.ElectricalLoadFilePath); } //剩下的都属于耐张塔 else { loadCompose = new LoadComposeTensionTower(paras.BaseParas, paras.LineParas.ToArray(), paras.HPSettingsParas[i], paras.Template, paras.ElectricalLoadFilePath); } paras.ResultPointLoad.AddRange(loadCompose.LoadCaculate(path)); } }
private void _FileSystemDockFolderMoved(string oldFolder, string newFolder) { if (File.Exists(GodotSharpDirs.ProjectCsProjPath)) { ProjectUtils.RenameItemsToNewFolderInProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile", ProjectSettings.GlobalizePath(oldFolder), ProjectSettings.GlobalizePath(newFolder)); } }
private void _FileSystemDockFileRemoved(string file) { if (Path.GetExtension(file) == Internal.CSharpLanguageExtension) { ProjectUtils.RemoveItemFromProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile", ProjectSettings.GlobalizePath(file)); } }
/// <summary> /// 使用excel模板进行提资 /// </summary> /// <param name="index"></param> protected void ProvideMeterial(int index) { ExcelPath = ProjectUtils.GetInstance().ProjectPath + "\\" + ConstVar.ElecCalsStr + "\\" + SequenceName + "\\" + TowerSerials[index].TowerName + "\\" + ConstVar.ElecLoadTemplateFileName; ElecLoadProcessExcel precessExcel = new ElecLoadProcessExcel(ExcelPath); precessExcel.CalsElecLoad(ParaList[index].TowerCals); }
private void _FileSystemDockFolderRemoved(string oldFolder) { if (File.Exists(GodotSharpDirs.ProjectCsProjPath)) { ProjectUtils.RemoveItemsInFolderFromProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile", ProjectSettings.GlobalizePath(oldFolder)); } }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); object item = ProjectUtils.GetSelectedItem(); ProjectItem selectedItem = item as ProjectItem; VCFilter selectedFilter = item as VCFilter; try { // It's a source file if (selectedItem.ProjectItems.Item(1) == null) { // Just remove the source file string targetPath = selectedItem.Properties.Item("FullPath").Value as string; string dir = Path.GetDirectoryName(targetPath); if (Directory.GetFiles(dir, "*", SearchOption.AllDirectories).Length <= 1) { // If this is the last source file in the dir, remove everything Directory.Delete(dir, true); ProjectItem parent = selectedItem.Properties.Parent as ProjectItem; parent = parent.Properties.Parent as ProjectItem; if (parent == null) { parent = selectedItem.Properties.Parent as ProjectItem; } //selectedItem.Remove(); string parentName = parent.Name; string parParentName = (parent.Properties.Parent as ProjectItem).Name; //string collName = selectedItem.Collection.; parent.Remove(); parent.ContainingProject.Save(); } else { // Remove physical file from the disk File.Delete(targetPath); // Remove file from the project selectedItem.Remove(); selectedItem.ContainingProject.Save(); } } else { RemoveDir(selectedItem); } } catch (Exception exc) { // It's a filter (folder) } }
public virtual void onConfirm() { float vol = (float)Convert.ToDecimal(Voltage.Substring(0, Voltage.Length - 2)); if (ProjectUtils.NewStruCalsTower(TowerName, TowerType, vol, TemplatePath, ElectricalLoadFilePath, _fullStressTemplatePaths)) { close(TowerName); } }
public static void AddItem(string projectPath, string itemType, string include) { if (!(bool)GlobalDef("mono/project/auto_update_project", true)) { return; } ProjectUtils.AddItemToProjectChecked(projectPath, itemType, include); }
public override void ExecuteBuild() { var bLayered = ParseParam("layered"); var SourceDirectory = ParseParamValue("sourcedirectory", null); var TargetDirectory = ParseParamValue("targetdirectory", null); var CryptoKeysFile = ParseParamValue("cryptokeysjson", null); var Compressor = ParseParamValue("customcompressor", null); var Project = ParseParamValue("project", null); string ExtraArgs = ""; if (!string.IsNullOrEmpty(Compressor)) { ExtraArgs += "-customcompressor=" + Compressor; } if (Params.Contains("passargs")) { IEnumerable <string> ExtraArgArray = Params.Where((arg, index) => index > Array.IndexOf(Params, "passargs")); if (ExtraArgArray.Count() > 0) { ExtraArgs += " -" + string.Join(" -", ExtraArgArray); } } if (String.IsNullOrEmpty(SourceDirectory)) { throw new AutomationException("SourceDirectory is a required parameter"); } if (String.IsNullOrEmpty(TargetDirectory)) { throw new AutomationException("TargetDirectory is a required parameter"); } if (String.IsNullOrEmpty(CryptoKeysFile)) { throw new AutomationException("CryptoKeysJson is a required parameter"); } DirectoryInfo SourceDirectoryInfo = new DirectoryInfo(SourceDirectory); LogInformation("Extracting paks from {0} to {1}", SourceDirectory, TargetDirectory); FileReference ProjectFile = null; if (!string.IsNullOrEmpty(Project)) { ProjectFile = ProjectUtils.FindProjectFileFromName(Project); if (ProjectFile == null) { throw new AutomationException("Could not find project file based on {0}", Project); } } PackageUtils.ExtractPakFiles(SourceDirectoryInfo, TargetDirectory, CryptoKeysFile, ExtraArgs, bLayered, ProjectFile); }
private void menuProjectOpen_Click(object sender, EventArgs e) { var file_dialog = openFileDialog.ShowDialog(); if (file_dialog == DialogResult.OK) { ProjectUtils.OpenProject(openFileDialog.FileName); } }
// flag 用于判断,当前格挡状态是成功还是失败 public void endParry(bool flag) { if (flag) { // 格挡成功 PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_CLIP, () => { if (!_firstSuccess) { _owner.setState(PlayerState.Idle); } }); // 成功格挡次数 + 1 _parrySuccessCount++; if (getSwordRemainCount() == 1) { PlayerAudioCtrl.getInstance().play(PlayerAudioData.SWORD_WILL_BREAK_CLIP); } // 播放初次格挡成功音效 if (_firstSuccess) { PlayerAudioCtrl.getInstance().play(PlayerAudioData.ESCAPE_CLIP, () => { _firstSuccess = false; _owner.setState(PlayerState.Idle); }); } _isParry = false; ProjectUtils.Log("Parry Success"); } else { PlayerAudioCtrl.getInstance().play(PlayerAudioData.HURT_CLIP, () => { if (_owner.getLife() != 2) { _owner.setLife(-1); } }); if (_owner.getLife() == 2) { PlayerAudioCtrl.getInstance().play(PlayerAudioData.EXCITATION_CLIP, () => { _owner.setState(PlayerState.Idle); _owner.setLife(-1); }); } _isParry = false; ProjectUtils.Log("Parry Failed"); } _owner.switchGestureToMove(); _sliderBar.value = 0; _sliderFillImage.color = Color.white; }
private void OnMenuStripClickOnOpenHLMV(object sender, EventArgs e) { TabPage tab = GetCurrentTabPage(); if (tab != null) { string pathToFile = ProjectUtils.GetFilePathForTreeNodeItem(tab.Name, tab.Text); Globals.OpenModelInHLMV(pathToFile); } }
protected override void InitializeData() { projectUtils = ProjectUtils.GetInstance(); doCommSideParaSettingCommand = new DelegateCommand(doCommSideParaSetting); doTowerParaSettingCommand = new DelegateCommand(doTowerParaSetting); doRefreshCommand = new DelegateCommand(doRefreshLink); doSaveCommand = new DelegateCommand(doSave); doCaculateCommand = new DelegateCommand(doCaculate); }
private void menuProjectSettings_Click(object sender, EventArgs e) { if (!ProjectUtils.IsProjectLoaded()) { return; } ProjectSettingsWizardForm projectSettings = new ProjectSettingsWizardForm(); projectSettings.ShowDialog(this); }