Skip to content

Commit

Permalink
fix: 🐛 clang format for Server & ClientTest main
Browse files Browse the repository at this point in the history
  • Loading branch information
Grange007 committed Oct 28, 2023
1 parent c897adc commit b027287
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 182 deletions.
48 changes: 24 additions & 24 deletions logic/Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,41 +55,41 @@
<PackageReference Include="Google.Protobuf" Version="3.24.4" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="Grpc.Tools" Version="2.54.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup>


<ItemGroup>
<Compile Update="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Update="Map.xaml.cs">
<DependentUpon>Map.xaml</DependentUpon>
</Compile>
<Compile Update="GameStatusBar.xaml.cs">
<DependentUpon>GameStatusBar.xaml</DependentUpon>
</Compile>
<Compile Update="PlayerStatusBar.xaml.cs">
<DependentUpon>PlayerStatusBar.xaml</DependentUpon>
</Compile>
<Compile Update="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Update="Map.xaml.cs">
<DependentUpon>Map.xaml</DependentUpon>
</Compile>
<Compile Update="GameStatusBar.xaml.cs">
<DependentUpon>GameStatusBar.xaml</DependentUpon>
</Compile>
<Compile Update="PlayerStatusBar.xaml.cs">
<DependentUpon>PlayerStatusBar.xaml</DependentUpon>
</Compile>
</ItemGroup>


<ItemGroup>
<MauiXaml Update="Map.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="GameStatusBar.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="PlayerStatusBar.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Map.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="GameStatusBar.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="PlayerStatusBar.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\dependency\proto\Protos.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion logic/Client/PlayerStatusBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void DrawShipTable()
ShipAllAttributesGrid.SetColumn(shipLabels[shipCounter].armor, 3);
ShipAllAttributesGrid.SetColumn(shipLabels[shipCounter].shield, 4);
ShipAllAttributesGrid.SetColumn(shipLabels[shipCounter].weapon, 5);
ShipAllAttributesGrid.SetColumn(shipStatusGrid, 5);
ShipAllAttributesGrid.SetColumn(shipStatusGrid, 6);
//ShipAllAttributesGrid.SetColumn(shipLabels[shipCounter].status, 6);
}
}
Expand Down
28 changes: 14 additions & 14 deletions logic/ClientTest/ClientTest.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\dependency\proto\Protos.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dependency\proto\Protos.csproj" />
</ItemGroup>

</Project>
42 changes: 42 additions & 0 deletions logic/ClientTest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//using Grpc.Core;
//using Protobuf;

namespace ClientTest
{
public class Program
{
public static Task Main(string[] args)
{
//Thread.Sleep(3000);
//Channel channel = new Channel("127.0.0.1:8888", ChannelCredentials.Insecure);
//var client = new AvailableService.AvailableServiceClient(channel);
//PlayerMsg playerInfo = new();
//playerInfo.PlayerId = 0;
//playerInfo.PlayerType = PlayerType.StudentPlayer;
//playerInfo.StudentType = StudentType.Athlete;
//var call = client.AddPlayer(playerInfo);
//MoveMsg moveMsg = new();
//moveMsg.PlayerId = 0;
//moveMsg.TimeInMilliseconds = 100;
//moveMsg.Angle = 0;
//int tot = 0;
///*while (await call.ResponseStream.MoveNext())
//{
// var currentGameInfo = call.ResponseStream.Current;
// if (currentGameInfo.GameState == GameState.GameStart) break;
//}*/
//while (true)
//{
// Thread.Sleep(50);
// MoveRes boolRes = client.Move(moveMsg);
// if (boolRes.ActSuccess == false) break;
// tot++;
// if (tot % 10 == 0) moveMsg.Angle += 1;

// Console.WriteLine("Move!");
//}

return Task.CompletedTask;
}
}
}
136 changes: 68 additions & 68 deletions logic/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,72 @@
//using Protobuf;

