Skip to content

Commit

Permalink
项目架构文件夹改名前工作
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Mar 21, 2021
1 parent 8a4758f commit 51a10e6
Show file tree
Hide file tree
Showing 26 changed files with 98 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Application.Repositories.sqlite-net-pcl</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>System.Application</RootNamespace>
<AssemblyName>System.Application.Services.SmsSender</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<RootNamespace>System</RootNamespace>
<SignAssembly>false</SignAssembly>
<!--(SignAssembly)对此程序集进行签名会导致编译失败(CompileAvaloniaXamlTask)-->
<AssemblyName>System.Application.SteamTools.Client.Desktop.Avalonia</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Application.SteamTools.Client.Desktop.Linux</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<RootNamespace>System</RootNamespace>
<DefineConstants>MONO_MAC;$(DefineConstants)</DefineConstants>
<!--<DefineConstants>XAMARIN_MAC;$(DefineConstants)</DefineConstants>-->
<AssemblyName>System.Application.SteamTools.Client.Desktop.Mac</AssemblyName>
</PropertyGroup>

<!--<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<RootNamespace>System</RootNamespace>
<UseWindowsForms>false</UseWindowsForms>
<UseWPF>false</UseWPF>
<AssemblyName>System.Application.SteamTools.Client.Desktop.Windows</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System.Application</RootNamespace>
<AssemblyName>System.Application.SteamTools.Client.Desktop</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>System.Application</RootNamespace>
<DefineConstants>UnitTest;$(DefineConstants)</DefineConstants>
<AssemblyName>System.Application.SteamTools.Client.Test</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System.Application</RootNamespace>
<DefineConstants>ORM_SQLITE_PCL;$(DefineConstants)</DefineConstants>
<AssemblyName>System.Application.SteamTools.Client</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System.Application</RootNamespace>
<AssemblyName>System.Application.SteamTools.Services.CloudService.Models</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<RootNamespace>System.Application</RootNamespace>
<AssemblyName>System.Application.SteamTools.Services.CloudService</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using static System.ProjectPathUtil;

