Skip to content

Commit

Permalink
Bump to version 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaniru Rajapakse committed May 23, 2022
1 parent bd4d5ff commit 3525d78
Show file tree
Hide file tree
Showing 42 changed files with 3,198 additions and 861 deletions.
9 changes: 9 additions & 0 deletions Client Launcher/Client Launcher.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Client_Launcher</RootNamespace>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions Client Launcher/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace Client_Launcher
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
8 changes: 8 additions & 0 deletions ClientLauncher/ClientLauncher.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>
116 changes: 116 additions & 0 deletions ClientLauncher/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using System;
using System.IO;
using System.Xml;
using System.Diagnostics;
using System.Threading.Tasks;

namespace ClientLauncher
{
class Program
{
static void Main(string[] args)
{

if (args.Length > 2)
{
if (args[2] == "/admin")
{
string aliasPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory +
@"\ClientLauncher.exe");

ProcessStartInfo Restartinfo = new ProcessStartInfo();
Restartinfo.Verb = "runas";
Restartinfo.UseShellExecute = true;
Restartinfo.FileName = aliasPath;
Process.Start(Restartinfo);
return;
}
}
Console.Title = "SDLauncher Loging System";
var l = GetEnviromentVar("LocalAppData");
var path = Path.Combine(l, @"Packages\SeaDevs.Launcher.UWP_0dk3ndwmrga1t\LocalState");
string arguements = "";
string fileName = "";
string workdir = "";
using (StreamReader sr = File.OpenText(Path.Combine(path, "StartInfo.xml")))
{
var s = sr.BaseStream;

XmlReaderSettings settings = new XmlReaderSettings();
settings.Async = true;
using (XmlReader reader = XmlReader.Create(s, settings))
{
reader.Read();
reader.ReadStartElement("Process");
reader.ReadToFollowing("StartInfo");
arguements = reader.GetAttribute("Arguments");
fileName = reader.GetAttribute("FileName");
workdir = reader.GetAttribute("WorkingDirectory");
reader.Close();
}
try
{
s.Close();
sr.Close();
}
catch
{

}
}
//Console.WriteLine(arguements);
//Console.WriteLine(fileName);
//Console.WriteLine(workdir);
var info = new ProcessStartInfo { FileName = fileName, Arguments = arguements, WorkingDirectory = workdir };
var proc = new Process { StartInfo = info };
var processUtil = new ProcessUtil(proc);
processUtil.OutputReceived += (s, e) => Console.WriteLine(e);
processUtil.StartWithEvents();
proc.WaitForExit();
}
static string GetEnviromentVar(string variableName)
{
return Environment.GetEnvironmentVariable(variableName);
}
}
public class ProcessUtil
{
public event EventHandler<string>? OutputReceived;
public event EventHandler? Exited;

public Process Process { get; private set; }

public ProcessUtil(Process process)
{
this.Process = process;
}

public void StartWithEvents()
{
Process.StartInfo.CreateNoWindow = true;
Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.StartInfo.UseShellExecute = false;
Process.StartInfo.RedirectStandardError = true;
Process.StartInfo.RedirectStandardOutput = true;
Process.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;
Process.StartInfo.StandardErrorEncoding = System.Text.Encoding.UTF8;
Process.EnableRaisingEvents = true;
Process.ErrorDataReceived += (s, e) => OutputReceived?.Invoke(this, e.Data ?? "");
Process.OutputDataReceived += (s, e) => OutputReceived?.Invoke(this, e.Data ?? "");
Process.Exited += (s, e) => Exited?.Invoke(this, new EventArgs());

Process.Start();
Process.BeginErrorReadLine();
Process.BeginOutputReadLine();
}

public Task WaitForExitTaskAsync()
{
return Task.Run(() =>
{
Process.WaitForExit();
});
}
}
}
21 changes: 15 additions & 6 deletions Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap uap5">
IgnorableNamespaces="uap rescap uap5 desktop">

<Identity
Name="92f4ca52-b32c-4442-ae85-f990fbb5eb7d"
Name="SeaDevs.Launcher.UWP"
Publisher="CN=SeaDev Team"
Version="1.0.3.0" />
Version="0.3.1.0" />

