Skip to content

Commit 874d9a9

Browse files
Update v1.8.0
1 parent ccc1fda commit 874d9a9

57 files changed

Lines changed: 1789 additions & 116 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,4 @@ icon128\.png
301301
MediaExtractor/translations/
302302

303303
MediaExtractor/I18N\.cs
304+
MediaExtractorInstaller/Output/

Changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## v1.8.0
4+
5+
Release Date: **04.10.2022**
6+
7+
- Added French translation
8+
- Added installer
9+
- Bumped to .NET 4.8
10+
- UI adaptions to handle further translations
11+
- Code maintenance
12+
- Updated readme, added development utilities and updated project structure
13+
14+
315
## v1.7.2
416

517
Release Date: **28.09.2022**

InstallerBootstrap/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>

InstallerBootstrap/DTO/Section.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Media Extractor is an application to preview and extract packed media in Microsoft Office files (e.g. Word, PowerPoint or Excel documents)
3+
* Copyright Raphael Stoeckli © 2023
4+
* This program is licensed under the MIT License.
5+
* You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6+
*/
7+
8+
using System.Collections.Generic;
9+
10+
namespace InstallerBootstrap.DTO
11+
{
12+
public class Section
13+
{
14+
public string Name { get; set; }
15+
public List<Setting> Settings { get; set; }
16+
public bool IsUserSection { get; set; }
17+
18+
public override bool Equals(object obj)
19+
{
20+
if (obj == null || GetType() != obj.GetType())
21+
{
22+
return false;
23+
}
24+
25+
Section otherSection = (Section)obj;
26+
27+
// Compare sections by name and whether they are application settings
28+
return Name == otherSection.Name && IsUserSection == otherSection.IsUserSection;
29+
}
30+
31+
public override int GetHashCode()
32+
{
33+
return (Name + IsUserSection.ToString()).GetHashCode();
34+
}
35+
}
36+
}

InstallerBootstrap/DTO/Setting.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Media Extractor is an application to preview and extract packed media in Microsoft Office files (e.g. Word, PowerPoint or Excel documents)
3+
* Copyright Raphael Stoeckli © 2023
4+
* This program is licensed under the MIT License.
5+
* You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6+
*/
7+
8+
using System.Collections.Generic;
9+
10+
namespace InstallerBootstrap.DTO
11+
{
12+
public class Setting
13+
{
14+
public string Name { get; set; }
15+
public string SerializeAs { get; set; }
16+
public string Value { get; set; }
17+
18+
public override bool Equals(object obj)
19+
{
20+
return obj is Setting setting &&
21+
Name == setting.Name &&
22+
SerializeAs == setting.SerializeAs &&
23+
Value == setting.Value;
24+
}
25+
26+
public override int GetHashCode()
27+
{
28+
int hashCode = -2100274719;
29+
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Name);
30+
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(SerializeAs);
31+
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Value);
32+
return hashCode;
33+
}
34+
}
35+
36+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{AA74FD79-120E-457F-A596-9A3DE3845F36}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>InstallerBootstrap</RootNamespace>
10+
<AssemblyName>InstallerBootstrap</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<PublishUrl>publish\</PublishUrl>
16+
<Install>true</Install>
17+
<InstallFrom>Disk</InstallFrom>
18+
<UpdateEnabled>false</UpdateEnabled>
19+
<UpdateMode>Foreground</UpdateMode>
20+
<UpdateInterval>7</UpdateInterval>
21+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
22+
<UpdatePeriodically>false</UpdatePeriodically>
23+
<UpdateRequired>false</UpdateRequired>
24+
<MapFileExtensions>true</MapFileExtensions>
25+
<ApplicationRevision>0</ApplicationRevision>
26+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
27+
<IsWebBootstrapper>false</IsWebBootstrapper>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<BootstrapperEnabled>true</BootstrapperEnabled>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
32+
<PlatformTarget>AnyCPU</PlatformTarget>
33+
<DebugSymbols>true</DebugSymbols>
34+
<DebugType>full</DebugType>
35+
<Optimize>false</Optimize>
36+
<OutputPath>bin\Debug\</OutputPath>
37+
<DefineConstants>DEBUG;TRACE</DefineConstants>
38+
<ErrorReport>prompt</ErrorReport>
39+
<WarningLevel>4</WarningLevel>
40+
</PropertyGroup>
41+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
42+
<PlatformTarget>AnyCPU</PlatformTarget>
43+
<DebugType>pdbonly</DebugType>
44+
<Optimize>true</Optimize>
45+
<OutputPath>bin\Release\</OutputPath>
46+
<DefineConstants>TRACE</DefineConstants>
47+
<ErrorReport>prompt</ErrorReport>
48+
<WarningLevel>4</WarningLevel>
49+
</PropertyGroup>
50+
<ItemGroup>
51+
<Reference Include="System" />
52+
<Reference Include="System.Configuration" />
53+
<Reference Include="System.Core" />
54+
<Reference Include="System.Xml.Linq" />
55+
<Reference Include="System.Data.DataSetExtensions" />
56+
<Reference Include="Microsoft.CSharp" />
57+
<Reference Include="System.Data" />
58+
<Reference Include="System.Net.Http" />
59+
<Reference Include="System.Xml" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<Compile Include="DTO\Section.cs" />
63+
<Compile Include="DTO\Setting.cs" />
64+
<Compile Include="Program.cs" />
65+
<Compile Include="Properties\AssemblyInfo.cs" />
66+
<Compile Include="SettingsParser.cs" />
67+
<Compile Include="TemplateProcessor.cs" />
68+
</ItemGroup>
69+
<ItemGroup>
70+
<None Include="App.config" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
74+
<Visible>False</Visible>
75+
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
76+
<Install>true</Install>
77+
</BootstrapperPackage>
78+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
79+
<Visible>False</Visible>
80+
<ProductName>.NET Framework 3.5 SP1</ProductName>
81+
<Install>false</Install>
82+
</BootstrapperPackage>
83+
</ItemGroup>
84+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
85+
</Project>

