초기 커밋.

This commit is contained in:
2026-04-01 20:20:09 +09:00
parent c286f362e5
commit fd1a2cba32
172 changed files with 43588 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib
{
public class DataRequestManager
{
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,184 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib
{
/// <summary>
/// DB와 MAnager간의 데이터의 정의에 관련된 클래스.
/// </summary
public static class DBDefine
{
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.42.188.8:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.53.30.8:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@localhost:50003"; //public static string MONGODB주소 = "mongodb://root:veryhardpassword123@203.251.148.27:50002";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@121.131.226.38:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@14.39.226.156:50003";
public static string MONGODB주소 = "mongodb://root:veryhardpassword123@121.131.226.37:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@192.168.200.178:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.171.119.9:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@10.100.9.186:50003"
//;
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@211.171.119.9:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@localhost:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@14.39.226.145:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@192.168.0.92:50003";
//public static string MONGODB주소 = "mongodb://root:veryhardpassword123@218.152.33.43:50003"; //사무실
internal static string = "data/ko_KR/champion.json";
internal static string = "data/en_US/runesReforged.json";
public static void (string recvDBAddress)
{
MONGODB주소 = "mongodb://root:veryhardpassword123@"+recvDBAddress+":50003";
}
public enum
{
,
,
,
,
}
public enum
{
[StringValue("밴데이터")]
,
[StringValue("픽데이터")]
,
[StringValue("현재골드량선수")]
,
[StringValue("현재데미지량선수")]
,
[StringValue("경험치레벨")]
,
[StringValue("오브젝트킬")]
,
[StringValue("룬데이터")]
,
[StringValue("골드차이팀")]
,
[StringValue("타워철거전체")]
,
[StringValue("타워골드데이터")]
,
[StringValue("경기종료정보")]
,
[StringValue("팟지")]
,
[StringValue("킬뎃어시")]
,
[StringValue("용리스폰")]
,
//[StringValue("아타칸리스폰")]
//아타칸리스폰,
[StringValue("한타딜량범위")]
,
[StringValue("퀘스트완료여부")]
}
public enum RequestDataType
{
BAN_AND_PICK,
GAME_STATUS,
OBJECT_EVENT,
DRAGON_RESPAWN,
ATAKHAN_RESPAWN,
STRUCT_EVENT,
STRUCT_GOLD_EVENT
}
public enum
{
= 100,
= 200
}
public enum
{
= 1,
= 2,
= 3,
= 4,
= 5
}
public enum
{
= 0,
= 1,
= 2
}
public static string GetStringValue(this Enum value)
{
// Get the type
Type type = value.GetType();
// Get fieldinfo for this type
FieldInfo fieldInfo = type.GetField(value.ToString());
// Get the stringvalue attributes
StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(
typeof(StringValueAttribute), false) as StringValueAttribute[];
// Return the first if there was a match.
return attribs.Length > 0 ? attribs[0].StringValue : null;
}
public class StringValueAttribute : Attribute
{
#region Properties
/// <summary>
/// Holds the stringvalue for a value in an enum.
/// </summary>
public string StringValue { get; protected set; }
#endregion
#region Constructor
/// <summary>
/// Constructor used to init a StringValue Attribute
/// </summary>
/// <param name="value"></param>
public StringValueAttribute(string value)
{
this.StringValue = value;
}
#endregion
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib
{
public interface IDataRequest
{
DataTable (DBDefine. , List<DataTable> );
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib
{
/// <summary>
/// 클라이언트에게 타이머에 관련된 데이터를 콜백으로 드롭하기위한 인터페이스
/// </summary>
public interface IGameTimeEventDrop
{
void (int );
void (string , int _단위_초);
//void 아타칸리스폰정보(string 아타칸종류, int 남은시간_단위_초);
void (string , string , int _단위_초);
void (string , string , int _단위_초, int );
void (DataTable );
void (DataTable );
void (int , int );
void (DataTable );
}
}

View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1923EB44-9E99-4198-8E08-008A98B7D673}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LolDataRequestLib</RootNamespace>
<AssemblyName>LolDataRequestLib</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DnsClient, Version=1.4.0.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
<HintPath>..\packages\DnsClient.1.4.0\lib\net471\DnsClient.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Bson, Version=2.12.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Bson.2.12.3\lib\net452\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver, Version=2.12.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.2.12.3\lib\net452\MongoDB.Driver.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.12.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.Core.2.12.3\lib\net452\MongoDB.Driver.Core.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Libmongocrypt, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Libmongocrypt.1.2.1\lib\net452\MongoDB.Libmongocrypt.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.23.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>..\packages\SharpCompress.0.23.0\lib\net45\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IGameTimeEventDrop.cs" />
<Compile Include="RequestData\ARequestData.cs" />
<Compile Include="DataManager.cs" />
<Compile Include="Define.cs" />
<Compile Include="IDataRequest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RequestData\AtakhanRequest.cs" />
<Compile Include="RequestData\DragonRequest.cs" />
<Compile Include="RequestData\StructDataRequest.cs" />
<Compile Include="RequestData\ObjectDataRequest.cs" />
<Compile Include="RequestData\GameStatusRequest.cs" />
<Compile Include="RequestData\BanPickRequest.cs" />
<Compile Include="RequestData\StructGoldDataRequest.cs" />
<Compile Include="ResponseData\AResponseData.cs" />
<Compile Include="ResponseData\IResponseData.cs" />
<Compile Include="ResponseData\있는데이터\KDA선수.cs" />
<Compile Include="ResponseData\있는데이터\아타칸데이터.cs" />
<Compile Include="ResponseData\있는데이터\용데이터.cs" />
<Compile Include="ResponseData\없는데이터\한타딜량범위.cs" />
<Compile Include="ResponseData\없는데이터\팟지선수.cs" />
<Compile Include="ResponseData\없는데이터\골드차이팀.cs" />
<Compile Include="ResponseData\없는데이터\경기종료정보.cs" />
<Compile Include="ResponseData\없는데이터\룬데이터.cs" />
<Compile Include="ResponseData\있는데이터\오브젝트킬전체.cs" />
<Compile Include="ResponseData\있는데이터\경험치레벨선수.cs" />
<Compile Include="ResponseData\있는데이터\누적데미지선수.cs" />
<Compile Include="ResponseData\있는데이터\골드획득량선수.cs" />
<Compile Include="ResponseData\있는데이터\퀘스트완료여부.cs" />
<Compile Include="ResponseData\있는데이터\타워골드데이터.cs" />
<Compile Include="ResponseData\있는데이터\타워파괴전체.cs" />
<Compile Include="ResponseData\있는데이터\픽데이터.cs" />
<Compile Include="ResponseData\있는데이터\밴데이터.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Core\Compression\Snappy\lib\win\snappy32.dll" />
<Content Include="Core\Compression\Snappy\lib\win\snappy64.dll" />
<Content Include="Core\Compression\Zstandard\lib\win\libzstd.dll" />
<Content Include="mongocrypt.dll" />
</ItemGroup>
<ItemGroup>
<None Include="libmongocrypt.dylib" />
<None Include="libmongocrypt.so" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MongoDB.Libmongocrypt.1.2.1\build\MongoDB.Libmongocrypt.targets" Condition="Exists('..\packages\MongoDB.Libmongocrypt.1.2.1\build\MongoDB.Libmongocrypt.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MongoDB.Libmongocrypt.1.2.1\build\MongoDB.Libmongocrypt.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Libmongocrypt.1.2.1\build\MongoDB.Libmongocrypt.targets'))" />
<Error Condition="!Exists('..\packages\MongoDB.Driver.Core.2.12.3\build\MongoDB.Driver.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Driver.Core.2.12.3\build\MongoDB.Driver.Core.targets'))" />
</Target>
<Import Project="..\packages\MongoDB.Driver.Core.2.12.3\build\MongoDB.Driver.Core.targets" Condition="Exists('..\packages\MongoDB.Driver.Core.2.12.3\build\MongoDB.Driver.Core.targets')" />
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("LolDataRequestLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LolDataRequestLib")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("1923eb44-9e99-4198-8e08-008a98b7d673")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,253 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace LolDataRequestLib
{
/// <summary>
/// 실시간으로 업데이트를 해야하는 데이터들의 추상팩토리클래스.
/// </summary>
internal abstract class ARequestData
{
/// <summary>
/// DB Access 클라이언트.
/// </summary>
protected MongoClient mDBClient = new MongoClient(DBDefine.MONGODB주소);
/// <summary>
/// DB데이터베이스.
/// </summary>
protected IMongoDatabase eventDataBase = null;
/// <summary>
/// 가장 최근에 업데이트했던 데이터의 인덱스.
/// 같은 데이터를 계속 업데이트 하는 것을 막는다.
/// </summary>
protected int mLastDataSequanceIndex = 0;
/// <summary>
/// 데이터를 가져올 DB 컬렉션(테이블) 이름
/// </summary>
protected string mCollectionName = "";
/// <summary>
/// db에서 가져와서 manager에 업데이트하기위해 가공된 BsonValue
/// </summary>
protected BsonValue mUpdatedBsonValue = null;
/// <summary>
/// 인스턴스를 생산하기위해 요청된 데이터타입.
/// </summary>
protected DBDefine.RequestDataType mRequestType = DBDefine.RequestDataType.BAN_AND_PICK;
/// <summary>
/// 팩토리 Create메서드
/// </summary>
/// <param name="recvRequestType"></param>
/// <returns></returns>
internal static ARequestData createRequestFactory(DBDefine.RequestDataType recvRequestType)
{
ARequestData bufInstance = null;
try
{
switch (recvRequestType)
{
case DBDefine.RequestDataType.BAN_AND_PICK:
bufInstance = new BanPickRequest();
bufInstance.mCollectionName = "champ_select";
break;
case DBDefine.RequestDataType.GAME_STATUS:
bufInstance = new GameStatusRequest();
bufInstance.mCollectionName = "stats_update";
break;
case DBDefine.RequestDataType.OBJECT_EVENT:
bufInstance = new ObjectDataRequest();
bufInstance.mCollectionName = "epic_monster_kill";
break;
case DBDefine.RequestDataType.STRUCT_EVENT:
bufInstance = new StructDataRequest();
bufInstance.mCollectionName = "building_destroyed";
break;
case DBDefine.RequestDataType.DRAGON_RESPAWN:
bufInstance = new DragonRequest();
bufInstance.mCollectionName = "queued_dragon_info";
break;
case DBDefine.RequestDataType.ATAKHAN_RESPAWN:
bufInstance = new AtakhanRequest();
bufInstance.mCollectionName = "queued_epic_monster_info";
break;
case DBDefine.RequestDataType.STRUCT_GOLD_EVENT:
bufInstance = new StructGoldDataRequest();
bufInstance.mCollectionName = "building_gold_grant";
break;
}
//조회를 위한 RequestType등록.
bufInstance.mRequestType = recvRequestType;
//데이터베이스(Schema)선택
bufInstance.eventDataBase = bufInstance.mDBClient.GetDatabase("datalol");
//ThreadPool에 업데이트워크를 등록
ThreadPool.QueueUserWorkItem(o => { bufInstance.UpdateWorker(); });
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return bufInstance;
}
/// <summary>
/// 인스턴스의 DB주소를 변경
/// 20210614 현재 사용하지 않는다.
/// Mongodb의 커넥션 인스턴스가 Mariadb와 달라서 비슷하게 접근했다가 Connection이 Disconnect되는 현상이 계속 발생했다.
/// </summary>
internal void resetDBAddress()
{
mDBClient = new MongoClient(DBDefine.MONGODB주소);
}
/// <summary>
/// 업데이트 인덱스를 초기화한다.
/// 20210608 첫용이 업데이트 되지 않는 버그를 수정하면서 추가.
/// </summary>
internal void initIndex()
{
this.mLastDataSequanceIndex = 0;
}
/// <summary>
/// 인스턴스내에 데이터를 업데이트 하는 워커메서드.
/// 해당메서드를 스레드풀에 넣고 반복문을 통해 계속 업데이트한다.
/// </summary>
internal void UpdateWorker()
{
while (DataManager.getInstance().IsupdateWorkersWork)
{
try
{
//DB에서 데이터를 가져온다.
this.requestDataMongoDB();
//조회되는 데이터가 없을경우 테이블을 비운다.
if (mUpdatedBsonValue == null)
{
this.exchangeTable();
}
//조회되는 데이터가 기존 데이터와 INDEX가 같지 않을경우 데이터를 업데이트한다.
else if (mUpdatedBsonValue["sequenceIndex"].ToInt32() != this.mLastDataSequanceIndex)
{
this.exchangeTable();
this.mLastDataSequanceIndex = mUpdatedBsonValue["sequenceIndex"].ToInt32();
}
//조회 후 인터벌 시간동안 슬립.
Thread.Sleep(DataManager.getInstance().);
}
catch (Exception ex)
{
//DataManager.getInstance().mCallback.errorReceivedByWorker(요청데이터, ex.ToString());
//break;
#if(DEBUG)
{
Console.WriteLine(ex.ToString());
}
#endif
}
}
}
/// <summary>
/// DB에서 데이터를 요청하는 메서드.
/// </summary>
protected virtual void requestDataMongoDB()
{
try
{
//var filter = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var projection = Builders<BsonDocument>.Projection
.Exclude("_id")
.Include("eventDocument");
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
.Find(new BsonDocument())//.Find(filter)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.Limit(1)
.ToList();
if (documents.Count != 0)
{
mUpdatedBsonValue = documents.Last()["eventDocument"];
}
else
{
mUpdatedBsonValue = null;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
void exchangeTable()
{
try
{
Dictionary<int, BsonValue> bufHash = null;
switch (this.mRequestType)
{
case DBDefine.RequestDataType.BAN_AND_PICK:
DataManager.getInstance(). = this.mUpdatedBsonValue;
break;
case DBDefine.RequestDataType.GAME_STATUS:
DataManager.getInstance(). = this.mUpdatedBsonValue;
//DataManager.getInstance().경기시간 = this.mUpdatedBsonValue["gameTime"].ToInt32() / 1000;
//Console.WriteLine("gametime : " + this.mUpdatedBsonValue["gameTime"].ToInt32() / 1000);
break;
case DBDefine.RequestDataType.OBJECT_EVENT:
DataManager.getInstance(). = this.mUpdatedBsonValue;
break;
case DBDefine.RequestDataType.STRUCT_EVENT:
DataManager.getInstance(). = this.mUpdatedBsonValue;
break;
case DBDefine.RequestDataType.DRAGON_RESPAWN:
DataManager.getInstance(). = this.mUpdatedBsonValue;
break;
case DBDefine.RequestDataType.STRUCT_GOLD_EVENT:
DataManager.getInstance(). = this.mUpdatedBsonValue;
break;
//case DBDefine.RequestDataType.ATAKHAN_RESPAWN:
// DataManager.getInstance().아타칸리스폰 = this.mUpdatedBsonValue;
// break;
}
}
catch(Exception ex) { }
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class AtakhanRequest : ARequestData
{
protected override void requestDataMongoDB()
{
try
{
//var subFilterGameID = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var projection =
MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>
("{'eventDocument.monsterName' : 1, 'eventDocument.sequenceIndex' : 1, 'eventDocument.gameTime' : 1}");
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
.Find(new BsonDocument()) //.Find(subFilterGameID)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.ToList();
if (documents.Count == 0)
{
mUpdatedBsonValue = null;
return;
}
BsonDocument rtnValue = new BsonDocument();
foreach (BsonDocument item in documents)
{
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), item["eventDocument"].ToBsonDocument());
}
rtnValue.Add("sequenceIndex", documents.First()["eventDocument"]["sequenceIndex"].ToInt32());
mUpdatedBsonValue = rtnValue;
}
catch (Exception ex) { }
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class BanPickRequest : ARequestData
{
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class DragonRequest : ARequestData
{
protected override void requestDataMongoDB()
{
try
{
//var subFilterGameID = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var projection =
MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>
("{'eventDocument.nextDragonName' : 1, 'eventDocument.sequenceIndex' : 1, 'eventDocument.nextDragonSpawnTime' : 1}");
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
.Find(new BsonDocument()) //.Find(subFilterGameID)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.ToList();
if (documents.Count == 0)
{
mUpdatedBsonValue = null;
return;
}
BsonDocument rtnValue = new BsonDocument();
foreach (BsonDocument item in documents)
{
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), item["eventDocument"].ToBsonDocument());
}
rtnValue.Add("sequenceIndex", documents.First()["eventDocument"]["sequenceIndex"].ToInt32());
mUpdatedBsonValue = rtnValue;
}
catch (Exception ex) { }
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class GameStatusRequest : ARequestData
{
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class ObjectDataRequest : ARequestData
{
protected override void requestDataMongoDB()
{
try
{
//var subFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.gameTime' : {$gt : " + calculatedTime + " }}");
var subFilterMonsterSort = //Builders<BsonDocument>.Filter.ElemMatch("eventDocument",
Builders<BsonDocument>.Filter.Or(
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "dragon"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "riftHerald"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "baron"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "VoidGrub"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "RuinousAtakhan"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "VoraciousAtakhan"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.monsterType"], "ThornboundAtakhan")
);
//var subFilterGameID = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var filter = Builders<BsonDocument>.Filter.And(subFilterMonsterSort); //var filter = Builders<BsonDocument>.Filter.And(subFilterGameID, subFilterMonsterSort);
//var filter = Builders<BsonDocument>.Filter.And(subFilterGameID);
var projection = Builders<BsonDocument>.Projection
.Exclude("_id")
.Include("eventDocument");
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
.Find(filter)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.ToList();
if (documents.Count == 0)
{
mUpdatedBsonValue = null;
return;
}
BsonDocument rtnValue = new BsonDocument();
foreach (BsonDocument item in documents)
{
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), item["eventDocument"].ToBsonDocument());
}
rtnValue.Add("sequenceIndex", documents.First()["eventDocument"]["sequenceIndex"].ToInt32());
mUpdatedBsonValue = rtnValue;
}
catch(Exception ex) { }
}
}
}

View File

@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class StructDataRequest : ARequestData
{
protected override void requestDataMongoDB()
{
try
{
//var subFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.gameTime' : {$gt : " + calculatedTime + " }}");
var subFilterMonsterSort = //Builders<BsonDocument>.Filter.ElemMatch("eventDocument",
Builders<BsonDocument>.Filter.Or(
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.buildingType"], "turret"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.buildingType"], "inhibitor")
);
//var subFilterGameID = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var filter = Builders<BsonDocument>.Filter.And(subFilterMonsterSort); //var filter = Builders<BsonDocument>.Filter.And(subFilterGameID, subFilterMonsterSort);
var projection = Builders<BsonDocument>.Projection
.Exclude("_id")
.Include("eventDocument");
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
.Find(filter)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.ToList();
/*
var filter = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var subFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>(
"{'eventDocument.sequenceIndex' : 1,'eventDocument.teamID' : 1, 'eventDocument.gameTime' : 1, 'eventDocument.lane' : 1, 'eventDocument.turretTier' : 1, 'eventDocument.buildingType' : 1}");
List<BsonDocument> documents = this.eventDataBase.GetCollection<BsonDocument>("building_destroyed")
.Find(filter)
.SortBy(x => x["sequenceIndex"])
.Project(subFilter)
.ToList();
*/
if (documents.Count == 0)
{
mUpdatedBsonValue = null;
return;
}
BsonDocument rtnValue = new BsonDocument();
foreach (BsonDocument item in documents)
{
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), item["eventDocument"].ToBsonDocument());
}
rtnValue.Add("sequenceIndex", documents.Last()["eventDocument"]["sequenceIndex"].ToInt32());
mUpdatedBsonValue = rtnValue;
}
catch(Exception ex) { }
}
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
namespace LolDataRequestLib
{
class StructGoldDataRequest : ARequestData
{
protected override void requestDataMongoDB()
{
try
{
var subFilterMonsterSort =
Builders<BsonDocument>.Filter.Or(
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.source"], "turretPlate"),
Builders<BsonDocument>.Filter.Eq(e => e["eventDocument.source"], "turret")
);
var filter = Builders<BsonDocument>.Filter.And(subFilterMonsterSort);
var projection = Builders<BsonDocument>.Projection
.Exclude("_id")
.Include("eventDocument");
List<BsonDocument> documents = eventDataBase.GetCollection<BsonDocument>(this.mCollectionName)
.Find(filter)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.ToList();
if (documents.Count == 0)
{
mUpdatedBsonValue = null;
return;
}
BsonDocument rtnValue = new BsonDocument();
foreach (BsonDocument item in documents)
{
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), item["eventDocument"].ToBsonDocument());
}
rtnValue.Add("sequenceIndex", documents.Last()["eventDocument"]["sequenceIndex"].ToInt32());
mUpdatedBsonValue = rtnValue;
}
catch (Exception ex) { }
}
}
}

View File

@@ -0,0 +1,33 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
internal abstract class AResponseData : IResponseData
{
protected MongoClient mDBClient = new MongoClient(DBDefine.MONGODB주소);
protected IMongoDatabase mEventDataBase = null;
public DataTable () {
mEventDataBase = mDBClient.GetDatabase("datalol");
return buildDataForResponse(getDataFromMongo());
}
protected abstract BsonDocument getDataFromMongo();
protected abstract DataTable buildDataForResponse(BsonDocument recvDocument);
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib
{
internal interface IResponseData
{
DataTable ();
}
}

View File

@@ -0,0 +1,68 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
internal class : AResponseData
{
protected override DataTable buildDataForResponse(BsonDocument recvDocument)
{
BsonValue bufGameEndData = null;
if (recvDocument != null)
{
bufGameEndData = recvDocument["eventDocument"];
}
DataTable gameEndData = new DataTable();
try
{
gameEndData.TableName = DBDefine...ToString();
gameEndData.Columns.Add("승리팀");
gameEndData.Columns.Add("경기시간");
DataRow bufRow = gameEndData.NewRow();
bufRow["승리팀"] = (DBDefine.)bufGameEndData["winningTeam"].ToInt32();
bufRow["경기시간"] = bufGameEndData["gameTime"].ToInt32() / 1000;
gameEndData.Rows.Add(bufRow);
}
catch(Exception ex) { }
return gameEndData;
}
protected override BsonDocument getDataFromMongo()
{
//var filter = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var projection = Builders<BsonDocument>.Projection
.Exclude("_id")
.Include("eventDocument");
List<BsonDocument> documents = mEventDataBase.GetCollection<BsonDocument>("game_end")
.Find(new BsonDocument()) //.Find(filter)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.Limit(1)
.ToList();
return documents.Last();
}
}
}

View File

@@ -0,0 +1,155 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
internal class : AResponseData
{
protected override DataTable buildDataForResponse(BsonDocument recvDocument)
{
List<BsonElement> bufPlayerDataList = null;
if (recvDocument != null)
{
bufPlayerDataList = recvDocument.Elements.ToList();
}
DataTable goldData = new DataTable();
goldData.TableName = DBDefine...ToString();
goldData.Columns.Add("블루팀골드량");
goldData.Columns.Add("레드팀골드량");
goldData.Columns.Add("골드차");
goldData.Columns.Add("골드차블루최대");
goldData.Columns.Add("골드차레드최대");
goldData.Columns.Add("초");
int = 0;
int = 0;
foreach (BsonElement item in bufPlayerDataList)
{
DataRow bufRow = goldData.NewRow();
BsonArray itemValue = item.Value.ToBsonDocument()["teams"].AsBsonArray;
int = 0;
int = 0;
foreach (BsonValue itemTeam in itemValue)
{
if (itemTeam["teamID"].ToInt32() == (int)DBDefine..)
{
= itemTeam["totalGold"].ToInt32();
}
else
{
= itemTeam["totalGold"].ToInt32();
}
}
bufRow["블루팀골드량"] = ;
bufRow["레드팀골드량"] = ;
bufRow["골드차"] = - ;
if ( < ( - ))
{
= ( - );
}
if ( < ( - ))
{
= ( - );
}
bufRow["골드차블루최대"] = ;
bufRow["골드차레드최대"] = * -1;
bufRow["초"] = item.Value["gameTime"].ToInt32() / 1000;
goldData.Rows.Add(bufRow);
}
return goldData;
}
protected override BsonDocument getDataFromMongo()
{
// 필요한 필드만 포함하는 필터 문서를 생성합니다.
var subFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.playbackID' : 1, 'eventDocument.teams.totalGold' : 1, 'eventDocument.teams.teamID' : 1, 'eventDocument.sequenceIndex' : 1, " +
"'eventDocument.gameTime' : 1, 'eventDocument.parentGameID': 1, 'eventDocument.repeater_timestamp': 1}");
//var subFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.playbackID' : 1, 'eventDocument.teams.totalGold' : 1, 'eventDocument.teams.teamID' : 1,'eventDocument.sequenceIndex' : 1, 'eventDocument.gameTime' : 1}");
// MongoDB 컬렉션 "stats_update"에서 전체 문서를 가져오고 필요한 필드만 Projection합니다.
List<BsonDocument> documents = mEventDataBase.GetCollection<BsonDocument>("stats_update")
.Find(new BsonDocument())
.Project(subFilter)
.ToList();
//documents = documents.OrderBy(r => r["eventDocument"]["sequenceIndex"].ToInt32()).ToList();
documents = documents.OrderBy(r => DateTime.Parse(r["eventDocument"]["repeater_timestamp"].AsString)).ToList();
BsonDocument rtnValue = new BsonDocument();
// 이전 이벤트의 RequestGameID를 저장할 변수입니다.
string previousRequestGameID = null;
foreach (BsonDocument item in documents)
{
try
{
// 현재 이벤트의 RequestGameID 값을 추출합니다.
string currentRequestGameID = item["eventDocument"]["parentGameID"].ToString();
// 롤백 상황 감지:
// 이전 이벤트의 RequestGameID가 존재하고, 현재 이벤트의 값과 다르다면
// 이는 롤백 후 새로운 게임 데이터가 들어왔음을 의미합니다.
if (previousRequestGameID != null && !currentRequestGameID.Equals(previousRequestGameID))
{
// 현재 이벤트의 gameTime을 롤백 기준으로 설정합니다.
int rollbackThreshold = item["eventDocument"]["gameTime"].ToInt32();
// 지금까지 모아둔 데이터(rtnValue) 중 gameTime이 rollbackThreshold 미만인 이벤트만 유지합니다.
List<BsonElement> filteredElements = rtnValue.ToList()
.Where(d => d.Value["gameTime"].ToInt32() < rollbackThreshold)
.ToList();
rtnValue = new BsonDocument(filteredElements);
}
// 현재 이벤트 정보를 새 BsonDocument로 준비합니다.
BsonDocument bufDocument = new BsonDocument();
bufDocument.Add("gameTime", item["eventDocument"]["gameTime"].ToInt32());
bufDocument.Add("teams", item["eventDocument"]["teams"].AsBsonArray);
bufDocument.Add("playback", item["eventDocument"]["playbackID"].ToString());
bufDocument.Add("parentGameID", item["eventDocument"]["parentGameID"]);
// sequenceIndex 값을 Key로 하여 해당 이벤트를 rtnValue에 추가합니다.
rtnValue.Add(item["eventDocument"]["sequenceIndex"].ToString(), bufDocument);
// 다음 반복을 위해 이전 RequestGameID를 업데이트합니다.
previousRequestGameID = currentRequestGameID;
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
return rtnValue;
}
}
}

View File

@@ -0,0 +1,133 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
internal class : AResponseData
{
protected override DataTable buildDataForResponse(BsonDocument recvDocument)
{
BsonArray bufPlayerDataList = null;
DataTable = new DataTable();
.TableName = DBDefine...ToString();
.Columns.Add("팀");
.Columns.Add("선수이름");
.Columns.Add("챔피언이름");
.Columns.Add("메인룬스타일");
.Columns.Add("메인룬이름");
.Columns.Add("서브룬스타일");
.Columns.Add("서브룬이름");
.Columns.Add("룬1");
.Columns.Add("룬2");
.Columns.Add("룬3");
.Columns.Add("룬4");
.Columns.Add("룬5");
.Columns.Add("룬6");
.Columns.Add("룬7");
.Columns.Add("룬8");
.Columns.Add("룬9");
.Columns.Add("룬10");
.Columns.Add("룬배열");
if (recvDocument == null)
{
return ;
}
bufPlayerDataList = recvDocument["eventDocument"]["participants"].AsBsonArray;
foreach (BsonValue item in bufPlayerDataList)
{
DataRow bufRow = .NewRow();
bufRow["팀"] = (DBDefine.)item["teamID"].ToInt32();
bufRow["선수이름"] = item["summonerName"].ToString();
bufRow["챔피언이름"] = item["championName"].ToString();
if (!item.AsBsonDocument.Contains("perks"))
{
continue;
}
int = item["perks"][0]["perkStyle"].ToInt32();
bufRow["메인룬스타일"] = ;
if (DataManager.getInstance().mRuneTable.ContainsKey())
{
bufRow["메인룬이름"] = DataManager.getInstance().mRuneTable[];
}
int = item["perks"][0]["perkSubStyle"].ToInt32();
bufRow["서브룬스타일"] = ;
if (DataManager.getInstance().mRuneTable.ContainsKey())
{
bufRow["서브룬이름"] = DataManager.getInstance().mRuneTable[];
}
bufRow["룬배열"] = item["perks"][0]["perkIds"].ToString();
BsonArray runeArray = item["perks"][0]["perkIds"].AsBsonArray;
if (runeArray.Count != 0)
{
for (int i = 1; i < runeArray.Count + 1; i++)
{
int runeID = runeArray[i - 1].ToInt32();
if (DataManager.getInstance().mRuneTable.ContainsKey(runeID))
{
bufRow["룬" + i] = DataManager.getInstance().mRuneTable[runeID];
}
}
}
.Rows.Add(bufRow);
}
return ;
}
protected override BsonDocument getDataFromMongo()
{
//var filter = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var projection = Builders<BsonDocument>.Projection
.Exclude("_id")
.Include("eventDocument");
List<BsonDocument> documents = mEventDataBase.GetCollection<BsonDocument>("game_info")
.Find(new BsonDocument()) //.Find(filter)
.SortByDescending(x => x["sequenceIndex"])
.Project(projection)
.Limit(1)
.ToList();
if (documents.Count == 0)
{
return null;
}
return documents.Last();
}
}
}

View File

@@ -0,0 +1,400 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
internal class : AResponseData
{
private int nullToZero(string value)
{
try
{
return Convert.ToInt32(value);
}
catch(Exception e)
{
return 0;
}
}
private double nullToZeroD(string value)
{
try
{
return Convert.ToDouble(value);
}
catch (Exception e)
{
return 0;
}
}
protected override DataTable buildDataForResponse(BsonDocument recvDocument)
{
DataTable = new DataTable();
.TableName = DBDefine...ToString();
//선수관련
.Columns.Add("게임시간");
.Columns.Add("누적된분");
.Columns.Add("팀구분");
.Columns.Add("선수아이디");
.Columns.Add("챔피언");
//KDA
.Columns.Add("킬");
.Columns.Add("데스");
.Columns.Add("어시스트");
//데미지관련
.Columns.Add("가한데미지");
.Columns.Add("받은데미지");
.Columns.Add("팀원에게준힐량");
.Columns.Add("팀원의데미지를막아낸실드량");
//분당데미지관련
.Columns.Add("분당가한데미지");
.Columns.Add("분당받은데미지");
.Columns.Add("분당팀원에게준힐량");
.Columns.Add("분당팀원의데미지를막아낸실드량");
///스코어관련
.Columns.Add("크립스코어");
.Columns.Add("경험치");
.Columns.Add("분당크립스코어");
.Columns.Add("비전스코어");
.Columns.Add("설치한와드수");
.Columns.Add("부순와드수");
.Columns.Add("골드획득량");
.Columns.Add("분당골드획득량");
//CC
.Columns.Add("군중제어점수");
.Columns.Add("다른챔피언에CC기를건시간");
//추가
.Columns.Add("킬관여율");
.Columns.Add("골드당데미지");
.Columns.Add("팀내데미지비중");
//2022 데이터 추가 중립크립스코어
.Columns.Add("라인크립스코어");
.Columns.Add("정글크립스코어");
//2022 데이터 추가 현상금
.Columns.Add("현재현상금");
if (m팟지데이터들.Count == 0 || m팀데이터들.Count == 0)
{
return ;
}
Dictionary<int, int> _킬_수 = new Dictionary<int, int>();
Dictionary<int, int> _킬_수 = new Dictionary<int, int>();
foreach (BsonDocument item in m팀데이터들)
{
BsonArray bufTeamArray = item.Values.Last().AsBsonArray;
foreach (BsonValue itemTeam in bufTeamArray)
{
if (itemTeam["teamID"].ToInt32() == (int)DBDefine..)
{
_킬_수.Add(Convert.ToInt32(item.Names.Last()), nullToZero(itemTeam["championsKills"].ToString()));
}
else
{
_킬_수.Add(Convert.ToInt32(item.Names.Last()), nullToZero(itemTeam["championsKills"].ToString()));
}
}
}
Dictionary<int, double> _데미지_합 = new Dictionary<int, double>();
Dictionary<int, double> _데미지_합 = new Dictionary<int, double>();
foreach (BsonDocument item in m팟지데이터들)
{
int gameTime = Convert.ToInt32(item.Names.Last());
double gameTimeMin = Convert.ToDouble(gameTime) / 60.0;
BsonArray bufPlayersData = item.Values.Last().AsBsonArray;
foreach (var itemPlayer in bufPlayersData)
{
DataRow bufRow = .NewRow();
bufRow["게임시간"] = gameTime;
bufRow["누적된분"] = gameTimeMin;
bufRow["팀구분"] = (DBDefine.)itemPlayer["teamID"].ToInt32();
bufRow["선수아이디"] = itemPlayer["playerName"].ToString();
bufRow["챔피언"] = itemPlayer["championName"].ToString();
//스텟이 아닌 선수정보에 있는 것들
bufRow["경험치"] = itemPlayer["XP"].ToInt32();
bufRow["골드획득량"] = itemPlayer["totalGold"].ToInt32();
bufRow["분당골드획득량"] = itemPlayer["totalGold"].ToDouble() / (gameTimeMin);
bufRow["현재현상금"] = itemPlayer["shutdownValue"].ToInt32();
BsonArray bufStats = itemPlayer["stats"].AsBsonArray;
foreach (BsonValue itemStats in bufStats)
{
switch (itemStats["name"].ToString())
{
case "CHAMPIONS_KILLED":
try { bufRow["킬"] = itemStats["value"].ToString(); }
catch (Exception ex) { bufRow["킬"] = "0"; }
break;
case "NUM_DEATHS":
try { bufRow["데스"] = itemStats["value"].ToString(); }
catch (Exception ex) { bufRow["데스"] = "0"; }
break;
case "ASSISTS":
try { bufRow["어시스트"] = itemStats["value"].ToString(); }
catch (Exception ex) { bufRow["어시스트"] = "0"; }
break;
//데미지관련
case "TOTAL_DAMAGE_DEALT_TO_CHAMPIONS":
bufRow["가한데미지"] = itemStats["value"].ToInt32();
bufRow["분당가한데미지"] = itemStats["value"].ToDouble() / (gameTimeMin);
bufRow["골드당데미지"] = itemStats["value"].ToDouble() / itemPlayer["totalGold"].ToDouble();
if ((DBDefine.)itemPlayer["teamID"].ToInt32() == DBDefine..)
{
if (!_데미지_합.ContainsKey(Convert.ToInt32(bufRow["게임시간"])))
{
_데미지_합.Add(Convert.ToInt32(bufRow["게임시간"]), itemStats["value"].ToInt32());
}
else
{
_데미지_합[Convert.ToInt32(bufRow["게임시간"])] += itemStats["value"].ToInt32();
}
}
else
{
if (!_데미지_합.ContainsKey(Convert.ToInt32(bufRow["게임시간"])))
{
_데미지_합.Add(Convert.ToInt32(bufRow["게임시간"]), itemStats["value"].ToInt32());
}
else
{
_데미지_합[Convert.ToInt32(bufRow["게임시간"])] += itemStats["value"].ToInt32();
}
}
break;
case "TOTAL_DAMAGE_TAKEN":
bufRow["받은데미지"] = itemStats["value"].ToInt32();
bufRow["분당받은데미지"] = itemStats["value"].ToDouble() / (gameTimeMin);
break;
case "TOTAL_HEAL_ON_TEAMMATES":
bufRow["팀원에게준힐량"] = itemStats["value"].ToInt32();
bufRow["분당팀원에게준힐량"] = itemStats["value"].ToDouble() / (gameTimeMin);
break;
case "TOTAL_DAMAGE_SHIELDED_ON_TEAMMATES":
bufRow["팀원의데미지를막아낸실드량"] = itemStats["value"].ToInt32();
bufRow["분당팀원의데미지를막아낸실드량"] = itemStats["value"].ToDouble() / (gameTimeMin);
break;
///스코어관련
case "MINIONS_KILLED":
bufRow["라인크립스코어"] = nullToZero(itemStats["value"].ToString());
//bufRow["분당크립스코어수급량"] = itemStats["value"].ToDouble()/(gameTimeMin);
break;
case "NEUTRAL_MINIONS_KILLED":
bufRow["정글크립스코어"] = itemStats["value"].ToInt32();
break;
case "VISION_SCORE":
bufRow["비전스코어"] = itemStats["value"].ToInt32();
break;
case "WARD_PLACED":
bufRow["설치한와드수"] = itemStats["value"].ToString();
break;
case "WARD_KILLED":
bufRow["부순와드수"] = itemStats["value"].ToString();
break;
case "TOTAL_TIME_CROWD_CONTROL_DEALT":
bufRow["군중제어점수"] = itemStats["value"].ToString();
break;
case "TIME_CCING_OTHERS":
bufRow["다른챔피언에CC기를건시간"] = itemStats["value"].ToString();
break;
}
}
//bufRow["크립스코어"] = Convert.ToInt32(bufRow["라인크립스코어"]) + Convert.ToInt32(bufRow["정글크립스코어"]);
//bufRow["분당크립스코어"] = Convert.ToDouble(bufRow["크립스코어"]) / (gameTimeMin);
bufRow["크립스코어"] = nullToZero(bufRow["라인크립스코어"].ToString()) + nullToZero(bufRow["정글크립스코어"].ToString());
bufRow["분당크립스코어"] = nullToZeroD(bufRow["크립스코어"].ToString()) / (gameTimeMin);
.Rows.Add(bufRow);
}
}
foreach (DataRow bufRow in .Rows)
{
if (bufRow["팀구분"].ToString() == "블루")
{
try
{
bufRow["팀내데미지비중"] = Convert.ToDouble(bufRow["가한데미지"]) / _데미지_합[Convert.ToInt32(bufRow["게임시간"])] * 100.0;
}
catch(Exception ex)
{
bufRow["팀내데미지비중"] = "Err";
}
try
{
bufRow["킬관여율"] = (nullToZeroD(bufRow["킬"].ToString()) + nullToZeroD(bufRow["어시스트"].ToString())) / _킬_수[Convert.ToInt32(bufRow["게임시간"])] * 100.0;
}
catch(Exception ex)
{
bufRow["킬관여율"] = "Err";
}
}
else
{
try
{
bufRow["팀내데미지비중"] = Convert.ToDouble(bufRow["가한데미지"]) / _데미지_합[Convert.ToInt32(bufRow["게임시간"])] * 100.0;
}
catch(Exception ex)
{
bufRow["팀내데미지비중"] = "Err";
}
try
{
bufRow["킬관여율"] = (nullToZeroD(bufRow["킬"].ToString()) + nullToZeroD(bufRow["어시스트"].ToString())) / _킬_수[Convert.ToInt32(bufRow["게임시간"])] * 100.0;
}
catch(Exception ex)
{
bufRow["킬관여율"] = "Err";
}
}
}
.Columns.Remove("게임시간");
return ;
}
List<BsonDocument> m팟지데이터들 = new List<BsonDocument>();
List<BsonDocument> m팀데이터들 = new List<BsonDocument>();
protected override BsonDocument getDataFromMongo()
{
//팟지데이터는 5분단위로 누적.
//ex ~5 ~10 ~15 ~20 ~25 ~30... 마지막데이터는 0
//맨 처음 전체데이터로 경기시간을 구한다음 시간으로 나눈다?
if (DataManager.getInstance(). == null)
{
return null;
}
int = DataManager.getInstance().["gameTime"].ToInt32() / 1000;
int = 0;
m팟지데이터들 = new List<BsonDocument>();
m팀데이터들 = new List<BsonDocument>();
while ( - > 0)
{
+= 5 * 60;
BsonDocument rtnValue = new BsonDocument();
//var subfilter1 = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var subFilter2 = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.gameTime' : {$lt : " + * 1000 + " }}");
var filter1 = Builders<BsonDocument>.Filter.And(subFilter2); //var filter1 = Builders<BsonDocument>.Filter.And(subfilter1, subFilter2);
var projectionFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.participants' : 1, 'eventDocument.teams' : 1}");
List<BsonDocument> documents = mEventDataBase.GetCollection<BsonDocument>("stats_update")
.Find(filter1)
.SortByDescending(x => x["sequenceIndex"])
.Limit(1)
.ToList();
///경기의 마지막정보는 경기시간으로 리턴.
if ( > )
{
rtnValue.Add(.ToString(), documents.Last()["eventDocument"]["participants"].AsBsonArray);
}
else
{
rtnValue.Add(.ToString(), documents.Last()["eventDocument"]["participants"].AsBsonArray);
}
m팟지데이터들.Add(rtnValue);
rtnValue = new BsonDocument();
if ( > )
{
rtnValue.Add(.ToString(), documents.Last()["eventDocument"]["teams"].AsBsonArray);
}
else
{
rtnValue.Add(.ToString(), documents.Last()["eventDocument"]["teams"].AsBsonArray);
}
m팀데이터들.Add(rtnValue);
}
//구조를 위해 리턴은 하지만 이 상속클래스는 BsonDocument를 멤버변수 kv페어로 관리한다.
return new BsonDocument();
}
}
}

View File

@@ -0,0 +1,145 @@
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
internal class : AResponseData
{
int = 0;
int = 0;
internal (int , int )
{
= ;
= ;
}
protected override DataTable buildDataForResponse(BsonDocument recvDocument)
{
DataTable = new DataTable();
.TableName = DBDefine...ToString();
//선수관련
.Columns.Add("팀구분");
.Columns.Add("선수아이디");
.Columns.Add("챔피언");
//데미지관련
.Columns.Add("데미지차이");
.Columns.Add("시작데미지량");
.Columns.Add("종료데미지량");
.Columns.Add("딜량백분율");
if (m시작데이터.Count() == 0 || m종료데이터.Count() == 0)
{
return ;
}
BsonArray = m시작데이터["participants"].AsBsonArray;
foreach (BsonDocument itemPlayer in )
{
DataRow bufRow = .NewRow();
bufRow["팀구분"] = (DBDefine.)itemPlayer["teamID"].ToInt32();
bufRow["선수아이디"] = itemPlayer["playerName"].ToString();
bufRow["챔피언"] = itemPlayer["championName"].ToString();
bufRow["시작데미지량"] = itemPlayer["stats"].AsBsonArray.ToList().Where(v => v["name"] == "TOTAL_DAMAGE_DEALT_TO_CHAMPIONS").ToList()[0]["value"];
.Rows.Add(bufRow);
}
BsonArray = m종료데이터["participants"].AsBsonArray;
foreach (BsonDocument itemPlayer in )
{
DataRow bufPlayerRow = .AsEnumerable().Where(r => r.Field<String>("선수아이디") == itemPlayer["playerName"].ToString()).Last();
bufPlayerRow["종료데미지량"] = itemPlayer["stats"].AsBsonArray.ToList().Where(v => v["name"] == "TOTAL_DAMAGE_DEALT_TO_CHAMPIONS").ToList()[0]["value"];
bufPlayerRow["데미지차이"] = Convert.ToDouble(bufPlayerRow["종료데미지량"]) - Convert.ToDouble(bufPlayerRow["시작데미지량"]);
}
double = Convert.ToDouble(.AsEnumerable().OrderByDescending(r => Convert.ToDouble(r.Field<string>("데미지차이"))).First()["데미지차이"]);
foreach (DataRow item in .Rows)
{
double = Convert.ToDouble(item["데미지차이"]);
if ( != 0)
{
item["딜량백분율"] = / * 100.0;
}
else
{
item["딜량백분율"] = 0.0;
}
}
return ;
}
BsonDocument m시작데이터 = new BsonDocument();
BsonDocument m종료데이터 = new BsonDocument();
protected override BsonDocument getDataFromMongo()
{
//var subfilter1 = Builders<BsonDocument>.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID);
var subFilter2 = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.gameTime' : {$lt : " + * 1000 + " }}");
var filter1 = Builders<BsonDocument>.Filter.And(subFilter2); //var filter1 = Builders<BsonDocument>.Filter.And(subfilter1, subFilter2);
var projectionFilter = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.participants' : 1 , 'eventDocument.gameTime' : 1 }");
List<BsonDocument> documents = mEventDataBase.GetCollection<BsonDocument>("stats_update")
.Find(filter1)
.Project(projectionFilter)
.SortByDescending(x => x["sequenceIndex"])
.Limit(1)
.ToList();
m시작데이터 = documents.Last()["eventDocument"].AsBsonDocument;
subFilter2 = MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>("{'eventDocument.gameTime' : {$lt : " + * 1000 + " }}");
filter1 = Builders<BsonDocument>.Filter.And(subFilter2); //filter1 = Builders<BsonDocument>.Filter.And(subfilter1, subFilter2);
List<BsonDocument> documents2 = mEventDataBase.GetCollection<BsonDocument>("stats_update")
.Find(filter1)
.SortByDescending(x => x["sequenceIndex"])
.Project(projectionFilter)
.Limit(1)
.ToList();
m종료데이터 = documents2.Last()["eventDocument"].AsBsonDocument;
//구조를 위해 리턴은 하지만 이 상속클래스는 BsonDocument를 멤버변수 kv페어로 관리한다.
return new BsonDocument();
}
}
}

View File

@@ -0,0 +1,83 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class KDA선수 : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
try
{
List<BsonValue> = DataManager.getInstance().["participants"].AsBsonArray.ToList();
.Columns.Add("팀");
//픽리스트테이블.Columns.Add("포지션");
.Columns.Add("선수닉네임");
.Columns.Add("챔피언이름");
.Columns.Add("킬");
.Columns.Add("데스");
.Columns.Add("어시스트");
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i];
DataRow bufRow = .NewRow();
bufRow["팀"] = (DBDefine.)item["teamID"].ToInt32();
//bufRow["포지션"] = (DBDefine.라인구분)item["participantID"].AsInt32 + 1;
bufRow["선수닉네임"] = item["playerName"];
bufRow["챔피언이름"] = item["championName"];
try
{
bufRow["킬"] = item["stats"].AsBsonArray.Where(v => v["name"] == "CHAMPIONS_KILLED").ToList()[0]["value"];
}
catch(Exception ex)
{
bufRow["킬"] = "0";
}
try {
bufRow["데스"] = item["stats"].AsBsonArray.Where(v => v["name"] == "NUM_DEATHS").ToList()[0]["value"];
}
catch(Exception ex)
{
bufRow["데스"] = "0";
}
try
{
bufRow["어시스트"] = item["stats"].AsBsonArray.Where(v => v["name"] == "ASSISTS").ToList()[0]["value"];
}
catch (Exception ex)
{
bufRow["어시스트"] = "0";
}
.Rows.Add(bufRow);
}
}
catch(Exception ex) {
Console.WriteLine(ex.ToString());
}
return ;
}
}
}

