控制台基本版本

This commit is contained in:
sin365 2022-08-26 16:38:41 +08:00
parent 73f1a15018
commit 0b38c0ab17
35 changed files with 452 additions and 6 deletions

Binary file not shown.

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,55 @@
using System.Text;
namespace AxibugTransfer.Config
{
public struct CfgInfo
{
public int localPort;
public string targetIP;
public int targetPort;
}
public static class Config
{
public static bool LoadConfig(out List<CfgInfo> cfgList)
{
cfgList = new List<CfgInfo>();
try
{
StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + "\\config.cfg", Encoding.Default);
String line;
while (!string.IsNullOrEmpty((line = sr.ReadLine())))
{
if (!line.Contains(":"))
continue;
try
{
CfgInfo cfg = new CfgInfo()
{
localPort = Convert.ToInt32(line.Split(':')[0].Trim()),
targetIP = line.Split(':')[1].Trim(),
targetPort = Convert.ToInt32(line.Split(':')[2].Trim())
};
cfgList.Add(cfg);
}
catch
{
continue;
}
}
sr.Close();
if (cfgList.Count > 0)
return true;
else
return false;
}
catch(Exception ex)
{
Console.WriteLine("配置文件异常:"+ex.ToString());
return false;
}
}
}
}

View File

@ -0,0 +1,36 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"AxibugTransfer.Test/1.0.0": {
"dependencies": {
"AxibugTransfer.Tcp": "1.0.0"
},
"runtime": {
"AxibugTransfer.Test.dll": {}
}
},
"AxibugTransfer.Tcp/1.0.0": {
"runtime": {
"AxibugTransfer.Tcp.dll": {}
}
}
}
},
"libraries": {
"AxibugTransfer.Test/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"AxibugTransfer.Tcp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

View File

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

View File

@ -0,0 +1,120 @@
{
"format": 1,
"restore": {
"D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj": {}
},
"projects": {
"D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj",
"projectName": "AxibugTransfer.Tcp",
"projectPath": "D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj",
"packagesPath": "C:\\Users\\35337\\.nuget\\packages\\",
"outputPath": "D:\\AxibugTransfer\\AxibugTransfer.Tcp\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\35337\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.100\\RuntimeIdentifierGraph.json"
}
}
},
"D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj",
"projectName": "AxibugTransfer.Test",
"projectPath": "D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj",
"packagesPath": "C:\\Users\\35337\\.nuget\\packages\\",
"outputPath": "D:\\AxibugTransfer\\AxibugTransfer.Test\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\35337\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {
"D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj": {
"projectPath": "D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.100\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\35337\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.0.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\35337\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]

View File

@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("AxibugTransfer.Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("AxibugTransfer.Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("AxibugTransfer.Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@ -0,0 +1 @@
69e1cf852d1994ef7c0be22013f0f35cbb069029

View File

@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = AxibugTransfer.Test
build_property.ProjectDir = D:\AxibugTransfer\AxibugTransfer.Test\

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1 @@
e179f8622bf9744cf7922575e7c888ae50556c67

View File

@ -0,0 +1,18 @@
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Test.exe
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Test.deps.json
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Test.runtimeconfig.json
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Test.dll
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\ref\AxibugTransfer.Test.dll
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Test.pdb
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Tcp.dll
E:\AxibugTransfer\AxibugTransfer.Test\bin\Debug\net6.0\AxibugTransfer.Tcp.pdb
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.csproj.AssemblyReference.cache
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.GeneratedMSBuildEditorConfig.editorconfig
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.AssemblyInfoInputs.cache
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.AssemblyInfo.cs
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.csproj.CoreCompileInputs.cache
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.csproj.CopyComplete
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.dll
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\ref\AxibugTransfer.Test.dll
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.pdb
E:\AxibugTransfer\AxibugTransfer.Test\obj\Debug\net6.0\AxibugTransfer.Test.genruntimeconfig.cache

View File

@ -0,0 +1 @@
b22f4ba34b841ddd82c288acc43dcad5f77f4cdd

Binary file not shown.

View File

@ -0,0 +1,90 @@
{
"version": 3,
"targets": {
"net6.0": {
"AxibugTransfer.Tcp/1.0.0": {
"type": "project",
"framework": ".NETCoreApp,Version=v6.0",
"compile": {
"bin/placeholder/AxibugTransfer.Tcp.dll": {}
},
"runtime": {
"bin/placeholder/AxibugTransfer.Tcp.dll": {}
}
}
}
},
"libraries": {
"AxibugTransfer.Tcp/1.0.0": {
"type": "project",
"path": "../AxibugTransfer.Tcp/AxibugTransfer.Tcp.csproj",
"msbuildProject": "../AxibugTransfer.Tcp/AxibugTransfer.Tcp.csproj"
}
},
"projectFileDependencyGroups": {
"net6.0": [
"AxibugTransfer.Tcp >= 1.0.0"
]
},
"packageFolders": {
"C:\\Users\\35337\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj",
"projectName": "AxibugTransfer.Test",
"projectPath": "D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj",
"packagesPath": "C:\\Users\\35337\\.nuget\\packages\\",
"outputPath": "D:\\AxibugTransfer\\AxibugTransfer.Test\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\35337\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {
"D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj": {
"projectPath": "D:\\AxibugTransfer\\AxibugTransfer.Tcp\\AxibugTransfer.Tcp.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.100\\RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "E/yrvGgmxWvu5Ot5O3T23suFTBDm79NrdvlbdABGNtUD5UvkZu6plI4sscxxfp9bBsG2g05W8R5+ccPY5Ducew==",
"success": true,
"projectFilePath": "D:\\AxibugTransfer\\AxibugTransfer.Test\\AxibugTransfer.Test.csproj",
"expectedPackageFiles": [],
"logs": []
}

View File

@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer.Tcp", "AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj", "{B5A89E34-0283-44CB-8683-8E41888CA949}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugTransfer.Tcp", "AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj", "{B5A89E34-0283-44CB-8683-8E41888CA949}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer.Test", "AxibugTransfer.Test\AxibugTransfer.Test.csproj", "{A27FCE74-123D-477C-BB5B-2879D0B39D22}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer.Config", "AxibugTransfer.Config\AxibugTransfer.Config.csproj", "{A4C29DED-B1B3-4312-8743-A2BF20188618}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer", "AxibugTransfer\AxibugTransfer.csproj", "{69341276-017A-43F1-BC73-6123013C689F}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +19,14 @@ Global
{B5A89E34-0283-44CB-8683-8E41888CA949}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5A89E34-0283-44CB-8683-8E41888CA949}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.Build.0 = Release|Any CPU {B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.Build.0 = Release|Any CPU
{A27FCE74-123D-477C-BB5B-2879D0B39D22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A4C29DED-B1B3-4312-8743-A2BF20188618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A27FCE74-123D-477C-BB5B-2879D0B39D22}.Debug|Any CPU.Build.0 = Debug|Any CPU {A4C29DED-B1B3-4312-8743-A2BF20188618}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A27FCE74-123D-477C-BB5B-2879D0B39D22}.Release|Any CPU.ActiveCfg = Release|Any CPU {A4C29DED-B1B3-4312-8743-A2BF20188618}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A27FCE74-123D-477C-BB5B-2879D0B39D22}.Release|Any CPU.Build.0 = Release|Any CPU {A4C29DED-B1B3-4312-8743-A2BF20188618}.Release|Any CPU.Build.0 = Release|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\AxibugTransfer.Config\AxibugTransfer.Config.csproj" />
<ProjectReference Include="..\AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj" />
</ItemGroup>
</Project>

14
AxibugTransfer/Program.cs Normal file
View File

@ -0,0 +1,14 @@
using AxibugTransfer.Tcp;
using AxibugTransfer.Config;
if (!Config.LoadConfig(out List<CfgInfo> cfgList))
{
Console.WriteLine("请检查配置文件!");
return;
}
foreach (CfgInfo cfg in cfgList)
new TcpTransfer(cfg.localPort, cfg.targetIP, cfg.targetPort, true).Start();
while (true)
Console.ReadLine();

View File

@ -0,0 +1 @@
80:127.0.0.1:8080