namespace Server
{
public class Program
{
// const string welcome =
//@"
// _____ _ _ _ _ _ ___ _____
// |_ _| | | | | | | / \ |_ _|___ |
// | | | |_| | | | |/ _ \ | | / /
// | | | _ | |_| / ___ \ | | / /
// |_| |_| |_|\___/_/ \_\___|/_/
//";
// static ServerBase CreateServer(ArgumentOptions options)
// {
// //return options.Playback ? new PlaybackServer(options) : new GameServer(options);
// return new PlaybackServer(options);
// }

static int Main(string[] args)
{
// foreach (var arg in args)
// {
// Console.Write($"{arg} ");
// }
// Console.WriteLine();

// ArgumentOptions? options = null;
// _ = Parser.Default.ParseArguments<ArgumentOptions>(args).WithParsed(o => { options = o; });
// if (options == null)
// {
// Console.WriteLine("Argument parsing failed!");
// return 1;
// }

// if (options.StartLockFile == "114514")
// {
// Console.WriteLine(welcome);
// }
// Console.WriteLine("Server begins to run: " + options.ServerPort.ToString());

// try
// {
// var server = CreateServer(options);
// Grpc.Core.Server rpcServer = new Grpc.Core.Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
// {
// Services = { AvailableService.BindService(server) },
// Ports = { new ServerPort(options.ServerIP, options.ServerPort, ServerCredentials.Insecure) }
// };
// rpcServer.Start();

// Console.WriteLine("Server begins to listen!");
// server.WaitForEnd();
// Console.WriteLine("Server end!");
// rpcServer.ShutdownAsync().Wait();

// Thread.Sleep(50);
// Console.WriteLine("");
// Console.WriteLine("=================== Final Score ====================");
// Console.WriteLine($"Team0: {server.GetScore()[0]}");
// Console.WriteLine($"Team1: {server.GetScore()[1]}");
// }
// catch (Exception ex)
// {
// Console.WriteLine(ex.ToString());
// Console.WriteLine(ex.StackTrace);
// }
return 0;
}
}
{
public class Program
{
// const string welcome =
//@"
// _____ _ _ _ _ _ ___ _____
// |_ _| | | | | | | / \ |_ _|___ |
// | | | |_| | | | |/ _ \ | | / /
// | | | _ | |_| / ___ \ | | / /
// |_| |_| |_|\___/_/ \_\___|/_/
//";
// static ServerBase CreateServer(ArgumentOptions options)
// {
// //return options.Playback ? new PlaybackServer(options) : new GameServer(options);
// return new PlaybackServer(options);
// }

static int Main(string[] args)
{
// foreach (var arg in args)
// {
// Console.Write($"{arg} ");
// }
// Console.WriteLine();

// ArgumentOptions? options = null;
// _ = Parser.Default.ParseArguments<ArgumentOptions>(args).WithParsed(o => { options = o; });
// if (options == null)
// {
// Console.WriteLine("Argument parsing failed!");
// return 1;
// }

// if (options.StartLockFile == "114514")
// {
// Console.WriteLine(welcome);
// }
// Console.WriteLine("Server begins to run: " + options.ServerPort.ToString());

// try
// {
// var server = CreateServer(options);
// Grpc.Core.Server rpcServer = new Grpc.Core.Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
// {
// Services = { AvailableService.BindService(server) },
// Ports = { new ServerPort(options.ServerIP, options.ServerPort, ServerCredentials.Insecure) }
// };
// rpcServer.Start();

// Console.WriteLine("Server begins to listen!");
// server.WaitForEnd();
// Console.WriteLine("Server end!");
// rpcServer.ShutdownAsync().Wait();

// Thread.Sleep(50);
// Console.WriteLine("");
// Console.WriteLine("=================== Final Score ====================");
// Console.WriteLine($"Team0: {server.GetScore()[0]}");
// Console.WriteLine($"Team1: {server.GetScore()[1]}");
// }
// catch (Exception ex)
// {
// Console.WriteLine(ex.ToString());
// Console.WriteLine(ex.StackTrace);
// }
return 0;
}
}
}
Loading

0 comments on commit b027287

Please sign in to comment.