View File

@@ -0,0 +1,69 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
try
{
.Columns.Add("팀");
//픽리스트테이블.Columns.Add("포지션");
.Columns.Add("선수닉네임");
.Columns.Add("챔피언이름");
.Columns.Add("레벨");
.Columns.Add("경험치");
.Columns.Add("경험치대비");
.Columns.Add("레벨대비");
.Columns.Add("퀘스트여부");
if (DataManager.getInstance(). == null)
{
return ;
}
List<BsonValue> = DataManager.getInstance().["participants"].AsBsonArray.OrderByDescending(p => p["XP"].ToInt32()).ToList();
double maxXP = (double)[0]["XP"].ToInt32();
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i];
DataRow bufRow = .NewRow();
bufRow["팀"] = (DBDefine.)item["teamID"].ToInt32();
//bufRow["포지션"] = (DBDefine.라인구분)item["participantID"].AsInt32 + 1;
bufRow["선수닉네임"] = item["playerName"];
bufRow["챔피언이름"] = item["championName"];
bufRow["레벨"] = item["level"].ToInt32();
bufRow["경험치"] = item["XP"];
bufRow["경험치대비"] = (item["XP"].ToInt32() / maxXP) * 100;
//bufRow["레벨대비"] = (item["XP"].ToInt32() - 180 - (item["level"].ToInt32() * 180) / 180 + ((item["level"].ToInt32() + 1) * 180)) * 100;
.Rows.Add(bufRow);
}
}
catch(Exception ex) { }
return ;
}
}
}