<Properties>
<DisplayName>Package</DisplayName>
<DisplayName>SD Launcher</DisplayName>
<PublisherDisplayName>user</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
Expand All @@ -32,10 +33,10 @@
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="SDLauncher"
DisplayName="SDLauncher UWP"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png" Description="Minecraft Launcher by SeaDevs">
Square44x44Logo="Images\Square44x44Logo.png" Description="UWP Minecraft Launcher for Windows by SeaDevs">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png" ShortName="SDLauncher"/>
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
Expand All @@ -48,6 +49,14 @@
<uap5:ExecutionAlias Alias="SDL.exe" />
</uap5:AppExecutionAlias>
</uap5:Extension>
<desktop:Extension
Category="windows.fullTrustProcess"
Executable="ClientLauncher\ClientLauncher.exe">
<desktop:FullTrustProcess>
<desktop:ParameterGroup GroupId="User" Parameters="/user" />
<desktop:ParameterGroup GroupId="Admin" Parameters="/admin" />
</desktop:FullTrustProcess>
</desktop:Extension>
</Extensions>
</Application>
</Applications>
Expand Down
1 change: 1 addition & 0 deletions Package/Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.19041.8" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ClientLauncher\ClientLauncher.csproj" />
<ProjectReference Include="..\SDLauncher UWP\SDLauncher UWP.csproj" />
</ItemGroup>
</Project>
22 changes: 22 additions & 0 deletions SDLauncher UWP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDLauncher UWP", "SDLaunche
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Package", "Package\Package.wapproj", "{817AAF28-3E88-4E8F-99C6-EE0C0B66C013}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientLauncher", "ClientLauncher\ClientLauncher.csproj", "{F97BA254-A457-4D27-BC65-90B7761B162D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -77,6 +79,26 @@ Global
{817AAF28-3E88-4E8F-99C6-EE0C0B66C013}.Release|x86.ActiveCfg = Release|x86
{817AAF28-3E88-4E8F-99C6-EE0C0B66C013}.Release|x86.Build.0 = Release|x86
{817AAF28-3E88-4E8F-99C6-EE0C0B66C013}.Release|x86.Deploy.0 = Release|x86
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|ARM.Build.0 = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|ARM64.Build.0 = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|x64.ActiveCfg = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|x64.Build.0 = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|x86.ActiveCfg = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Debug|x86.Build.0 = Debug|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|Any CPU.Build.0 = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|ARM.ActiveCfg = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|ARM.Build.0 = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|ARM64.ActiveCfg = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|ARM64.Build.0 = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|x64.ActiveCfg = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|x64.Build.0 = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|x86.ActiveCfg = Release|Any CPU
{F97BA254-A457-4D27-BC65-90B7761B162D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
11 changes: 6 additions & 5 deletions SDLauncher UWP/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
xmlns:local="using:SDLauncher_UWP"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)">
<Application.Resources>
<controls:XamlControlsResources>
<controls:XamlControlsResources.MergedDictionaries>
<winui:XamlControlsResources>
<winui:XamlControlsResources.MergedDictionaries>
<!-- Other app resources here -->
<ResourceDictionary>
<FontFamily x:Key="Pixel">/Fonts/Pixeboy.ttf#Pixeboy</FontFamily>
Expand All @@ -17,7 +17,8 @@
<EntranceThemeTransition IsStaggeringEnabled="True"/>
</TransitionCollection>
</ResourceDictionary>
</controls:XamlControlsResources.MergedDictionaries>
</controls:XamlControlsResources>
<ResourceDictionary Source="/Resources/ExpanderStyle.xaml"/>
</winui:XamlControlsResources.MergedDictionaries>
</winui:XamlControlsResources>
</Application.Resources>
</Application>
3 changes: 2 additions & 1 deletion SDLauncher UWP/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Toolkit.Uwp.Helpers;
using SDLauncher_UWP.Helpers;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -34,7 +35,7 @@ public App()
this.InitializeComponent();
this.Suspending += OnSuspending;
}
SettingsData settings = new SettingsData();
SettingsDataManager settings = new SettingsDataManager();
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
Expand Down
43 changes: 43 additions & 0 deletions SDLauncher UWP/Converters/ProcessToXmlConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Windows.Storage;
using System.Threading.Tasks;
using System.Diagnostics;
using Windows.Storage.Streams;
using System.IO;
using System.Xml;

namespace SDLauncher_UWP.Converters
{
public class ProcessToXmlConverter
{
public async static Task Convert(Process Process,StorageFolder Destination,string FileName)
{
var inf = Process.StartInfo;
var storagefile = await Destination.CreateFileAsync(FileName, CreationCollisionOption.ReplaceExisting);
using (IRandomAccessStream writestream = await storagefile.OpenAsync(FileAccessMode.ReadWrite))
{
Stream s = writestream.AsStreamForWrite();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Async = true;
settings.NewLineOnAttributes = false;
settings.Indent = true;
using (XmlWriter writer = XmlWriter.Create(s, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("Process");
writer.WriteStartElement("StartInfo");
writer.WriteAttributeString("Arguments", inf.Arguments);
writer.WriteAttributeString("FileName", inf.FileName);
writer.WriteAttributeString("WorkingDirectory", inf.WorkingDirectory);
writer.WriteEndElement();
writer.WriteEndElement();
writer.Flush();
await writer.FlushAsync();
}
}
}
}
}
47 changes: 47 additions & 0 deletions SDLauncher UWP/Converters/StringToVisibility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

namespace SDLauncher_UWP.Converters
{
public class StringToVisibility : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
// Reversed result
if (parameter is string param)
{
if (param == "0")
{
return (value is string val && val.Length > 0) ? Visibility.Collapsed : Visibility.Visible;
}
}

return (value is string str && str.Length > 0) ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new InvalidOperationException("Use the boolean to visibility converter in this situation. " +
"A string is very likely unnecessary in this case.");
}
}

public class BindlessStringToVisibility
{
public static Visibility BindlessConvert(object value)
{
return (value is string str && str.Length > 0) ? Visibility.Visible : Visibility.Collapsed;
}

public static void BindlessConvertBack(object value)
{
throw new InvalidOperationException("Use the boolean to visibility converter in this situation." +
"A string is very likely unnecessary in this case. You tried to convert: " + value.ToString());
}
}
}
Loading

0 comments on commit 3525d78

Please sign in to comment.