private void ParserThread() { ProjectContent.AddReferencedContent(ProjectContentRegistry.Mscorlib); // do one initial parser step to enable code-completion while other references are loading ParseStep(); foreach (var assemblyName in GetReferences(false, null)) { var referenceProjectContent = ProjectContentRegistry.GetProjectContentForReference(assemblyName, assemblyName); ProjectContent.AddReferencedContent(referenceProjectContent); if (referenceProjectContent is ReflectionProjectContent) { (referenceProjectContent as ReflectionProjectContent).InitializeReferences(); } } if (SupportedLanguage == SupportedLanguage.VisualBasic) { ProjectContent.DefaultImports = new DefaultUsing(ProjectContent); ProjectContent.DefaultImports.Usings.Add("System"); ProjectContent.DefaultImports.Usings.Add("System.Text"); ProjectContent.DefaultImports.Usings.Add("Microsoft.VisualBasic"); } // Parse the current file every 2 seconds while (!IsDisposed) { ParseStep(); Thread.Sleep(2000); } }
public void AddFile(string fileName) { var csharpFile = new CSharpFile(this, fileName); Files.Add(csharpFile); ProjectContent.AddOrUpdateFiles(new[] { csharpFile.ParsedFile }); }
bool AssessVCBaseProjectContent(out ProjectContent projectContent) { EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursors.WaitCursor; ProjectNode project = (cmbBaseProjects.Tag as List <ProjectNode>).ElementAt(cmbBaseProjects.SelectedIndex); ReleaseInfo projectVersion = (cmbSelectVersion.Tag as List <ReleaseInfo>).ElementAt(cmbSelectVersion.SelectedIndex); projectContent = new ProjectContent(project.Id); List <VersionControlUnitInfo> content; string releaseName = string.Empty; if (!_vcAdministrator.GetReleaseInfo(project.Id, projectVersion.Name, out content)) { UserInfoHandler.ShowError(_vcAdministrator._vcAPI.GetErrorMessage()); EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursors.Default; return(false); } foreach (VersionControlUnitInfo unit in content) { projectContent.projectUnits.Add(unit); projectContent.selections.Add(true); } projectContent.selectedRelease = cmbSelectVersion.SelectedItem.ToString(); EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursors.Default; return(true); }
private void ParseStep() { try { string code = null; Invoke(new MethodInvoker(delegate { code = _control.Text; })); TextReader textReader = new StringReader(code); ICompilationUnit newCompilationUnit; var supportedLanguage = SupportedLanguage == SupportedLanguage.CSharp ? ICSharpCode.NRefactory.SupportedLanguage.CSharp : ICSharpCode.NRefactory.SupportedLanguage.VBNet; using (var p = ParserFactory.CreateParser(supportedLanguage, textReader)) { // we only need to parse types and method definitions, no method bodies // so speed up the parser and make it more resistent to syntax // errors in methods p.ParseMethodBodies = false; p.Parse(); newCompilationUnit = ConvertCompilationUnit(p.CompilationUnit); } // Remove information from lastCompilationUnit and add information from newCompilationUnit. ProjectContent.UpdateCompilationUnit(LastCompilationUnit, newCompilationUnit, DummyFileName); LastCompilationUnit = newCompilationUnit; ParseInformation = new ParseInformation(newCompilationUnit); } // ReSharper disable once EmptyGeneralCatchClause catch (Exception) { } }
public void Handle(AddProjectTranslationCommand command) { var project = _projectWithContentsQueryHandler.Handle(command.Id.Value); foreach (var item in command.Items) { var content = project.ProjectContents.FirstOrDefault(c => c.Locale == item.Locale); if (content != null && content.IsUpdated) { continue; } if (content == null) { content = new ProjectContent(); _projectContentRepository.Add(content); content.Project = project; content.Id = project.Id; content.Locale = item.Locale; } content.IsUpdated = true; content.Name = item.Name; content.Description = item.Description; } }
/// <inheritdoc /> public override void OnExit() { FlaxEngine.Content.AssetDisposing -= Content_OnAssetDisposing; // Disable events _enableEvents = false; // Cleanup Proxy.ForEach(x => x.Dispose()); if (ProjectContent != null) { ProjectContent.Dispose(); ProjectContent = null; } if (ProjectSource != null) { ProjectSource.Dispose(); ProjectSource = null; } if (EnginePrivate != null) { EnginePrivate.Dispose(); EnginePrivate = null; } if (EditorPrivate != null) { EditorPrivate.Dispose(); EditorPrivate = null; } Proxy.Clear(); }
public ExPerienceItem(int index, ProjectContent projectContent, IList <ExperienceLevel> levelList) { InitializeComponent(); this.ProjectContent = projectContent; this.LevelList = levelList; this.Index = index; }
private void ResolveAssemblies() { foreach (string assemblyFile in ReferencedAssemblies) { IUnresolvedAssembly assembly = ((Solution)Solution).LoadAssembly(assemblyFile); ProjectContent = ProjectContent.AddAssemblyReferences(new[] { assembly }); ResolvedReferencedAssemblies.Add(assembly); } }
public IActionResult Post([FromBody] ProjectContent value) { var res = _repo.add(value); if (res == true) { return(CreatedAtRoute("ProjectContentById", new { Controller = "ProjectContent", id = value.ProjectContentId }, value)); } return(StatusCode(500)); }
// -------------------------------------------------------------------- private void ImportMeshes() { mLoadedMeshes = new int[mCurrentModel.MeshCount]; List <ModelSupportData.MeshData> previousMeshes = new List <ModelSupportData.MeshData>(mSupportFile.Meshes); mSupportFile.Meshes.Clear(); for (int i = 0; i < mCurrentModel.MeshCount; ++i) { Onyx3D.Mesh onyxMesh = mCurrentModel.Meshes[i].ToOnyx3D(); onyxMesh.Scale(sMeshScalar); string name = mCurrentModel.Meshes[i].Name; string meshPath = ProjectContent.GetMeshPath(name); AssetLoader <Onyx3D.Mesh> .Save(onyxMesh, meshPath, false); int id = -1; for (int prevIndex = 0; prevIndex < previousMeshes.Count; ++prevIndex) { ModelSupportData.MeshData mesh = previousMeshes[prevIndex]; if (mesh.Name == name) { id = mesh.Id; previousMeshes.Remove(mesh); break; } } if (id < 0) { id = ProjectManager.Instance.Content.AddMesh(meshPath, false, onyxMesh).Guid; } mLoadedMeshes[i] = id; ModelSupportData.MeshData data = new ModelSupportData.MeshData(); data.Id = id; data.Name = name; mSupportFile.Meshes.Add(data); Onyx3DEngine.Instance.Resources.GetMesh(id).IsDirty = true; } foreach (ModelSupportData.MeshData meshData in previousMeshes) { if (mSupportFile.GetMeshId(meshData.Name) < 0) { if (MessageBox.Show("Mesh " + meshData.Name + " is no longer part of the new model. Do you want to keep it in the project?", "Mesh Disappeared", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { ProjectManager.Instance.Content.RemoveMesh(meshData.Id); } } } }
public static ProjectContentViewModel FromModel(ProjectContent model) { return(new ProjectContentViewModel { Id = model.Id, Locale = model.Locale, IsUpdated = model.IsUpdated, Name = model.Name, Description = model.Description }); }
private static void FindAllSources(string[] sourcesArguments) { MainSources = sourcesArguments; RootPath = Path.GetDirectoryName(sourcesArguments[0]); Assembler assembler = new Assembler(); List <string> allsources = assembler.GetSourceFiles(MainSources); var references = new HashSet <string>(); if (assembler.UseDefaultReferences) { foreach (string defaultReference in Assembler.DefaultReferences) { references.Add(Assembler.GetAssemblyDllPath(defaultReference)); } } foreach (var assemblerRef in assembler.References) { references.Add(assemblerRef); } // find all folders and create associated projects types foreach (var source in allsources) { string dir = Path.GetDirectoryName(source); if (!string.IsNullOrEmpty(dir)) { dir = Util.PathMakeStandard(dir); } var existing = DebugProjects.FirstOrDefault(dp => dir.Contains(dp.Value.ProjectFolder)); if (existing.Equals(default(KeyValuePair <Type, ProjectContent>))) { string projectName = Path.GetFileName(dir) + "_sharpmake"; Type myProjectType = CreateProject(projectName); ProjectContent project = new ProjectContent { ProjectFolder = dir }; project.References.AddRange(references); foreach (var p in DebugProjects) { p.Value.ProjectReferences.Add(myProjectType); } DebugProjects.Add(myProjectType, project); existing = DebugProjects.Last(); } existing.Value.ProjectFiles.Add(source); } }
public void AddReference(string reference) { try { References.Add(LoadAssembly(reference)); ProjectContent = ProjectContent.AddAssemblyReferences(References); } catch (BadImageFormatException) { // Ignore native dlls _logger.Error(reference + " is a native dll"); } }
public bool update(int id, ProjectContent projectContent) { try { _context.ProjectContents.Update(projectContent); _context.SaveChanges(); return(true); } catch (Exception e) { Console.WriteLine(e.StackTrace); return(false); } }
// -------------------------------------------------------------------- private void ReloadSupportFile() { string modelPath = mCurrentPath; string dataPath = ModelSupportData.GetPath(modelPath); if (File.Exists(dataPath)) { mSupportFile = AssetStreamLoader <ModelSupportData> .Load(dataPath, false); } else { mSupportFile = new ModelSupportData(ProjectContent.GetRelativePath(modelPath)); } }
public bool add(ProjectContent projectContent) { try { projectContent.Date = DateTime.Now; _context.ProjectContents.Add(projectContent); _context.SaveChanges(); return(true); } catch (Exception e) { Console.WriteLine(e.StackTrace); return(false); } }
static bool AssessDiskBaseProjectContent(string baseProjectPath, out ProjectContent projectContent) { projectContent = new ProjectContent(baseProjectPath); List <VersionControlUnitInfo> content = VCAdministrator.GetContent_LocalProject(baseProjectPath); foreach (VersionControlUnitInfo unit in content) { projectContent.projectUnits.Add(unit); } for (int i = 0; i < projectContent.projectUnits.Count; i++) { projectContent.selections.Add(true); } return(true); }
// -------------------------------------------------------------------- private int ImportMesh(Assimp.Mesh newMesh, List<ModelSupportData.MeshData> previousMeshes) { Onyx3D.Mesh onyxMesh = newMesh.ToOnyx3D(); onyxMesh.Scale(sMeshScalar); string name = GetSafeFileName(newMesh.Name); string meshPath = ProjectContent.GetMeshPath(name); AssetLoader<Onyx3D.Mesh>.Save(onyxMesh, meshPath, false); int id = -1; for (int prevIndex = 0; prevIndex < previousMeshes.Count; ++prevIndex) { ModelSupportData.MeshData mesh = previousMeshes[prevIndex]; if (mesh.Name == name) { id = mesh.Id; previousMeshes.Remove(mesh); break; } } if (id < 0) { id = ProjectManager.Instance.Content.AddMesh(meshPath, false, onyxMesh).Guid; } else { OnyxProjectAsset asset = ProjectManager.Instance.Content.GetAsset(id); if (asset == null) { ProjectManager.Instance.Content.AddObject(meshPath, false, ProjectManager.Instance.Content.Meshes, id, onyxMesh); } else { onyxMesh.LinkedProjectAsset = asset; } } ModelSupportData.MeshData data = new ModelSupportData.MeshData(); data.Id = id; data.Name = name; mSupportFile.Meshes.Add(data); ProjectManager.Instance.Content.MarkDirty(id); return id; }
private void FillTexturesList() { listViewTextures.Items.Clear(); int i = 0; listViewTextures.SmallImageList = new ImageList(); listViewTextures.SmallImageList.ImageSize = new Size(64, 64); foreach (OnyxProjectAsset t in ProjectManager.Instance.Content.Textures) { Bitmap bmp = new Bitmap(ProjectContent.GetAbsolutePath(t.Path)); Image small_img = bmp.GetThumbnailImage(64, 64, null, IntPtr.Zero); listViewTextures.SmallImageList.Images.Add(small_img); listViewTextures.Items.Add(new ListViewItem(Path.GetFileName(t.Path), i)); i++; } }
public void Handle(CreateProjectCommand command) { var project = new Project(); project.Id = Guid.NewGuid(); project.Active = true; foreach (var item in command.Items) { var content = new ProjectContent(); content.Description = item.Description; content.Name = item.Name; content.Locale = item.Locale; content.Project = project; content.IsUpdated = true; content.Id = project.Id; _projectContentRepository.Add(content); } project.CreatedAt = DateTime.Now; var currentUser = _currentUserRetriever.Get(); if (currentUser == null) { throw new Exception(Sentences.youMustBeLoggedIn); } var identifier = _projectNextIdQuery.Handle(currentUser.Id); project.Owner = currentUser; project.CreatorId = currentUser.Id; project.Identifier = identifier; var permission = new Permission(); permission.Id = Guid.NewGuid(); permission.Profile = Profile.ProjectOwner; permission.Project = project; permission.User = currentUser; _permissionRepository.Add(permission); _projectRepository.Add(project); }
// -------------------------------------------------------------------- public static Entity Create(SceneObject obj, string name) { Vector3 position = obj.Transform.Position; SceneObject rootNode = new SceneObject(name); obj.Parent = rootNode; obj.Transform.LocalPosition = Vector3.Zero; Entity entity = new Entity(rootNode); string entityPath = ProjectContent.GetEntityPath(name); AssetLoader <Entity> .Save(entity, entityPath, false); OnyxProjectAsset asset = ProjectManager.Instance.Content.AddEntity(entityPath, false, entity); asset.Name = name; return(entity); }
// -------------------------------------------------------------------- public static bool Save() { if (ProjectManager.Instance.CurrentProjectPath.Length == 0) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Title = "Save Project"; saveFileDialog1.Filter = "Onyx3d project files (*.o3dproj)|*.o3dproj"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { try { ProjectManager.Instance.Save(saveFileDialog1.FileName); Properties.Settings.Default.LastProjectPath = saveFileDialog1.FileName; Properties.Settings.Default.Save(); ProjectContent.CreateProjectHierarchy(Path.GetDirectoryName(saveFileDialog1.FileName)); return(true); } catch (Exception ex) { MessageBox.Show("Error: Could not save the project: " + ex.StackTrace); return(false); } } } else { ProjectManager.Instance.Save(); return(true); } return(false); }
// ----------------------------s---------------------------------------- public static Entity Create(List <SceneObject> objects, string name, Vector3 position) { SceneObject rootNode = new SceneObject(name); rootNode.Transform.Position = position; foreach (SceneObject obj in objects) { obj.Parent = rootNode; } rootNode.Transform.Position = Vector3.Zero; Entity entity = new Entity(rootNode); string entityPath = ProjectContent.GetEntityPath(name); AssetLoader <Entity> .Save(entity, entityPath, false); OnyxProjectAsset asset = ProjectManager.Instance.Content.AddEntity(entityPath, false, entity); asset.Name = name; return(entity); }
public void Handle(UpdateProjectCommand command) { var project = _projectWithContentsQueryHandler.Handle(command.Id.Value); foreach (var content in project.ProjectContents) { if (command.Items.Any(i => content.Locale == i.Locale)) { var item = command.Items.FirstOrDefault(i => content.Locale == i.Locale); content.IsUpdated = true; content.Name = item.Name; content.Description = item.Description; } else { content.IsUpdated = false; } } foreach (var item in command.Items) { if (project.ProjectContents.Any(p => p.Locale == item.Locale)) { continue; } var content = new ProjectContent(); content.Id = project.Id; content.IsUpdated = true; content.Name = item.Name; content.Locale = item.Locale; content.Description = item.Description; content.Project = project; _projectContentRepository.Add(content); } }
void ParserThread() { //BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading mscorlib..."; })); m_projectcontent.AddReferencedContent(ProjectContentRegistry.Mscorlib); // do one initial parser step to enable code-completion while other // references are loading ParseStep(); foreach (string assemblyName in GetReferences(false)) { string assemblyNameCopy = assemblyName; // copy for anonymous method //BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading " + assemblyNameCopy + "..."; })); IProjectContent referenceProjectContent = ProjectContentRegistry.GetProjectContentForReference(assemblyName, assemblyName); ProjectContent.AddReferencedContent(referenceProjectContent); if (referenceProjectContent is ReflectionProjectContent) { (referenceProjectContent as ReflectionProjectContent).InitializeReferences(); } } if (SupportedLanguage == ESupportedLanguage.VisualBasic) { ProjectContent.DefaultImports = new DefaultUsing(ProjectContent); ProjectContent.DefaultImports.Usings.Add("System"); ProjectContent.DefaultImports.Usings.Add("System.Text"); ProjectContent.DefaultImports.Usings.Add("Microsoft.VisualBasic"); } //BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Ready"; })); // Parse the current file every 2 seconds while (!IsDisposed) { ParseStep(); Thread.Sleep(2000); } }
bool AssessVCBaseProjectContent(out ProjectContent projectContent) { EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursors.WaitCursor; ProjectNode project = _projectNode; ReleaseInfo projectVersion = _releaseInfo; projectContent = new ProjectContent(project.Id); List <VersionControlUnitInfo> content; if (!_vcAdministrator.GetReleaseInfo(project.Id, projectVersion.Name, out content)) { UserInfoHandler.ShowError(_vcAdministrator._vcAPI.GetErrorMessage()); EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursors.Default; return(false); } foreach (VersionControlUnitInfo unit in content) { projectContent.projectUnits.Add(unit); } EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursors.Default; return(true); }
private static Type GenerateDebugProject(IAssemblyInfo assemblyInfo, bool isSetupProject, string startArguments, IDictionary <string, Type> visited, string[] defines) { string displayName = assemblyInfo.DebugProjectName; if (string.IsNullOrEmpty(displayName)) { displayName = isSetupProject ? "sharpmake_debug" : $"sharpmake_package_{assemblyInfo.Id.GetDeterministicHashCode():X8}"; } Type generatedProject; if (visited.TryGetValue(assemblyInfo.Id, out generatedProject)) { if (generatedProject == null) { throw new Error($"Circular sharpmake package dependency on {displayName}"); } return(generatedProject); } visited[assemblyInfo.Id] = null; ProjectContent project = new ProjectContent { ProjectFolder = RootPath, IsSetupProject = isSetupProject, DisplayName = displayName, StartArguments = startArguments }; generatedProject = CreateProject(displayName); DebugProjects.Add(generatedProject, project); // Add sources foreach (var source in assemblyInfo.SourceFiles) { project.ProjectFiles.Add(source); } // Add references var references = new HashSet <string>(); foreach (var assemblerRef in assemblyInfo.References) { if (!assemblyInfo.SourceReferences.ContainsKey(assemblerRef)) { references.Add(assemblerRef); } } project.References.AddRange(references); foreach (var refInfo in assemblyInfo.SourceReferences.Values) { project.ProjectReferences.Add(GenerateDebugProject(refInfo, false, string.Empty, visited, defines)); } if (defines != null) { project.Defines.AddRange(defines); } visited[assemblyInfo.Id] = generatedProject; return(generatedProject); }
private void LoadTexturePreview() { Bitmap bmp = new Bitmap(ProjectContent.GetAbsolutePath(mCurrentTexture.Path)); pictureBoxPreview.Image = bmp.GetThumbnailImage(256, 256, null, IntPtr.Zero); }
public void AddReference(IAssemblyReference reference) { References.Add(reference); ProjectContent.AddAssemblyReferences(new[] { reference }); }
Document CreateProgramDocument(Project project, ProjectContent content) { try { var solution = project.Solution; var programDeclaration = SyntaxFactory.ClassDeclaration("Program") .WithModifiers(SyntaxTokenList.Create(SyntaxFactory.Token(SyntaxKind.PublicKeyword))) .WithBaseList(SyntaxFactory.BaseList( SyntaxFactory.SeparatedList <BaseTypeSyntax>() .Add(SyntaxFactory.SimpleBaseType(SyntaxFactory.ParseTypeName("MyGridProgram")) ))) .NormalizeWhitespace("", "\n"); var pendingTrivia = new List <SyntaxTrivia>(); var programParts = content.Parts.OfType <ProgramScriptPart>().OrderBy(part => part, _partComparer).ToArray(); var members = new List <MemberDeclarationSyntax>(); foreach (var part in programParts) { pendingTrivia.AddRange(part.GetLeadingTrivia()); var nodes = part.Content().ToArray(); if (pendingTrivia.Count > 0) { var firstNode = nodes.FirstOrDefault(); if (firstNode != null) { nodes[0] = firstNode.WithLeadingTrivia(pendingTrivia.Concat(firstNode.GetLeadingTrivia())); pendingTrivia.Clear(); } } pendingTrivia.AddRange(part.GetTrailingTrivia()); if (pendingTrivia.Count > 0) { var lastNode = nodes.LastOrDefault(); if (lastNode != null) { nodes[nodes.Length - 1] = lastNode.WithTrailingTrivia(pendingTrivia.Concat(lastNode.GetTrailingTrivia())); pendingTrivia.Clear(); } } members.AddRange(nodes.Select(node => node.Unindented(2))); } programDeclaration = programDeclaration.WithMembers(new SyntaxList <MemberDeclarationSyntax>().AddRange(members)); var extensionDeclarations = content.Parts .OfType <ExtensionScriptPart>() .OrderBy(part => part, _partComparer) .Select(p => p.PartRoot .Unindented(1)) .Cast <MemberDeclarationSyntax>() .ToArray(); if (extensionDeclarations.Any()) { programDeclaration = programDeclaration .WithCloseBraceToken( programDeclaration.CloseBraceToken .WithLeadingTrivia(SyntaxFactory.EndOfLine("\n")) .WithTrailingTrivia(SyntaxFactory.EndOfLine("\n"), SyntaxFactory.EndOfLine("\n") ) ); } var compilationProject = solution.AddProject("__ScriptCompilationProject", "__ScriptCompilationProject.dll", LanguageNames.CSharp) .WithCompilationOptions(project.CompilationOptions) .WithMetadataReferences(project.MetadataReferences); var unit = SyntaxFactory.CompilationUnit() .WithUsings(SyntaxFactory.List(content.UsingDirectives)) .AddMembers(programDeclaration) .AddMembers(extensionDeclarations); return(compilationProject.AddDocument("Program.cs", unit)); } catch (Exception e) { throw new BuildException(string.Format(Text.BuildModule_CreateProgramDocument_Error, project.FilePath), e); } }
public LevelContent(ProjectContent project, XmlDocument document) { this.Project = project; XmlNode levelNode = document["level"]; // Level values/attributes foreach (ValueTemplateContent value in project.Values) { XmlNode attribute = null; if ((attribute = levelNode.Attributes[value.Name]) != null) { if (value is BooleanValueTemplateContent) this.Values.Add(new BooleanValueContent(value.Name, bool.Parse(attribute.Value))); else if (value is IntegerValueTemplateContent) this.Values.Add(new IntegerValueContent(value.Name, int.Parse(attribute.Value, CultureInfo.InvariantCulture))); else if (value is NumberValueTemplateContent) this.Values.Add(new NumberValueContent(value.Name, float.Parse(attribute.Value, CultureInfo.InvariantCulture))); else if (value is StringValueTemplateContent) this.Values.Add(new StringValueContent(value.Name, attribute.Value)); } } // Height this.Height = int.Parse(levelNode.SelectSingleNode("height").InnerText, CultureInfo.InvariantCulture); // Width this.Width = int.Parse(levelNode.SelectSingleNode("width").InnerText, CultureInfo.InvariantCulture); // Layers // Here we'll construct an XPath query of all possible layer names so we can just extract the nodes all // at once. string[] layerNames = (from x in project.LayerSettings select x.Name).ToArray<string>(); string layerXPath = string.Join("|", layerNames); foreach (XmlNode layerNode in levelNode.SelectNodes(layerXPath)) { // Attempt to extract the settings for this layer. LayerSettingsContent[] s = (from x in project.LayerSettings where x.Name.Equals(layerNode.Name) select x).ToArray<LayerSettingsContent>(); if (!(s.Length > 0)) continue; LayerSettingsContent layerSettings = s[0]; // We have a grid layer. if (layerSettings is GridLayerSettingsContent) { GridLayerSettingsContent settings = layerSettings as GridLayerSettingsContent; GridLayerContent gridLayer = new GridLayerContent(layerNode, this, settings); if (gridLayer != null) this.Layers.Add(gridLayer); } else if (layerSettings is TileLayerSettingsContent) { TileLayerSettingsContent settings = layerSettings as TileLayerSettingsContent; TileLayerContent tileLayer = new TileLayerContent(layerNode, this, settings); if (tileLayer != null) this.Layers.Add(tileLayer); } else if (layerSettings is ObjectLayerSettingsContent) { ObjectLayerContent objectLayer = new ObjectLayerContent(layerNode, this); if(objectLayer != null) this.Layers.Add(objectLayer); } } }