View File

@@ -0,0 +1,67 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
try
{
.Columns.Add("팀");
//픽리스트테이블.Columns.Add("포지션");
.Columns.Add("선수닉네임");
.Columns.Add("챔피언이름");
.Columns.Add("총골드획득량");
.Columns.Add("보유골드량");
.Columns.Add("대비총골드퍼센트");
.Columns.Add("대비보유골드퍼센트");
if (DataManager.getInstance(). == null)
{
return ;
}
List<BsonValue> = DataManager.getInstance().["participants"].AsBsonArray.OrderByDescending(p => p["totalGold"].ToInt32()).ToList();
double maxGold = (double)[0]["totalGold"].ToInt32();
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i];
DataRow bufRow = .NewRow();
bufRow["팀"] = (DBDefine.)item["teamID"].ToInt32();
//bufRow["포지션"] = (DBDefine.라인구분)item["participantID"].AsInt32 + 1;
bufRow["선수닉네임"] = item["playerName"];
bufRow["챔피언이름"] = item["championName"];
bufRow["총골드획득량"] = item["totalGold"].ToInt32();
bufRow["보유골드량"] = item["currentGold"];
bufRow["대비총골드퍼센트"] = (item["totalGold"].ToInt32() / maxGold) * 100;
bufRow["대비보유골드퍼센트"] = (item["currentGold"].ToInt32() / maxGold) * 100;
.Rows.Add(bufRow);
}
}
catch (Exception ex) { }
return ;
}
}
}