namespace System
{
/// <summary>
/// 开源协议清单列表自动生成工具
/// </summary>
static class Program
{
const string OpenSourceLibraryListEmoji = "📄";

static async Task Main(string[] args)
{
var projPath = GetProjectPath();
var readmePath = Path.Combine(projPath, README);

var file = Path.Combine(projPath, "resources", "OpenSourceLibraryList.mpo");
Expand Down Expand Up @@ -174,18 +177,6 @@ static async Task Main(string[] args)

const string README = "README.md";

static string GetProjectPath(string? path = null)
{
path ??= AppContext.BaseDirectory;
if (!Directory.GetFiles(path, README).Any())
{
var parent = Directory.GetParent(path);
if (parent == null) return string.Empty;
return GetProjectPath(parent.FullName);
}
return path;
}

static void Print(List<OpenSourceLibrary> items)
{
Console.WriteLine(OpenSourceLibrary.ToString(items));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<Compile Include="..\System.Common.CoreLib\Extensions\StringExtensions.cs">
<Link>Extensions\StringExtensions.cs</Link>
</Compile>
<Compile Include="..\resources\ProjectPathUtil.cs">
<Link>ProjectPathUtil.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.ProjectPathUtil;

namespace System.Application.UI.Views
{
Expand All @@ -11,7 +12,7 @@ namespace System.Application.UI.Views
/// </summary>
public partial class Form1 : Form
{
readonly string app_path = @"\System.Application.SteamTools.Client.Desktop.Avalonia.App\bin\Release\Publish\win-x86";
readonly string app_path = DirPublishWinX86;

static string GetPath(string path)
{
Expand All @@ -22,19 +23,7 @@ static string GetPath(string path)
public Form1()
{
InitializeComponent();
textBox1.Text = GetPath(GetProjectPath() + app_path);
}

static string GetProjectPath(string? path = null)
{
path ??= AppContext.BaseDirectory;
if (!Directory.GetFiles(path, "*.sln").Any())
{
var parent = Directory.GetParent(path);
if (parent == null) return string.Empty;
return GetProjectPath(parent.FullName);
}
return path;
textBox1.Text = GetPath(projPath + app_path);
}

void OnBtnSelectPathClick(object sender, EventArgs e)
Expand Down
3 changes: 3 additions & 0 deletions System.Application.SteamTools.Tools.Packager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace System
{
/// <summary>
/// 压缩包测试,压缩与解压,进度条UI
/// </summary>
static class Program
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<Compile Include="..\System.Common.CoreLib\FileEx.cs">
<Link>FileEx.cs</Link>
</Compile>
<Compile Include="..\resources\ProjectPathUtil.cs">
<Link>ProjectPathUtil.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand Down
23 changes: 6 additions & 17 deletions System.Application.SteamTools.Tools.Translate/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.ProjectPathUtil;

// 已知BUG:疑似部分语言中存在键,其他语言中没有此键,则不会自动翻译?

namespace System
{
Expand All @@ -15,7 +18,7 @@ namespace System
/// <para>人工审阅与校对</para>
/// <para>从Excel中读取翻译结果自动插入resx文件中</para>
/// </summary>
class Program
static class Program
{
static readonly string[] langs = new[] {
"en",
Expand All @@ -25,15 +28,13 @@ class Program
"ko",
};

static readonly string projPath = GetProjectPath();

static void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient();
}

public const string CoreLib = @"System.Common.CoreLib\Properties\SR";
public const string AppRes = @"System.Application.SteamTools.Client.Desktop\UI\Resx\AppResources";
public const string CoreLib = ProjectDir_CoreLib + @"\Properties\SR";
public const string AppRes = ProjectDir_ClientDesktop + @"\UI\Resx\AppResources";

static async Task Main(string[] args)
{
Expand Down Expand Up @@ -283,18 +284,6 @@ static IDictionary<string, string> ReadResx(string path)
return dict;
}

static string GetProjectPath(string? path = null)
{
path ??= AppContext.BaseDirectory;
if (!Directory.GetFiles(path, "*.sln").Any())
{
var parent = Directory.GetParent(path);
if (parent == null) return string.Empty;
return GetProjectPath(parent.FullName);
}
return path;
}

public static bool Is_zh_Hans(string? input) => input?.Any(Is_zh_Hans) ?? false;

public static bool Is_zh_Hans(char input) => input >= 0x4e00 && input <= 0x9fbb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<Compile Include="..\System.Common.CoreLib\Properties\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\resources\ProjectPathUtil.cs">
<Link>ProjectPathUtil.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System.Application</RootNamespace>
<AssemblyName>System.Application.SteamTools</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>MonoAndroid10.0</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Common.ClientLib.Droid</AssemblyName>
<AndroidUseIntermediateDesignerFile>false</AndroidUseIntermediateDesignerFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>Xamarin.iOS10</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Common.ClientLib.iOS</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions System.Common.ClientLib/System.Common.ClientLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Common.ClientLib</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions System.Common.CoreLib/System.Common.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Common.CoreLib</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>MonoAndroid10.0</TargetFramework>
<RootNamespace>System.UnitTest</RootNamespace>
<AssemblyName>System.Common.UnitTest.Droid</AssemblyName>
<IsPackable>false</IsPackable>
<DefineConstants>UnitTest;$(DefineConstants)</DefineConstants>
<AndroidUseIntermediateDesignerFile>false</AndroidUseIntermediateDesignerFile>
Expand Down
1 change: 1 addition & 0 deletions System.Common.UnitTest/System.Common.UnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>System</RootNamespace>
<AssemblyName>System.Common.UnitTest</AssemblyName>
<IsPackable>false</IsPackable>
<DefineConstants>UnitTest;$(DefineConstants)</DefineConstants>
</PropertyGroup>
Expand Down
55 changes: 55 additions & 0 deletions resources/ProjectPathUtil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.IO;
using System.Linq;

namespace System
{
public static class ProjectPathUtil
{
public static readonly string projPath;

public const string ProjectDir_AvaloniaApp = "System.Application.SteamTools.Client.Desktop.Avalonia.App";

public const string ProjectDir_CoreLib = "System.Common.CoreLib";

public const string ProjectDir_ClientDesktop = "System.Application.SteamTools.Client.Desktop";

public const string DirPublishWinX86 =
@"\" + ProjectDir_AvaloniaApp + @"\bin\Release\Publish\win-x86";

static ProjectPathUtil()
{
projPath = GetProjectPath();
if (!Directory.Exists(Path.Combine(projPath, ProjectDir_AvaloniaApp)))
{
projPath = GetProjectPathByServerTool();
}
}

/// <summary>
/// 获取当前项目绝对路径(.sln文件所在目录)
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
static string GetProjectPath(string? path = null)
{
path ??= AppContext.BaseDirectory;
if (!Directory.GetFiles(path, "*.sln").Any())
{
var parent = Directory.GetParent(path);
if (parent == null) return string.Empty;
return GetProjectPath(parent.FullName);
}
return path;
}

/// <summary>
/// 获取公开客户端项目绝对路径,仅供服务端工具项目中使用
/// </summary>
/// <returns></returns>
static string GetProjectPathByServerTool()
{
var projPath_ = GetProjectPath();
return Path.GetFullPath(Path.Combine(projPath_, "..", "SteamTools"));
}
}
}

0 comments on commit 51a10e6

Please sign in to comment.