├── DemoApp ├── app.ico ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── DemoApp.csproj ├── MainWindow.xaml.cs └── MainWindow.xaml ├── .nuke └── parameters.json ├── replace.txt ├── source ├── InnoSetup.ScriptBuilder │ ├── Model │ │ ├── Generic │ │ │ └── KeyValueSection.cs │ │ ├── SetupSection │ │ │ ├── LZMAMatchFinder.cs │ │ │ ├── WizardStyle.cs │ │ │ ├── PrivilegesRequired.cs │ │ │ ├── BackColorDirection.cs │ │ │ ├── CloseApplications.cs │ │ │ ├── UninstallLogMode.cs │ │ │ ├── LanguageDetectionMethod.cs │ │ │ ├── WizardImageAlphaFormat.cs │ │ │ ├── SetupPrivilegesRequiredOverrides.cs │ │ │ ├── SetupOption.cs │ │ │ ├── Architectures.cs │ │ │ ├── ArchitecturesInstallIn64BitMode.cs │ │ │ └── SetupSection.cs │ │ ├── DeleteSection │ │ │ ├── DeleteTypes.cs │ │ │ └── DeleteEntry.cs │ │ ├── TypesSection │ │ │ ├── TypeFlags.cs │ │ │ └── TypeEntry.cs │ │ ├── ModelBase.cs │ │ ├── IniSection │ │ │ ├── IniFlags.cs │ │ │ └── IniEntry.cs │ │ ├── TasksSection │ │ │ ├── TaskFlags.cs │ │ │ └── TaskEntry.cs │ │ ├── FileSection │ │ │ ├── GroupPermission.cs │ │ │ └── FileEntry.cs │ │ ├── ComponentSection │ │ │ └── ComponentEntry.cs │ │ ├── LanguageSection │ │ │ └── LanguageEntry.cs │ │ ├── CommonParameterSectionEntryBase.cs │ │ ├── DirsSection │ │ │ └── DirEntry.cs │ │ ├── RunSection │ │ │ ├── RunFlags.cs │ │ │ └── RunEntry.cs │ │ ├── RegistrySection │ │ │ └── RegistryEntry.cs │ │ ├── LangOptionsSection │ │ │ └── LangOptionsSection.cs │ │ └── IconsSection │ │ │ ├── IconFlags.cs │ │ │ └── IconEntry.cs │ ├── Constants │ │ ├── YesNo.cs │ │ ├── Permissions.cs │ │ ├── ValueTypes.cs │ │ ├── AttribsFlags.cs │ │ ├── Sids.cs │ │ ├── DirFlags.cs │ │ ├── ComponentFlags.cs │ │ ├── RegistryFlags.cs │ │ ├── RegistryKeys.cs │ │ └── FileFlags.cs │ ├── Builder │ │ ├── Abstractions │ │ │ ├── IDirsBuilder.cs │ │ │ ├── IRunBuilder.cs │ │ │ ├── ISetupBuilder.cs │ │ │ ├── ILangOptionsBuilder.cs │ │ │ ├── IBuilder.cs │ │ │ ├── IIconBuilder.cs │ │ │ ├── IIniBuilder.cs │ │ │ ├── ITasksBuilder.cs │ │ │ ├── ITypesBuilder.cs │ │ │ ├── IDeleteBuilder.cs │ │ │ ├── IFileEntryBuilder.cs │ │ │ ├── IRegistryBuilder.cs │ │ │ ├── IGenericKeyValueSectionBuilder.cs │ │ │ ├── IComponentEntryBuilder.cs │ │ │ ├── IGenericParameterSectionBuilder.cs │ │ │ ├── ILanguageEntryBuilder.cs │ │ │ ├── IHazComponentsAndTasks.cs │ │ │ └── IComponentsAndTasksBuilder.cs │ │ ├── GenericKeyValueSectionBuilder.cs │ │ ├── GenericParameterSectionBuilder.cs │ │ ├── CodeBuilder.cs │ │ ├── TypesBuilder.cs │ │ ├── CommonParameterSectionBuilderBase.cs │ │ ├── TasksBuilder.cs │ │ ├── ComponentsBuilder.cs │ │ ├── LanguagesBuilder.cs │ │ ├── DeleteBuilder.cs │ │ ├── IniBuilder.cs │ │ ├── DirsBuilder.cs │ │ ├── SectionBuilderBase.cs │ │ ├── LangOptionsBuilder.cs │ │ ├── RunBuilder.cs │ │ ├── RegistryBuilder.cs │ │ ├── IconsBuilder.cs │ │ ├── KeyValueSectionBuilderBase.cs │ │ ├── FilesBuilder.cs │ │ ├── ParameterSectionBuilderBase.cs │ │ ├── DirectivesBuilder.cs │ │ ├── IssBuilder.cs │ │ └── SetupBuilder.cs │ ├── Utils │ │ ├── DelegateScriptBuilder.cs │ │ ├── BuilderUtils.cs │ │ └── ValueExtensions.cs │ ├── IssBuilderException.cs │ ├── InnoSetup.ScriptBuilder.csproj │ └── InnoSetup.ScriptBuilder.csproj.DotSettings ├── BuilderTests │ ├── CodeTests.cs │ ├── LanguagesTests.cs │ ├── TypesTests.cs │ ├── ComponentsTests.cs │ ├── TasksTests.cs │ ├── LangOptionsTests.cs │ ├── DirsTests.cs │ ├── IniTests.cs │ ├── BuilderTests.csproj │ ├── RegistryTests.cs │ ├── EnumTests.cs │ ├── FilesTests.cs │ ├── IconsTests.cs │ ├── DeleteTests.cs │ ├── ParameterSectionTestsBase.cs │ ├── KeyValueSectionTestsBase.cs │ ├── RunSectionTests.cs │ ├── DirectivesTests.cs │ ├── ConstantTests.cs │ ├── TestUtils.cs │ ├── CustomSectionAndParameterTests.cs │ ├── BuilderTests.cs │ ├── SetupTests.cs │ └── TestBuilder.cs └── Directory.Build.Props ├── Examples ├── Examples.csproj ├── DemoBuilder.cs └── Program.cs ├── LICENSE ├── .github └── workflows │ ├── Publish.yml │ └── CI.yml ├── InnoSetup.ScriptBuilder.sln ├── .gitignore ├── README.md └── stylecop.ruleset /DemoApp/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/max-eroshkin/InnoSetup.ScriptBuilder/HEAD/DemoApp/app.ico -------------------------------------------------------------------------------- /.nuke/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./build.schema.json", 3 | "Solution":"InnoSetup.ScriptBuilder.sln" 4 | } -------------------------------------------------------------------------------- /replace.txt: -------------------------------------------------------------------------------- 1 | 2 | public (\w+)\?? (\w+) \{ get\; set\; \} 3 | 4 | public ComponentEntryBuilder $2($1 value) => SetPropertyValue(value); 5 | -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/Generic/KeyValueSection.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class KeyValueSection : ModelBase 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/YesNo.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum YesNo 4 | { 5 | Auto, 6 | Yes, 7 | No 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/LZMAMatchFinder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum LzmaMatchFinder 4 | { 5 | Hc, 6 | Bt 7 | } 8 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/WizardStyle.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum WizardStyle 4 | { 5 | Classic, 6 | Modern 7 | } 8 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/PrivilegesRequired.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum PrivilegesRequired 4 | { 5 | Admin, 6 | Lowest 7 | } 8 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IDirsBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IDirsBuilder 4 | { 5 | DirsBuilder CreateEntry(string name); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IRunBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IRunBuilder 4 | { 5 | RunBuilder CreateEntry(string fileName); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/ISetupBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface ISetupBuilder 4 | { 5 | SetupBuilder Create(string appName); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/ILangOptionsBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface ILangOptionsBuilder 4 | { 5 | LangOptionsBuilder Create(); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/BackColorDirection.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum BackColorDirection 4 | { 5 | TopToBottom, 6 | LeftToRight 7 | } 8 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/CloseApplications.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum CloseApplications 4 | { 5 | Yes, 6 | No, 7 | Force 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/DeleteSection/DeleteTypes.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum DeleteTypes 4 | { 5 | Files, 6 | FilesAndOrDirs, 7 | DirIfEmpty 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/UninstallLogMode.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum UninstallLogMode 4 | { 5 | Append, 6 | New, 7 | Overwrite 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System.IO; 4 | 5 | public interface IBuilder 6 | { 7 | void Write(TextWriter writer); 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IIconBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IIconBuilder 4 | { 5 | IconsBuilder CreateEntry(string name, string filename); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IIniBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IIniBuilder 4 | { 5 | IniBuilder CreateEntry(string filename, string section); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/TypesSection/TypeFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum TypeFlags 7 | { 8 | IsCustom = 0x01 9 | } 10 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/ITasksBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface ITasksBuilder 4 | { 5 | TasksBuilder CreateEntry(string name, string description); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/ITypesBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface ITypesBuilder 4 | { 5 | TypesBuilder CreateEntry(string name, string description); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IDeleteBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IDeleteBuilder 4 | { 5 | DeleteBuilder CreateEntry(DeleteTypes type, string name); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/LanguageDetectionMethod.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum LanguageDetectionMethod 4 | { 5 | UiLanguage, 6 | Locale, 7 | None 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IFileEntryBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IFileEntryBuilder 4 | { 5 | FilesBuilder CreateEntry(string source, string destDir); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IRegistryBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IRegistryBuilder 4 | { 5 | RegistryBuilder CreateEntry(RegistryKeys root, string subkey); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/WizardImageAlphaFormat.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum WizardImageAlphaFormat 4 | { 5 | Ignored, 6 | Defined, 7 | Premultiplied 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IGenericKeyValueSectionBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IGenericKeyValueSectionBuilder 4 | { 5 | GenericKeyValueSectionBuilder CreateEntry(); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IComponentEntryBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IComponentEntryBuilder 4 | { 5 | ComponentsBuilder CreateEntry(string name, string description); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/IGenericParameterSectionBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface IGenericParameterSectionBuilder 4 | { 5 | GenericParameterSectionBuilder CreateEntry(); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/Abstractions/ILanguageEntryBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public interface ILanguageEntryBuilder 4 | { 5 | LanguagesBuilder CreateEntry(string name, string messagesFile); 6 | } 7 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/Permissions.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum Permissions 7 | { 8 | ReadExec = 1, 9 | Modify = 2, 10 | Full = 4 11 | } 12 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/ModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System.Collections.Generic; 4 | 5 | public abstract class ModelBase 6 | { 7 | public Dictionary Aux { get; } = new(); 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/ValueTypes.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum ValueTypes 4 | { 5 | None, 6 | String, 7 | ExpandSz, 8 | MultiSz, 9 | DWord, 10 | QWord, 11 | Binary, 12 | } 13 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/SetupSection/SetupPrivilegesRequiredOverrides.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum SetupPrivilegesRequiredOverrides 7 | { 8 | CommandLine = 1, 9 | Dialog = 2 10 | } 11 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/AttribsFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum AttribsFlags 7 | { 8 | Readonly = 1, 9 | Hidden = 2, 10 | System = 4, 11 | NotContentIndexed = 8 12 | } 13 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/TypesSection/TypeEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class TypeEntry : CommonParameterSectionEntryBase 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | public TypeFlags? Flags { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/IniSection/IniFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum IniFlags 7 | { 8 | CreateKeyIfDoesntExist = 1, 9 | UninsDeleteEntry = 1 << 1, 10 | UninsDeleteSection = 1 << 2, 11 | UninsDeleteSectionIfEmpty = 1 << 3 12 | } 13 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/Sids.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public enum Sids 4 | { 5 | Admins, 6 | AuthUsers, 7 | CreatorOwner, 8 | Everyone, 9 | Guests, 10 | IisiUsrs, 11 | NetworkService, 12 | PowerUsers, 13 | Service, 14 | System, 15 | Users 16 | } 17 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/DirFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum DirFlags 7 | { 8 | UninsNeverUninstall = 0x01, 9 | DeleteAfterInstall = 0x02, 10 | UninsAlwaysUninstall = 0x04, 11 | SetNtfsCompression = 0x08, 12 | UnsetNtfsCompression = 0x10 13 | } 14 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/ComponentFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum ComponentFlags 7 | { 8 | Fixed = 0x1, 9 | Restart = 0x2, 10 | DisableNoUninstallWarning = 0x4, 11 | Exclusive = 0x8, 12 | DontInheritCheck = 0x10, 13 | CheckAbleAlone = 0x20 14 | } 15 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/TasksSection/TaskFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum TaskFlags 7 | { 8 | Exclusive = 1, 9 | Unchecked = 1 << 1, 10 | Restart = 1 << 2, 11 | CheckableAlone = 1 << 3, 12 | CheckedOnce = 1 << 4, 13 | DontInheritCheck = 1 << 5 14 | } 15 | } -------------------------------------------------------------------------------- /DemoApp/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /DemoApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace DemoApp 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /Examples/Examples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Utils/DelegateScriptBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | public class DelegateScriptBuilder : IssBuilder 6 | { 7 | public DelegateScriptBuilder(Action config) 8 | { 9 | _ = config ?? throw new ArgumentNullException(nameof(config), "config cannot be null"); 10 | config(this); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/FileSection/GroupPermission.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class GroupPermission 4 | { 5 | public GroupPermission(Sids group, Permissions permission) 6 | { 7 | Group = group; 8 | Permission = permission; 9 | } 10 | 11 | public Sids Group { get; } 12 | 13 | public Permissions Permission { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/TasksSection/TaskEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class TaskEntry : CommonParameterSectionEntryBase 4 | { 5 | public string Name { get; set; } 6 | 7 | public string Description { get; set; } 8 | 9 | public string GroupDescription { get; set; } 10 | 11 | public string Components { get; set; } 12 | 13 | public TaskFlags? Flags { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/ComponentSection/ComponentEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class ComponentEntry : CommonParameterSectionEntryBase 4 | { 5 | public string Name { get; set; } 6 | 7 | public string Description { get; set; } 8 | 9 | public string Types { get; set; } 10 | 11 | public long? ExtraDiskSpaceRequired { get; set; } 12 | 13 | public ComponentFlags? Flags { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /DemoApp/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/LanguageSection/LanguageEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class LanguageEntry : ModelBase 4 | { 5 | public string Name { get; set; } 6 | 7 | public string MessagesFile { get; set; } 8 | 9 | public string LicenseFile { get; set; } 10 | 11 | public string InfoAfterFile { get; set; } 12 | 13 | public string InfoBeforeFile { get; set; } 14 | 15 | public string Check { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/DeleteSection/DeleteEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class DeleteEntry : CommonParameterSectionEntryBase, IHazComponentsAndTasks 4 | { 5 | public string Name { get; set; } 6 | 7 | public DeleteTypes? Type { get; set; } 8 | 9 | public string Components { get; set; } 10 | 11 | public string Tasks { get; set; } 12 | 13 | public string BeforeInstall { get; set; } 14 | 15 | public string AfterInstall { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/CommonParameterSectionEntryBase.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | /// 4 | /// See ISS documentation. 5 | /// 6 | public class CommonParameterSectionEntryBase : ModelBase 7 | { 8 | public string Languages { get; set; } 9 | public string MinVersion { get; set; } 10 | public string OnlyBelowVersion { get; set; } 11 | public string Check { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /source/BuilderTests/CodeTests.cs: -------------------------------------------------------------------------------- 1 | namespace BuilderTests 2 | { 3 | using FluentAssertions; 4 | using InnoSetup.ScriptBuilder; 5 | using Xunit; 6 | 7 | public class CodeTests 8 | { 9 | [Fact] 10 | public void Test() 11 | { 12 | var iss = BuilderUtils.CreateBuilder(builder => builder.Code 13 | .CreateEntry("code1") 14 | .CreateEntry("code2")) 15 | .ToString(); 16 | iss.Should().Be("\r\n[Code]\r\ncode1\r\ncode2\r\n"); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/IssBuilderException.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace InnoSetup.ScriptBuilder 3 | { 4 | using System; 5 | 6 | public class IssBuilderException : Exception 7 | { 8 | public IssBuilderException() 9 | { 10 | } 11 | 12 | public IssBuilderException(string? message) 13 | : base(message) 14 | { 15 | } 16 | 17 | public IssBuilderException(string? message, Exception? innerException) 18 | : base(message, innerException) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Constants/RegistryFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum RegistryFlags 7 | { 8 | _32Bit = 0x1, 9 | _64Bit = 0x2, 10 | CreateValueIfDoesntExist = 0x4, 11 | UninsDeleteValue = 0x8, 12 | UninsClearValue = 0x10, 13 | UninsDeleteKey = 0x20, 14 | UninsDeleteKeyIfEmpty = 0x40, 15 | PreserveStringType = 0x80, 16 | DeleteKey = 0x100, 17 | DeleteValue = 0x200, 18 | NoError = 0x400, 19 | DontCreateKey = 0x800, 20 | } 21 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/GenericKeyValueSectionBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class GenericKeyValueSectionBuilder : KeyValueSectionBuilderBase, IGenericKeyValueSectionBuilder 4 | { 5 | public GenericKeyValueSectionBuilder(string name) 6 | { 7 | SectionName = name; 8 | } 9 | 10 | public override string SectionName { get; } 11 | 12 | public GenericKeyValueSectionBuilder CreateEntry() 13 | { 14 | return CreateEntryInternal(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /DemoApp/DemoApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | win-x64 7 | enable 8 | true 9 | true 10 | true 11 | true 12 | app.ico 13 | false 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/GenericParameterSectionBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class GenericParameterSectionBuilder : 4 | ParameterSectionBuilderBase, 5 | IGenericParameterSectionBuilder 6 | { 7 | public GenericParameterSectionBuilder(string name) 8 | { 9 | SectionName = name; 10 | } 11 | 12 | public override string SectionName { get; } 13 | 14 | public GenericParameterSectionBuilder CreateEntry() 15 | { 16 | return CreateEntryInternal(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/IniSection/IniEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class IniEntry : CommonParameterSectionEntryBase, IHazComponentsAndTasks 4 | { 5 | public string Filename { get; set; } 6 | 7 | public string Section { get; set; } 8 | 9 | public string Key { get; set; } 10 | 11 | public string String { get; set; } 12 | 13 | public IniFlags? Flags { get; set; } 14 | 15 | public string Components { get; set; } 16 | 17 | public string Tasks { get; set; } 18 | 19 | public string BeforeInstall { get; set; } 20 | 21 | public string AfterInstall { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/DirsSection/DirEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System.Collections.Generic; 4 | 5 | public class DirEntry : CommonParameterSectionEntryBase, IHazComponentsAndTasks 6 | { 7 | public string Name { get; set; } 8 | 9 | public AttribsFlags? Attribs { get; set; } 10 | 11 | public List Permissions { get; set; } 12 | 13 | public DirFlags? Flags { get; set; } 14 | 15 | public string Components { get; set; } 16 | 17 | public string Tasks { get; set; } 18 | 19 | public string BeforeInstall { get; set; } 20 | 21 | public string AfterInstall { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /source/BuilderTests/LanguagesTests.cs: -------------------------------------------------------------------------------- 1 | namespace BuilderTests 2 | { 3 | using System.Collections.Generic; 4 | using InnoSetup.ScriptBuilder; 5 | 6 | public class LanguagesTests : ParameterSectionTestsBase 7 | { 8 | protected override string SectionName => "Languages"; 9 | 10 | protected override Dictionary ReferenceData => new() 11 | { 12 | { "Name", "\"Name\"" }, 13 | { "MessagesFile", "\"MessagesFile\"" }, 14 | { "LicenseFile", "\"LicenseFile\"" }, 15 | { "InfoAfterFile", "\"InfoAfterFile\"" }, 16 | { "InfoBeforeFile", "\"InfoBeforeFile\"" }, 17 | { "Check", "\"Check\"" }, 18 | }; 19 | } 20 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/CodeBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System.IO; 4 | using System.Text; 5 | 6 | public class CodeBuilder : IBuilder 7 | { 8 | private readonly StringBuilder _data = new(); 9 | 10 | public string SectionName => "Code"; 11 | 12 | public CodeBuilder CreateEntry(string script) 13 | { 14 | _data.AppendLine(script); 15 | return this; 16 | } 17 | 18 | public void Write(TextWriter writer) 19 | { 20 | if (_data.Length == 0) 21 | return; 22 | writer.WriteLine($"\r\n[{SectionName}]"); 23 | writer.Write(_data); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /source/BuilderTests/TypesTests.cs: -------------------------------------------------------------------------------- 1 | namespace BuilderTests 2 | { 3 | using System.Collections.Generic; 4 | using InnoSetup.ScriptBuilder; 5 | 6 | public class TypesTests : ParameterSectionTestsBase 7 | { 8 | protected override string SectionName => "Types"; 9 | 10 | protected override Dictionary ReferenceData => new() 11 | { 12 | { "Name", "\"Name\"" }, 13 | { "Description", "\"Description\"" }, 14 | { "Flags", "iscustom" }, 15 | { "Languages", "\"Languages\"" }, 16 | { "MinVersion", "\"MinVersion\"" }, 17 | { "OnlyBelowVersion", "\"OnlyBelowVersion\"" }, 18 | { "Check", "\"Check\"" }, 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/TypesBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class TypesBuilder : CommonParameterSectionBuilderBase, ITypesBuilder 4 | { 5 | public override string SectionName => "Types"; 6 | 7 | public TypesBuilder Flags(TypeFlags value) => SetPropertyValue(value); 8 | 9 | public TypesBuilder CreateEntry(string name, string description) 10 | { 11 | CreateEntryInternal(); 12 | Name(name); 13 | Description(description); 14 | 15 | return this; 16 | } 17 | 18 | private TypesBuilder Name(string value) => SetPropertyValue(value); 19 | private TypesBuilder Description(string value) => SetPropertyValue(value); 20 | } 21 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Builder/CommonParameterSectionBuilderBase.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | /// 4 | /// See ISS documentation. 5 | /// 6 | public abstract class CommonParameterSectionBuilderBase : ParameterSectionBuilderBase 7 | where TBuilder : class 8 | where TData : CommonParameterSectionEntryBase, new() 9 | { 10 | public TBuilder Languages(string value) => SetPropertyValue(value); 11 | public TBuilder MinVersion(string value) => SetPropertyValue(value); 12 | public TBuilder OnlyBelowVersion(string value) => SetPropertyValue(value); 13 | public TBuilder Check(string value) => SetPropertyValue(value); 14 | } 15 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/RunSection/RunFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum RunFlags 7 | { 8 | _32bit = 1, 9 | _64bit = 1 << 1, 10 | NoWait = 1 << 2, 11 | WaitUntilIdle = 1 << 3, 12 | ShellExec = 1 << 4, 13 | SkipIfDoesntExist = 1 << 5, 14 | RunMinimized = 1 << 6, 15 | RunMaximized = 1 << 7, 16 | PostInstall = 1 << 8, 17 | Unchecked = 1 << 9, 18 | SkipIfSilent = 1 << 10, 19 | SkipIfNotSilent = 1 << 11, 20 | HideWizard = 1 << 12, 21 | RunHidden = 1 << 13, 22 | WaitUntilTerminated = 1 << 14, 23 | RunAsOriginalUser = 1 << 15, 24 | RunAsCurrentUser = 1 << 16, 25 | DontLogParameters = 1 << 17, 26 | LogOutput = 1 << 18, 27 | } 28 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/RunSection/RunEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class RunEntry : CommonParameterSectionEntryBase, IHazComponentsAndTasks 4 | { 5 | public string Filename { get; set; } 6 | 7 | public string Description { get; set; } 8 | 9 | public string Parameters { get; set; } 10 | 11 | public string WorkingDir { get; set; } 12 | 13 | public string StatusMsg { get; set; } 14 | 15 | public string RunOnceId { get; set; } 16 | 17 | public string Verb { get; set; } 18 | 19 | public RunFlags? Flags { get; set; } 20 | 21 | public string Components { get; set; } 22 | 23 | public string Tasks { get; set; } 24 | 25 | public string BeforeInstall { get; set; } 26 | 27 | public string AfterInstall { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /source/BuilderTests/ComponentsTests.cs: -------------------------------------------------------------------------------- 1 | namespace BuilderTests 2 | { 3 | using System.Collections.Generic; 4 | using InnoSetup.ScriptBuilder; 5 | 6 | public class ComponentsTests : ParameterSectionTestsBase 7 | { 8 | protected override string SectionName => "Components"; 9 | 10 | protected override Dictionary ReferenceData => new() 11 | { 12 | { "Name", "\"Name\"" }, 13 | { "Description", "\"Description\"" }, 14 | { "ExtraDiskSpaceRequired", "123456" }, 15 | { "Types", "\"Types\"" }, 16 | { "Languages", "\"Languages\"" }, 17 | { "MinVersion", "\"MinVersion\"" }, 18 | { "OnlyBelowVersion", "\"OnlyBelowVersion\"" }, 19 | { "Flags", "fixed exclusive" }, 20 | { "Check", "\"Check\"" }, 21 | }; 22 | } 23 | } -------------------------------------------------------------------------------- /source/BuilderTests/TasksTests.cs: -------------------------------------------------------------------------------- 1 | namespace BuilderTests 2 | { 3 | using System.Collections.Generic; 4 | using InnoSetup.ScriptBuilder; 5 | 6 | public class TasksTests: ParameterSectionTestsBase 7 | { 8 | protected override string SectionName => "Tasks"; 9 | 10 | protected override Dictionary ReferenceData => new() 11 | { 12 | { "Name", "\"Name\"" }, 13 | { "Description", "\"Description\"" }, 14 | { "GroupDescription", "\"GroupDescription\"" }, 15 | { "Components", "\"Components\"" }, 16 | { "Flags", "restart checkedonce" }, 17 | { "Languages", "\"Languages\"" }, 18 | { "MinVersion", "\"MinVersion\"" }, 19 | { "OnlyBelowVersion", "\"OnlyBelowVersion\"" }, 20 | { "Check", "\"Check\"" }, 21 | }; 22 | } 23 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/RegistrySection/RegistryEntry.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System.Collections.Generic; 4 | 5 | public class RegistryEntry : CommonParameterSectionEntryBase, IHazComponentsAndTasks 6 | { 7 | public RegistryKeys? Root { get; set; } 8 | 9 | public string Subkey { get; set; } 10 | 11 | public ValueTypes? ValueType { get; set; } 12 | 13 | public string ValueName { get; set; } 14 | 15 | public string ValueData { get; set; } 16 | 17 | public List Permissions { get; set; } 18 | public RegistryFlags? Flags { get; set; } 19 | public string Components { get; set; } 20 | public string Tasks { get; set; } 21 | 22 | public string BeforeInstall { get; set; } 23 | 24 | public string AfterInstall { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /DemoApp/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace DemoApp 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void CloseButtonOnClick(object sender, RoutedEventArgs e) 29 | { 30 | Close(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/LangOptionsSection/LangOptionsSection.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | public class LangOptionsSection : KeyValueSection 4 | { 5 | public string LanguageName { get; set; } 6 | 7 | public string DialogFontName { get; set; } 8 | 9 | public int? DialogFontSize { get; set; } 10 | 11 | public string WelcomeFontName { get; set; } 12 | 13 | public int? WelcomeFontSize { get; set; } 14 | 15 | public string TitleFontName { get; set; } 16 | 17 | public int? TitleFontSize { get; set; } 18 | 19 | public string CopyrightFontName { get; set; } 20 | 21 | public int? CopyrightFontSize { get; set; } 22 | 23 | public YesNo? RightToLeft { get; set; } 24 | 25 | public string LanguageID { get; set; } 26 | 27 | public long? LanguageCodePage { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /source/InnoSetup.ScriptBuilder/Model/IconsSection/IconFlags.cs: -------------------------------------------------------------------------------- 1 | namespace InnoSetup.ScriptBuilder 2 | { 3 | using System; 4 | 5 | [Flags] 6 | public enum IconFlags 7 | { 8 | UninsNeverUninstall = 1, 9 | RunMinimized = 1 << 1, 10 | CreateOnlyIfFileExists = 1 << 2, 11 | UseAppPaths = 1 << 3, 12 | CloseOnExit = 1 << 4, 13 | DontCloseOnExit = 1 << 5, 14 | RunMaximized = 1 << 6, 15 | FolderShortcut = 1 << 7, 16 | ExcludeFromShowInNewInstall = 1 << 8, 17 | PreventPinning = 1 << 9 18 | } 19 | 20 | /* 21 | * = 1 22 | * = 1 << 1 23 | * = 1 << 2 24 | * = 1 << 3 25 | * = 1 << 4 26 | * = 1 << 5 27 | * = 1 << 6 28 | * = 1 << 7 29 | * = 1 << 8 30 | * = 1 << 9 31 | * = 1 << 10 32 | * = 1 << 11 33 | * = 1 << 12 34 | * = 1 << 13 35 | * = 1 << 14 36 | */ 37 | } -------------------------------------------------------------------------------- /DemoApp/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 |