View File

@@ -0,0 +1,74 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable("누적데미지");
.Columns.Add("팀");
.Columns.Add("선수닉네임");
.Columns.Add("챔피언이름");
.Columns.Add("총가한데미지");
.Columns.Add("대비총데미지퍼센트");
if (DataManager.getInstance(). == null)
{
return ;
}
List<BsonValue> = DataManager.getInstance().["participants"].AsBsonArray.ToList();
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i];
DataRow bufRow = .NewRow();
bufRow["팀"] = (DBDefine.)item["teamID"].ToInt32();
//bufRow["포지션"] = (DBDefine.라인구분)item["participantID"].AsInt32 + 1;
bufRow["선수닉네임"] = item["playerName"];
bufRow["챔피언이름"] = item["championName"];
bufRow["총가한데미지"] = item["stats"].AsBsonArray.Where(v => v["name"] == "TOTAL_DAMAGE_DEALT_TO_CHAMPIONS").ToList()[0]["value"];
.Rows.Add(bufRow);
}
if (.Rows.Count > 0)
{
= .AsEnumerable().OrderByDescending(r => Convert.ToDouble(r.Field<string>("총가한데미지"))).CopyToDataTable();
double maxDamageToChamps = Convert.ToDouble(.Rows[0]["총가한데미지"].ToString());
foreach (DataRow item in .Rows)
{
item["대비총데미지퍼센트"] = Convert.ToDouble(item["총가한데미지"]) / maxDamageToChamps * 100;
}
}
.TableName = DBDefine...ToString();
return ;
}
}
}

