Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
Switch to .NET 4.5.1,
Browse files Browse the repository at this point in the history
Faster LEGUI loading speed by removing custom skin,
Allow "run as administrator",
Sign all assemblies
  • Loading branch information
xupefei committed Jan 31, 2014
1 parent 859643c commit 1d208d5
Show file tree
Hide file tree
Showing 40 changed files with 333 additions and 192 deletions.
7 changes: 5 additions & 2 deletions LECommonLibrary/LECommonLibrary.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>
Expand All @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LECommonLibrary</RootNamespace>
<AssemblyName>LECommonLibrary</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -28,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
Expand Down
52 changes: 39 additions & 13 deletions LECommonLibrary/LEConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace LECommonLibrary
{
public class LEConfig
public static class LEConfig
{
public static string GlobalConfigPath =
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
Expand Down Expand Up @@ -47,7 +47,8 @@ public static LEProfile[] GetProfiles(string configPath)
p.Element("Location").Value,
p.Element("DefaultFont").Value,
p.Element("Timezone").Value,
bool.Parse(p.Element("RunWithSuspend").Value)
bool.Parse(p.TryGetValue("RunAsAdmin", "false")),
bool.Parse(p.TryGetValue("RunWithSuspend", "false"))
)
).ToArray();

Expand Down Expand Up @@ -79,17 +80,41 @@ public static void SaveApplicationConfigFile(string path, LEProfile profile)

private static void BuildGlobalConfigFile()
{
var defaultProfile = new LEProfile("Run in Japanese",
Guid.NewGuid().ToString(),
false,
String.Empty,
"ja-JP",
"MS Gothic",
"Tokyo Standard Time",
false
);

WriteConfig(GlobalConfigPath, defaultProfile);
var defaultProfiles = new[]
{
new LEProfile("Run in Japanese",
Guid.NewGuid().ToString(),
false,
String.Empty,
"ja-JP",
"MS Gothic",
"Tokyo Standard Time",
false,
false
),
new LEProfile("Run in Japanese (Admin)",
Guid.NewGuid().ToString(),
false,
String.Empty,
"ja-JP",
"MS Gothic",
"Tokyo Standard Time",
true,
false
)
};

WriteConfig(GlobalConfigPath, defaultProfiles);
}

private static string TryGetValue(this XElement element, string name, string defaultValue = null)
{
XElement found = element.Element(name);
if (found != null)
{
return found.Value;
}
return defaultValue;
}

private static void WriteConfig(string writeTo, params LEProfile[] profiles)
Expand All @@ -106,6 +131,7 @@ private static void WriteConfig(string writeTo, params LEProfile[] profiles)
new XElement("Location", pro.Location),
new XElement("DefaultFont", pro.DefaultFont),
new XElement("Timezone", pro.Timezone),
new XElement("RunAsAdmin", pro.RunAsAdmin),
new XElement("RunWithSuspend", pro.RunWithSuspend)
)
);
Expand Down
3 changes: 3 additions & 0 deletions LECommonLibrary/LEProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public struct LEProfile
public string Location;
public string Name;
public string Parameter;
public bool RunAsAdmin;
public bool RunWithSuspend;
public bool ShowInMainMenu;
public string Timezone;
Expand All @@ -18,6 +19,7 @@ public struct LEProfile
string location,
string defaultFont,
string timezone,
bool runAsAdmin,
bool runWithSuspend)
{
Name = name;
Expand All @@ -27,6 +29,7 @@ public struct LEProfile
Location = location;
DefaultFont = defaultFont;
Timezone = timezone;
RunAsAdmin = runAsAdmin;
RunWithSuspend = runWithSuspend;
}
}
Expand Down
12 changes: 8 additions & 4 deletions LEContextMenuHandler/LEContextMenuHandler.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>
Expand All @@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LEContextMenuHandler</RootNamespace>
<AssemblyName>LEContextMenuHandler</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
Expand Down Expand Up @@ -101,7 +104,8 @@
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>copy /Y "$(ProjectDir)\Lang\*.xml" "$(TargetDir)\Lang\"
<PostBuildEvent>mkdir "$(TargetDir)Lang\"
copy /Y "$(ProjectDir)Lang\*.xml" "$(TargetDir)Lang\"
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
36 changes: 18 additions & 18 deletions LEContextMenuHandler/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified LEContextMenuHandler/key.snk
Binary file not shown.
2 changes: 1 addition & 1 deletion LEGUI/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="GlobalConfig.xaml" Startup="App_OnStartup">
<Application.Resources>
<ResourceDictionary Source="/ReuxablesLegacy;component/Mercury.xaml">
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Lang\DefaultLanguage.xaml" />
</ResourceDictionary.MergedDictionaries>
Expand Down
25 changes: 16 additions & 9 deletions LEGUI/AppConfig.xaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
<Window x:Class="LEGUI.AppConfig"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:legui="clr-namespace:LEGUI"
Title="Locale Emulator GUI" Height="303" Width="280"
Title="Locale Emulator GUI - APP" Height="331" Width="330.4"
WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize">
<Grid TextElement.FontFamily="{DynamicResource UIFont}">
<Grid x:Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid x:Name="appConfigGrid" Grid.Row="0" Background="#FFE2E2E2">
<Grid x:Name="appConfigGrid" Grid.Row="0" Background="#FFF1F1F1">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<legui:MaskedTextBox x:Name="tbAppParameter" Grid.Row="0" Grid.Column="0" Height="Auto"
Margin="3,3,3,4" MaskText="{StaticResource EnterArgument}"
VerticalContentAlignment="Center" Grid.ColumnSpan="4" />
VerticalContentAlignment="Center" Grid.ColumnSpan="3" />
<Button x:Name="bSaveAppSetting" Grid.Row="1" Grid.Column="0" Content="{DynamicResource Save}"
Margin="3,0,3,5" Style="{StaticResource NuclearBlueButton}" Click="bSaveAppSetting_Click" />
<Button x:Name="bDeleteAppSetting" Grid.Row="1" Grid.Column="1" Content="{DynamicResource Delete}"
Margin="3,0,3,5" Style="{StaticResource NuclearGreenButton}" Click="bDeleteAppSetting_Click" />
Margin="3,0,3,5" Click="bSaveAppSetting_Click" />
<Button x:Name="bShortcut" Grid.Row="1" Grid.Column="1" Content="{DynamicResource Shortcut}"
Margin="3,0,3,5" Click="bShortcut_Click" />
<Button x:Name="bDeleteAppSetting" Grid.Row="1" Grid.Column="2" Content="{DynamicResource Delete}"
Margin="3,0,3,5" Click="bDeleteAppSetting_Click" />
</Grid>
<Grid Grid.Row="1" Margin="0,0,0,10">
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1.3*" />
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="{DynamicResource LocationSettings}" Margin="4,0">
<Grid>
Expand Down Expand Up @@ -72,9 +75,13 @@
<GroupBox Grid.Row="3" Header="{DynamicResource DebugOptions}" Margin="4,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<CheckBox x:Name="cbStartAsSuspend" Grid.Row="0"
<CheckBox x:Name="cbStartAsAdmin" Grid.Row="0"
Content="{DynamicResource AsAdmin}" Margin="5,0,0,0"
VerticalAlignment="Center" />
<CheckBox x:Name="cbStartAsSuspend" Grid.Row="1"
Content="{DynamicResource WithCREATESUSPENDED}" Margin="5,0,0,0"
VerticalAlignment="Center" />
</Grid>
Expand Down

0 comments on commit 1d208d5

Please sign in to comment.