public LinkerSettingsFormViewModel(IProject project) : base("Linker", project)
        {
            try
            {
                try
                {
                    settings = GCCToolchain.GetSettings(project).LinkSettings;
                }
                catch (Exception)
                {
                    Model.ToolchainSettings.GccToolchainSettings = new GccToolchainSettings();
                }
            }
            catch (Exception)
            {
                Model.ToolchainSettings.GccToolchainSettings = new GccToolchainSettings();
                settings = Model.ToolchainSettings.GccToolchainSettings.LinkSettings;
            }

            if (settings == null)
            {
                settings = new LinkSettings();
            }

            useMemoryLayout       = settings.UseMemoryLayout;
            discardUnusedSections = settings.DiscardUnusedSections;
            notUseStandardStartup = settings.NotUseStandardStartupFiles;
            linkedLibraries       = new ObservableCollection <string>(settings.LinkedLibraries);
            linkerScripts         = new ObservableCollection <string>(settings.LinkerScripts);
            inRom1Start           = string.Format("0x{0:X8}", settings.InRom1Start);
            inRom1Size            = string.Format("0x{0:X8}", settings.InRom1Size);
            inRom2Start           = string.Format("0x{0:X8}", settings.InRom2Start);
            inRom2Size            = string.Format("0x{0:X8}", settings.InRom2Size);
            inRam1Start           = string.Format("0x{0:X8}", settings.InRam1Start);
            inRam1Size            = string.Format("0x{0:X8}", settings.InRam1Size);
            inRam2Start           = string.Format("0x{0:X8}", settings.InRam2Start);
            inRam2Size            = string.Format("0x{0:X8}", settings.InRam2Size);
            scatterFile           = settings.ScatterFile;
            miscOptions           = settings.MiscLinkerArguments;
            librarySelectedIndex  = (int)settings.Library;

            AddLinkedLibraryCommand = ReactiveCommand.Create();
            AddLinkedLibraryCommand.Subscribe(AddLinkedLibrary);

            AddLinkerScriptCommand = ReactiveCommand.Create();
            AddLinkerScriptCommand.Subscribe(AddLinkerScript);

            RemoveLinkerScriptCommand = ReactiveCommand.Create();
            RemoveLinkerScriptCommand.Subscribe(RemoveLinkerScript);

            RemoveLinkedLibraryCommand = ReactiveCommand.Create();
            RemoveLinkedLibraryCommand.Subscribe(RemoveLinkedLibrary);
            //BrowseScatterFileCommand = new RoutingCommand(BrowseScatterFile);
            //EditScatterFileCommand = new RoutingCommand(EditScatterFile);

            UpdateLinkerString();
        }
        public LinkerSettingsFormViewModel(IProject project) : base("Linker", project)
        {
            settings = project.GetToolchainSettings <GccToolchainSettings>().LinkSettings;

            if (settings == null)
            {
                settings = new LinkSettings();
            }

            useMemoryLayout       = settings.UseMemoryLayout;
            discardUnusedSections = settings.DiscardUnusedSections;
            notUseStandardStartup = settings.NotUseStandardStartupFiles;
            linkedLibraries       = new ObservableCollection <string>(settings.LinkedLibraries);
            linkerScripts         = new ObservableCollection <string>(settings.LinkerScripts);
            systemLibraries       = new ObservableCollection <string>(settings.SystemLibraries);
            inRom1Start           = string.Format("0x{0:X8}", settings.InRom1Start);
            inRom1Size            = string.Format("0x{0:X8}", settings.InRom1Size);
            inRom2Start           = string.Format("0x{0:X8}", settings.InRom2Start);
            inRom2Size            = string.Format("0x{0:X8}", settings.InRom2Size);
            inRam1Start           = string.Format("0x{0:X8}", settings.InRam1Start);
            inRam1Size            = string.Format("0x{0:X8}", settings.InRam1Size);
            inRam2Start           = string.Format("0x{0:X8}", settings.InRam2Start);
            inRam2Size            = string.Format("0x{0:X8}", settings.InRam2Size);
            scatterFile           = settings.ScatterFile;
            miscOptions           = settings.MiscLinkerArguments;
            librarySelectedIndex  = (int)settings.Library;

            AddLinkedLibraryCommand = ReactiveCommand.Create();
            AddLinkedLibraryCommand.Subscribe(AddLinkedLibrary);

            AddLinkerScriptCommand = ReactiveCommand.Create();
            AddLinkerScriptCommand.Subscribe(AddLinkerScript);

            RemoveLinkerScriptCommand = ReactiveCommand.Create();
            RemoveLinkerScriptCommand.Subscribe(RemoveLinkerScript);

            RemoveLinkedLibraryCommand = ReactiveCommand.Create();
            RemoveLinkedLibraryCommand.Subscribe(RemoveLinkedLibrary);

            AddSystemLibraryCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.SystemLibraryText, lib => !string.IsNullOrEmpty(lib) && !SystemLibraries.Contains(lib) && lib.All(s => !char.IsWhiteSpace(s))));
            AddSystemLibraryCommand.Subscribe(_ =>
            {
                SystemLibraries.Add(SystemLibraryText);
                SystemLibraryText = string.Empty;
                UpdateLinkerString();
            });

            RemoveSystemLibraryCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.SelectedSystemLibrary, selected => !string.IsNullOrEmpty(selected)));
            RemoveSystemLibraryCommand.Subscribe(_ =>
            {
                SystemLibraries.Remove(SelectedSystemLibrary);
                UpdateLinkerString();
            });

            UpdateLinkerString();
        }
		public ArmGCCLinkTemplate(LinkSettings linkSettings)
		{
			this.linkSettings = linkSettings;
		}