View File

@@ -0,0 +1,170 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
List<DataTable> rtnValue = new List<DataTable>();
DataTable = new DataTable(DBDefine...ToString());
rtnValue.Add();
//추가 시작
// 1) 순번 컬럼을 int로 (정렬/비교 안정화)
.Columns.Add("순번", typeof(int));
.Columns.Add("챔피언ID");
.Columns.Add("챔피언이름");
.Columns.Add("팀");
// 여기부터 새로 넣기
var dm = DataManager.getInstance();
if (dm. == null || dm..IsBsonNull || !dm..IsBsonDocument)
{
.TableName = DBDefine...ToString();
return ;
}
var doc = dm..AsBsonDocument;
if (!doc.TryGetValue("bannedChampions", out var banned) || banned == null || banned.IsBsonNull || !banned.IsBsonArray)
{
.TableName = DBDefine...ToString();
return ;
}
//List<BsonValue> 밴데이터 = banned.AsBsonArray.ToList();
List<BsonValue> = dm.["bannedChampions"].AsBsonArray.ToList();
var turns = .Select(x => x["pickTurn"].ToInt32()).ToList();
bool isGlobalTurnFormat = turns.Any(t => t >= 13); // 1~6 + 13~16
bool isDirectSlotFormat = turns.Distinct().Count() == turns.Count // 1~10 같은 직접 슬롯
&& turns.All(t => t >= 1 && t <= 10);
foreach (BsonValue item in )
{
DataRow bufRow = .NewRow();
int pickTurn = item["pickTurn"].ToInt32();
int teamId = item["teamID"].ToInt32();
int slot = 0;
/*
if (isDirectSlotFormat)
{
slot = pickTurn;
}
else if (isGlobalTurnFormat)
{
if (pickTurn >= 1 && pickTurn <= 6) slot = pickTurn;
else if (pickTurn >= 13 && pickTurn <= 16) slot = pickTurn - 6; // 13~16 => 7~10
else slot = 0;
}
else
{
int key = pickTurn + teamId;
if (!dm.밴픽순서테이블.TryGetValue(key, out slot))
slot = 0;
}
*/
//if (slot == 0) slot = 밴리스트테이블.Rows.Count + 1;
//bufRow["순번"] = slot;
bufRow["순번"] = pickTurn;
int selectedChamp = item["championID"].ToInt32();
bufRow["챔피언ID"] = selectedChamp;
bufRow["팀"] = item["teamID"].ToInt32();
if (selectedChamp > 0)
bufRow["챔피언이름"] = dm.mChampionTable[selectedChamp].champNameKOR;
else if (selectedChamp == -1)
bufRow["챔피언이름"] = "선택없음";
.Rows.Add(bufRow);
}
// 여기까지 새로 넣기
// 5) 정렬도 int 기준으로
if (.Rows.Count > 0)
{
= .AsEnumerable()
.OrderBy(r => r.Field<int>("순번"))
.CopyToDataTable();
}
////추가 끝
//밴리스트테이블.Columns.Add("순번");
//밴리스트테이블.Columns.Add("챔피언ID");
//밴리스트테이블.Columns.Add("챔피언이름");
//if (DataManager.getInstance().밴픽데이터 == null)
//{
// return 밴리스트테이블;
//}
//List<BsonValue> 밴데이터 = DataManager.getInstance().밴픽데이터["bannedChampions"].AsBsonArray.ToList();
//foreach (BsonValue item in 밴데이터)
//{
// DataRow bufRow = 밴리스트테이블.NewRow();
// //Console.WriteLine(item["pickTurn"].ToInt32() + item["teamID"].ToInt32());
// if (DataManager.getInstance().isNewBanPick)
// {
// bufRow["순번"] = item["pickTurn"].ToInt32();
// }
// else
// {
// bufRow["순번"] = DataManager.getInstance().밴픽순서테이블[item["pickTurn"].ToInt32() + item["teamID"].ToInt32()];
// }
// int selectedChamp = item["championID"].ToInt32();
// if (selectedChamp > 0 )
// {
// bufRow["챔피언이름"] = DataManager.getInstance().mChampionTable[selectedChamp];
// }
// if (selectedChamp == -1)
// {
// bufRow["챔피언이름"] = "선택없음";
// }
// bufRow["챔피언ID"] = selectedChamp;
// 밴리스트테이블.Rows.Add(bufRow);
//}
//if (밴리스트테이블.Rows.Count > 0)
//{
// 밴리스트테이블 = 밴리스트테이블.AsEnumerable().OrderBy(r => Convert.ToInt32(r.Field<string>("순번"))).CopyToDataTable();
//}
.TableName = DBDefine...ToString();
return ;
}
}
}

