public ILexerFactory CreateLexer(ProjectFileType languageType, IBuffer buffer) { //Logger.LogMessage("MappingFileProjectFileLanguageService.CreateLexer for language type {0}", languageType.Name); if (languageType == MAPPING_FILE) { return new XmlLexerFactory(MappingFileLanguageService.MAPPING_FILE); } return null; }
//public virtual void Save(string filePath, bool includeData, bool compressed) { public virtual void Save(XmlWriter writer, ProjectFileType fileType) { //Stream stream; //if (compressed) // stream = new GZipStream(new FileStream(filePath, FileMode.Create), CompressionMode.Compress); //else // stream = new FileStream(filePath, FileMode.Create); //try { // using (XmlWriter writer = XmlWriter.Create(stream)) { writer.WriteStartElement("spectra"); writer.WriteAttributeString("name", this._name); writer.WriteAttributeString("class", this._model.DeltaFileName); writer.WriteAttributeString("enabled", this._enabled.ToString()); writer.WriteAttributeString("dataLength", this._data.Length.ToString()); foreach (ISpectrum spectrum in this._spectra) { spectrum.writeToXml(writer, fileType == ProjectFileType.CompressedPack, fileType == ProjectFileType.CompressedES); if (SaveProgressChanged != null) { SaveProgressChanged(this, null); //new System.ComponentModel.ProgressChangedEventArgs(this._spectra.IndexOf(spectrum), null)); } } writer.WriteEndElement(); //spectra writer.Flush(); //writer.Close(); // } //} finally { // stream.Close(); //} }
public PsiLanguageType GetPsiLanguageType(ProjectFileType projectFileType) { //Logger.LogMessage("MappingFileProjectFileLanguageService.GetPsiLanguageType for project file type {0}", projectFileType.Name); if (projectFileType != MAPPING_FILE) { return PsiLanguageType.UNKNOWN; } return MappingFileLanguageService.MAPPING_FILE; }
private void SaveProject(ProjectForm projectForm, string projectFilePath, ProjectFileType fileType) { //toolStripStatusLabel.Text = "Saving"; tsMainProgressBar.Visible = true; tsMainProgressBar.Maximum = 0; //SavingSpectraCount = 0; //if (Path.GetExtension(project foreach (ISpectraContainer container in projectForm.project.Containers) { tsMainProgressBar.Maximum += container.Spectra.Count; } //if (projectPath == System.IO.Path.GetDirectoryName(projectForm.project.Path)) if (projectFilePath == projectForm.project.ProjectFile) { projectForm.project.Save(projectForm.project.ProjectFile, fileType); } else { //share.Utilities.CopyDirectory(projectForm.project.Path, projectFile); projectForm.project.Save(projectFilePath, fileType); //projectForm.project.Path = projectFile; } projectForm.NotSavedChanges = false; projectForm.Text = projectForm.project.Caption; //toolStripStatusLabel.Text = "Ready"; tsMainProgressBar.Visible = false; appendProjectToRecoveryFile(projectForm.project.ProjectFile); refreshRecentProjectsList(projectForm.project.ProjectFile); ReadRegistry(); }
private void SaveProject(ProjectForm projectForm, string projectFilePath, ProjectFileType fileType) { //toolStripStatusLabel.Text = "Saving"; try { tsMainProgressBar.Visible = true; tsMainProgressBar.Maximum = 0; //SavingSpectraCount = 0; //if (Path.GetExtension(project foreach (ISpectraContainer container in projectForm.project.Containers) { tsMainProgressBar.Maximum += container.Spectra.Count; } //if (projectPath == System.IO.Path.GetDirectoryName(projectForm.project.Path)) if (projectFilePath == projectForm.project.ProjectFile) { projectForm.project.Save(projectForm.project.ProjectFile, fileType); } else { //share.Utilities.CopyDirectory(projectForm.project.Path, projectFile); projectForm.project.Save(projectFilePath, fileType); //projectForm.project.Path = projectFile; } projectForm.NotSavedChanges = false; projectForm.Text = projectForm.project.Caption; //toolStripStatusLabel.Text = "Ready"; tsMainProgressBar.Visible = false; appendProjectToRecoveryFile(projectForm.project.ProjectFile); refreshRecentProjectsList(projectForm.project.ProjectFile); ReadRegistry(); } catch (Exception e) { MessageBox.Show(String.Format("Couldn't save project ({0}).", e.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
///<summary> /// /// Creates lexer, that corresponds to source file text (NOT generated!) /// ///</summary> /// public ILexerFactory CreateLexer(ProjectFileType languageType, IBuffer buffer) { if (languageType != L4N) return null; return new XmlLexerFactory(L4NLanguageService.L4N); }
public PsiLanguageType GetPsiLanguageType(ProjectFileType languageType) { if (languageType != NH) { return PsiLanguageType.UNKNOWN; } return NHLanguageService.NH; }
public IEnumerable <string> GetExtensions(ProjectFileType projectFileType) { if (Equals(projectFileType, YamlProjectFileType.Instance)) { return(UnityYamlFileExtensions.AllFileExtensionsWithDot); } return(EmptyList <string> .Enumerable); }
public PsiLanguageType GetPsiLanguageType(ProjectFileType languageType) { if (languageType != L4N) { return PsiLanguageType.UNKNOWN; } return L4NLanguageService.L4N; }
public override IEnumerable <string> GetExtensions(ProjectFileType projectFileType) { if (Equals(projectFileType, YamlProjectFileType.Instance)) { return(base.GetExtensions(projectFileType).Concat(ourFileExtensions)); } return(base.GetExtensions(projectFileType)); }
public IEnumerable <string> GetExtensions(ProjectFileType projectFileType) { if (Equals(projectFileType, YamlProjectFileType.Instance)) { return(ourFileExtensions); } return(EmptyList <string> .Enumerable); }
private ProjectFileType TryParseProjectType(string projectType) { ProjectFileType parsedProjectType = ProjectFileType.ParseTypeString(projectType); if (parsedProjectType == null) { Log.WarnFormat($"The following project type could not be parsed: '{projectType}'"); } return(parsedProjectType); }
private bool ShouldBeProcessed(IPsiSourceFile sourceFile) { if (!sourceFile.Properties.ShouldBuildPsi) { return(false); } ProjectFileType languageType = sourceFile.LanguageType; return(!languageType.IsNullOrUnknown() && projectFileTypeCoordinator.TryGetService(languageType) != null); }
public static XmlWriter getXmlWriter(string filePath, ProjectFileType fileType, out Stream stream) { stream = new FileStream(filePath, FileMode.Create); if (fileType == ProjectFileType.Normal) { return(XmlWriter.Create(stream)); } else { stream = new GZipStream(stream, CompressionMode.Compress); return(XmlWriter.Create(stream)); } }
public static string GetExtension(ProjectFileType fileType) { switch (fileType) { case ProjectFileType.Normal: return(NORMAL_PROJECT); case ProjectFileType.CompressedIS: return(COMPRESSED_IS_PROJECT); case ProjectFileType.CompressedES: return(COMPRESSED_ES_PROJECT); case ProjectFileType.CompressedPack: return(COMPRESSED_PACK_PROJECT); } throw new ArgumentException(String.Format("{0} is not valid project file type", fileType)); }
internal ProjectFile(string fullFileNamePath, ProjectFileType projectFileType, string webAppName, string apiName, string webApiName, bool isUseWebApi, GeneratedSqlType generatedSqlType, bool isUseLogging, bool isUseSecurity, bool isUseCaching, bool isUseAuditLogging, bool isEmailNotification) { this._fullFileNamePath = fullFileNamePath; this._projectFileType = projectFileType; this._webAppName = webAppName; this._apiName = apiName; this._webApiName = webApiName; this._isUseWebApi = isUseWebApi; this._generatedSqlType = generatedSqlType; this._isUseLogging = isUseLogging; this._isUseSecurity = isUseSecurity; this._isUseCaching = isUseCaching; this._isUseAuditLogging = isUseAuditLogging; this._isEmailNotification = isEmailNotification; this.Generate(); }
internal ProjectJson(string webAppName, string apiName, string webApiName, string fullFileNamePath, bool isUseWebApi, ProjectFileType projectFileType, GeneratedSqlType generatedSqlType) { this._webAppName = webAppName; this._apiName = apiName; this._webApiName = webApiName; this._fullFileNamePath = fullFileNamePath; this._isUseWebApi = isUseWebApi; this._projectFileType = projectFileType; this._generatedSqlType = generatedSqlType; this.Generate(); if (projectFileType != ProjectFileType.WebAPI || !isUseWebApi) { return; } this.ReplaceTextForWebAPI(); }
public ProjectAboutFile AddAboutFile(long projectId, long foreignID, ProjectFileType fileType, FileEntry filedto) { ProjectAboutFile entity = new ProjectAboutFile { ProjectId = projectId, ForeignID = foreignID, FileName = filedto.FileName, FileSize = filedto.FileSize, StoragePath = filedto.StoragePath, FileType = fileType }; entity.Created(this); repository.AddAboutFile(entity); repository.UnitOfWork.Commit(); return(entity); }
public NancyRazorLayoutReference(IExpression owner, IQualifier qualifier, TToken token, TreeTextRange rangeWithin, ProjectFileType expectedFileType, bool noCircular, bool allowEmptyName) : base(owner, qualifier, token, rangeWithin, expectedFileType, noCircular, allowEmptyName) { Assertion.Assert(owner.ConstantValue.IsString(), "expression is not string constant"); ResolveFilter = element => { var pathDeclaredElement = element as IPathDeclaredElement; if (pathDeclaredElement == null || pathDeclaredElement.GetProjectItem() == null) { return(false); } if (pathDeclaredElement.Path.ExistsDirectory) { return(false); } return(true); }; }
public bool CanHandle(ProjectFileType projectFileType) { return (projectFileType is PsiProjectFileType); }
public string[] LoadContents() { string[] cont = File.ReadAllLines(Filepath); try { switch (Path.GetExtension(Filepath).ToLower()) { case ".cs": Filetype = ProjectFileType.CSharpSource; Extention = "cs"; break; case ".cmpkg": Filetype = ProjectFileType.ContentPackage; Extention = "cmpkg"; try { Analyzer.AnalyzePackage(Filepath); } catch (Exception) { throw new InvalidFileContentsException(); } break; case ".scene": Filetype = ProjectFileType.SceneData; Extention = "scene"; if (cont[0] != "%SCENEMETADATA") { throw new InvalidFileContentsException(); } break; case ".gameobj": Filetype = ProjectFileType.GameObjectData; Extention = "gameobj"; if (cont[0] != "%GAMEOBJMETADATA") { throw new InvalidFileContentsException(); } break; case ".gameappdata": Filetype = ProjectFileType.GameApplicationData; Extention = "gameappdata"; if (cont[0] != "%GAMEWNDAPPDATA") { throw new InvalidFileContentsException(); } break; default: Filetype = ProjectFileType.Unknown; Extention = Path.GetExtension(Filepath); break; } } catch (Exception) { throw new InvalidFileContentsException(); } return(cont); }
public JsonResult Document(int ID, int TypeID, int[] WorkIDs) { string GeneratedFolder = "GeneratedFiles"; User user = HttpContext.CurrentUser(); ProjectFileType fileType = db.ProjectFileTypes.FirstOrDefault(val => val.ID == TypeID); Project project = db.Projects.FirstOrDefault(val => val.ID == ID); List <ProjectWork> allWorks = db.ProjectWorks.Where(val => val.ProjectID == ID).OrderBy(val => val.OrderNumber).ThenBy(val => val.ID).ToList(); List <ProjectWork> works = WorkIDs != null?allWorks.Where(val => val.ProjectID == ID && WorkIDs.Contains(val.ID)).OrderBy(val => val.OrderNumber).ThenBy(val => val.ID).ToList() : allWorks; ProjectFile result; //works[0].Cost if (fileType == null || project == null) { return(Json(new { Success = false })); } AdCrm.Models.DynamicDocuments.DataProvider dp = new AdCrm.Models.DynamicDocuments.DataProvider() { Data = works, Number = "0", User = db.CurrentUser, Project = project }; if (!string.IsNullOrEmpty(fileType.Condition) && !DynamicDocumentGenerator.Helpers.Reflection.CheckStringCondition(dp, fileType.Condition, false)) { return(Json(new { Success = false, Error = fileType.ErrorMessage })); } result = new ProjectFile() { TypeID = TypeID, CategoryID = (int)BuildingEntities.ProjectFileCategoriesEnum.Generated, ProjectID = ID, File = new File() { ChangeDate = DateTime.Now, ChangerID = user.ID, CreateDate = DateTime.Now, CreatorID = user.ID, Name = string.Format(fileType.ResultNameTemplate, project.Contract != null ? project.Contract.Number : "", DateTime.Now).Replace(System.IO.Path.GetInvalidFileNameChars(), "_"), Url = "" } }; db.ProjectFiles.AddObject(result); db.SaveChanges(); //dp.Number = report.ID.ToString(); result.File.Url = string.Format("{0}/{1}", GeneratedFolder, result.File.ID + "_" + fileType.FileName); System.IO.FileInfo fi = new System.IO.FileInfo(result.File.RealPath); if (!fi.Directory.Exists) { System.IO.Directory.CreateDirectory(fi.DirectoryName); } DynamicDocumentGenerator.Generator g = new DynamicDocumentGenerator.Generator(fileType, dp); g.BeforeGetValueFromString += (s, e) => { if (e.Variable.Name == "{NumberInEstimation}") { ProjectWork pw = e.Context as ProjectWork; if (pw != null) { e.Value = allWorks.IndexOf(pw) + 1; e.Stop = true; } } }; g.Generate(); System.IO.File.WriteAllBytes(result.File.RealPath, g.ResultContent); db.SaveChanges(); return(Json(new { Success = true, ProjectFile = result.ToJson() })); }
/// <summary> /// Determines whether this instance can handle the specified project file type. /// </summary> /// <param name="projectFileType">Type of the project file.</param> /// <returns><c>true</c> if this instance can handle the specified project file type; otherwise, <c>false</c>.</returns> public bool CanHandle(ProjectFileType projectFileType) { return(projectFileType.Is <T4ProjectFileType>()); }
public override CachingLexer Resync(ISolution solution, DocumentUpdatesAccumulator updatesAccumulator, ProjectFileType projectFileType, ITextControl textControl, PsiProjectFileTypeCoordinator projectFileTypeCoordinator, IPsiSourceFile sourceFile = null) { // TOdo resync via TokenBuffer.Resync, cache TokenBuffer. return(new ShaderLabLexerGenerated(textControl.Document.Buffer, CppLexer.Create).ToCachingLexer().TokenBuffer.CreateLexer()); }
public SpringProjectFileLanguageService(ProjectFileType projectFileType) : base(projectFileType) { }
public bool CanHandle(ProjectFileType projectFileType) { return(projectFileType is PsiProjectFileType); }
public void UpdateProjectFolder(ProjectFolder projectFolder, TreeNode folderNode) { if (projectFolder.Folders != null) { foreach (ProjectFolder pf in projectFolder.Folders) { TreeNode pfNode = new TreeNode(pf.FolderName); folderNode.Nodes.Add(pfNode); pfNode.ImageIndex = pfNode.SelectedImageIndex = 7; folderNodes.Add(pfNode, pf); if (!pf.IsCollapsed) { pfNode.Expand(); } else { pfNode.Collapse(); } UpdateProjectFolder(pf, pfNode); } } if (projectFolder.Files != null) { foreach (ProjectFile pf in projectFolder.Files) { TreeNode currentNode = new TreeNode(pf.FileName); folderNode.Nodes.Add(currentNode); currentNode.ImageIndex = currentNode.SelectedImageIndex = 3; fileNodes.Add(currentNode, pf); // types expected: // .xml (MODX) // .mod (Text Template) // .txt (Text Template) // .php (PHP) // .php (language file /*if (pf.IsOpen) * { * // TODO: * // * // query parent for the window owning the current node that is open * // query the mod for a list of files edited * // add the list of mods to the tree * // * // query window for icon type * } * else * {*/ // query for the file type so we can change it's icon try { string fileFullPath = ""; if (projectFolder.FolderName == "") { fileFullPath = Path.Combine(projectPath, pf.FileName); } else { fileFullPath = Path.Combine(Path.Combine(projectPath, projectFolder.GetFolderPath()), pf.FileName); } FileInfo projectFileInfo = new FileInfo(fileFullPath); ProjectFileType pft = ReadFirstBytesInFile(fileFullPath); switch (projectFileInfo.Extension.ToLower()) { case ".mod": if (pft == ProjectFileType.TextFile) { currentNode.ImageIndex = currentNode.SelectedImageIndex = 0; openModFiles.Add(pf.FileName, currentNode); } break; case ".txt": switch (pft) { case ProjectFileType.Gpl: currentNode.ImageIndex = currentNode.SelectedImageIndex = 4; break; case ProjectFileType.TextMod: currentNode.ImageIndex = currentNode.SelectedImageIndex = 0; break; } openModFiles.Add(pf.FileName, currentNode); break; case ".xml": if (pft == ProjectFileType.ModxMox) { currentNode.ImageIndex = currentNode.SelectedImageIndex = 1; openModFiles.Add(pf.FileName, currentNode); } break; case ".php": Console.WriteLine(">>> " + pft.ToString()); switch (pft) { case ProjectFileType.PhpFile: currentNode.ImageIndex = currentNode.SelectedImageIndex = 6; Console.WriteLine("*** PHP file ***"); break; case ProjectFileType.LanguageFile: currentNode.ImageIndex = currentNode.SelectedImageIndex = 5; Console.WriteLine("*** Language file ***"); break; } openModFiles.Add(pf.FileName, currentNode); break; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } } }
/// <summary>Determines whether this instance can handle the specified project file type.</summary> /// <param name="projectFileType">Type of the project file.</param> /// <returns><c>true</c> if this instance can handle the specified project file type; otherwise, <c>false</c>.</returns> public bool CanHandle(ProjectFileType projectFileType) => projectFileType.Is <T4ProjectFileType>();
public override CachingLexer CreateCachingLexer(ISolution solution, ProjectFileType projectFileType, ITextControl textControl, PsiProjectFileTypeCoordinator projectFileTypeCoordinator, IPsiSourceFile sourceFile = null) { return(new ShaderLabLexerGenerated(textControl.Document.Buffer, CppLexer.Create).ToCachingLexer().TokenBuffer.CreateLexer()); }
public PsiLanguageType GetPsiLanguageType(ProjectFileType LanguageType) { return(LanguageType.Is <RaconteurProjectFileType>() ? (PsiLanguageType)RaconteurLanguage.Instance : UnknownLanguage.Instance); }
public ProjectBase(string fileName) : this() { SpectraContainerBase container; object[] args = new object[3]; args[0] = this; Stream stream; //jesli rozszerzeniu pliku projektu to evpc projekt zostal zapisany w plikach skompresowanych i //taki rodzaj strumienia musi byc wykorzystany //if (this._compressed = System.IO.Path.GetExtension(fileName) == ".evpc") this._fileType = ProjectFileExtensions.GetProjectFileType(System.IO.Path.GetExtension(fileName)); if (this._fileType == ProjectFileType.Normal) { stream = new FileStream(fileName, FileMode.Open); } else { stream = new GZipStream(new FileStream(fileName, FileMode.Open), CompressionMode.Decompress); } try { int spectraCount = -1; //this._path = System.IO.Path.GetDirectoryName(fileName); this._projectFile = fileName; XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; using (XmlReader reader = XmlReader.Create(stream, settings)) { reader.Read(); //declaration reader.Read(); //project if (reader.HasAttributes) { while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "caption": this._caption = reader.Value; break; case "calculatedValues": this._calculatedValues = Boolean.Parse(reader.Value); break; case "spectraCount": spectraCount = int.Parse(reader.Value); break; } } reader.MoveToElement(); } //List<IParameter> bindingParameters = new List<IParameter>(); //reader.ReadStartElement("project"); while (reader.Read()) { switch (reader.Name) { case "models": bool includedModelsData = reader.GetAttribute("defs") == "included"; while (reader.Read()) { if (reader.Name == "model") { BindingFlags bindingFlags = BindingFlags.CreateInstance; Assembly ass = Assembly.GetAssembly(this.GetSpectraContainerType()); string typeName = this.GetSpectraContainerType().ToString(); XmlReader containerReader; if (includedModelsData) { containerReader = reader.ReadSubtree(); args[1] = containerReader; args[2] = null; try { container = (SpectraContainerBase)ass.CreateInstance(typeName, true, bindingFlags, null, args, null, null); if (container != null) { AddSpectraContainer(container); } } finally { containerReader.Close(); } } else { Stream conStream; reader.MoveToFirstAttribute(); string containerFileName = reader.Value; // containerElement.Attributes["file"].Value; containerFileName = System.IO.Path.Combine(this.Path, containerFileName); containerReader = getXmlReader(containerFileName, this._fileType, out conStream); try { //args = new object[] { this, containerReader, System.IO.Path.GetDirectoryName(containerFileName) }; args[1] = containerReader; args[2] = System.IO.Path.GetDirectoryName(containerFileName); container = (SpectraContainerBase)ass.CreateInstance(typeName, true, bindingFlags, null, args, null, null); if (container != null) { AddSpectraContainer(container); } } finally { containerReader.Close(); conStream.Close(); } reader.MoveToElement(); } } else { break; } } break; case "bindings": //if (reader.ReadToFollowing("bindings")) { while (reader.Read()) { if (reader.Name == "binding") { string name = reader.GetAttribute("name"); switch (reader.GetAttribute("type")) { case "parameter": _bindingsManager.Add(new ParameterBinding(reader, this, name)); break; case "group": _bindingsManager.Add(new GroupBinding(reader, this, name)); break; } } else { break; } } break; } } } } finally { if (stream != null) { stream.Close(); } } }
public YamlProjectFileLanguageService(ProjectFileType projectFileType) : base(projectFileType) { }
public override PsiLanguageType GetPsiLanguageType(ProjectFileType languageType) { return(SpringLanguage.Instance); }
public virtual void Save(string filePath, ProjectFileType fileType) { this._projectFile = filePath; this._fileType = fileType; this._caption = System.IO.Path.GetFileName(filePath); string modelsDirectory = System.IO.Path.Combine(this.Path, "models"); string containerFile, containerDirectory, spectraDirectory, destFileName; if (!System.IO.Directory.Exists(this.Path) && (fileType == ProjectFileType.Normal || fileType == ProjectFileType.CompressedIS)) { System.IO.Directory.CreateDirectory(this.Path); } Stream stream = null; if (fileType != ProjectFileType.Normal) { stream = new GZipStream(new FileStream(ProjectFile, FileMode.Create), CompressionMode.Compress); } else { stream = new FileStream(ProjectFile, FileMode.Create); } try { using (XmlWriter writer = XmlWriter.Create(stream)) { writer.WriteStartElement("project"); writer.WriteAttributeString("caption", this.Caption); writer.WriteAttributeString("name", this.Caption); writer.WriteAttributeString("calculatedValues", this.CalculatedValues.ToString()); int i, scount = 0; for (i = 0; i < this.Containers.Count; i++) { scount += this.Containers[i].Spectra.Count; } writer.WriteAttributeString("spectraCount", scount.ToString()); string[] tmpStrings = this.GetType().ToString().Split(new char[] { '.' }); string className = tmpStrings[tmpStrings.Length - 1]; writer.WriteAttributeString("class", className); writer.WriteStartElement("models"); if (fileType == ProjectFileType.CompressedES || fileType == ProjectFileType.CompressedPack) { writer.WriteAttributeString("defs", "included"); } else { writer.WriteAttributeString("defs", "files"); } if (!System.IO.Directory.Exists(modelsDirectory)) { System.IO.Directory.CreateDirectory(modelsDirectory); } foreach (ISpectraContainer container in this._containers) { writer.WriteStartElement("model"); Stream conStream = null; if (fileType == ProjectFileType.Normal || fileType == ProjectFileType.CompressedIS) { containerDirectory = System.IO.Path.Combine(modelsDirectory, container.Name); if (!System.IO.Directory.Exists(containerDirectory)) { System.IO.Directory.CreateDirectory(containerDirectory); } containerFile = System.IO.Path.Combine(containerDirectory, container.Name); containerFile = System.IO.Path.ChangeExtension(containerFile, (fileType == ProjectFileType.CompressedIS) ? ProjectFileExtensions.COMPRESSED_IS_MODEL : ProjectFileExtensions.NORMAL_MODEL); writer.WriteAttributeString("file", String.Format("models/{0}/{1}", container.Name, System.IO.Path.GetFileName(containerFile))); try { using (XmlWriter conWriter = getXmlWriter(containerFile, this._fileType, out conStream)) container.Save(conWriter, this._fileType); } finally { conStream.Close(); } //copy or create spectra files spectraDirectory = System.IO.Path.Combine(containerDirectory, "spectra"); if (!System.IO.Directory.Exists(spectraDirectory)) { System.IO.Directory.CreateDirectory(spectraDirectory); } foreach (ISpectrum spectrum in container.Spectra) { destFileName = System.IO.Path.Combine(spectraDirectory, spectrum.Name); if (spectrum.Path != null) { destFileName = System.IO.Path.ChangeExtension(destFileName, System.IO.Path.GetExtension(spectrum.Path)); try { System.IO.File.Copy(spectrum.Path, destFileName, false); } catch (Exception) { } } else { destFileName = System.IO.Path.ChangeExtension(destFileName, ".txt"); spectrum.writeData(destFileName); } } } else { container.Save(writer, this._fileType); } //XML model node writer.WriteEndElement(); //model } writer.WriteEndElement(); //models //bindings writer.WriteStartElement("bindings"); foreach (Binding b in _bindingsManager) { b.WriteXml(writer); } writer.WriteEndElement(); //bindings writer.WriteEndElement(); //project writer.Flush(); writer.Close(); } } finally { stream.Close(); } //remove document folders not included in project (renamed or removed) foreach (string docDir in Directory.GetDirectories(modelsDirectory)) { bool present = false; foreach (ISpectraContainer container in this.Containers) { if (container.Name.Equals(System.IO.Path.GetFileNameWithoutExtension(docDir))) { present = true; break; } } if (!present) { Directory.Delete(docDir, true); } } }
internal ProjectJsonLock(string webAppName, string apiName, string webApiName, string fullFileNamePath, bool isUseWebApi, ProjectFileType projectFileType, GeneratedSqlType generatedSqlType, string fileExtension) { this._webAppName = webAppName; this._apiName = apiName; this._webApiName = webApiName; this._fullFileNamePath = fullFileNamePath; this._isUseWebApi = isUseWebApi; this._generatedSqlType = generatedSqlType; this._fileExtension = fileExtension; switch (projectFileType) { case ProjectFileType.WebApp: this.ReplaceTextForWebApp(); break; case ProjectFileType.WebAPI: if (!isUseWebApi) { break; } this.ReplaceTextForWebAPI(); break; } }
/// <summary> /// Determines whether this instance can handle the specified project file type. /// </summary> /// <param name="projectFileType">Type of the project file.</param> /// <returns><c>true</c> if this instance can handle the specified project file type; otherwise, <c>false</c>.</returns> public bool CanHandle(ProjectFileType projectFileType) { return projectFileType.Is<T4ProjectFileType>(); }
public PsiLanguageType GetPsiLanguageType(ProjectFileType LanguageType) { return LanguageType.Is<RaconteurProjectFileType>() ? (PsiLanguageType) RaconteurLanguage.Instance : UnknownLanguage.Instance; }
internal ProjectUserFile(string fullFileNamePath, ProjectFileType projectFileType) { this._fullFileNamePath = fullFileNamePath; this._projectFileType = projectFileType; this.Generate(); }