public void SetProjectElement(ProjectElement Element) { DocumentInfo = Element.DocumentInfo; }
public BaseDocument ShowDocument(ProjectElement Element) { if (Element.DocumentInfo.Type == ProjectElement.ElementType.FOLDER) { return(null); } if (Element.Document == null) { BaseDocument document = Core.MainForm.CreateNewDocument(Element.DocumentInfo.Type, Element.DocumentInfo.Project); if (document == null) { System.Windows.Forms.MessageBox.Show("Could not create document for " + Element.DocumentInfo.Type.ToString(), "Error creating document"); return(null); } Element.Document = document; Element.Document.ShowHint = DockState.Document; Element.Document.Icon = Core.MainForm.IconFromType(Element.DocumentInfo); document.SetProjectElement(Element); document.Core = Core; document.SetDocumentFilename(Element.Filename); if (Element.DocumentInfo.Project == null) { // icon for non project documents document.Icon = System.Drawing.SystemIcons.Asterisk; } document.ToolTipText = ""; if (document.DocumentFilename == null) { // a new file Element.Name = Element.Name; Element.Document.Show(Core.MainForm.panelMain); } else if (document.Load()) { document.ToolTipText = document.DocumentInfo.FullPath; Element.Name = document.Text; //Element.Name; Element.Document.Show(Core.MainForm.panelMain); } else if (!string.IsNullOrEmpty(Element.Filename)) { Element.Document = null; return(null); } if (Element.Document != null) { Element.Document.DocumentInfo = Element.DocumentInfo; Element.DocumentInfo.BaseDoc = Element.Document; } if ((Element.Document != null) && (Element.Document is SourceASMEx)) { Element.Document.DocumentEvent += new BaseDocument.DocumentEventHandler(Core.MainForm.Document_DocumentEvent); } // set known tokens if we have any bool setFromMainDoc = false; if (!string.IsNullOrEmpty(Settings.MainDocument)) { var element = GetElementByFilename(Settings.MainDocument); if ((element != null) && (element.DocumentInfo.Type == ProjectElement.ElementType.ASM_SOURCE) && (element.DocumentInfo.ASMFileInfo != null)) { if (element.DocumentInfo.ASMFileInfo.ContainsFile(Element.DocumentInfo.FullPath)) { if (!Core.Compiling.IsCurrentlyBuilding()) { Element.DocumentInfo.SetASMFileInfo(element.DocumentInfo.ASMFileInfo, element.DocumentInfo.KnownKeywords, element.DocumentInfo.KnownTokens); } setFromMainDoc = true; } } } if ((!setFromMainDoc) && (Core.Compiling.ParserASM.ASMFileInfo.ContainsFile(Element.DocumentInfo.FullPath))) { if (!Core.Compiling.IsCurrentlyBuilding()) { Element.DocumentInfo.SetASMFileInfo(Core.Compiling.ParserASM.ASMFileInfo, Core.Compiling.ParserASM.KnownTokens(), Core.Compiling.ParserASM.KnownTokenInfo()); } } //Debug.Log( "m_Outline.RefreshFromDocument after showdoc" ); Core.MainForm.m_Outline.RefreshFromDocument(Element.DocumentInfo.BaseDoc); } Element.Document.Select(); Element.IsShown = true; Core.MainForm.RaiseApplicationEvent(new C64Studio.Types.ApplicationEvent(C64Studio.Types.ApplicationEvent.Type.DOCUMENT_OPENED, Element.DocumentInfo)); Core.MainForm.RaiseApplicationEvent(new C64Studio.Types.ApplicationEvent(C64Studio.Types.ApplicationEvent.Type.ELEMENT_OPENED, Element)); return(Element.Document); }
public bool NeedsRebuild(DocumentInfo DocInfo, string ConfigSetting) { if (DocInfo == null) { return(false); } // actual parsing and deducing dependencies if a rebuild is necessary! foreach (IDockContent dockContent in Core.MainForm.panelMain.Documents) { BaseDocument baseDoc = (BaseDocument)dockContent; if (baseDoc.Modified) { return(true); } } if (DocInfo.Element != null) { foreach (var dependency in DocInfo.Element.ForcedDependency.DependentOnFile) { ProjectElement elementDependency = DocInfo.Project.GetElementByFilename(dependency.Filename); if (elementDependency == null) { Core.AddToOutput("Could not find dependency for " + dependency + System.Environment.NewLine); return(true); } if (NeedsRebuild(elementDependency.DocumentInfo, ConfigSetting)) { return(true); } foreach (var rebuildFile in m_RebuiltFiles) { if (GR.Path.IsPathEqual(elementDependency.DocumentInfo.DocumentFilename, rebuildFile)) { Core.AddToOutput("Dependency " + elementDependency.DocumentInfo.DocumentFilename + " was rebuilt in this cycle, need to rebuild dependent element " + DocInfo.DocumentFilename + System.Environment.NewLine); return(true); } } } if (DocInfo.DeducedDependency[ConfigSetting] != null) { // custom build overrides output file -> always rebuild if ((!string.IsNullOrEmpty(DocInfo.Element.Settings[ConfigSetting].CustomBuild)) && (!string.IsNullOrEmpty(DocInfo.Element.TargetFilename))) { Core.AddToOutput("Custom build always requires a rebuild" + System.Environment.NewLine); return(true); } foreach (var dependency in DocInfo.Element.ExternalDependencies.DependentOnFile) { string fullPath = BuildFullPath(DocInfo.Project.Settings.BasePath, dependency.Filename); DateTime fileTime = new DateTime(); try { if (System.IO.File.Exists(fullPath)) { fileTime = System.IO.File.GetLastWriteTime(fullPath); } } catch { } if (fileTime != DocInfo.DeducedDependency[ConfigSetting].BuildState[fullPath]) { Core.AddToOutput("External Dependency " + fullPath + " was modified, need to rebuild dependent element " + DocInfo.DocumentFilename + System.Environment.NewLine); DocInfo.DeducedDependency[ConfigSetting].BuildState.Add(fullPath, fileTime); return(true); } } } else { // no build time stored yet, needs rebuild DocInfo.DeducedDependency[ConfigSetting] = new DependencyBuildState(); return(true); } } if (DocInfo.Compilable) { if (!DocInfo.HasBeenSuccessfullyBuilt) { return(true); } } if (DocInfo.Project == null) { return(true); } if (DocInfo.DeducedDependency[ConfigSetting] == null) { // no build time stored yet, needs rebuild DocInfo.DeducedDependency[ConfigSetting] = new DependencyBuildState(); return(true); } foreach (KeyValuePair <string, DateTime> dependency in DocInfo.DeducedDependency[ConfigSetting].BuildState) { DateTime fileTime = new DateTime(); try { fileTime = System.IO.File.GetLastWriteTime(dependency.Key); } catch { } if (fileTime != dependency.Value) { //Debug.Log( "File time differs for " + dependency.Key ); return(true); } } return(false); }
public bool Load(byte[] ProjectData) { string currentConfig = "Default"; string activeElement = ""; Node = new System.Windows.Forms.TreeNode(); Node.Tag = this; GR.IO.MemoryReader memIn = new GR.IO.MemoryReader(ProjectData); GR.IO.FileChunk chunk = new GR.IO.FileChunk(); ushort origDebugStartAddress = 2049; while (chunk.ReadFromStream(memIn)) { GR.IO.MemoryReader memChunk = chunk.MemoryReader(); switch (chunk.Type) { case Types.FileChunk.PROJECT: // Project Info // Version memChunk.ReadUInt32(); Settings.Name = memChunk.ReadString(); Settings.Filename = memChunk.ReadString(); Settings.DebugPort = memChunk.ReadUInt16(); origDebugStartAddress = memChunk.ReadUInt16(); Settings.BuildTool = memChunk.ReadString(); Settings.RunTool = memChunk.ReadString(); Settings.MainDocument = memChunk.ReadString(); currentConfig = memChunk.ReadString(); activeElement = memChunk.ReadString(); Node.Text = Settings.Name; break; case Types.FileChunk.PROJECT_ELEMENT: // Element Info { // Version int version = (int)memChunk.ReadUInt32(); ProjectElement.ElementType type = (ProjectElement.ElementType)memChunk.ReadUInt32(); //System.Windows.Forms.TreeNode nodeParent = NodeFromHierarchy( ProjectElement element = CreateElement(type, Node); element.Name = memChunk.ReadString(); //element.Filename = System.IO.Path.GetFileName( memChunk.ReadString() ); element.Filename = memChunk.ReadString(); if (element.DocumentInfo.Type == ProjectElement.ElementType.FOLDER) { element.Node.Text = element.Name; } else { element.Node.Text = System.IO.Path.GetFileName(element.Filename); } GR.IO.FileChunk subChunk = new GR.IO.FileChunk(); if (!subChunk.ReadFromStream(memChunk)) { return(false); } if (subChunk.Type != Types.FileChunk.PROJECT_ELEMENT_DATA) { return(false); } // Element Data element.DocumentInfo.DocumentFilename = element.Filename; if (element.Document != null) { if (!element.Document.ReadFromReader(subChunk.MemoryReader())) { Elements.Remove(element); element.Document.Dispose(); element = null; } else { element.Document.SetDocumentFilename(element.Filename); } } element.TargetFilename = memChunk.ReadString(); element.TargetType = (Types.CompileTargetType)memChunk.ReadUInt32(); int dependencyCount = memChunk.ReadInt32(); for (int i = 0; i < dependencyCount; ++i) { string dependency = memChunk.ReadString(); element.ForcedDependency.DependentOnFile.Add(new FileDependency.DependencyInfo(dependency, true, false)); } element.StartAddress = memChunk.ReadString(); // 2 free strings memChunk.ReadString(); memChunk.ReadString(); int perConfigSettingCount = memChunk.ReadInt32(); for (int i = 0; i < perConfigSettingCount; ++i) { GR.IO.FileChunk chunkElementPerConfigSetting = new GR.IO.FileChunk(); chunkElementPerConfigSetting.ReadFromStream(memChunk); if (chunkElementPerConfigSetting.Type == Types.FileChunk.PROJECT_ELEMENT_PER_CONFIG_SETTING) { ProjectElement.PerConfigSettings perConfigSetting = new ProjectElement.PerConfigSettings(); GR.IO.MemoryReader memSubChunk = chunkElementPerConfigSetting.MemoryReader(); string config = memSubChunk.ReadString(); perConfigSetting.PreBuild = memSubChunk.ReadString(); perConfigSetting.CustomBuild = memSubChunk.ReadString(); perConfigSetting.PostBuild = memSubChunk.ReadString(); perConfigSetting.DebugFile = memSubChunk.ReadString(); perConfigSetting.DebugFileType = (C64Studio.Types.CompileTargetType)memSubChunk.ReadInt32(); perConfigSetting.PreBuildChain.Active = (memSubChunk.ReadInt32() == 1); int numEntries = memSubChunk.ReadInt32(); for (int j = 0; j < numEntries; ++j) { var entry = new BuildChainEntry(); entry.ProjectName = memSubChunk.ReadString(); entry.Config = memSubChunk.ReadString(); entry.DocumentFilename = memSubChunk.ReadString(); entry.PreDefines = memSubChunk.ReadString(); perConfigSetting.PreBuildChain.Entries.Add(entry); } perConfigSetting.PostBuildChain.Active = (memSubChunk.ReadInt32() == 1); numEntries = memSubChunk.ReadInt32(); for (int j = 0; j < numEntries; ++j) { var entry = new BuildChainEntry(); entry.ProjectName = memSubChunk.ReadString(); entry.Config = memSubChunk.ReadString(); entry.DocumentFilename = memSubChunk.ReadString(); entry.PreDefines = memSubChunk.ReadString(); perConfigSetting.PostBuildChain.Entries.Add(entry); } element.Settings[config] = perConfigSetting; } } element.IsShown = (memChunk.ReadInt32() != 0); element.AssemblerType = (C64Studio.Types.AssemblerType)memChunk.ReadUInt32(); int hierarchyPartCount = memChunk.ReadInt32(); for (int i = 0; i < hierarchyPartCount; ++i) { string part = memChunk.ReadString(); element.ProjectHierarchy.Add(part); } if (element.ProjectHierarchy.Count > 0) { // node is sub-node, move accordingly System.Windows.Forms.TreeNode parentNode = NodeFromHierarchy(element.ProjectHierarchy); if ((parentNode != null) && (parentNode != element.Node.Parent)) { element.Node.Remove(); parentNode.Nodes.Add(element.Node); } } // dependency - include symbols dependencyCount = memChunk.ReadInt32(); for (int i = 0; i < dependencyCount; ++i) { element.ForcedDependency.DependentOnFile[i].IncludeSymbols = (memChunk.ReadInt32() != 0); } // code folding entries int numFoldingEntries = memChunk.ReadInt32(); element.DocumentInfo.CollapsedFoldingBlocks = new GR.Collections.Set <int>(); for (int i = 0; i < numFoldingEntries; ++i) { int collapsedBlockLine = memChunk.ReadInt32(); element.DocumentInfo.CollapsedFoldingBlocks.Add(collapsedBlockLine); //Debug.Log( "Get collapsed blocked for " + element.DocumentInfo.FullPath + ", line " + collapsedBlockLine ); } // external dependencies int externalDependencyCount = memChunk.ReadInt32(); for (int i = 0; i < externalDependencyCount; ++i) { string dependency = memChunk.ReadString(); element.ExternalDependencies.DependentOnFile.Add(new FileDependency.DependencyInfo(dependency, true, false)); } element.BasicVersion = (BasicVersion)memChunk.ReadUInt32(); // TODO - load other stuff if ((element != null) && (element.IsShown)) { ShowDocument(element); if (element.Document != null) { element.Document.ShowHint = DockState.Document; //element.Document.Show( MainForm.panelMain ); } } } break; case Types.FileChunk.PROJECT_ELEMENT_DISPLAY_DATA: { string elementFilename = memChunk.ReadString(); ProjectElement element = GetElementByFilename(elementFilename); if (element != null) { UInt32 numBytes = memChunk.ReadUInt32(); GR.Memory.ByteBuffer displayData = new GR.Memory.ByteBuffer(); memChunk.ReadBlock(displayData, numBytes); if (element.Document != null) { element.Document.ApplyDisplayDetails(displayData); } } } break; case Types.FileChunk.PROJECT_CONFIG: { ProjectConfig config = new ProjectConfig(); config.Load(memChunk); if (string.IsNullOrEmpty(config.DebugStartAddressLabel)) { config.DebugStartAddressLabel = origDebugStartAddress.ToString(); } Settings.Configuration(config.Name, config); } break; case Types.FileChunk.PROJECT_WATCH_ENTRY: { WatchEntry watch = new WatchEntry(); watch.Load(memChunk); Core.MainForm.AddWatchEntry(watch); //Debug.Log( "loaded watch entry for " + watch.Name ); } break; } } if (Settings.GetConfigurationCount() == 0) { // there must be one config ProjectConfig config = new ProjectConfig(); config.Name = "Default"; Settings.Configuration(config.Name, config); Settings.CurrentConfig = config; } else { Settings.CurrentConfig = Settings.Configuration(currentConfig); if (Settings.CurrentConfig == null) { Settings.CurrentConfig = Settings.GetConfigurations().First(); } } foreach (ProjectElement element in Elements) { if (element.Settings.Count == 0) { foreach (var configName in Settings.GetConfigurationNames()) { // needs a default setting! element.Settings[configName] = new ProjectElement.PerConfigSettings(); } } if ((!string.IsNullOrEmpty(element.Filename)) && (GR.Path.IsPathEqual(element.Filename, Settings.MainDocument))) { Core.MainForm.m_SolutionExplorer.HighlightNode(element.Node); } Core.MainForm.RaiseApplicationEvent(new C64Studio.Types.ApplicationEvent(C64Studio.Types.ApplicationEvent.Type.DOCUMENT_INFO_CREATED, element.DocumentInfo)); Core.MainForm.RaiseApplicationEvent(new C64Studio.Types.ApplicationEvent(C64Studio.Types.ApplicationEvent.Type.ELEMENT_CREATED, element)); } if (!String.IsNullOrEmpty(activeElement)) { ProjectElement element = GetElementByFilename(activeElement); if ((element != null) && (element.Document != null)) { element.Document.Show(); } } m_Modified = false; return(true); }
GR.Memory.ByteBuffer ElementToBuffer(ProjectElement Element) { GR.Memory.ByteBuffer buffer = new GR.Memory.ByteBuffer(); GR.IO.FileChunk chunkElement = new GR.IO.FileChunk(Types.FileChunk.PROJECT_ELEMENT); chunkElement.AppendU32(1); chunkElement.AppendU32((uint)Element.DocumentInfo.Type); chunkElement.AppendString(Element.Name); chunkElement.AppendString(Element.Filename); GR.IO.FileChunk chunkElementData = new GR.IO.FileChunk(Types.FileChunk.PROJECT_ELEMENT_DATA); if (Element.Document != null) { Element.Document.SaveToChunk(chunkElementData); } chunkElement.Append(chunkElementData.ToBuffer()); chunkElement.AppendString(Element.TargetFilename); chunkElement.AppendU32((uint)Element.TargetType); chunkElement.AppendI32(Element.ForcedDependency.DependentOnFile.Count); foreach (var dependency in Element.ForcedDependency.DependentOnFile) { chunkElement.AppendString(dependency.Filename); } chunkElement.AppendString(Element.StartAddress); // 2 free strings chunkElement.AppendString(""); chunkElement.AppendString(""); chunkElement.AppendI32(Element.Settings.Count); foreach (KeyValuePair <string, ProjectElement.PerConfigSettings> configSetting in Element.Settings) { GR.IO.FileChunk chunkElementPerConfigSetting = new GR.IO.FileChunk(Types.FileChunk.PROJECT_ELEMENT_PER_CONFIG_SETTING); chunkElementPerConfigSetting.AppendString(configSetting.Key); chunkElementPerConfigSetting.AppendString(configSetting.Value.PreBuild); chunkElementPerConfigSetting.AppendString(configSetting.Value.CustomBuild); chunkElementPerConfigSetting.AppendString(configSetting.Value.PostBuild); chunkElementPerConfigSetting.AppendString(configSetting.Value.DebugFile); chunkElementPerConfigSetting.AppendI32((int)configSetting.Value.DebugFileType); chunkElementPerConfigSetting.AppendI32(configSetting.Value.PreBuildChain.Active ? 1 : 0); chunkElementPerConfigSetting.AppendI32(configSetting.Value.PreBuildChain.Entries.Count); foreach (var buildChainEntry in configSetting.Value.PreBuildChain.Entries) { chunkElementPerConfigSetting.AppendString(buildChainEntry.ProjectName); chunkElementPerConfigSetting.AppendString(buildChainEntry.Config); chunkElementPerConfigSetting.AppendString(buildChainEntry.DocumentFilename); chunkElementPerConfigSetting.AppendString(buildChainEntry.PreDefines); } chunkElementPerConfigSetting.AppendI32(configSetting.Value.PostBuildChain.Active ? 1 : 0); chunkElementPerConfigSetting.AppendI32(configSetting.Value.PostBuildChain.Entries.Count); foreach (var buildChainEntry in configSetting.Value.PostBuildChain.Entries) { chunkElementPerConfigSetting.AppendString(buildChainEntry.ProjectName); chunkElementPerConfigSetting.AppendString(buildChainEntry.Config); chunkElementPerConfigSetting.AppendString(buildChainEntry.DocumentFilename); chunkElementPerConfigSetting.AppendString(buildChainEntry.PreDefines); } chunkElement.Append(chunkElementPerConfigSetting.ToBuffer()); } chunkElement.AppendI32(Element.IsShown ? 1 : 0); chunkElement.AppendU32((uint)Element.AssemblerType); chunkElement.AppendI32(Element.ProjectHierarchy.Count); foreach (string hierarchyPart in Element.ProjectHierarchy) { chunkElement.AppendString(hierarchyPart); } // dependency - include symbols chunkElement.AppendI32(Element.ForcedDependency.DependentOnFile.Count); foreach (var dependency in Element.ForcedDependency.DependentOnFile) { chunkElement.AppendI32(dependency.IncludeSymbols ? 1 : 0); } // collapsed folding blocks chunkElement.AppendI32(Element.DocumentInfo.CollapsedFoldingBlocks.Count); foreach (int foldStartLine in Element.DocumentInfo.CollapsedFoldingBlocks) { chunkElement.AppendI32(foldStartLine); //Debug.Log( "Save folded block for line " + foldStartLine ); } // external dependencies chunkElement.AppendI32(Element.ExternalDependencies.DependentOnFile.Count); foreach (var dependency in Element.ExternalDependencies.DependentOnFile) { chunkElement.AppendString(dependency.Filename); } // BASIC (that is sooo ugly) chunkElement.AppendU32((uint)Element.BasicVersion); buffer.Append(chunkElement.ToBuffer()); if (Element.Document != null) { GR.Memory.ByteBuffer displayDetails = Element.Document.DisplayDetails(); if (displayDetails != null) { GR.IO.FileChunk chunkElementDisplayData = new GR.IO.FileChunk(Types.FileChunk.PROJECT_ELEMENT_DISPLAY_DATA); chunkElementDisplayData.AppendString(Element.Filename); chunkElementDisplayData.AppendU32(displayDetails.Length); chunkElementDisplayData.Append(displayDetails); buffer.Append(chunkElementDisplayData.ToBuffer()); } } // child elements foreach (System.Windows.Forms.TreeNode node in Element.Node.Nodes) { ProjectElement subElement = (ProjectElement)node.Tag; buffer.Append(ElementToBuffer(subElement)); } return(buffer); }
public bool NeedsRebuild(DocumentInfo DocInfo, string ConfigSetting) { if (DocInfo == null) { return(false); } // actual parsing and deducing dependencies if a rebuild is necessary! foreach (IDockContent dockContent in Core.MainForm.panelMain.Documents) { BaseDocument baseDoc = (BaseDocument)dockContent; if (baseDoc.Modified) { return(true); } } if (DocInfo.Element != null) { foreach (var dependency in DocInfo.Element.ForcedDependency.DependentOnFile) { ProjectElement elementDependency = DocInfo.Project.GetElementByFilename(dependency.Filename); if (elementDependency == null) { Core.AddToOutput("Could not find dependency for " + dependency + System.Environment.NewLine); return(true); } if (NeedsRebuild(elementDependency.DocumentInfo, ConfigSetting)) { return(true); } foreach (var rebuildFile in m_RebuiltFiles) { if (GR.Path.IsPathEqual(elementDependency.DocumentInfo.DocumentFilename, rebuildFile)) { Core.AddToOutput("Dependency " + elementDependency.DocumentInfo.DocumentFilename + " was rebuilt in this cycle, need to rebuild dependent element " + DocInfo.DocumentFilename + System.Environment.NewLine); return(true); } } } } if (DocInfo.Compilable) { if (!DocInfo.HasBeenSuccessfullyBuilt) { return(true); } } if (DocInfo.Project == null) { return(true); } if (DocInfo.DeducedDependency[ConfigSetting] == null) { // no build time stored yet, needs rebuild DocInfo.DeducedDependency[ConfigSetting] = new DependencyBuildState(); return(true); } foreach (KeyValuePair <string, DateTime> dependency in DocInfo.DeducedDependency[ConfigSetting].BuildState) { DateTime fileTime = new DateTime(); try { fileTime = System.IO.File.GetLastWriteTime(dependency.Key); } catch { } if (fileTime != dependency.Value) { //Debug.Log( "File time differs for " + dependency.Key ); return(true); } } return(false); }
public PropCompileTarget(ProjectElement Element, StudioCore Core) { this.Element = Element; this.Core = Core; TopLevel = false; Text = "Compile Target"; InitializeComponent(); comboTargetType.Items.Add("None"); comboTargetType.Items.Add("Plain"); comboTargetType.Items.Add("PRG (cbm)"); comboTargetType.Items.Add("T64"); comboTargetType.Items.Add("8 KB Cartridge (bin)"); comboTargetType.Items.Add("8 KB Cartridge (crt)"); comboTargetType.Items.Add("16 KB Cartridge (bin)"); comboTargetType.Items.Add("16 KB Cartridge (crt)"); comboTargetType.Items.Add("D64"); comboTargetType.Items.Add("Magic Desk 64 KB Cartridge (bin)"); comboTargetType.Items.Add("Magic Desk 64 KB Cartridge (crt)"); comboTargetType.Items.Add("TAP"); comboTargetType.Items.Add("Easyflash Cartridge (bin)"); comboTargetType.Items.Add("Easyflash Cartridge (crt)"); comboTargetType.Items.Add("RGCD 64 KB Cartridge (bin)"); comboTargetType.Items.Add("RGCD 64 KB Cartridge (crt)"); comboTargetType.Items.Add("GMOD2 Cartridge (bin)"); comboTargetType.Items.Add("GMOD2 Cartridge (crt)"); comboTargetType.Items.Add("D81"); comboTargetType.SelectedIndex = (int)Element.TargetType; editTargetFilename.Text = Element.TargetFilename; foreach (ProjectElement element in Element.DocumentInfo.Project.Elements) { if ((element != Element) && (element.DocumentInfo.Type != ProjectElement.ElementType.FOLDER)) { var dependencies = Element.DocumentInfo.Project.GetDependencies(element); FileDependency.DependencyInfo depInfo = Element.ForcedDependency.FindDependency(element.Filename); if (depInfo == null) { depInfo = new FileDependency.DependencyInfo(element.Filename, false, false); } bool isDependent = false; foreach (var dependency in dependencies) { if (dependency.Filename == Element.Filename) { isDependent = true; break; } } if (!isDependent) { // not itself! DependencyItem depItem = new DependencyItem(depInfo, element.DocumentInfo.Type == ProjectElement.ElementType.ASM_SOURCE); ListViewItem item = new ListViewItem(element.Filename); if (Element.ForcedDependency.DependsOn(element.Filename)) { item.SubItems.Add("1"); } else { item.SubItems.Add("0"); } if (depInfo.IncludeSymbols) { item.SubItems.Add("1"); } else { item.SubItems.Add("0"); } item.Tag = depItem; listDependencies.Items.Add(item); } } } foreach (var entry in Element.ExternalDependencies.DependentOnFile) { listExternalDependencies.Items.Add(entry.Filename); } }
public bool Load(string Filename) { byte[] projectData = null; try { projectData = System.IO.File.ReadAllBytes(Filename); } catch (System.IO.IOException) { return(false); } Settings.Filename = Filename; Settings.BasePath = System.IO.Path.GetDirectoryName(Settings.Filename); GR.IO.MemoryReader memIn = new GR.IO.MemoryReader(projectData); GR.IO.FileChunk chunk = new GR.IO.FileChunk(); while (chunk.ReadFromStream(memIn)) { GR.IO.MemoryReader memChunk = chunk.MemoryReader(); switch (chunk.Type) { case Types.FileChunk.PROJECT: // Project Info // Version memChunk.ReadUInt32(); Settings.Name = memChunk.ReadString(); Settings.Filename = memChunk.ReadString(); Settings.DebugPort = memChunk.ReadUInt16(); Settings.DebugStartAddress = memChunk.ReadUInt16(); Settings.BuildTool = memChunk.ReadString(); Settings.RunTool = memChunk.ReadString(); Settings.MainDocument = memChunk.ReadString(); break; case Types.FileChunk.PROJECT_ELEMENT: // Element Info { // Version int version = (int)memChunk.ReadUInt32(); ProjectElement.ElementType type = (ProjectElement.ElementType)memChunk.ReadUInt32(); ProjectElement element = CreateElement(type); element.Name = memChunk.ReadString(); element.Filename = memChunk.ReadString(); ShowDocument(element); GR.IO.FileChunk subChunk = new GR.IO.FileChunk(); if (!subChunk.ReadFromStream(memChunk)) { return(false); } if (subChunk.Type != Types.FileChunk.PROJECT_ELEMENT_DATA) { return(false); } // Element Data if (element.Document != null) { if (!element.Document.ReadFromReader(subChunk.MemoryReader())) { Elements.Remove(element); element.Document.Dispose(); element = null; } } element.TargetFilename = memChunk.ReadString(); element.TargetType = (FileParser.CompileTargetType)memChunk.ReadUInt32(); if ((element != null) && (element.Document != null)) { element.Document.ShowHint = DockState.Document; element.Document.Show(MainForm.panelMain); } } break; } } Settings.Filename = Filename; m_Modified = false; return(true); }
public void RemoveElement(ProjectElement Element) { Elements.Remove(Element); m_Modified = true; }
internal bool IsNodeExpanded(ProjectElement Element) { string key = "Element*" + Element.DocumentInfo.Project.Settings.Name + "*" + Element.Name; return(ExpandedNodes.Contains(key)); }