View File

@@ -0,0 +1,53 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class //: IResponseData
{
//public DataTable 디비데이터를데이터테이블로만듬()
//{
// DataTable 아타칸리스폰테이블 = new DataTable(DBDefine.요청데이터분류.아타칸리스폰.ToString());
// 아타칸리스폰테이블.Columns.Add("아타칸정보");
// 아타칸리스폰테이블.Columns.Add("리스폰타임");
// if (DataManager.getInstance().아타칸리스폰== null)
// {
// return 아타칸리스폰테이블;
// }
// BsonDocument dd = DataManager.getInstance().아타칸리스폰.DeepClone().AsBsonDocument;
// dd.Remove("sequenceIndex");
// List<BsonElement> bufStructDataList = dd.ToList();
// foreach (BsonElement item in bufStructDataList)
// {
// DataRow bufRow = 아타칸리스폰테이블.NewRow();
// BsonDocument bufValue = item.Value.AsBsonDocument;
// bufRow["아타칸정보"] = bufValue["monsterName"].ToString();
// int 아타칸리스폰타임 = bufValue["sequenceIndex"].ToInt32();
// bufRow["리스폰타임"] = 아타칸리스폰타임;
// if (bufValue["monsterName"].ToString().Contains("Atakhan")) 아타칸리스폰테이블.Rows.Add(bufRow);
// }
// return 아타칸리스폰테이블;
//}
}
}