InstallerBootstrap/Program.cs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Media Extractor is an application to preview and extract packed media in Microsoft Office files (e.g. Word, PowerPoint or Excel documents)
3+
* Copyright Raphael Stoeckli © 2023
4+
* This program is licensed under the MIT License.
5+
* You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6+
*/
7+
8+
using System.Collections.Generic;
9+
10+
namespace InstallerBootstrap
11+
{
12+
using InstallerBootstrap.DTO;
13+
using System;
14+
using System.Reflection;
15+
16+
public class Program
17+
{
18+
protected Program()
19+
{
20+
// Do not instantiate
21+
}
22+
23+
static void Main(string[] args)
24+
{
25+
if (args.Length != 4)
26+
{
27+
Console.WriteLine("Usage: InstallerBootstrap <templateInputPath> <installerFileOutputPath> <assembyPath> <assemblyFile>");
28+
return;
29+
}
30+
31+
string templateInputPath = args[0];
32+
string installerFileOutputPath = args[1];
33+
string assembyPath = args[2];
34+
string assembyFile = args[3];
35+
36+
try
37+
{
38+
string assemblyFullPath = assembyPath + "\\" + assembyFile;
39+
Assembly mediaExtractorAssembly = Assembly.LoadFile(assemblyFullPath);
40+
List<Section> sections = SettingsParser.ParseConfiguration(assemblyFullPath + ".config");
41+
42+
TemplateProcessor templateProcessor = new TemplateProcessor(templateInputPath);
43+
templateProcessor.SetAppName("Media Extractor");
44+
templateProcessor.SetAppVersion(GetFormattedVersion(mediaExtractorAssembly.GetName().Version, "."));
45+
templateProcessor.SetAppUrl(GetSettingsValue(sections, false, "Website"));
46+
templateProcessor.SetAppSupportUrl(GetSettingsValue(sections, true, "Support"));
47+
templateProcessor.SetAppExeName(assembyFile);
48+
//TODO ensure that these files are there or provide them on build
49+
templateProcessor.SetLicenseFile(".\\Resources\\MIT-License.rtf");
50+
templateProcessor.SetInstallIconFile(".\\Resources\\media_extractor_installer.ico");
51+
templateProcessor.SetChangeLogFile("changelog.txt");
52+
templateProcessor.SetOutputBaseFilename("Media-Extractor-Setup_" + GetFormattedVersion(mediaExtractorAssembly.GetName().Version, "_"));
53+
templateProcessor.SetMainExecutable(assembyPath, assembyFile);
54+
templateProcessor.SetAssemblyPath(assembyPath);
55+
templateProcessor.SaveFile(installerFileOutputPath);
56+
}
57+
catch (Exception ex)
58+
{
59+
Console.WriteLine("Error: " + ex.Message);
60+
}
61+
}
62+
63+
private static string GetSettingsValue(List<Section> sections, bool userSettings, string key)
64+
{
65+
return sections.Find(x => x.IsUserSection == userSettings).Settings.Find(x => x.Name == key).Value;
66+
}
67+
68+
private static string GetFormattedVersion(Version version, string delimiter)
69+
{
70+
string formattedVersion = $"{version.Major}{delimiter}{version.Minor}";
71+
72+
if (version.Build > 0)
73+
{
74+
formattedVersion += $"{delimiter}{version.Build}";
75+
}
76+
77+
if (version.Revision > 0)
78+
{
79+
formattedVersion += $"{delimiter}{version.Revision}";
80+
}
81+
return formattedVersion;
82+
}
83+
}
84+
85+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("InstallerBootstrap")]
9+
[assembly: AssemblyDescription("Media-Extractor InstallerBootstrap")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Media-Extractor")]
13+
[assembly: AssemblyCopyright("Copyright © 2023 Raphael Stoeckli")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("aa74fd79-120e-457f-a596-9a3de3845f36")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

InstallerBootstrap/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Media-Extractor Installer Bootstrap Utility
2+
3+
This project is the link between the actual Media-Extractor application project and the setup project
4+
5+
## Usage
6+
7+
The utility resolves the application version of Media-Extractor and several ebedded properties, like the project website, the author or path to the appliucation files.
8+
9+
The application is usually automatically executed when building Media-Extractor. Then, the above mentioned properties are extracted and written as installer file for **Inno Setup**
10+
11+
The (console) application takes four arguments:
12+
13+
| Order | Argument | Description |
14+
| --- | --- | --- |
15+
| 1 | Template path | The absolute Path to the Inno Setup template file |
16+
| 2 | Installer file path | The absolut path to the Inno Setup installer file (*.iss), used to buld the intsaller |
17+
| 3 | Assemply path | The absolute path to the Media-Extractor assebly and all necessary files |
18+
| 4 | Assembly file | The file name of the executable (e.g. MediaExtractor.exe) within the assembly path |
19+
20+
## Template Variables
21+
22+
All template variables (e.g. *TPL_MY_APP_VERSION*) are hardcoded in the class **TemplateProcessor** and must match in the bootstrap utilit and the setup template file.
23+
Therefore, any change mut be performed in the bootstrap utility and the template file (*.TPL) in the Inno Setup installer project.
24+
25+
## License
26+
27+
MIT License

0 commit comments

Comments
 (0)