Skip to content

Commit

Permalink
Fixed crash if Microsoft Visual C++ Redistributable is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmayer-dev committed Apr 9, 2022
1 parent fe1c8fb commit 714fdc4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
25 changes: 18 additions & 7 deletions Macro Deck 2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<PropertyGroup>
<VersionMajor>2</VersionMajor>
<VersionMinor>10</VersionMinor>
<VersionPatch>0</VersionPatch>
<VersionPatch>1</VersionPatch>
<VersionRevision Condition="'$(VersionRevision)' == ''">$([System.DateTime]::UtcNow.ToString("yy"))$([System.DateTime]::UtcNow.DayOfYear.ToString("000"))$([System.DateTime]::UtcNow.ToString("HHmm"))</VersionRevision>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -26,16 +27,19 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/SuchByte/Macro-Deck</PackageProjectUrl>
<RepositoryUrl>https://github.com/SuchByte/Macro-Deck</RepositoryUrl>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ApplicationManifest>app.manifest</ApplicationManifest>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -97,6 +101,7 @@
<PackageReference Include="FCTB" Version="2.16.24" />
<PackageReference Include="Fleck" Version="1.2.0" />
<PackageReference Include="GiphyDotNet" Version="2.0.0" />
<PackageReference Include="HidSharp" Version="2.1.0" />
<PackageReference Include="Magick.NET-Q16-x64" Version="8.3.1" />
<PackageReference Include="Magick.NET.Core" Version="8.3.1" />
<PackageReference Include="Magick.NET.SystemDrawing" Version="4.0.6" />
Expand All @@ -108,6 +113,12 @@
<PackageReference Include="SQLiteNetExtensions" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="DeckSurf.SDK">
<HintPath>C:\Users\Manuel\Desktop\decksurf-sdk-main\src\DeckSurf.SDK\bin\Debug\netcoreapp3.1\DeckSurf.SDK.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Compile Update="Folders\Plugin\GUI\FolderSwitcherConfigurator.cs">
<SubType>UserControl</SubType>
Expand Down
20 changes: 13 additions & 7 deletions MacroDeck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,19 @@ static void Main(string[] args)
}

// Initializing Cef Browser
CefSettings settings = new CefSettings();
settings.CefCommandLineArgs.Add("force-device-scale-factor", "1");
settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CachePath = Path.Combine(UserDirectoryPath, "CefSharp", "Cache");

Cef.Initialize(settings);
try
{
CefSettings settings = new CefSettings();
settings.CefCommandLineArgs.Add("force-device-scale-factor", "1");
settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CachePath = Path.Combine(UserDirectoryPath, "CefSharp", "Cache");

Cef.Initialize(settings);
} catch (Exception ex)
{
MacroDeckLogger.Error(typeof(MacroDeck), $"Could not initialize Chromium Embedded Framework: {ex.Message}" + Environment.NewLine + $"Make sure, Microsoft Visual C++ Redistributable is installed on your computer. You can download it here: https://aka.ms/vs/17/release/vc_redist.x64.exe");
}

// Check if config exists
if (!File.Exists(ConfigFilePath))
Expand Down

0 comments on commit 714fdc4

Please sign in to comment.