View File

@@ -0,0 +1,144 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
internal (bool recvIsPostGameData)
{
this.isPostGame = recvIsPostGameData;
}
bool isPostGame = false;
public DataTable ()
{
DataTable = new DataTable("오브젝트리스트");
.Columns.Add("오브젝트타입");
.Columns.Add("드래곤종류");
.Columns.Add("잡은팀");
.Columns.Add("킬시간");
.Columns.Add("킬분");
.Columns.Add("킬초");
//오브젝트테이블.Columns.Add("리젠분");
//오브젝트테이블.Columns.Add("리젠초");
if (DataManager.getInstance(). != null)
{
BsonDocument dd = DataManager.getInstance()..DeepClone().AsBsonDocument;
dd.Remove("sequenceIndex");
List<BsonElement> = dd.ToList().OrderBy(e => e.Value.AsBsonDocument["gameTime"].ToInt32()).ToList();
bool is크로노 = false;
int Index크로노 = 0;
int nowSequenceIndex = 0;
//크로노브레이크를 대비해야 sequenceIndex 가 역변하는 순간이 존재하는지 확인하는 절차
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i].ToBsonDocument().AsBsonValue;
int sequenceIndex = item["Value"]["sequenceIndex"].ToInt32();
if (sequenceIndex > nowSequenceIndex) nowSequenceIndex = sequenceIndex;
else
{
is크로노 = true;
nowSequenceIndex = sequenceIndex;
Index크로노 = i;
break;
}
}
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i].ToBsonDocument().AsBsonValue;
int sequenceIndex = item["Value"]["sequenceIndex"].ToInt32();
DataRow bufRow = .NewRow();
if (is크로노)
{
if (sequenceIndex >= nowSequenceIndex)
{
if (i < Index크로노)
{
continue;
}
}
}
if (item["Value"]["killerTeamID"].ToInt32() == 300)
{
continue;
}
bufRow["잡은팀"] = (DBDefine.)item["Value"]["killerTeamID"].ToInt32();
bufRow["오브젝트타입"] = item["Value"]["monsterType"].ToString();
int = item["Value"]["gameTime"].ToInt32();
int = / 1000 / 60;
int = / 1000 - ( * 60);
bufRow["킬시간"] = ;
bufRow["킬분"] = ;
bufRow["킬초"] = ;
if (item["Value"]["monsterType"].AsString == "dragon")
{
//20210615 용이 상단에 딜레이보다 미리 들어가는 현상이 보여서 처리
if ( > DataManager.getInstance(). * 1000 && !isPostGame)
{
continue;
}
bufRow["드래곤종류"] = item["Value"]["dragonType"];
}
.Rows.Add(bufRow);
}
}
if (.Rows.Count > 0)
{
DataTable = .AsEnumerable().OrderBy(r => Convert.ToInt32(r.Field<string>("킬시간"))).CopyToDataTable();
.TableName = DBDefine...ToString();
return ;
}
else
{
.TableName = DBDefine...ToString();
return ;
}
}
}
}

