Skip to content

Commit

Permalink
improve: some changes to launcher
Browse files Browse the repository at this point in the history
Added to create shortcut
Added launcher_config.json for read launcher configs from url
Fixed some other things
  • Loading branch information
dudantas committed Feb 7, 2023
1 parent 0f47291 commit 74fe332
Show file tree
Hide file tree
Showing 14 changed files with 346 additions and 224 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ obj

# Build results
Properties/
.vs/
.obj/
97 changes: 97 additions & 0 deletions CanaryLauncher.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E21D451C-4724-4738-A716-DD441AD38747}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CanaryLauncher</RootNamespace>
<ApplicationIcon>icon.ico</ApplicationIcon>
<AssemblyName>CanaryLauncher</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="src\App.xaml.cs" />
<Compile Include="src\AssemblyInfo.cs" />
<Compile Include="src\ClientConfig.cs" />
<Compile Include="src\MainWindow.xaml.cs" />
<Compile Include="src\SplashScreen.xaml.cs" />
<PackageReference Include="Ionic.Zip" Version="1.9.1.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<Resource Include="assets\icons.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Resource>
<Page Include="src\App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="src\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="src\SplashScreen.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="assets\background.jpg" />
<Resource Include="assets\bg_button_update.png" />
<Resource Include="assets\bg_hints.png" />
<Resource Include="assets\button_hover_play.png" />
<Resource Include="assets\button_hover_update.png" />
<Resource Include="assets\button_play.png" />
<Resource Include="assets\button_update.png" />
<Resource Include="assets\icon_play.png" />
<Resource Include="assets\icon_update.png" />
<Resource Include="assets\launcher_ico.png" />
<Resource Include="assets\logo.png" />
<Resource Include="assets\logo_company.png" />
<Resource Include="assets\rh_lore.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions CanaryLauncher.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CanaryLauncher", "CanaryLauncher.csproj", "{E21D451C-4724-4738-A716-DD441AD38747}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E21D451C-4724-4738-A716-DD441AD38747}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E21D451C-4724-4738-A716-DD441AD38747}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E21D451C-4724-4738-A716-DD441AD38747}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E21D451C-4724-4738-A716-DD441AD38747}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F0CE66E6-7311-4CFA-8866-0B11975F833A}
EndGlobalSection
EndGlobal
91 changes: 0 additions & 91 deletions CanaryLauncherUpdate.csproj

This file was deleted.

12 changes: 0 additions & 12 deletions Properties/PublishProfiles/FolderProfile.pubxml

This file was deleted.

9 changes: 0 additions & 9 deletions Properties/PublishProfiles/FolderProfile.pubxml.user

This file was deleted.

File renamed without changes.
13 changes: 10 additions & 3 deletions App.xaml.cs → src/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ namespace CanaryLauncherUpdate
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
public class Program
{
[STAThread]
public static void Main(string[] args)
{
App app = new App();
app.InitializeComponent();
app.Run();
}
}
}
File renamed without changes.
38 changes: 38 additions & 0 deletions src/ClientConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Windows;
using System.Net;
using System.IO;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace LauncherConfig
{
public class ClientConfig
{
public string clientVersion { get; set; }
public string launcherVersion { get; set; }
public bool replaceFolders { get; set; }
public ReplaceFolderName[] replaceFolderName { get; set; }
public string clientFolder { get; set; }
public string newClientUrl { get; set; }
public string newConfigUrl { get; set; }
public string clientExecutable { get; set; }

public static ClientConfig loadFromFile(string url)
{
using (HttpClient client = new HttpClient())
{
Task<string> jsonTask = client.GetStringAsync(url);
string jsonString = jsonTask.Result;
return JsonConvert.DeserializeObject<ClientConfig>(jsonString);
}
}
}

public class ReplaceFolderName
{
public string name { get; set; }
}
}
25 changes: 5 additions & 20 deletions MainWindow.xaml → src/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<BitmapImage x:Key="RhLoreKey" UriSource="pack://application:,,,/Assets/rh_lore.png"/>
</Grid.Resources>
<Grid.Background>
<ImageBrush ImageSource="{StaticResource BackGroundKey}" Stretch="UniformToFill" Opacity="0.3"></ImageBrush>
<ImageBrush ImageSource="{StaticResource BackGroundKey}" Stretch="UniformToFill" Opacity="100"></ImageBrush>
</Grid.Background>
<StackPanel
Grid.Column="1"
Expand All @@ -57,24 +57,6 @@
Click="CloseButton_Click"
Tag="IsCloseButton"
Cursor="Hand"/>
<Button
x:Name="RestoreButton"
Margin="5, 0"
Click="RestoreButton_Click"
Cursor="Hand">
<Button.Style>
<Style
TargetType="{x:Type Button}"
BasedOn="{StaticResource WindowButtonStyle}">
<Setter Property="Content" Value="{StaticResource maximize_ico}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=home, Path=WindowState}" Value="Maximized">
<Setter Property="Content" Value="{StaticResource restore_ico}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button
x:Name="MinimizeButton"
Style="{StaticResource WindowButtonStyle}"
Expand All @@ -93,7 +75,10 @@
Height="120"
Source="{StaticResource LogoKey}"
Stretch="Uniform"
Visibility="Visible"></Image>
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="Visible">
</Image>
</StackPanel>
<StackPanel
Grid.Row="1"
Expand Down
Loading

0 comments on commit 74fe332

Please sign in to comment.