View File

@@ -0,0 +1,55 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
.Columns.Add("용정보");
.Columns.Add("리스폰타임");
if (DataManager.getInstance(). == null)
{
return ;
}
BsonDocument dd = DataManager.getInstance()..DeepClone().AsBsonDocument;
dd.Remove("sequenceIndex");
List<BsonElement> bufStructDataList = dd.ToList();
foreach (BsonElement item in bufStructDataList)
{
DataRow bufRow = .NewRow();
BsonDocument bufValue = item.Value.AsBsonDocument;
bufRow["용정보"] = bufValue["nextDragonName"].ToString();
int = bufValue["nextDragonSpawnTime"].ToInt32();
bufRow["리스폰타임"] = ;
.Rows.Add(bufRow);
}
return ;
}
}
}

View File

@@ -0,0 +1,56 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
try
{
.Columns.Add("팀");
//픽리스트테이블.Columns.Add("포지션");
.Columns.Add("선수닉네임");
.Columns.Add("챔피언이름");
.Columns.Add("퀘스트완료여부");
if (DataManager.getInstance(). == null)
{
return ;
}
List<BsonValue> = DataManager.getInstance().["participants"].AsBsonArray.OrderByDescending(p => p["roleBoundQuestComplete"].ToBoolean()).ToList();
for (int i = 0; i < .Count(); i++)
{
BsonValue item = [i];
DataRow bufRow = .NewRow();
bufRow["팀"] = (DBDefine.)item["teamID"].ToInt32();
bufRow["선수닉네임"] = item["playerName"];
bufRow["챔피언이름"] = item["championName"];
bufRow["퀘스트완료여부"] = item["roleBoundQuestComplete"].ToBoolean();
.Rows.Add(bufRow);
}
}
catch (Exception ex) { }
return ;
}
}
}

View File

@@ -0,0 +1,77 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
.Columns.Add("지급원인");
.Columns.Add("팀");
.Columns.Add("선수");
.Columns.Add("지급골드");
.Columns.Add("타워위치");
.Columns.Add("타워티어");
.Columns.Add("게임시간");
if (DataManager.getInstance(). == null)
{
return ;
}
BsonDocument dd = DataManager.getInstance()..DeepClone().AsBsonDocument;
dd.Remove("sequenceIndex");
List<BsonElement> bufStructDataList = dd.ToList();
//Console.WriteLine("타워파괴전체.cs : 시작");
foreach (BsonElement item in bufStructDataList)
{
DataRow bufRow = .NewRow();
BsonDocument bufValue = item.Value.AsBsonDocument;
//Console.WriteLine("타워파괴전체.cs 정보 : " + bufValue.ToString());
try
{
{
bufRow["지급원인"] = bufValue["source"].ToString();
bufRow["팀"] = bufValue["teamID"].ToString();
bufRow["선수"] = bufValue["recipientId"].ToString();
bufRow["지급골드"] = bufValue["amount"].ToString();
bufRow["타워위치"] = bufValue["lane"].ToString();
bufRow["타워티어"] = bufValue["turretTier"].ToString();
bufRow["게임시간"] = bufValue["gameTime"].ToString();
.Rows.Add(bufRow);
}
}
catch (Exception ex)
{
}
}
return ;
}
}
}

View File

@@ -0,0 +1,89 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
.Columns.Add("타워부서진팀");
.Columns.Add("경기시간(초)");
.Columns.Add("파괴된라인");
.Columns.Add("터렛티어");
.Columns.Add("타워종류");
.Columns.Add("타워위치");
.Columns.Add("넥서스타워");
if (DataManager.getInstance(). == null)
{
return ;
}
BsonDocument dd = DataManager.getInstance()..DeepClone().AsBsonDocument;
dd.Remove("sequenceIndex");
List<BsonElement> bufStructDataList = dd.ToList();
//Console.WriteLine("타워파괴전체.cs : 시작");
foreach (BsonElement item in bufStructDataList)
{
DataRow bufRow = .NewRow();
BsonDocument bufValue = item.Value.AsBsonDocument;
//Console.WriteLine("타워파괴전체.cs 정보 : " + bufValue.ToString());
//turretTier
try
{
bufRow["타워부서진팀"] = (DBDefine.)(bufValue["teamID"].ToInt32());
bufRow["경기시간(초)"] = (bufValue["gameTime"].ToInt32()) / 1000;
if (bufValue.AsBsonDocument.Contains("lane"))
{
bufRow["파괴된라인"] = bufValue["lane"].ToString();
if (bufValue.AsBsonDocument.Contains("turretTier"))
{
bufRow["터렛티어"] = bufValue["turretTier"].ToString();
}
if (bufValue.AsBsonDocument.Contains("nexusTurretName"))
{
bufRow["넥서스타워"] = bufValue["nexusTurretName"].ToString();
bufRow["타워위치"] = bufValue["position"].ToString();
}
bufRow["타워종류"] = bufValue["buildingType"].ToString();
.Rows.Add(bufRow);
}
}
catch (Exception ex)
{
}
}
return ;
}
}
}

View File

@@ -0,0 +1,101 @@
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LolDataRequestLib.ResponseData
{
class : IResponseData
{
public DataTable ()
{
DataTable = new DataTable(DBDefine...ToString());
.Columns.Add("팀");
//픽리스트테이블.Columns.Add("포지션");
.Columns.Add("선수닉네임");
.Columns.Add("챔피언ID");
.Columns.Add("챔피언이름");
.Columns.Add("픽상태");
.Columns.Add("선택스킨ID");
.Columns.Add("순번", typeof(int));
if (DataManager.getInstance(). == null)
{
return ;
}
List<BsonValue> = DataManager.getInstance().["teamOne"].AsBsonArray.ToList();
foreach (BsonValue item in )
{
DataRow bufRow = .NewRow();
bufRow["팀"] = DBDefine..;
//bufRow["포지션"] = (DBDefine.라인구분)item["participantID"].AsInt32 + 1;
bufRow["선수닉네임"] = item["summonerName"];
int selectedChamp = item["championID"].ToInt32();
if (selectedChamp != 0)
{
bufRow["챔피언이름"] = DataManager.getInstance().mChampionTable[selectedChamp].champNameKOR;
}
bufRow["챔피언ID"] = selectedChamp;
bufRow["픽상태"] = (DBDefine.)item["pickMode"].ToInt32();
bufRow["선택스킨ID"] = item["championID"];
bufRow["순번"] = item["pickTurn"].ToInt32();
.Rows.Add(bufRow);
}
List<BsonValue> = DataManager.getInstance().["teamTwo"].AsBsonArray.ToList();
foreach (BsonValue item in )
{
DataRow bufRow = .NewRow();
bufRow["팀"] = DBDefine..;
//bufRow["포지션"] = (DBDefine.라인구분)item["participantID"].AsInt32 - 4;
bufRow["선수닉네임"] = item["summonerName"];
int selectedChamp = item["championID"].ToInt32();
if (selectedChamp != 0)
{
bufRow["챔피언이름"] = DataManager.getInstance().mChampionTable[selectedChamp].champNameKOR;
}
bufRow["챔피언ID"] = selectedChamp;
bufRow["픽상태"] = (DBDefine.)item["pickMode"].ToInt32();
bufRow["선택스킨ID"] = item["championID"];
bufRow["순번"] = item["pickTurn"].ToInt32();
.Rows.Add(bufRow);
}
if (DataManager.getInstance().isNewBanPick)
{
if (.Rows.Count > 0)
{
= .AsEnumerable()
.OrderBy(r => r.Field<string>("팀") == DBDefine...ToString() ? 0 : 1) // 블루 팀 우선
.ThenBy(r => r.Field<int>("순번")) // 같은 팀 내에서는 순번 오름차순
.CopyToDataTable();
}
}
return ;
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DnsClient" version="1.4.0" targetFramework="net472" />
<package id="MongoDB.Bson" version="2.12.3" targetFramework="net472" />
<package id="MongoDB.Driver" version="2.12.3" targetFramework="net472" />
<package id="MongoDB.Driver.Core" version="2.12.3" targetFramework="net472" />
<package id="MongoDB.Libmongocrypt" version="1.2.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="SharpCompress" version="0.23.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.IO" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
<package id="System.Runtime" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" />
</packages>