초기커밋
This commit is contained in:
162
ServerCommon/z.Backup/AccountAuthorityManager.cs
Normal file
162
ServerCommon/z.Backup/AccountAuthorityManager.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
|
||||
|
||||
//namespace ServerCommon
|
||||
//{
|
||||
// public class AccountAuthorityManager
|
||||
// {
|
||||
// private static readonly AccountAuthorityManager _instance = new();
|
||||
// static AccountAuthorityManager() { }
|
||||
// private AccountAuthorityManager() { }
|
||||
// public static AccountAuthorityManager Instance { get { return _instance; } }
|
||||
|
||||
// public bool isInspection { get; set; } = false;
|
||||
// public bool isReadyForDistroy { get; set; } = false;
|
||||
|
||||
// MainDB? _mainDB = null;
|
||||
// BlackListEntity _blackListEntity = new();
|
||||
// WhiteListEntity _whiteListEntity = new();
|
||||
|
||||
// ReaderWriterLockSlim rwWhiteListLock = new();
|
||||
// ReaderWriterLockSlim rwBlackListLock = new();
|
||||
|
||||
// public async Task<bool> LoadDB(MainDB mainDB)
|
||||
// {
|
||||
// if (mainDB == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// _mainDB = mainDB;
|
||||
|
||||
// if (await UpdateWhiteList() == false)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (await UpdateBlackList() == false)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public async Task<bool> UpdateWhiteList()
|
||||
// {
|
||||
// if (_mainDB == null)
|
||||
// {
|
||||
// Log.getLogger().error("_mainDB == null");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// WhiteListEntity? whiteList = await _mainDB.GetWhiteListData();
|
||||
// if (whiteList == null)
|
||||
// {
|
||||
// whiteList = await _mainDB.AddWhiteList();
|
||||
// if (whiteList == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// rwWhiteListLock.EnterWriteLock();
|
||||
// try
|
||||
// {
|
||||
// _whiteListEntity = whiteList;
|
||||
// return true;
|
||||
// }
|
||||
// finally { rwWhiteListLock.ExitWriteLock(); }
|
||||
// }
|
||||
|
||||
// public async Task<bool> UpdateBlackList()
|
||||
// {
|
||||
// if (_mainDB == null)
|
||||
// {
|
||||
// Log.getLogger().error("_mainDB == null");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// BlackListEntity? blackList = await _mainDB.GetBlackListData();
|
||||
// if (blackList == null)
|
||||
// {
|
||||
// blackList = await _mainDB.AddBlackList();
|
||||
// if (blackList == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// rwBlackListLock.EnterWriteLock();
|
||||
// try
|
||||
// {
|
||||
// _blackListEntity = blackList;
|
||||
// return true;
|
||||
// }
|
||||
// finally { rwBlackListLock.ExitWriteLock(); }
|
||||
// }
|
||||
|
||||
// public bool IsWhiteListUser(string accountId)
|
||||
// {
|
||||
// rwWhiteListLock.EnterReadLock();
|
||||
// try
|
||||
// {
|
||||
// if(_whiteListEntity.Attr.WhiteListByID.TryGetValue(accountId, out var value) == true)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// foreach(var pattern in _whiteListEntity.Attr.WhiteListByPattern)
|
||||
// {
|
||||
// Regex regex = new Regex(@pattern.Key);
|
||||
// if (regex.IsMatch(accountId))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
// finally { rwWhiteListLock.ExitReadLock();}
|
||||
// }
|
||||
|
||||
// public bool IsBlockUser(AccountEntity myAccountEntity)
|
||||
// {
|
||||
// DateTime dt = DateTime.Now;
|
||||
// if (myAccountEntity.Attr.BlockStartDate <= dt && dt <= myAccountEntity.Attr.BlockEndDate)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public bool IsBlackListUser(string accountId)
|
||||
// {
|
||||
// rwBlackListLock.EnterReadLock();
|
||||
// try
|
||||
// {
|
||||
// if (_blackListEntity.Attr.BlackListByID.TryGetValue(accountId, out var blackList) == true)
|
||||
// {
|
||||
// if(DateTime.Compare(DateTime.Now, blackList) < 0)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// foreach (var pattern in _blackListEntity.Attr.BlackListByPattern)
|
||||
// {
|
||||
// Regex regex = new Regex(@pattern.Key);
|
||||
// if (regex.IsMatch(accountId)
|
||||
// && DateTime.Compare(DateTime.Now, pattern.Value) < 0)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
// finally { rwBlackListLock.ExitReadLock();}
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
163
ServerCommon/z.Backup/AccountEntity.cs
Normal file
163
ServerCommon/z.Backup/AccountEntity.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
//using Amazon.DynamoDBv2;
|
||||
//using Amazon.DynamoDBv2.Model;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class AccountAttr
|
||||
// {
|
||||
// // AccountGUID 값
|
||||
// [JsonProperty("aid")]
|
||||
// public string Aid { get; set; } = string.Empty;
|
||||
|
||||
// // AccountID 값 (사용자 입력 ID or 웹인증 ID)
|
||||
// [JsonProperty("id"),]
|
||||
// public string Id { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("password")]
|
||||
// public string Password { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("pin")]
|
||||
// public string Pin { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("language")]
|
||||
// public LanguageType Language { get; set; } = LanguageType.None;
|
||||
|
||||
// [JsonProperty("e-mail")]
|
||||
// public string Email { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_metamask")]
|
||||
// public string ConnectMetamask { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_kaikas")]
|
||||
// public string ConnectKaikas { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_facebook")]
|
||||
// public string ConnectFacebook { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_google")]
|
||||
// public string ConnectGoogle { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_naver")]
|
||||
// public string ConnectNaver { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_kakao")]
|
||||
// public string ConnectKakao { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("connect_facewallet")]
|
||||
// public string ConnectFacewallet { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("profile_img")]
|
||||
// public string ProfileImg { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("membership")]
|
||||
// public string Membership { get; set; } = string.Empty;
|
||||
|
||||
// // 추천인
|
||||
// [JsonProperty("referral")]
|
||||
// public string Referral { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("create_date")]
|
||||
// public DateTime CreateDate = DateTime.UtcNow;
|
||||
|
||||
// [JsonProperty("blockStartDate")]
|
||||
// public DateTime BlockStartDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// [JsonProperty("blockEndDate")]
|
||||
// public DateTime BlockEndDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// [JsonProperty("blockPolicy")]
|
||||
// public List<string> blockPolicy { get; set; } = new();
|
||||
|
||||
// [JsonProperty("blockReason")]
|
||||
// public string blockReason { get; set; } = string.Empty;
|
||||
|
||||
// [JsonProperty("auth_admin_level_type")]
|
||||
// public AuthAdminLevelType m_auth_admin_level_type { get; set; } = AuthAdminLevelType.None;
|
||||
|
||||
// // 아래 두개는 별로로 분리할 필요있음
|
||||
// // 현재 Logout은 기록하지 않음.
|
||||
// [JsonProperty]
|
||||
// public DateTime LoginDate = DateTime.UtcNow;
|
||||
|
||||
// [JsonProperty,]
|
||||
// public DateTime LogoutDate = DateTime.UtcNow;
|
||||
|
||||
|
||||
|
||||
|
||||
// public bool Read(string guid, TestUserCreateData userData)
|
||||
// {
|
||||
// Aid = guid;
|
||||
// Id = userData.Id;
|
||||
// Password = userData.Password;
|
||||
// //Pin = userData.Pin; 제거 - kangms
|
||||
// Language = userData.Language;
|
||||
|
||||
// // TODO: ConnectFacewallet 유지보수 필요 테이블에 추가하던지 다른이용방안이 필요함
|
||||
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public class AccountEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Guid { get; private set; } = string.Empty;
|
||||
// public AccountAttr Attr { get; private set; } = new AccountAttr();
|
||||
|
||||
// public AccountEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Account), "");
|
||||
// SK_Guid = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Account), "");
|
||||
|
||||
// Log.getLogger().debug(document["Attr"].AsString());
|
||||
|
||||
// AccountAttr? attr = JsonConvert.DeserializeObject<AccountAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// // 임시
|
||||
// if (attr.Id == null)
|
||||
// {
|
||||
// throw new Exception("attr.Id == null");
|
||||
// }
|
||||
|
||||
// Log.getLogger().debug(JsonConvert.SerializeObject(attr));
|
||||
// //
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public void UpdateLoginTime(DateTime loginTime)
|
||||
// {
|
||||
// Attr.LoginDate = loginTime;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Account, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Account, SK_Guid);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
|
||||
// Log.getLogger().debug(JsonConvert.SerializeObject(Attr));
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
55
ServerCommon/z.Backup/AccountGameOptionEntity.cs
Normal file
55
ServerCommon/z.Backup/AccountGameOptionEntity.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class AccountGameOptionAttr
|
||||
// {
|
||||
// public string options = string.Empty;
|
||||
// }
|
||||
|
||||
// public class AccountGameOptionEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public AccountGameOptionAttr Attr { get; private set; } = new();
|
||||
|
||||
// public AccountGameOptionEntity() { }
|
||||
// public AccountGameOptionEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.GameOption), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.GameOption), "");
|
||||
|
||||
// AccountGameOptionAttr? attr = JsonConvert.DeserializeObject<AccountGameOptionAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.GameOption, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.GameOption, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
30
ServerCommon/z.Backup/AccountIDEntity.cs
Normal file
30
ServerCommon/z.Backup/AccountIDEntity.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2;
|
||||
//using Amazon.DynamoDBv2.Model;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class AccountIDEntity
|
||||
// {
|
||||
// public string PK_Name { get; private set; } = string.Empty;
|
||||
// public string SK_Guid { get; private set; } = string.Empty;
|
||||
|
||||
// public AccountIDEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Name = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.AccountId), "");
|
||||
// SK_Guid = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.AccountId), "");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
54
ServerCommon/z.Backup/BlackListEntity.cs
Normal file
54
ServerCommon/z.Backup/BlackListEntity.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using System.Collections.Concurrent;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class BlackListAttr
|
||||
// {
|
||||
// public ConcurrentDictionary<string, DateTime> BlackListByID = new();
|
||||
// public ConcurrentDictionary<string, DateTime> BlackListByPattern = new();
|
||||
// }
|
||||
|
||||
// public class BlackListEntity
|
||||
// {
|
||||
// public string PK_Empty { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public BlackListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public BlackListEntity()
|
||||
// {
|
||||
// }
|
||||
|
||||
// public BlackListEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
//// PK_Empty = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.BlackList), "");
|
||||
//// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.BlackList), "");
|
||||
////
|
||||
//// BlackListAttr? attr = JsonConvert.DeserializeObject<BlackListAttr>(document["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// throw new Exception("Attr DeserializeObject error");
|
||||
////
|
||||
//// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.BlackList, PK_Empty);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.BlackList, SK_Empty);
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
96
ServerCommon/z.Backup/BlockListEntity.cs
Normal file
96
ServerCommon/z.Backup/BlockListEntity.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class BlockListAttr
|
||||
// {
|
||||
// public Dictionary<string, BlockInfo> blockList;
|
||||
|
||||
// public BlockListAttr()
|
||||
// {
|
||||
// blockList = new Dictionary<string, BlockInfo>();
|
||||
// }
|
||||
// }
|
||||
|
||||
// public class BlockListEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public BlockListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public BlockListEntity() { }
|
||||
|
||||
// public BlockListEntity(List<Document> documents, string accountGuid)
|
||||
// {
|
||||
// ReadFrom(documents, accountGuid);
|
||||
// }
|
||||
|
||||
// void ReadFrom(List<Document> documents, string accountGuid)
|
||||
// {
|
||||
// if (documents.Count == 0)
|
||||
// {
|
||||
// Attr.blockList = new();
|
||||
// PK_Guid = accountGuid;
|
||||
// }
|
||||
|
||||
// //bool isCheck = false;
|
||||
// foreach (Document doc in documents)
|
||||
// {
|
||||
|
||||
//// if (isCheck == false)
|
||||
//// {
|
||||
//// PK_Guid = doc["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.BlockList), "");
|
||||
//// isCheck = true;
|
||||
//// }
|
||||
//// string blockGuid = doc["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.BlockList), "");
|
||||
//// BlockInfo? attr = JsonConvert.DeserializeObject<BlockInfo>(doc["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// Log.getLogger().error("BlockList ReadFrom attr is null");
|
||||
//// continue;
|
||||
//// }
|
||||
//// Attr.blockList.TryAdd(blockGuid, attr);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public Document DocumentForInsert(string myGuid, BlockInfo blockInfo)
|
||||
// {
|
||||
// var document = new Document();
|
||||
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.BlockList, myGuid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.BlockList, blockInfo.Guid);
|
||||
////
|
||||
////
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(blockInfo);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
// public BlockInfo MakeNewBlockInfo(string blockGuid, string blockNickname)
|
||||
// {
|
||||
// BlockInfo blockInfo = new BlockInfo();
|
||||
// blockInfo.Guid = blockGuid;
|
||||
// blockInfo.NickName = blockNickname;
|
||||
// blockInfo.CreateTime = Timestamp.FromDateTime(DateTime.UtcNow);
|
||||
|
||||
// return blockInfo;
|
||||
// }
|
||||
|
||||
// public Document DocumentForDelete(string myGuid, string blockGuid)
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.BlockList, myGuid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.BlockList, blockGuid);
|
||||
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
55
ServerCommon/z.Backup/BuildingEntity.cs
Normal file
55
ServerCommon/z.Backup/BuildingEntity.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class BuildingAttr
|
||||
// {
|
||||
// public string Owner = string.Empty;
|
||||
// public string Name = string.Empty;
|
||||
// public string Description = string.Empty;
|
||||
// public Dictionary<int, int> FloorInfo = new Dictionary<int, int>();
|
||||
// public Dictionary<string, AnchorProp> PropInfo = new();
|
||||
// }
|
||||
|
||||
// public class BuildingEntity
|
||||
// {
|
||||
// public int PK_Id { get; private set; } = 0;
|
||||
// public int SK_Id { get; private set; } = 0;
|
||||
// public BuildingAttr Attr { get; private set; } = new();
|
||||
|
||||
// public BuildingEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// if (!int.TryParse(document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Building), ""), out var pk))
|
||||
// throw new Exception("PK int.TryParse error");
|
||||
|
||||
// if (!int.TryParse(document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Building), ""), out var sk))
|
||||
// throw new Exception("SK int.TryParse error");
|
||||
|
||||
// BuildingAttr? attr = JsonConvert.DeserializeObject<BuildingAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Building, PK_Id.ToString());
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Building, SK_Id.ToString());
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
58
ServerCommon/z.Backup/BuildingListEntity.cs
Normal file
58
ServerCommon/z.Backup/BuildingListEntity.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class BuildingListAttr
|
||||
// {
|
||||
// public HashSet<int> buildingIds = new HashSet<int>();
|
||||
// }
|
||||
|
||||
// public class BuildingListEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public BuildingListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public BuildingListEntity() { }
|
||||
// public BuildingListEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.BuildingList), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.BuildingList), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<BuildingListAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.BuildingList, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.BuildingList, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
55
ServerCommon/z.Backup/CartEntity.cs
Normal file
55
ServerCommon/z.Backup/CartEntity.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class CartEntityAttr
|
||||
// {
|
||||
// public Dictionary<ECurrencyType, List<CartItemInfo>> ItemCartInfo = new();
|
||||
// }
|
||||
|
||||
// public class CartEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public CartEntityAttr Attr { get; private set; } = new();
|
||||
|
||||
// public CartEntity()
|
||||
// {
|
||||
// }
|
||||
// public CartEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Cart), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Cart), "");
|
||||
|
||||
// CartEntityAttr? attr = JsonConvert.DeserializeObject<CartEntityAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"CartEntityAttr is null");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Cart, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Cart, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
134
ServerCommon/z.Backup/CharEntity.cs
Normal file
134
ServerCommon/z.Backup/CharEntity.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2;
|
||||
//using Amazon.DynamoDBv2.Model;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using StackExchange.Redis;
|
||||
//using Microsoft.OpenApi.Extensions;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class CharEntity
|
||||
// {
|
||||
// public string PK_Guid { get; set; } = string.Empty;
|
||||
// public string SK_Guid { get; private set; } = string.Empty;
|
||||
|
||||
// public string Id { get; set; } = string.Empty;
|
||||
|
||||
// public string eoa { get; set; } = string.Empty;
|
||||
|
||||
// public CharInfo CharInfo { get; set; } = new CharInfo(); //{ Level = 1, Gold = 100L, BlueCali = 0L, RedCali = 0L, BlackCali = 0L, Exp = 0 };
|
||||
|
||||
// public AvatarInfo AvatarInfo { get; set; } = new AvatarInfo()
|
||||
// {
|
||||
// AvatarId = 1,
|
||||
// BASICSTYLE = 10001,
|
||||
// BODYSHAPE = 20001,
|
||||
// HAIRSTYLE = 30001,
|
||||
// Init = 1
|
||||
// };
|
||||
// public ClothInfo ClothInfo { get; set; } = new ClothInfo()
|
||||
// {
|
||||
// ClothAvatar = 0,
|
||||
// ClothHeadwear = 0,
|
||||
// ClothMask = 0,
|
||||
// ClothBag = 0,
|
||||
// ClothShoes = 0,
|
||||
// ClothOuter = 0,
|
||||
// ClothTops = 0,
|
||||
// ClothBottoms = 0,
|
||||
// ClothGloves = 0,
|
||||
// ClothEarrings = 0,
|
||||
// ClothNeckless = 0,
|
||||
// ClothSocks = 0,
|
||||
// };
|
||||
|
||||
// public EquipInfo EquipInfo { get; set; } = new EquipInfo();
|
||||
|
||||
|
||||
// public CharPos CharPos { get; set; } = new CharPos();
|
||||
|
||||
// public CharPos LastGameServerPos { get; set; } = new CharPos();
|
||||
|
||||
// public List<string> m_auth_admin_levels { get; set; } = new() { AuthAdminLevelType.None.ToString() };
|
||||
|
||||
|
||||
// //public Dictionary<int, Buff> BuffInfo = new ();
|
||||
|
||||
// public CharEntity()
|
||||
// {
|
||||
// CharPos.MapId = 1;
|
||||
// CharPos.Pos = new Pos() { X = 0.0F, Y = 0.0F, Z = 0.0F, Angle = 0 };
|
||||
|
||||
// LastGameServerPos.MapId = 1;
|
||||
// LastGameServerPos.Pos = new Pos() { X = 0.0F, Y = 0.0F, Z = 0.0F, Angle = 0 };
|
||||
// }
|
||||
// public CharEntity(Document document)
|
||||
// {
|
||||
// CharPos.MapId = 1;
|
||||
// CharPos.Pos = new Pos() { X = 0.0F, Y = 0.0F, Z = 0.0F, Angle = 0 };
|
||||
|
||||
// LastGameServerPos.MapId = 1;
|
||||
// LastGameServerPos.Pos = new Pos() { X = 0.0F, Y = 0.0F, Z = 0.0F, Angle = 0 };
|
||||
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public void ReadFrom(Document document)
|
||||
// {
|
||||
// //PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Character), "");
|
||||
// //SK_Guid = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Character), "");
|
||||
|
||||
// if (false == document.Contains("CharInfo"))
|
||||
// {
|
||||
// //TODO: 에러처리
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// CharInfo = JsonConvert.DeserializeObject<CharInfo>(document["CharInfo"].AsString()) ?? new();
|
||||
// AvatarInfo = JsonConvert.DeserializeObject<AvatarInfo>(document["AvatarInfo"].AsString()) ?? new();
|
||||
// ClothInfo = JsonConvert.DeserializeObject<ClothInfo>(document["ClothInfo"].AsString()) ?? new();
|
||||
// CharPos = JsonConvert.DeserializeObject<CharPos>(document["CharPos"].AsString()) ?? new();
|
||||
// EquipInfo = JsonConvert.DeserializeObject<EquipInfo>(document["EquipInfo"].AsString()) ?? new();
|
||||
// LastGameServerPos = JsonConvert.DeserializeObject<CharPos>(document["LastGameServerPos"].AsString()) ?? new();
|
||||
// m_auth_admin_levels = JsonConvert.DeserializeObject<List<string>>(document["AuthAdminLevel"].AsString()) ?? new();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error(ex.ToString());
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// //document["PK"] = MainDB.MakePK(EEntityType.Character, PK_Guid);
|
||||
// //document["SK"] = MainDB.MakeSK(EEntityType.Character, PK_Guid);
|
||||
// //document["Type"] = EEntityType.Character.ToString();
|
||||
// document["CharInfo"] = JsonConvert.SerializeObject(CharInfo);
|
||||
// document["AvatarInfo"] = JsonConvert.SerializeObject(AvatarInfo);
|
||||
// document["ClothInfo"] = JsonConvert.SerializeObject(ClothInfo);
|
||||
// document["CharPos"] = JsonConvert.SerializeObject(CharPos);
|
||||
// document["EquipInfo"] = JsonConvert.SerializeObject(EquipInfo);
|
||||
// document["LastGameServerPos"] = JsonConvert.SerializeObject(LastGameServerPos);
|
||||
// document["AuthAdminLevel"] = JsonConvert.SerializeObject(m_auth_admin_levels);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
// public void UpdateCharacterToMemory(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public void CopyCharacterEntityForTransaction(out CharEntity newcharEntity)
|
||||
// {
|
||||
// newcharEntity = new(DocumentForUpdate());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
29
ServerCommon/z.Backup/CharListEntity.cs
Normal file
29
ServerCommon/z.Backup/CharListEntity.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2;
|
||||
//using Amazon.DynamoDBv2.Model;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class CharListEntity
|
||||
// {
|
||||
// public string PK_AccountGuid { get; private set; } = string.Empty;
|
||||
// public string SK_CharGuid { get; private set; } = string.Empty;
|
||||
|
||||
// public CharListEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_AccountGuid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.CharList), "");
|
||||
// SK_CharGuid = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.CharList), "");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
60
ServerCommon/z.Backup/CharMetaDataEntity.cs
Normal file
60
ServerCommon/z.Backup/CharMetaDataEntity.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//using System;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using System.Collections.Concurrent;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class CharMetaDataAttr
|
||||
// {
|
||||
// public int MailSendCount = 0;
|
||||
// public long MailSendUpdateDay = 0;
|
||||
// public int LastGetSystemMailId = 0;
|
||||
// public List<ChatTapInfo> chatTapInfoList = new();
|
||||
// }
|
||||
|
||||
// public class CharMetaDataEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public CharMetaDataAttr Attr { get; private set; } = new();
|
||||
|
||||
// public CharMetaDataEntity() { }
|
||||
|
||||
// public CharMetaDataEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.CharMetaData), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.CharMetaData), "");
|
||||
|
||||
// CharMetaDataAttr? attr = JsonConvert.DeserializeObject<CharMetaDataAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.CharMetaData, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.CharMetaData, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
57
ServerCommon/z.Backup/CharProfileEntity.cs
Normal file
57
ServerCommon/z.Backup/CharProfileEntity.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class CharProfileAttr
|
||||
// {
|
||||
// public string SNSLick = string.Empty;
|
||||
// public string Message = string.Empty;
|
||||
// }
|
||||
|
||||
// public class CharProfileEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public CharProfileAttr Attr { get; private set; } = new();
|
||||
|
||||
// public CharProfileEntity() { }
|
||||
|
||||
// public CharProfileEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.CharProfile), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.CharProfile), "");
|
||||
|
||||
// CharProfileAttr? attr = JsonConvert.DeserializeObject<CharProfileAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.CharProfile, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.CharProfile, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
113
ServerCommon/z.Backup/ClaimRewardEntity.cs
Normal file
113
ServerCommon/z.Backup/ClaimRewardEntity.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
|
||||
|
||||
//namespace ServerCommon
|
||||
//{
|
||||
|
||||
|
||||
// public class DBClaimInfo
|
||||
// {
|
||||
// public int ClaimId { get; set; } = 0;
|
||||
// public int ActiveRewardIdx { get; set; } = 0;
|
||||
// public Timestamp ActiveTime { get; set; } = new();
|
||||
// public Timestamp CreateTime { get; set; } = new();
|
||||
// public Timestamp CompleteTime { get; set; } = new();
|
||||
// public int IsComplete { get; set; } = 0;
|
||||
// }
|
||||
|
||||
|
||||
// public class ClaimAttr
|
||||
// {
|
||||
// public Dictionary<int, DBClaimInfo> Infos;
|
||||
|
||||
// public ClaimAttr()
|
||||
// {
|
||||
// Infos = new();
|
||||
// }
|
||||
// }
|
||||
|
||||
// public class ClaimNormalEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public ClaimAttr Attr { get; set; } = new();
|
||||
|
||||
// public ClaimNormalEntity() { }
|
||||
|
||||
// public ClaimNormalEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
//// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.ClaimRewardNormal), "");
|
||||
//// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.ClaimRewardNormal), "");
|
||||
////
|
||||
//// ClaimAttr? attr = JsonConvert.DeserializeObject<ClaimAttr>(document["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
//// return false;
|
||||
//// }
|
||||
////
|
||||
//// Attr = attr;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.ClaimRewardNormal, PK_Guid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.ClaimRewardNormal, SK_Empty);
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// public class ClaimMembershipEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public ClaimAttr Attr { get; set; } = new();
|
||||
|
||||
// public ClaimMembershipEntity() { }
|
||||
|
||||
// public ClaimMembershipEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
//// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.ClaimRewardMembership), "");
|
||||
//// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.ClaimRewardMembership), "");
|
||||
////
|
||||
//// ClaimAttr? attr = JsonConvert.DeserializeObject<ClaimAttr>(document["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
//// return false;
|
||||
//// }
|
||||
////
|
||||
//// Attr = attr;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.ClaimRewardMembership, PK_Guid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.ClaimRewardMembership, SK_Empty);
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
183
ServerCommon/z.Backup/DynamoDBHelper.cs
Normal file
183
ServerCommon/z.Backup/DynamoDBHelper.cs
Normal file
@@ -0,0 +1,183 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
|
||||
//using Amazon.DynamoDBv2;
|
||||
//using Amazon.DynamoDBv2.Model;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Amazon.Runtime;
|
||||
|
||||
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
|
||||
//namespace ServerCommon
|
||||
//{
|
||||
// public static class DynamoDBHelper
|
||||
// {
|
||||
// public static AmazonDynamoDBClient? CreateClient(ServerConfig config)
|
||||
// {
|
||||
// AmazonDynamoDBClient? client;
|
||||
// AmazonDynamoDBConfig ddbConfig = new AmazonDynamoDBConfig();
|
||||
// ddbConfig.BufferSize = 4 * 1024 * 1024; // 4 MB
|
||||
// ddbConfig.RetryMode = RequestRetryMode.Standard;
|
||||
// ddbConfig.DisableLogging = false; // Logging is disabled by default. - Set to true to enable request-level logging.
|
||||
// ddbConfig.ThrottleRetries = false; // Throttled requests are not automatically retried. - Set to false to automatically retry throttled requests.
|
||||
// if (config.AWS.LocalDynamoDB)
|
||||
// {
|
||||
// // DynamoDB-Local is running, so create a client
|
||||
// Log.getLogger().info("Setting up a DynamoDB-Local client (DynamoDB Local seems to be running)");
|
||||
// ddbConfig.ServiceURL = config.Dynamodb;
|
||||
|
||||
// try
|
||||
// {
|
||||
// client = new AmazonDynamoDBClient("AKIA3UC3QYDRYBC4IN66", "uErT6wYLyyTqTBIoV5o/tJGogVem6EhdmlTr9cgJ", ddbConfig);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error($"FAILED to create a DynamoDBLocal client: {ex}");
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Log.getLogger().info($" -- Setting up a DynamoDB-Remote client : TargetRegion:{config.AWS.Region}");
|
||||
|
||||
// try
|
||||
// {
|
||||
// ddbConfig.RegionEndpoint = Amazon.RegionEndpoint.GetBySystemName(config.AWS.Region);
|
||||
// client = new AmazonDynamoDBClient( config.AWS.AccessKey, config.AWS.SecretKey
|
||||
// , ddbConfig );
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error($"FAILED to create a DynamoDB-Remote client: {ex}");
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return client;
|
||||
// }
|
||||
|
||||
// public static async Task<bool> CheckingTableExistence(AmazonDynamoDBClient client, string tblNm)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var response = await client.ListTablesAsync();
|
||||
// return response.TableNames.Contains(tblNm);
|
||||
// }
|
||||
// catch(Exception e)
|
||||
// {
|
||||
// Log.getLogger().error($"table:{tblNm} {e}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// public static async Task<bool> CreateTable(AmazonDynamoDBClient client, string tableName,
|
||||
// List<AttributeDefinition> tableAttributes,
|
||||
// List<KeySchemaElement> tableKeySchema)
|
||||
// {
|
||||
// bool response = true;
|
||||
|
||||
// // Build the 'CreateTableRequest' structure for the new table
|
||||
// var toCreateUpdate = new CreateTableRequest
|
||||
// {
|
||||
// TableName = tableName,
|
||||
// AttributeDefinitions = tableAttributes,
|
||||
// KeySchema = tableKeySchema,
|
||||
// BillingMode = BillingMode.PAY_PER_REQUEST
|
||||
// };
|
||||
|
||||
// try
|
||||
// {
|
||||
// var makeTbl = await client.CreateTableAsync(toCreateUpdate);
|
||||
// Log.getLogger().info($"Table : {makeTbl.TableDescription.TableName}");
|
||||
// }
|
||||
// //catch (AmazonDynamoDBException ex) { Log.getLogger().error(ex.ToString()); }
|
||||
// //catch (AmazonServiceException ex) { Log.getLogger().error(ex.ToString()); }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error($"table:{tableName} {ex}");
|
||||
// response = false;
|
||||
// }
|
||||
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// public static async Task<bool> CreateTable(AmazonDynamoDBClient client, string tableName,
|
||||
// List<AttributeDefinition> tableAttributes,
|
||||
// List<KeySchemaElement> tableKeySchema,
|
||||
// List<GlobalSecondaryIndex> globalSecondaryIndexes)
|
||||
// {
|
||||
// bool response = true;
|
||||
|
||||
// // Build the 'CreateTableRequest' structure for the new table
|
||||
// var request = new CreateTableRequest
|
||||
// {
|
||||
// TableName = tableName,
|
||||
// AttributeDefinitions = tableAttributes,
|
||||
// KeySchema = tableKeySchema,
|
||||
// GlobalSecondaryIndexes = globalSecondaryIndexes,
|
||||
// BillingMode = BillingMode.PAY_PER_REQUEST
|
||||
// };
|
||||
|
||||
// try
|
||||
// {
|
||||
// var makeTbl = await client.CreateTableAsync(request);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error($"table:{tableName} {ex}");
|
||||
// response = false;
|
||||
// }
|
||||
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// public static async Task<bool> DeleteTable(AmazonDynamoDBClient client, string tableName)
|
||||
// {
|
||||
// bool response = true;
|
||||
|
||||
// // Build the 'CreateTableRequest' structure for the new table
|
||||
// var request = new DeleteTableRequest
|
||||
// {
|
||||
// TableName = tableName,
|
||||
// };
|
||||
|
||||
// try
|
||||
// {
|
||||
// var makeTbl = await client.DeleteTableAsync(request);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error($"table:{tableName} {ex}");
|
||||
// response = false;
|
||||
// }
|
||||
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// public static async Task<TableDescription?> GetTableDescription(AmazonDynamoDBClient client, string tableName)
|
||||
// {
|
||||
// TableDescription? result = null;
|
||||
|
||||
// // If the table exists, get its description.
|
||||
// try
|
||||
// {
|
||||
// var response = await client.DescribeTableAsync(tableName);
|
||||
// result = response.Table;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error($"GetTableDescription : {ex}");
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
60
ServerCommon/z.Backup/EmotionCollectionEntity.cs
Normal file
60
ServerCommon/z.Backup/EmotionCollectionEntity.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class EmotionCollectionAttr
|
||||
// {
|
||||
// public HashSet<int> collectionInfos = new HashSet<int>();
|
||||
// }
|
||||
|
||||
// public class EmotionCollectionEntity
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// DB PK에 사용되는 charGuid
|
||||
// /// </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// /// <summary>
|
||||
// /// DB SK에 사용되지 않음. 빈값임
|
||||
// /// </summary>
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public EmotionCollectionAttr Attr { get; private set; } = new EmotionCollectionAttr();
|
||||
|
||||
// public EmotionCollectionEntity() { }
|
||||
|
||||
// public EmotionCollectionEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.EmotionCollection), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.EmotionCollection), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<EmotionCollectionAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.EmotionCollection, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.EmotionCollection, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
54
ServerCommon/z.Backup/EmotionSlotEntity.cs
Normal file
54
ServerCommon/z.Backup/EmotionSlotEntity.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class EmotionSlotAttr
|
||||
// {
|
||||
// public Dictionary<int, int> slotInfos = new Dictionary<int, int>();
|
||||
// }
|
||||
|
||||
// public class EmotionSlotEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public EmotionSlotAttr Attr { get; private set; } = new EmotionSlotAttr();
|
||||
|
||||
// public EmotionSlotEntity() { }
|
||||
|
||||
// public EmotionSlotEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.EmotionSlot), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.EmotionSlot), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<EmotionSlotAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.EmotionSlot, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.EmotionSlot, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
49
ServerCommon/z.Backup/EnumConverter.cs
Normal file
49
ServerCommon/z.Backup/EnumConverter.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
using MetaAssets;
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public static class EnumConverter
|
||||
{
|
||||
public static CurrencyType ToProto(this DataAssets.CurrencyType currencyType)
|
||||
{
|
||||
return currencyType switch
|
||||
{
|
||||
DataAssets.CurrencyType.None => CurrencyType.None,
|
||||
DataAssets.CurrencyType.GOLD => CurrencyType.Gold,
|
||||
DataAssets.CurrencyType.BLUECALI => CurrencyType.BlueCali,
|
||||
DataAssets.CurrencyType.REDCALI => CurrencyType.RedCali,
|
||||
DataAssets.CurrencyType.BLACKCALI => CurrencyType.BlackCali,
|
||||
_ => throw new Exception($"ToProto error. enum value error. currencyType: {currencyType}"),
|
||||
};
|
||||
}
|
||||
|
||||
public static ContentsType ToProto(this DataAssets.ContentsType contentsType)
|
||||
{
|
||||
return contentsType switch
|
||||
{
|
||||
DataAssets.ContentsType.None => ContentsType.None,
|
||||
DataAssets.ContentsType.MyHome => ContentsType.MyHome,
|
||||
DataAssets.ContentsType.DressRoom => ContentsType.DressRoom,
|
||||
DataAssets.ContentsType.Concert => ContentsType.Concert,
|
||||
DataAssets.ContentsType.Movie => ContentsType.Movie,
|
||||
DataAssets.ContentsType.Instance => ContentsType.Instance,
|
||||
DataAssets.ContentsType.Meeting => ContentsType.Meeting,
|
||||
_ => throw new Exception($"ToProto error. enum value error. currencyType: {contentsType}"),
|
||||
};
|
||||
}
|
||||
|
||||
public static LanguageType ToProto(this DataAssets.LanguageType languageType)
|
||||
{
|
||||
return languageType switch
|
||||
{
|
||||
DataAssets.LanguageType.None => LanguageType.None,
|
||||
DataAssets.LanguageType.Ko => LanguageType.Ko,
|
||||
DataAssets.LanguageType.En => LanguageType.En,
|
||||
DataAssets.LanguageType.Th => LanguageType.Th,
|
||||
_ => throw new Exception($"ToProto error. enum value error. currencyType: {languageType}"),
|
||||
};
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
58
ServerCommon/z.Backup/EscapePositionEntity.cs
Normal file
58
ServerCommon/z.Backup/EscapePositionEntity.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class EscapePositionAttr
|
||||
// {
|
||||
// [JsonProperty("AvailableTime")]
|
||||
// public Timestamp m_escape_available_time = new();
|
||||
// }
|
||||
// public class EscapePositionEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public EscapePositionAttr Attr { get; private set; } = new();
|
||||
// public EscapePositionEntity(EscapePositionEntity entity)
|
||||
// {
|
||||
// PK_Guid = new string(entity.PK_Guid);
|
||||
// SK_Empty = new string(entity.SK_Empty);
|
||||
// Attr.m_escape_available_time = new(entity.Attr.m_escape_available_time);
|
||||
// }
|
||||
|
||||
// public EscapePositionEntity() {}
|
||||
|
||||
// public void ReadFrom(Document document)
|
||||
// {
|
||||
|
||||
//// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.EscapePosition), "");
|
||||
//// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.EscapePosition), "");
|
||||
////
|
||||
//// EscapePositionAttr? attr = JsonConvert.DeserializeObject<EscapePositionAttr>(document["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// attr = new EscapePositionAttr();
|
||||
//// }
|
||||
//// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.EscapePosition, PK_Guid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.EscapePosition, SK_Empty);
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//}
|
||||
83
ServerCommon/z.Backup/FriendFolderListEntity.cs
Normal file
83
ServerCommon/z.Backup/FriendFolderListEntity.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public enum FriendFolderHoldType
|
||||
// {
|
||||
// HOLD = 1,
|
||||
// RELEASE = 2,
|
||||
// }
|
||||
|
||||
// public enum FriendFolderorderType
|
||||
// {
|
||||
// ALPHABETICAL = 1,
|
||||
// STATEFUL = 2,
|
||||
// }
|
||||
|
||||
// public class FriendFolderListAttr
|
||||
// {
|
||||
// public int folderOrderType; //
|
||||
// public ConcurrentDictionary<string, FriendFolder> friendFolderList;
|
||||
|
||||
// public FriendFolderListAttr()
|
||||
// {
|
||||
// folderOrderType = (int)FriendFolderorderType.ALPHABETICAL;
|
||||
|
||||
// Timestamp now = Timestamp.FromDateTime(DateTime.UtcNow);
|
||||
|
||||
// FriendFolder folder = new FriendFolder();
|
||||
// folder.FolderName = Constant.FRIEND_FOLDER_DEFUALT_NAME;
|
||||
// folder.IsHold = (int)FriendFolderHoldType.RELEASE;
|
||||
// folder.HoldTime = now;
|
||||
// folder.CreateTime = now;
|
||||
// friendFolderList = new ConcurrentDictionary<string, FriendFolder>();
|
||||
// friendFolderList.TryAdd(folder.FolderName, folder);
|
||||
// }
|
||||
// }
|
||||
// public class FriendFolderListEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public FriendFolderListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public FriendFolderListEntity() { }
|
||||
|
||||
// public FriendFolderListEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.FriendFolderList), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.FriendFolderList), "");
|
||||
|
||||
// FriendFolderListAttr? attr = JsonConvert.DeserializeObject<FriendFolderListAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// throw new Exception("FriendListEntity Attr DeserializeObject error");
|
||||
|
||||
// }
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.FriendFolderList, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.FriendFolderList, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
143
ServerCommon/z.Backup/FriendListEntity.cs
Normal file
143
ServerCommon/z.Backup/FriendListEntity.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
//using Nettention.Proud;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCommon;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Reflection;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class FriendListAttr
|
||||
// {
|
||||
// public ConcurrentDictionary<string, FriendInfo> friendList;
|
||||
|
||||
// public FriendListAttr()
|
||||
// {
|
||||
// friendList = new ConcurrentDictionary<string, FriendInfo>();
|
||||
// }
|
||||
|
||||
// }
|
||||
// public class FriendListEntity
|
||||
// {
|
||||
// public FriendListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public FriendListEntity()
|
||||
// {
|
||||
// Log.getLogger().debug("FriendListEntity Empty Constructor Call");
|
||||
// }
|
||||
|
||||
// public FriendListEntity(List<Document> documents, string accountGuid)
|
||||
// {
|
||||
// ReadFrom(documents, accountGuid);
|
||||
// }
|
||||
|
||||
// void ReadFrom(List<Document> documents, string accountGuid)
|
||||
// {
|
||||
// if (documents.Count == 0)
|
||||
// {
|
||||
// Attr.friendList = new();
|
||||
// }
|
||||
|
||||
//// foreach (Document doc in documents) {
|
||||
////
|
||||
//// string friendGuid = doc["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.FriendList), "");
|
||||
//// FriendInfo? attr = JsonConvert.DeserializeObject<FriendInfo>(doc["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// Log.getLogger().error("FriendList ReadFrom attr is null");
|
||||
//// continue;
|
||||
//// }
|
||||
//// Attr.friendList.TryAdd(friendGuid, attr);
|
||||
//// }
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate(string pkGuid, string skGuid, FriendInfo? info = null)
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.FriendList, pkGuid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.FriendList, skGuid);
|
||||
////
|
||||
//// if (info is null)
|
||||
//// {
|
||||
//// info = new FriendInfo();
|
||||
//// }
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(info);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
|
||||
//// public (List<Document>, FriendInfo) DocumentForInsert(string myGuid, string myNickName, string friendGuid, string friendNickname)
|
||||
//// {
|
||||
////
|
||||
//// List<Document> documents = new List<Document>();
|
||||
////
|
||||
////
|
||||
//// var myDocument = new Document();
|
||||
//// myDocument["PK"] = MainDB.MakePK(EEntityType.FriendList, myGuid);
|
||||
//// myDocument["SK"] = MainDB.MakeSK(EEntityType.FriendList, friendGuid);
|
||||
////
|
||||
//// DateTime now = DateTime.UtcNow;
|
||||
////
|
||||
//// FriendInfo friendInfo = new FriendInfo();
|
||||
//// friendInfo.Guid = friendGuid;
|
||||
//// friendInfo.NickName = friendNickname;
|
||||
//// friendInfo.IsNew = 1;
|
||||
//// friendInfo.FolderName = Constant.FRIEND_FOLDER_DEFUALT_NAME;
|
||||
//// Timestamp nowTS = Timestamp.FromDateTime(now);
|
||||
////
|
||||
//// friendInfo.CreateTime = nowTS;
|
||||
//// Timestamp lastInviteTS = Timestamp.FromDateTime(now.AddMilliseconds(MetaHelper.GameConfigMeta.FriendIntiveCoolTime * 1000 * -1));
|
||||
//// friendInfo.LastInvitedTime = lastInviteTS;
|
||||
//// //친구의 현재 상태는 바로 확인이 안된다. 일단 2로..
|
||||
//// // 0 : online 1 : sleep 2 : don't disturb
|
||||
//// friendInfo.CurrentState = 2;
|
||||
////
|
||||
//// myDocument["Attr"] = JsonConvert.SerializeObject(friendInfo);
|
||||
//// documents.Add(myDocument);
|
||||
////
|
||||
////
|
||||
//// var friendDocument = new Document();
|
||||
//// friendDocument["PK"] = MainDB.MakePK(EEntityType.FriendList, friendGuid);
|
||||
//// friendDocument["SK"] = MainDB.MakeSK(EEntityType.FriendList, myGuid);
|
||||
////
|
||||
//// FriendInfo myInfo = new FriendInfo();
|
||||
//// myInfo.Guid = myGuid;
|
||||
//// myInfo.NickName = myNickName;
|
||||
//// myInfo.IsNew = 1;
|
||||
//// myInfo.FolderName = Constant.FRIEND_FOLDER_DEFUALT_NAME;
|
||||
//// myInfo.CreateTime = nowTS;
|
||||
//// myInfo.LastInvitedTime = lastInviteTS;
|
||||
//// myInfo.CurrentState = 0;
|
||||
//// friendDocument["Attr"] = JsonConvert.SerializeObject(myInfo);
|
||||
////
|
||||
//// documents.Add(friendDocument);
|
||||
////
|
||||
//// return (documents, friendInfo);
|
||||
//// }
|
||||
|
||||
|
||||
// public List<Document> DocumentForDelete (string myGuid, string friendGuid)
|
||||
// {
|
||||
|
||||
// List<Document> documents = new List<Document>();
|
||||
//// var myDocument = new Document();
|
||||
//// myDocument["PK"] = MainDB.MakePK(EEntityType.FriendList, myGuid);
|
||||
//// myDocument["SK"] = MainDB.MakeSK(EEntityType.FriendList, friendGuid);
|
||||
//// documents.Add(myDocument);
|
||||
////
|
||||
//// var friendDocument = new Document();
|
||||
//// friendDocument["PK"] = MainDB.MakePK(EEntityType.FriendList, friendGuid);
|
||||
//// friendDocument["SK"] = MainDB.MakeSK(EEntityType.FriendList, myGuid);
|
||||
//// documents.Add(friendDocument);
|
||||
|
||||
// return documents;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
164
ServerCommon/z.Backup/FriendRequestListEntity.cs
Normal file
164
ServerCommon/z.Backup/FriendRequestListEntity.cs
Normal file
@@ -0,0 +1,164 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class FriendSendedRequestListAttr
|
||||
// {
|
||||
// public ConcurrentDictionary<string, FriendRequestInfo> sendedList;
|
||||
|
||||
// public FriendSendedRequestListAttr()
|
||||
// {
|
||||
// sendedList = new ConcurrentDictionary<string, FriendRequestInfo>();
|
||||
// }
|
||||
|
||||
// }
|
||||
// public class FriendReceivedRequestListAttr
|
||||
// {
|
||||
// public ConcurrentDictionary<string, FriendRequestInfo> receivedList;
|
||||
|
||||
// public FriendReceivedRequestListAttr()
|
||||
// {
|
||||
// receivedList = new ConcurrentDictionary<string, FriendRequestInfo>();
|
||||
// }
|
||||
|
||||
// }
|
||||
// public class FriendRequestListEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
|
||||
// public FriendSendedRequestListAttr SendedRequestAttr { get; private set; } = new ();
|
||||
// public FriendReceivedRequestListAttr ReceivedRequestAttr { get; private set; } = new();
|
||||
|
||||
// public readonly string SendedKeyPrefix = "sended#";
|
||||
// public readonly string ReceivedKeyPrefix = "received#";
|
||||
|
||||
// public FriendRequestListEntity() { }
|
||||
|
||||
// public FriendRequestListEntity(List<Document> documents, string accountGuid)
|
||||
// {
|
||||
// ReadFrom(documents, accountGuid);
|
||||
// }
|
||||
|
||||
// void ReadFrom(List<Document> documents, string accountGuid)
|
||||
// {
|
||||
// if (documents.Count == 0)
|
||||
// {
|
||||
// SendedRequestAttr.sendedList = new();
|
||||
// ReceivedRequestAttr.receivedList = new();
|
||||
// PK_Guid = accountGuid;
|
||||
// }
|
||||
|
||||
//// bool isCheck = false;
|
||||
// foreach (Document doc in documents)
|
||||
// {
|
||||
|
||||
//// if (isCheck == false)
|
||||
//// {
|
||||
//// PK_Guid = doc["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.FriendRequestList), "");
|
||||
//// isCheck = true;
|
||||
//// }
|
||||
////
|
||||
//// //string sendedStr = "sended#";
|
||||
//// //string receivedStr = "received#";
|
||||
//// if (doc["SK"].AsString().Contains(SendedKeyPrefix))
|
||||
//// {
|
||||
//// string guid = doc["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.FriendRequestList) + SendedKeyPrefix, "");
|
||||
//// FriendRequestInfo? attr = JsonConvert.DeserializeObject<FriendRequestInfo>(doc["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// Log.getLogger().error("Sended FriendList ReadFrom attr is null");
|
||||
//// continue;
|
||||
//// }
|
||||
////
|
||||
//// SendedRequestAttr.sendedList.TryAdd(guid, attr);
|
||||
////
|
||||
//// }
|
||||
//// else if (doc["SK"].AsString().Contains(ReceivedKeyPrefix))
|
||||
//// {
|
||||
//// string guid = doc["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.FriendRequestList) + ReceivedKeyPrefix, "");
|
||||
//// FriendRequestInfo? attr = JsonConvert.DeserializeObject<FriendRequestInfo>(doc["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// {
|
||||
//// Log.getLogger().error("Received FriendList ReadFrom attr is null");
|
||||
//// continue;
|
||||
//// }
|
||||
////
|
||||
//// ReceivedRequestAttr.receivedList.TryAdd(guid, attr);
|
||||
////
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public List<Document> DocumentForInsert(string myGuid, FriendRequestInfo sendedInfo, string friendGuid, FriendRequestInfo receivedInfo)
|
||||
// {
|
||||
// List<Document> documents = new List<Document>();
|
||||
//// var myDocument = new Document();
|
||||
//// myDocument["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, myGuid);
|
||||
//// myDocument["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, SendedKeyPrefix + friendGuid);
|
||||
//// myDocument["Attr"] = JsonConvert.SerializeObject(sendedInfo);
|
||||
//// documents.Add(myDocument);
|
||||
////
|
||||
//// var friendDocument = new Document();
|
||||
//// friendDocument["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, friendGuid);
|
||||
//// friendDocument["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, ReceivedKeyPrefix + myGuid);
|
||||
//// friendDocument["Attr"] = JsonConvert.SerializeObject(receivedInfo);
|
||||
//// documents.Add(friendDocument);
|
||||
|
||||
// return documents;
|
||||
|
||||
// }
|
||||
|
||||
//// public List<Document> DocumentReceivedForDelete(string myGuid, string deleteGuid)
|
||||
//// {
|
||||
//// List<Document> documents = new List<Document>();
|
||||
//// var myDocument = new Document();
|
||||
//// myDocument["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, myGuid);
|
||||
//// myDocument["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, ReceivedKeyPrefix + deleteGuid);
|
||||
//// documents.Add(myDocument);
|
||||
////
|
||||
//// var otherDocument = new Document();
|
||||
//// otherDocument["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, deleteGuid);
|
||||
//// otherDocument["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, SendedKeyPrefix + myGuid);
|
||||
//// documents.Add(otherDocument);
|
||||
////
|
||||
//// return documents;
|
||||
//// }
|
||||
|
||||
// public List<Document> DocumentSendedForDelete(string myGuid, string deleteGuid)
|
||||
// {
|
||||
// List<Document> documents = new List<Document>();
|
||||
//// var myDocument = new Document();
|
||||
//// myDocument["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, myGuid);
|
||||
//// myDocument["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, SendedKeyPrefix + deleteGuid);
|
||||
//// documents.Add(myDocument);
|
||||
////
|
||||
//// var otherDocument = new Document();
|
||||
//// otherDocument["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, deleteGuid);
|
||||
//// otherDocument["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, ReceivedKeyPrefix + myGuid);
|
||||
//// documents.Add(otherDocument);
|
||||
|
||||
// return documents;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//// public Document ReceivedDocumentForUpdate(string skGuid, FriendRequestInfo info)
|
||||
//// {
|
||||
//// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.FriendRequestList, PK_Guid);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.FriendRequestList, ReceivedKeyPrefix + skGuid);
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(info);
|
||||
////
|
||||
//// return document;
|
||||
//// }
|
||||
|
||||
// }
|
||||
//}
|
||||
60
ServerCommon/z.Backup/InstanceLastRoomEntity.cs
Normal file
60
ServerCommon/z.Backup/InstanceLastRoomEntity.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class InstanceLastRoomAttr
|
||||
// {
|
||||
// public Dictionary<int, string> LastRoomIds = new();
|
||||
// }
|
||||
|
||||
// public class InstanceLastRoomEntity
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// DB PK에 사용되는 charGuid
|
||||
// /// </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// /// <summary>
|
||||
// /// DB SK에 사용되지 않음. 빈값임
|
||||
// /// </summary>
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public InstanceLastRoomAttr Attr { get; private set; } = new();
|
||||
|
||||
// public InstanceLastRoomEntity() { }
|
||||
|
||||
// public InstanceLastRoomEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.InstanceLastRoom), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.InstanceLastRoom), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<InstanceLastRoomAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.InstanceLastRoom, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.InstanceLastRoom, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
79
ServerCommon/z.Backup/InventoryEntity.cs
Normal file
79
ServerCommon/z.Backup/InventoryEntity.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public enum InvenSlot
|
||||
// {
|
||||
// LOCAL_ETC = 0,
|
||||
// LOCAL_COSTUME = 1,
|
||||
// LOCAL_INTERIOR = 2,
|
||||
// LOCAL_BEAUTY = 3,
|
||||
// LOCAL_TATTOO = 4,
|
||||
// NFT_ETC = 5,
|
||||
// NFT_COSTUME = 6,
|
||||
// NFT_INTERIOR = 7,
|
||||
// NFT_BEAUTY = 8,
|
||||
// NFT_TATTOO = 9,
|
||||
// }
|
||||
|
||||
// public class InventoryAttr
|
||||
// {
|
||||
// public HashSet<string>[] InventoryTaps = { new(), new(), new(), new(), new(), new(), new(), new(), new(), new() };
|
||||
// }
|
||||
|
||||
// public class InventoryEntity
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// DB PK에 사용되는 charGuid
|
||||
// /// </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// /// <summary>
|
||||
// /// DB SK에 사용되지 않음. 빈값임
|
||||
// /// </summary>
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public InventoryAttr Attr { get; private set; } = new();
|
||||
|
||||
// public InventoryEntity() { }
|
||||
// public InventoryEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Inventory), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Inventory), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<InventoryAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Inventory, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Inventory, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
// public void Clear()
|
||||
// {
|
||||
// foreach (var InventoryTap in Attr.InventoryTaps)
|
||||
// {
|
||||
// InventoryTap.Clear();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
91
ServerCommon/z.Backup/ItemEntity.cs
Normal file
91
ServerCommon/z.Backup/ItemEntity.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
|
||||
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class ItemAttr
|
||||
// {
|
||||
// public string Owner = string.Empty;
|
||||
// public string ItemGuid = string.Empty;
|
||||
// public int ItemId = 0;
|
||||
// public int Count = 0;
|
||||
// public int Level = 0;
|
||||
// public List<int> AttributeIds = new();
|
||||
// public Timestamp CreateTime = new();
|
||||
// public Timestamp UpdateTime = new();
|
||||
// }
|
||||
|
||||
// public class ItemEntity
|
||||
// {
|
||||
// / <summary>
|
||||
// / DB PK에 사용되는 ItemGuid
|
||||
// / </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// / <summary>
|
||||
// / DB SK에 사용되는 ItemGuid
|
||||
// / </summary>
|
||||
// public string SK_Guid { get; private set; } = string.Empty;
|
||||
// public ItemAttr Attr { get; private set; } = new();
|
||||
|
||||
// public ItemEntity(int itemId, int itemCount, int level, List<int> attributeIds)
|
||||
// {
|
||||
// var itemGuid = Guid.NewGuid().ToString("N");
|
||||
|
||||
// PK_Guid = itemGuid;
|
||||
// SK_Guid = itemGuid;
|
||||
|
||||
// Attr.ItemGuid = itemGuid;
|
||||
// Attr.ItemId = itemId;
|
||||
// Attr.Count = itemCount;
|
||||
// Attr.Level = level;
|
||||
// Attr.AttributeIds = attributeIds;
|
||||
// Attr.CreateTime = Timestamp.FromDateTime(DateTime.UtcNow);
|
||||
// Attr.UpdateTime = Timestamp.FromDateTime(DateTime.UtcNow);
|
||||
// }
|
||||
|
||||
// public ItemEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Item), "");
|
||||
// SK_Guid = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Item), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<ItemAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Item, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Item, SK_Guid);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
|
||||
// public ItemBase ConvetToItem()
|
||||
// {
|
||||
// ItemBase item = new Item();
|
||||
|
||||
// item.ItemGuid = Attr.ItemGuid;
|
||||
// item.ItemId = Attr.ItemId;
|
||||
// item.Count = Attr.Count;
|
||||
// item.Level = Attr.Level;
|
||||
// item.Attributeids.AddRange(Attr.AttributeIds);
|
||||
// item.CreateTime = Attr.CreateTime;
|
||||
// item.UpdateTime = Attr.UpdateTime;
|
||||
|
||||
// return item;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
58
ServerCommon/z.Backup/LandEntity.cs
Normal file
58
ServerCommon/z.Backup/LandEntity.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class LandAttr
|
||||
// {
|
||||
// public string Owner = string.Empty;
|
||||
// public string Name = string.Empty;
|
||||
// public string Description = string.Empty;
|
||||
// public int BuildingId;
|
||||
// public Dictionary<string, AnchorProp> PropInfo = new();
|
||||
// public DateTime NFTUpdateTime;
|
||||
// }
|
||||
|
||||
// public class LandEntity
|
||||
// {
|
||||
// public int PK_Id { get; private set; } = 0;
|
||||
// public int SK_Id { get; private set; } = 0;
|
||||
// public LandAttr Attr { get; private set; } = new();
|
||||
|
||||
// public LandEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// if (!int.TryParse(document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Land), ""), out var pk))
|
||||
// throw new Exception("PK int.TryParse error");
|
||||
|
||||
// if (!int.TryParse(document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Land), ""), out var sk))
|
||||
// throw new Exception("SK int.TryParse error");
|
||||
|
||||
// LandAttr? attr = JsonConvert.DeserializeObject<LandAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// PK_Id = pk;
|
||||
// SK_Id = sk;
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Land, PK_Id.ToString());
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Land, SK_Id.ToString());
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
58
ServerCommon/z.Backup/LandListEntity.cs
Normal file
58
ServerCommon/z.Backup/LandListEntity.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class LandListAttr
|
||||
// {
|
||||
// public HashSet<int> landIds = new HashSet<int>();
|
||||
// }
|
||||
|
||||
// public class LandListEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public LandListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public LandListEntity() { }
|
||||
// public LandListEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.LandList), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.LandList), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<LandListAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.LandList, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.LandList, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
351
ServerCommon/z.Backup/LoginStorage.cs
Normal file
351
ServerCommon/z.Backup/LoginStorage.cs
Normal file
@@ -0,0 +1,351 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using OtpNet;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using StackExchange.Redis;
|
||||
|
||||
|
||||
//namespace ServerCommon
|
||||
//{
|
||||
// public class LoginInfo
|
||||
// {
|
||||
// public string Name = string.Empty;
|
||||
// public string Guid = string.Empty;
|
||||
// public string Email = string.Empty;
|
||||
// public DateTime LoginTime;
|
||||
// public LanguageType Language = LanguageType.None;
|
||||
// public int State = 0;
|
||||
// public string CurrentServer = String.Empty;
|
||||
// public string PartyGuid = string.Empty;
|
||||
// public string InstanceRoomId = string.Empty;
|
||||
|
||||
// public class MoveInfo
|
||||
// {
|
||||
// public string OneTimeKey = string.Empty;
|
||||
// public string DestServer = string.Empty;
|
||||
// }
|
||||
|
||||
// public MoveInfo? Moving;
|
||||
|
||||
// public bool ReadFrom(AccountAttr? attr, string curServer)
|
||||
// {
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error("attr is null");
|
||||
// return false;
|
||||
// }
|
||||
// Name = attr?.Id ?? string.Empty;
|
||||
// Guid = attr?.Aid ?? string.Empty;
|
||||
// Email = attr?.Email ?? string.Empty;
|
||||
// Language = attr?.Language ?? LanguageType.None;
|
||||
// LoginTime = attr?.LoginDate ?? DateTime.UtcNow;
|
||||
// CurrentServer = curServer;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// 유저 로그인 정보
|
||||
// /// </summary>
|
||||
// public class LoginStorage : IInitializer
|
||||
// {
|
||||
// readonly int KEEP_LOGIN_TIME_OUT = (60 * 1000);
|
||||
// //readonly int KEEP_WAIT_QUEUE_TIME = (30 * 1000);
|
||||
|
||||
// //ConnectionMultiplexer _connection = default!;
|
||||
// IDatabase _database = default!;
|
||||
|
||||
// string _keyPrefix = string.Empty;
|
||||
|
||||
// public LoginStorage(IDatabase redisDb, string keyPrefix)
|
||||
// {
|
||||
// Init(redisDb, keyPrefix);
|
||||
// }
|
||||
|
||||
// public async Task<Result> onInit()
|
||||
// {
|
||||
// await Task.CompletedTask;
|
||||
// var result = new Result();
|
||||
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
||||
// public LoginStorage()
|
||||
// {
|
||||
// }
|
||||
|
||||
// public void Init(IDatabase redisDB, string keyPrefix)
|
||||
// {
|
||||
// //var connection = await ConnectionMultiplexer.ConnectAsync(configuration);
|
||||
// //_database = _connection.GetDatabase();
|
||||
// _database = redisDB;
|
||||
|
||||
// _keyPrefix = keyPrefix;
|
||||
// if (!_keyPrefix.EndsWith(":"))
|
||||
// _keyPrefix += ":";
|
||||
|
||||
// _keyPrefix += "login:";
|
||||
// }
|
||||
|
||||
// string KeyWithPrefix(string key) => _keyPrefix + key;
|
||||
|
||||
|
||||
// /*
|
||||
// * 로그인 서버 로그인
|
||||
// */
|
||||
// public async Task<(ServerErrorCode, string)> Login(LoginInfo? login)
|
||||
// {
|
||||
// if (login == null)
|
||||
// {
|
||||
// Log.getLogger().error("login is null ");
|
||||
// return (ServerErrorCode.DbError, string.Empty);
|
||||
// }
|
||||
// string key = KeyWithPrefix(login.Name);
|
||||
|
||||
// Log.getLogger().debug($"login Id:{login.Name} guid:{login.Guid} email:{login.Email} server:{login.CurrentServer} key:{key} loginTime:{login.LoginTime.ToString("s")}");
|
||||
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue)
|
||||
// {
|
||||
// login = JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// if (login == null)
|
||||
// {
|
||||
// // TODO: 로그 출력 수정 필요.
|
||||
// Log.getLogger().error($"login is null !!!, login Id:{login?.Name} guid:{login?.Guid} email:{login?.Email} server:{login?.CurrentServer} key:{key} loginTime:{login?.LoginTime.ToString("s")}");
|
||||
// return (ServerErrorCode.DbError, string.Empty);
|
||||
// }
|
||||
|
||||
// if (login.Moving != null)
|
||||
// {
|
||||
// Log.getLogger().error($"Moving Error Id:{login.Name} guid:{login.Guid} email:{login.Email} server:{login.CurrentServer} loginTime:{login.LoginTime.ToString("s")} value:{value}");
|
||||
// return (ServerErrorCode.Moving, login.Moving.DestServer);
|
||||
// }
|
||||
// Log.getLogger().error($" DupLogin Id:{login.Name} guid:{login.Guid} email:{login.Email} server:{login.CurrentServer} loginTime:{login.LoginTime.ToString("s")} value:{value}");
|
||||
// return (ServerErrorCode.DupLogin, login.CurrentServer);
|
||||
// }
|
||||
|
||||
// login.LoginTime = DateTimeHelper.Current;
|
||||
// if (await _database.StringSetAsync(key, JsonConvert.SerializeObject(login), TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT)) == false)
|
||||
// {
|
||||
// Log.getLogger().error($"Id:{login.Name} guid:{login.Guid} email:{login.Email} server:{login.CurrentServer} loginTime:{login.LoginTime.ToString("s")} value:{value}");
|
||||
// return (ServerErrorCode.DbError, string.Empty);
|
||||
// }
|
||||
|
||||
// Log.getLogger().info($"login Id:{login.Name} guid:{login.Guid} email:{login.Email} server:{login.CurrentServer} loginTime:{login.LoginTime.ToString("s")}");
|
||||
|
||||
// return (ServerErrorCode.Success, string.Empty);
|
||||
// }
|
||||
|
||||
// public async Task Logout(string name)
|
||||
// {
|
||||
// Log.getLogger().info($"{name} Logout");
|
||||
|
||||
// string key = KeyWithPrefix(name);
|
||||
|
||||
// await _database.KeyDeleteAsync(key);
|
||||
// }
|
||||
|
||||
// public async Task<bool> KeepLogin(string name, LoginInfo login)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// //Log.getLogger().info($"KeepLogin Key:{name}");
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// if (login.Name == string.Empty)
|
||||
// {
|
||||
// Log.getLogger().error($"KeepLogin. value null Key:{key} id:{name}");
|
||||
// return false;
|
||||
// }
|
||||
// value = JsonConvert.SerializeObject(login);
|
||||
// Log.getLogger().warn($"KeepLogin. new value Key:{key} new value : {value} {login.Name}");
|
||||
// }
|
||||
|
||||
// // 레디스에 저장된 로그인 해있는 서버와 KeepLogin을 실행한 서버를 비교
|
||||
// // 다르면 중복 로그인으로 보고 로그아웃 처리한다
|
||||
|
||||
// //Log.getLogger().debug($"KeepLogin. Key:{key} id:{name}");
|
||||
// return await _database.StringSetAsync(key, value, TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT));
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Log.getLogger().error($"KeepLogin Key:{name} {e}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// public async Task<LoginInfo?> GetLoginInfo(string name)
|
||||
// {
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} GetLoginInfo Key:{key} value.HasValue==false");
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// Log.getLogger().info($"{name} GetLoginInfo Key:{key} Value:{value.ToString()}");
|
||||
|
||||
// return JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// }
|
||||
|
||||
// public async Task<bool> ChangeState(string name, int state)
|
||||
// {
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} GetLoginInfo Key:{key} value.HasValue==false");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// LoginInfo? login = JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// if (login == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Json parsing errer Key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// login.State = state;
|
||||
|
||||
// if (await _database.StringSetAsync(key, JsonConvert.SerializeObject(login), TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT)) == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} StringSetAsync fail Key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public async Task<bool> ChangePartyGuid(string name, string partyGuid)
|
||||
// {
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} GetLoginInfo Key:{key} value.HasValue==false");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// LoginInfo? login = JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// if (login == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Json parsing errer Key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// login.PartyGuid = partyGuid;
|
||||
|
||||
// if (await _database.StringSetAsync(key, JsonConvert.SerializeObject(login), TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT)) == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} StringSetAsync fail Key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public async Task<bool> ChangeInstanceRoomId(string name, string instanceRoomId)
|
||||
// {
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} GetLoginInfo Key:{key} value.HasValue==false");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// LoginInfo? login = JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// if (login == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Json parsing errer Key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// login.InstanceRoomId = instanceRoomId;
|
||||
|
||||
// if (await _database.StringSetAsync(key, JsonConvert.SerializeObject(login), TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT)) == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} StringSetAsync fail Key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public async Task<string> StartMoving(string name, string destServer)
|
||||
// {
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Not found Key:{key}");
|
||||
// return string.Empty;
|
||||
// }
|
||||
|
||||
// LoginInfo? login = JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// if (login == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Json parsing errer Key:{key} value:{value.ToString()}");
|
||||
// return string.Empty;
|
||||
// }
|
||||
|
||||
// var otp = KeyGeneration.GenerateRandomKey(20);
|
||||
// var base32otp = Base32Encoding.ToString(otp);
|
||||
|
||||
// login.Moving = new LoginInfo.MoveInfo();
|
||||
// login.Moving.OneTimeKey = base32otp;
|
||||
// login.Moving.DestServer = destServer;
|
||||
|
||||
// if (await _database.StringSetAsync(key, JsonConvert.SerializeObject(login), TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT*5)) == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} StringSetAsync fail Key:{key} value:{value.ToString()}");
|
||||
// return string.Empty;
|
||||
// }
|
||||
|
||||
// Log.getLogger().info($"{name} StartMoving To {destServer}");
|
||||
|
||||
// return base32otp;
|
||||
// }
|
||||
|
||||
// public async Task<bool> EndMoving(string name, DateTime loginTime)
|
||||
// {
|
||||
// string key = KeyWithPrefix(name);
|
||||
// var value = await _database.StringGetAsync(key, CommandFlags.PreferReplica);
|
||||
// if (value.HasValue == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Not found key:{key}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// LoginInfo? loginInfo = JsonConvert.DeserializeObject<LoginInfo>(value.ToString());
|
||||
// if (loginInfo == null || loginInfo.Moving == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} Json parsing error key:{key}, LoginInfo:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// string departureServer = loginInfo.CurrentServer;
|
||||
|
||||
// loginInfo.LoginTime = loginTime;
|
||||
// loginInfo.CurrentServer = loginInfo.Moving.DestServer;
|
||||
// loginInfo.Moving = null;
|
||||
|
||||
// if (await _database.StringSetAsync(key, JsonConvert.SerializeObject(loginInfo), TimeSpan.FromMilliseconds(KEEP_LOGIN_TIME_OUT)) == false)
|
||||
// {
|
||||
// Log.getLogger().error($"{name} StringSetAsynct fail key:{key} value:{value.ToString()}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Log.getLogger().info($"{name} EndMoving From {departureServer}");
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
38
ServerCommon/z.Backup/MQHelper.cs
Normal file
38
ServerCommon/z.Backup/MQHelper.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
|
||||
|
||||
namespace ServerCommon
|
||||
{
|
||||
public static class MQHelper
|
||||
{
|
||||
//static long _SessionUpdateTick = 0;
|
||||
//static int compareSessionCount = 0;
|
||||
|
||||
public static void SendSessionCount(RabbitMqConnector rabbit_mq, string instanceId, int sessionCount, int serverType, int worldId)
|
||||
{
|
||||
//DateTime newTime = DateTimeHelper.Current;
|
||||
//if (newTime.Ticks < _SessionUpdateTick || compareSessionCount == sessionCount)
|
||||
// return;
|
||||
|
||||
//_SessionUpdateTick = newTime.AddSeconds(Constant.UPDATE_SESSION_TIME).Ticks;
|
||||
|
||||
//ServerMessage notiMessage = new();
|
||||
//notiMessage.SessionInfoNoti = new();
|
||||
//notiMessage.SessionInfoNoti.InstanceId = instanceId;
|
||||
//notiMessage.SessionInfoNoti.SessionCount = sessionCount;
|
||||
//notiMessage.SessionInfoNoti.ServerType = serverType;
|
||||
//notiMessage.SessionInfoNoti.WorldId = worldId;
|
||||
|
||||
//rabbit_mq.SendManagerServer(notiMessage);
|
||||
|
||||
//compareSessionCount = sessionCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
ServerCommon/z.Backup/MailEntity.cs
Normal file
105
ServerCommon/z.Backup/MailEntity.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
////using Newtonsoft.Json;
|
||||
////using Amazon.DynamoDBv2.DocumentModel;
|
||||
////using System;
|
||||
////using System.Collections.Generic;
|
||||
////using System.Linq;
|
||||
////using System.Text;
|
||||
////using System.Threading.Tasks;
|
||||
////using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
////namespace ServerCommon.DB
|
||||
////{
|
||||
//// public enum EMailType
|
||||
//// {
|
||||
//// RECEIVED_MAIL = 1,
|
||||
//// SENDED_MAIL = 2,
|
||||
//// }
|
||||
|
||||
//// public class MailEntityAttr
|
||||
//// {
|
||||
//// public string mailKey = string.Empty;
|
||||
//// public bool isRead;
|
||||
//// public bool isGetItem;
|
||||
//// public bool isSystemMail;
|
||||
//// public string senderNickName = string.Empty;
|
||||
//// public string senderGuid = string.Empty;
|
||||
//// public string receiverNickName = string.Empty;
|
||||
//// public string receiverGuid = string.Empty;
|
||||
//// public string title = string.Empty;
|
||||
//// public string text = string.Empty;
|
||||
//// public Timestamp createTime = new();
|
||||
//// public Timestamp expireTime = new();
|
||||
//// public List<MailItem> ItemList = new();
|
||||
//// }
|
||||
|
||||
//// public class MailEntity
|
||||
//// {
|
||||
//// public string PK_Guid { get; private set; } = string.Empty;
|
||||
//// public string SK_DateSequence { get; private set; } = string.Empty;
|
||||
//// public MailEntityAttr Attr { get; private set; } = new();
|
||||
//// public string TTL { get; private set; } = string.Empty; //MUSTBE: TTL에 의해 메일이 삭제될 경우 메일 삭제 비즈니스 로그를 남기지 못한다. !!! - kangms
|
||||
|
||||
//// public EEntityType entityType { get; protected set; } = EEntityType.ReceivedMail;
|
||||
|
||||
//// public MailEntity()
|
||||
//// {
|
||||
//// }
|
||||
//// public MailEntity(Document document)
|
||||
//// {
|
||||
//// ReadFrom(document);
|
||||
//// }
|
||||
|
||||
//// public void ReadFrom(Document document)
|
||||
//// {
|
||||
//// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(entityType), "");
|
||||
//// SK_DateSequence = document["SK"].AsString().Replace(MainDB.GetSKPrefix(entityType), "");
|
||||
//// if (document.ContainsKey("TTL"))
|
||||
//// {
|
||||
//// document["TTL"].AsString();
|
||||
//// }
|
||||
//// else TTL = string.Empty;
|
||||
|
||||
|
||||
//// MailEntityAttr? attr = JsonConvert.DeserializeObject<MailEntityAttr>(document["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
//// Attr = attr;
|
||||
//// }
|
||||
|
||||
//// public Document DocumentForUpdate()
|
||||
//// {
|
||||
//// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(entityType, PK_Guid);
|
||||
//// document["SK"] = MainDB.MakeSK(entityType, SK_DateSequence);
|
||||
//// document["TTL"] = TTL;
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
//// return document;
|
||||
//// }
|
||||
//// public Document DocumentForDelete()
|
||||
//// {
|
||||
//// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(entityType, PK_Guid);
|
||||
//// document["SK"] = MainDB.MakeSK(entityType, SK_DateSequence);
|
||||
//// return document;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
//// public class ReceivedMailEntity : MailEntity
|
||||
//// {
|
||||
//// public ReceivedMailEntity(Document document)
|
||||
//// {
|
||||
//// entityType = EEntityType.ReceivedMail;
|
||||
//// ReadFrom(document);
|
||||
//// }
|
||||
//// }
|
||||
|
||||
//// public class SendedMailEntity : MailEntity
|
||||
//// {
|
||||
//// public SendedMailEntity(Document document)
|
||||
//// {
|
||||
//// entityType = EEntityType.SendedMail;
|
||||
//// ReadFrom(document);
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
2612
ServerCommon/z.Backup/MainDB.cs
Normal file
2612
ServerCommon/z.Backup/MainDB.cs
Normal file
File diff suppressed because it is too large
Load Diff
54
ServerCommon/z.Backup/MinimapMarkerEntity.cs
Normal file
54
ServerCommon/z.Backup/MinimapMarkerEntity.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class MinimapMarkerAttr
|
||||
// {
|
||||
// public Dictionary<int, Pos> markerInfos = new Dictionary<int, Pos>();
|
||||
// }
|
||||
|
||||
// public class MinimapMarkerEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public MinimapMarkerAttr Attr { get; private set; } = new MinimapMarkerAttr();
|
||||
|
||||
// public MinimapMarkerEntity() { }
|
||||
|
||||
// public MinimapMarkerEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.MinimapMarker), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.MinimapMarker), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<MinimapMarkerAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.MinimapMarker, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.MinimapMarker, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
55
ServerCommon/z.Backup/MyHomeEntity.cs
Normal file
55
ServerCommon/z.Backup/MyHomeEntity.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class MyHomeAttr
|
||||
// {
|
||||
// public int MyHomeId = 0;
|
||||
// public Dictionary<string, AnchorProp> PropInfo = new Dictionary<string, AnchorProp>();
|
||||
// }
|
||||
|
||||
// public class MyHomeEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public MyHomeAttr Attr { get; private set; } = new MyHomeAttr();
|
||||
|
||||
// public MyHomeEntity() { }
|
||||
|
||||
// public MyHomeEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.MyHome), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.MyHome), "");
|
||||
|
||||
// MyHomeAttr? attr = JsonConvert.DeserializeObject<MyHomeAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.MyHome, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.MyHome, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
60
ServerCommon/z.Backup/MyHomeListEntity.cs
Normal file
60
ServerCommon/z.Backup/MyHomeListEntity.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class MyHomeListAttr
|
||||
// {
|
||||
// public HashSet<int> myHomeIds = new HashSet<int>();
|
||||
// }
|
||||
|
||||
// public class MyHomeListEntity
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// DB PK에 사용되는 charGuid
|
||||
// /// </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// /// <summary>
|
||||
// /// DB SK에 사용되지 않음. 빈값임
|
||||
// /// </summary>
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public MyHomeListAttr Attr { get; private set; } = new MyHomeListAttr();
|
||||
|
||||
// public MyHomeListEntity() { }
|
||||
|
||||
// public MyHomeListEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.MyHomeList), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.MyHomeList), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<MyHomeListAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.MyHomeList, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.MyHomeList, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
58
ServerCommon/z.Backup/MyShopEntity.cs
Normal file
58
ServerCommon/z.Backup/MyShopEntity.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class ShopInfo
|
||||
// {
|
||||
// public List<ShopItemInfo> ShopItemList = new();
|
||||
// public Timestamp EndTime = Timestamp.FromDateTime(DateTime.UtcNow);
|
||||
// }
|
||||
|
||||
// public class MyShopEntityAttr
|
||||
// {
|
||||
// public Dictionary<int, ShopInfo> shopInfo = new();
|
||||
// }
|
||||
// public class MyShopEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public MyShopEntityAttr Attr { get; private set; } = new();
|
||||
|
||||
// public MyShopEntity()
|
||||
// {
|
||||
|
||||
// }
|
||||
// public MyShopEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// public void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.MyShop), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.MyShop), "");
|
||||
|
||||
// MyShopEntityAttr? attr = JsonConvert.DeserializeObject<MyShopEntityAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.MyShop, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.MyShop, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
44
ServerCommon/z.Backup/NickNameEntity.cs
Normal file
44
ServerCommon/z.Backup/NickNameEntity.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class NickNameEntityAttr
|
||||
// {
|
||||
// public string AccountGuid = string.Empty;
|
||||
// public string AccountId = string.Empty;
|
||||
// }
|
||||
// public class NickNameEntity
|
||||
// {
|
||||
// public string PK_NickName { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
|
||||
// public NickNameEntityAttr Attr { get; private set; } = new();
|
||||
|
||||
// public NickNameEntity()
|
||||
// {
|
||||
|
||||
// }
|
||||
// public NickNameEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_NickName = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.NickName), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.NickName), "");
|
||||
|
||||
// NickNameEntityAttr? attr = JsonConvert.DeserializeObject<NickNameEntityAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
75
ServerCommon/z.Backup/NoticeChatEntity.cs
Normal file
75
ServerCommon/z.Backup/NoticeChatEntity.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class NoticeChatEntityAttr
|
||||
// {
|
||||
// public List<NoticeChatInfo> noticeList = new();
|
||||
// }
|
||||
|
||||
// public class NoticeChatInfo
|
||||
// {
|
||||
// public int Id = 0;
|
||||
// public Timestamp startTime = new();
|
||||
// public int repeatMinuteTime = 0;
|
||||
// public int repeatCount = 0;
|
||||
// public string sender = string.Empty;
|
||||
// public int messageType = 0;
|
||||
// public List<DetailInfo> detailInfos = new();
|
||||
// }
|
||||
// public class DetailInfo
|
||||
// {
|
||||
// public LanguageType language = LanguageType.None;
|
||||
// public string chatMessage = string.Empty;
|
||||
// }
|
||||
|
||||
// public class NoticeChatEntity
|
||||
// {
|
||||
// public string PK_Empty { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public NoticeChatEntityAttr Attr { get; private set; } = new();
|
||||
|
||||
// public NoticeChatEntity()
|
||||
// {
|
||||
// }
|
||||
// public NoticeChatEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// protected void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Empty = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.NoticeChat), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.NoticeChat), "");
|
||||
|
||||
// NoticeChatEntityAttr? attr = JsonConvert.DeserializeObject<NoticeChatEntityAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.NoticeChat, PK_Empty);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.NoticeChat, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// public Document DocumentForDelete()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.NoticeChat, PK_Empty);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.NoticeChat, SK_Empty);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
208
ServerCommon/z.Backup/QuestListEntity.cs
Normal file
208
ServerCommon/z.Backup/QuestListEntity.cs
Normal file
@@ -0,0 +1,208 @@
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace ServerCommon
|
||||
{
|
||||
public class QuestRepeatInfo
|
||||
{
|
||||
//public Dictionary<int, Timestamp> NormalQuestAcceptTime { get; private set; } = new Dictionary<int, Timestamp>();
|
||||
public Timestamp m_next_allocate_time = new();
|
||||
//public int m_is_active = 0; //노멀 퀘스트메일 지급이 최초로 활성화 되는 시점에 1로 변경
|
||||
public int m_is_checking = 0;
|
||||
}
|
||||
|
||||
//클라에 안보내줘도 데이터들이 많아서 분리 처리
|
||||
public class UserQuestInfo
|
||||
{
|
||||
[JsonProperty("QuestId")]
|
||||
public Int32 m_quest_id { get; set; } = 0;
|
||||
|
||||
[JsonProperty("QuestAssignTime")]
|
||||
public Timestamp m_quest_assign_time { get; set; } = new();
|
||||
|
||||
[JsonProperty("CurrentTaskNum")]
|
||||
public Int32 m_current_task_num { get; set; } = 0;
|
||||
|
||||
[JsonProperty("TaskStartTime")]
|
||||
public Timestamp m_task_start_time { get; set; } = new();
|
||||
|
||||
[JsonProperty("QuestCompleteTime")]
|
||||
public Timestamp m_quest_complete_time { get; set; } = new();
|
||||
|
||||
[JsonProperty("ActiveIdxList")]
|
||||
public List<Int32> m_active_idx_list { get; set; } = new();
|
||||
|
||||
[JsonProperty("ActiveEvents")]
|
||||
public List<string> m_active_events { get; set; } = new();
|
||||
|
||||
[JsonProperty("HasCounter")]
|
||||
public Int32 m_has_counter { get; set; } = 0;
|
||||
|
||||
[JsonProperty("MinCounter")]
|
||||
public Int32 m_min_counter { get; set; } = 0;
|
||||
|
||||
[JsonProperty("MaxCounter")]
|
||||
public Int32 m_max_counter { get; set; } = 0;
|
||||
|
||||
[JsonProperty("CurrentCounter")]
|
||||
public Int32 m_current_counter { get; set; } = 0;
|
||||
|
||||
[JsonProperty("IsComplete")]
|
||||
public Int32 m_is_complete { get; set; } = 0;
|
||||
|
||||
[JsonProperty("ReplacedRewardGroupId")]
|
||||
public Int32 m_replaced_reward_group_id { get; set; } = 0;
|
||||
|
||||
[JsonProperty("HasTimer")]
|
||||
public Int32 m_has_timer { get; set; } = 0;
|
||||
|
||||
[JsonProperty("TimerCompleteTime")]
|
||||
public Timestamp m_timer_complete_time { get; set; } = new();
|
||||
|
||||
|
||||
//11월 26일 기준 위가 QuestInfo 와 동일
|
||||
[JsonProperty("IsCurrentTaskComplete")]
|
||||
public Int32 m_is_current_task_complete { get; set; } = 0;
|
||||
|
||||
[JsonProperty("CompletedIdxs")]
|
||||
public List<string> m_completed_idx_strings { get; set; } = new();
|
||||
|
||||
}
|
||||
|
||||
public class QuestListEntity
|
||||
{
|
||||
public string PK_Guid { get; private set; } = string.Empty;
|
||||
public string SK_Id { get; private set; } = string.Empty;
|
||||
public ConcurrentDictionary<int, UserQuestInfo> Quests = new ConcurrentDictionary<int, UserQuestInfo>();
|
||||
public ConcurrentDictionary<int, QuestEndInfo> EndQuests = new ConcurrentDictionary<int, QuestEndInfo>();
|
||||
public QuestRepeatInfo RepeatInfo = new QuestRepeatInfo();
|
||||
|
||||
public QuestListEntity()
|
||||
{
|
||||
}
|
||||
|
||||
public QuestListEntity(Document document)
|
||||
{
|
||||
ReadFrom(document);
|
||||
}
|
||||
|
||||
//public QuestListEntity Clone()
|
||||
//{
|
||||
// QuestListEntity entity = new QuestListEntity();
|
||||
// entity.PK_Guid = PK_Guid;
|
||||
// entity.SK_Id = SK_Id;
|
||||
|
||||
// entity.Quests = new();
|
||||
// foreach (var quest in Quests)
|
||||
// {
|
||||
// var quest_id = quest.Key;
|
||||
// var quest_info = quest.Value;
|
||||
|
||||
// UserQuestInfo new_info = new UserQuestInfo();
|
||||
|
||||
// new_info.m_quest_id = quest_info.m_quest_id;
|
||||
// new_info.m_quest_assign_time = new Timestamp(quest_info.m_quest_assign_time);
|
||||
// new_info.m_current_task_num = quest_info.m_current_task_num;
|
||||
|
||||
// new_info.m_task_start_time = new Timestamp(quest_info.m_task_start_time);
|
||||
// new_info.m_quest_complete_time = new Timestamp(quest_info.m_quest_complete_time);
|
||||
// new_info.m_active_idx_list = new();
|
||||
// new_info.m_active_idx_list.AddRange(quest_info.m_active_idx_list.ToList());
|
||||
// new_info.m_active_events = new();
|
||||
// new_info.m_active_events.AddRange(quest_info.m_active_events.ToList());
|
||||
|
||||
// new_info.m_has_counter = quest_info.m_has_counter;
|
||||
// new_info.m_min_counter = quest_info.m_min_counter;
|
||||
// new_info.m_max_counter = quest_info.m_max_counter;
|
||||
// new_info.m_current_counter = quest_info.m_current_counter;
|
||||
// new_info.m_is_complete = quest_info.m_is_complete;
|
||||
// new_info.m_replaced_reward_group_id = quest_info.m_replaced_reward_group_id;
|
||||
// new_info.m_has_timer = quest_info.m_has_timer;
|
||||
// new_info.m_timer_complete_time = new Timestamp(quest_info.m_timer_complete_time);
|
||||
// new_info.m_is_current_task_complete = quest_info.m_is_current_task_complete;
|
||||
// new_info.m_completed_idx_strings = new();
|
||||
// new_info.m_completed_idx_strings.AddRange(quest_info.m_completed_idx_strings.ToList());
|
||||
|
||||
// entity.Quests.TryAdd(quest_id, new_info);
|
||||
// }
|
||||
|
||||
// entity.EndQuests = new();
|
||||
|
||||
// foreach (var end in EndQuests)
|
||||
// {
|
||||
// var end_quest_id = end.Key;
|
||||
// var end_quest_info = end.Value;
|
||||
|
||||
// QuestEndInfo end_info = new();
|
||||
// end_info.QuestId = end_quest_info.QuestId;
|
||||
// end_info.EndCount = end_quest_info.EndCount;
|
||||
// end_info.LastEndTime = new Timestamp(end_quest_info.LastEndTime);
|
||||
// entity.EndQuests.TryAdd(end_quest_id, end_quest_info);
|
||||
// }
|
||||
|
||||
// entity.RepeatInfo = new();
|
||||
// entity.RepeatInfo.m_is_checking = RepeatInfo.m_is_checking;
|
||||
// entity.RepeatInfo.m_next_allocate_time = new Timestamp(RepeatInfo.m_next_allocate_time);
|
||||
|
||||
// return entity;
|
||||
//}
|
||||
|
||||
void ReadFrom(Document document)
|
||||
{
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.QuestList), "");
|
||||
// SK_Id = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.QuestList), "");
|
||||
//
|
||||
// if (document.Contains("QuestList"))
|
||||
// {
|
||||
// List<UserQuestInfo> questList = JsonConvert.DeserializeObject<List<UserQuestInfo>>(document["QuestList"].AsString()) ?? new();
|
||||
// Quests.Clear();
|
||||
// foreach (var quest in questList)
|
||||
// {
|
||||
// Quests.TryAdd(quest.m_quest_id, quest);
|
||||
// }
|
||||
// }
|
||||
// if (document.Contains("EndList"))
|
||||
// {
|
||||
// List<QuestEndInfo> endList = JsonConvert.DeserializeObject<List<QuestEndInfo>>(document["EndList"].AsString()) ?? new();
|
||||
// EndQuests.Clear();
|
||||
// foreach (var endQuest in endList)
|
||||
// {
|
||||
// EndQuests.TryAdd(endQuest.QuestId, endQuest);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (document.Contains("Attr"))
|
||||
// {
|
||||
// //dev 서버 초기화 하지 않기 위해 우선 catch, dev db 초기화 한 이후로는 추후 try catch 빼도 된다.
|
||||
// try
|
||||
// {
|
||||
// RepeatInfo = JsonConvert.DeserializeObject<QuestRepeatInfo>(document["Attr"].AsString()) ?? new();
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// RepeatInfo = new();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public Document DocumentForUpdate()
|
||||
{
|
||||
var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.QuestList, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.QuestList, SK_Id);
|
||||
// document["QuestList"] = JsonConvert.SerializeObject(Quests.Values);
|
||||
// document["EndList"] = JsonConvert.SerializeObject(EndQuests.Values);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(RepeatInfo);
|
||||
|
||||
return document;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
61
ServerCommon/z.Backup/QuestMailEntity.cs
Normal file
61
ServerCommon/z.Backup/QuestMailEntity.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
namespace ServerCommon.DB
|
||||
{
|
||||
public class QuestMailEntityAttr
|
||||
{
|
||||
public bool isRead;
|
||||
public int questId;
|
||||
public Timestamp createTime = new();
|
||||
}
|
||||
|
||||
// public class QuestMailEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Id { get; private set; } = string.Empty;
|
||||
// public QuestMailEntityAttr Attr { get; private set; } = new();
|
||||
//
|
||||
// public QuestMailEntity() { }
|
||||
//
|
||||
// public QuestMailEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
//
|
||||
// protected void ReadFrom(Document document)
|
||||
// {
|
||||
// // PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.QuestMail), "");
|
||||
// // SK_Id = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.QuestMail), "");
|
||||
// //
|
||||
// // QuestMailEntityAttr? attr = JsonConvert.DeserializeObject<QuestMailEntityAttr>(document["Attr"].AsString());
|
||||
// // if (attr == null)
|
||||
// // throw new Exception("Attr DeserializeObject error");
|
||||
// // Attr = attr;
|
||||
// }
|
||||
//
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// // document["PK"] = MainDB.MakePK(EEntityType.QuestMail, PK_Guid);
|
||||
// // document["SK"] = MainDB.MakeSK(EEntityType.QuestMail, SK_Id);
|
||||
// // document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// // public Document DocumentForDelete()
|
||||
// // {
|
||||
// // var document = new Document();
|
||||
// // document["PK"] = MainDB.MakePK(EEntityType.QuestMail, PK_Guid);
|
||||
// // document["SK"] = MainDB.MakeSK(EEntityType.QuestMail, SK_Id);
|
||||
// // return document;
|
||||
// // }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
265
ServerCommon/z.Backup/RabbitMQClient.cs
Normal file
265
ServerCommon/z.Backup/RabbitMQClient.cs
Normal file
@@ -0,0 +1,265 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Google.Protobuf;
|
||||
using Nettention.Proud;
|
||||
using RabbitMQ.Client.Events;
|
||||
using RabbitMQ.Client;
|
||||
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
|
||||
|
||||
namespace ServerBase;
|
||||
|
||||
public abstract class RabbitMQClient : RabbitMQConnectorBase, IRabbitMqSession, IInitializer
|
||||
{
|
||||
public delegate Task FnServerMessageRecvFromConsumer<T>(T message, BasicDeliverEventArgs ea) where T : IMessage;
|
||||
public FnServerMessageRecvFromConsumer<ServerMessage>? m_fn_server_message_recv_from_consumer;
|
||||
|
||||
|
||||
private readonly PacketReceiver m_packet_receiver;
|
||||
private readonly PacketSender m_packet_sender;
|
||||
|
||||
|
||||
public RabbitMQClient(string serviceName, string address, int port, string userName, string password, bool useSSL)
|
||||
: base(serviceName, address, port, userName, password, useSSL)
|
||||
{
|
||||
m_packet_receiver = new PacketReceiver(this);
|
||||
m_packet_sender = new PacketSender(this);
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task<Result> onInit()
|
||||
{
|
||||
var result = new Result();
|
||||
string err_msg = string.Empty;
|
||||
|
||||
if (false == await m_packet_receiver.registerRecvHandlerAll())
|
||||
{
|
||||
err_msg = $"Failed to register RecvHandler All !!! - {toBasicString()}";
|
||||
result.setFail(ServerErrorCode.PacketRecvHandlerRegisterFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (false == await m_packet_sender.registerSendHandlerAll())
|
||||
{
|
||||
err_msg = $"Failed to register SendHandler All !!! - {toBasicString()}";
|
||||
result.setFail(ServerErrorCode.PacketSendHandlerRegisterFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool startConsumer4Client(RabbitMQClient.FnServerMessageRecvFromConsumer<ServerMessage> fnFromConsumer)
|
||||
{
|
||||
var err_msg = string.Empty;
|
||||
|
||||
if (null == fnFromConsumer)
|
||||
{
|
||||
err_msg = $"Param fnFromConsumers is null !!! - {toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fn_server_message_recv_from_consumer = fnFromConsumer;
|
||||
|
||||
return base.startConsumer();
|
||||
}
|
||||
|
||||
protected bool onRecvProtocol<T>(BasicDeliverEventArgs ea, T recvProtocol)
|
||||
where T : Google.Protobuf.IMessage
|
||||
{
|
||||
Log.getLogger().info($"receive:{recvProtocol.ToString()} - {toBasicString()}");
|
||||
|
||||
|
||||
var receiver = getPacketReceiver();
|
||||
|
||||
if (false == receiver.fillupRabbitMqPacketCommand(ea, recvProtocol, out var fillupPacketCommand))
|
||||
{
|
||||
Log.getLogger().error($"Invalid received Packet !!! : {recvProtocol.ToString()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fillupPacketCommand == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var found_handler = receiver.findRecvHandler(fillupPacketCommand);
|
||||
if (null == found_handler)
|
||||
{
|
||||
Log.getLogger().error($"Unacceptable Packet !!! : {fillupPacketCommand.toBasicString()} - {toBasicString()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
var task = Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var result = await found_handler.onCheckValid(this, recvProtocol);
|
||||
if (result.isFail())
|
||||
{
|
||||
Log.getLogger().error($"Failed to check Valid !!! : {fillupPacketCommand.toBasicString()}");
|
||||
}
|
||||
|
||||
result = await found_handler.onProcessPacket(this, recvProtocol);
|
||||
if (result.isFail())
|
||||
{
|
||||
Log.getLogger().error($"Failed to process Packet !!! : {fillupPacketCommand.toBasicString()}");
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Task<object>? sendKick( string destServer, string name, Int32 delayMS
|
||||
, Action<Task<object>>? callback )
|
||||
{
|
||||
int reqId = nextReqId();
|
||||
Task<object>? wait_task = null;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
var cts = new CancellationTokenSource(delayMS);
|
||||
|
||||
wait_task = registerCompletionSource(reqId, cts.Token, callback);
|
||||
if (wait_task == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var message = new ServerMessage();
|
||||
message.KickReq = new ServerMessage.Types.KickReq();
|
||||
message.KickReq.ReqId = reqId;
|
||||
message.KickReq.Name = name;
|
||||
|
||||
sendMessageWithJsonToChannel(destServer, message);
|
||||
}
|
||||
|
||||
return wait_task;
|
||||
}
|
||||
|
||||
|
||||
protected override async void onRecvJsonMessageFromConsumer(object? sender, BasicDeliverEventArgs ea)
|
||||
{
|
||||
var body = ea.Body.ToArray();
|
||||
|
||||
var body_string = Encoding.UTF8.GetString(body);
|
||||
var recv_message = ServerMessage.Parser.ParseJson(body_string);
|
||||
|
||||
if (m_fn_server_message_recv_from_consumer == null)
|
||||
{
|
||||
Log.getLogger().error($"m_fn_server_message_recv_from_consumer is null !!! - {toBasicString()}");
|
||||
return;
|
||||
}
|
||||
|
||||
await m_fn_server_message_recv_from_consumer.Invoke(recv_message, ea);
|
||||
}
|
||||
|
||||
protected override void onRecvProtoMessageFromConsumer(object? sender, BasicDeliverEventArgs ea)
|
||||
{
|
||||
var body = ea.Body.ToArray();
|
||||
|
||||
var body_stream = new CodedInputStream(body);
|
||||
|
||||
var recv_message = new ServerMessage();
|
||||
recv_message.MergeFrom(body_stream);
|
||||
|
||||
if (m_fn_server_message_recv_from_consumer == null)
|
||||
{
|
||||
Log.getLogger().error($"m_fn_server_message_recv_from_consumer is null !!! - {toBasicString()}");
|
||||
return;
|
||||
}
|
||||
|
||||
// Byte 기반 패킷 전송 테스트 후 아래 코드도 테스트 해본다.
|
||||
// 이상 없다면 m_fn_server_message_recv_from_consumer 요건 제거 한다.
|
||||
//onRecvProtocol(ea, recv_message);
|
||||
|
||||
// TODO: spooky000 - event에 async 쓸 수없어서 fire and forgot로 한다. 검토 필요.
|
||||
_ = m_fn_server_message_recv_from_consumer.Invoke(recv_message, ea);
|
||||
}
|
||||
|
||||
|
||||
public void sendMessageWithByteArrayToChannel<T>(string to, T message)
|
||||
where T : Google.Protobuf.IMessage
|
||||
{
|
||||
IConnection? con = getConnection();
|
||||
if (con == null)
|
||||
{
|
||||
Log.getLogger().error($"Failed to sendMessageWithByteArrayToChannel() !!!, getConnetion() is null - {toBasicString()}");
|
||||
return;
|
||||
}
|
||||
|
||||
fillupSenderAndTime((message as ServerMessage));
|
||||
|
||||
using (var channel = con.CreateModel())
|
||||
{
|
||||
channel.QueueDeclare( queue: to,
|
||||
durable: true,
|
||||
exclusive: false,
|
||||
autoDelete: false,
|
||||
arguments: null);
|
||||
|
||||
channel.BasicPublish( exchange: "",
|
||||
routingKey: to,
|
||||
basicProperties: null,
|
||||
body: message.ToByteArray() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendMessageWithJsonToChannel<T>(string to, T message)
|
||||
where T : Google.Protobuf.IMessage
|
||||
{
|
||||
IConnection? con = getConnection();
|
||||
if (con == null)
|
||||
{
|
||||
Log.getLogger().error("getConnection return null");
|
||||
return;
|
||||
}
|
||||
|
||||
fillupSenderAndTime((message as ServerMessage));
|
||||
|
||||
using (var channel = con.CreateModel())
|
||||
{
|
||||
channel.QueueDeclare( queue: to,
|
||||
durable: true,
|
||||
exclusive: false,
|
||||
autoDelete: false,
|
||||
arguments: null);
|
||||
|
||||
channel.BasicPublish( exchange: "",
|
||||
routingKey: to,
|
||||
basicProperties: null,
|
||||
body: Encoding.UTF8.GetBytes(message.toJson()) );
|
||||
}
|
||||
}
|
||||
|
||||
private void fillupSenderAndTime(ServerMessage? toSendMessage)
|
||||
{
|
||||
if(null == toSendMessage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
toSendMessage.MessageTime = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(DateTime.UtcNow);
|
||||
toSendMessage.MessageSender = getServiceName();
|
||||
}
|
||||
|
||||
public PacketReceiver getPacketReceiver() => m_packet_receiver;
|
||||
|
||||
public abstract string toBasicString();
|
||||
}
|
||||
|
||||
56
ServerCommon/z.Backup/RoomEntity.cs
Normal file
56
ServerCommon/z.Backup/RoomEntity.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class RoomAttr
|
||||
// {
|
||||
// public string Owner = string.Empty;
|
||||
// public string Name = string.Empty;
|
||||
// public string Description = string.Empty;
|
||||
// public Dictionary<string, AnchorProp> PropInfo = new();
|
||||
// }
|
||||
|
||||
// public class RoomEntity
|
||||
// {
|
||||
// public int PK_Id { get; private set; } = 0;
|
||||
// public int SK_Id { get; private set; } = 0;
|
||||
// public RoomAttr Attr { get; private set; } = new();
|
||||
|
||||
// public RoomEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// if (!int.TryParse(document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Room), ""), out var pk))
|
||||
// throw new Exception("PK int.TryParse error");
|
||||
|
||||
// if (!int.TryParse(document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Room), ""), out var sk))
|
||||
// throw new Exception("SK int.TryParse error");
|
||||
|
||||
// RoomAttr? attr = JsonConvert.DeserializeObject<RoomAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// PK_Id = pk;
|
||||
// SK_Id = sk;
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.Room, PK_Id.ToString());
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.Room, SK_Id.ToString());
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
58
ServerCommon/z.Backup/RoomListEntity.cs
Normal file
58
ServerCommon/z.Backup/RoomListEntity.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class RoomListAttr
|
||||
// {
|
||||
// public HashSet<int> roomIds = new HashSet<int>();
|
||||
// }
|
||||
|
||||
// public class RoomListEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public RoomListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public RoomListEntity() { }
|
||||
// public RoomListEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.RoomList), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.RoomList), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<RoomListAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.RoomList, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.RoomList, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
52
ServerCommon/z.Backup/ServerAuthClient.cs
Normal file
52
ServerCommon/z.Backup/ServerAuthClient.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
//using Nettention.Proud;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
//namespace ServerCommon
|
||||
//{
|
||||
// public class ServerAuthClient
|
||||
// {
|
||||
// NetClient _netClient = new NetClient();
|
||||
|
||||
// PServerToIP.Stub _stub = new PServerToIP.Stub();
|
||||
// PServerToIP.Proxy _proxy = new PServerToIP.Proxy();
|
||||
|
||||
// public ServerAuthClient()
|
||||
// {
|
||||
// /*_netClient.JoinServerCompleteHandler = (errorInfo, PServerToIP) =>
|
||||
// {
|
||||
|
||||
// };
|
||||
|
||||
// _netClient.LeaveServerHandler = (errorInfo) =>
|
||||
// {
|
||||
|
||||
// };*/
|
||||
// }
|
||||
|
||||
// public async Task SendIPAsync(string name)
|
||||
// {
|
||||
// var delay = RandomHelper.next(1000, 60000);
|
||||
// await Task.Delay(delay);
|
||||
|
||||
// _netClient.AttachProxy(_proxy);
|
||||
// _netClient.AttachStub(_stub);
|
||||
|
||||
// NetConnectionParam param = new NetConnectionParam();
|
||||
// param.protocolVersion.Set(Constant.Version);
|
||||
// param.serverIP = "35.91.216.198";
|
||||
// param.serverPort = 80;
|
||||
|
||||
// if (!_netClient.Connect(param))
|
||||
// return;
|
||||
|
||||
// _proxy.Message(HostID.HostID_Server, RmiContext.ReliableSend, name, AwsHelper.getAwsPublicIPv4OrEthernetIPv4());
|
||||
|
||||
// _netClient.Disconnect();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
526
ServerCommon/z.Backup/ServerUtil.cs
Normal file
526
ServerCommon/z.Backup/ServerUtil.cs
Normal file
@@ -0,0 +1,526 @@
|
||||
//using Amazon.OpenSearchService.Model.Internal.MarshallTransformations;
|
||||
//using Google.Protobuf;
|
||||
//using Google.Protobuf.Collections;
|
||||
//using Nettention.Proud;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCommon.Redis;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Net;
|
||||
//using System.Net.Http;
|
||||
//using System.Net.NetworkInformation;
|
||||
//using System.Net.Sockets;
|
||||
//using System.Numerics;
|
||||
//using System.Security.Cryptography;
|
||||
//using System.Text;
|
||||
//using System.Threading.Channels;
|
||||
|
||||
//namespace ServerCommon
|
||||
//{
|
||||
// public static class ServerUtil
|
||||
// {
|
||||
// //public static Random rnd = new Random((int)DateTime.Now.Ticks);
|
||||
// //public static Mutex duplicateProcessCheckMutex = new Mutex();
|
||||
|
||||
// //static readonly object loginToGameIndexLock = new object();
|
||||
// //static int loginToGameIndex = 0;
|
||||
|
||||
// //public static void MakeP2PGroupToByteArray(ByteArray byArray, P2PGroupType p2PGroupType)
|
||||
// //{
|
||||
// // using (MemoryStream stream = new())
|
||||
// // {
|
||||
// // using (CodedOutputStream output = new(stream))
|
||||
// // {
|
||||
// // p2PGroupType.WriteTo(output);
|
||||
// // }
|
||||
// // byArray.AddRange(stream.ToArray());
|
||||
// // }
|
||||
// //}
|
||||
|
||||
// //public static string CreateServerName(ServerType type, string ip, int port, int worldId = 0, int channel = 0)
|
||||
// //{
|
||||
// // string serverType = type.ToString();
|
||||
// // string serverName = string.Empty;
|
||||
|
||||
// // switch (type)
|
||||
// // {
|
||||
// // case ServerType.Channel:
|
||||
// // {
|
||||
// // serverName = ($"{serverType}:{MakeWorldidToString(worldId)}:{MakeChannelToString(channel)}");
|
||||
// // }
|
||||
// // break;
|
||||
// // case ServerType.Login:
|
||||
// // case ServerType.Indun:
|
||||
// // case ServerType.Chat:
|
||||
// // case ServerType.Auth:
|
||||
// // case ServerType.Manager:
|
||||
// // {
|
||||
// // serverName = ($"{serverType}:{ip}_{port.ToString()}");
|
||||
// // }
|
||||
// // break;
|
||||
// // default:
|
||||
// // {
|
||||
// // serverName = ($"{serverType}:{ip}_{port.ToString()}");
|
||||
// // Log.getLogger().error($"Check !!! EServerType:{type} And CreateServerName()");
|
||||
// // }
|
||||
// // break;
|
||||
// // }
|
||||
|
||||
// // return serverName;
|
||||
// //}
|
||||
|
||||
// //public static string MakeWorldidToString(int worldId)
|
||||
// //{
|
||||
// // return worldId.ToString("000");
|
||||
// //}
|
||||
// //public static string MakeChannelToString(int channel)
|
||||
// //{
|
||||
// // return channel.ToString("000");
|
||||
// //}
|
||||
|
||||
// //public static ServerType GetServerType(string serverName)
|
||||
// //{
|
||||
// // var serverType = serverName.Split(":")[0];
|
||||
|
||||
// // if (!Enum.TryParse(serverType, out ServerType type))
|
||||
// // return ServerType.None;
|
||||
|
||||
// // return type;
|
||||
// //}
|
||||
|
||||
// //public static bool MakeStringToInt(string data, out int result)
|
||||
// //{
|
||||
// // try
|
||||
// // {
|
||||
// // result = int.Parse(data);
|
||||
// // }
|
||||
// // catch
|
||||
// // {
|
||||
// // result = 0;
|
||||
// // return false;
|
||||
// // }
|
||||
|
||||
// // return true;
|
||||
// //}
|
||||
|
||||
// //public static Pos MakePos(float x, float y, float z, int angle)
|
||||
// //{
|
||||
// // Pos pos = new Pos();
|
||||
// // pos.X = x;
|
||||
// // pos.Y = y;
|
||||
// // pos.Z = z;
|
||||
// // pos.Angle = angle;
|
||||
// // return pos;
|
||||
// //}
|
||||
|
||||
// /// <summary>
|
||||
// /// *게임 서버 고르기*<br/>
|
||||
// /// 서버 수용인원의 80% 되지 않은 서버에서 선택<br/>
|
||||
// /// 모든 서버가 80% 이상인 경우 서버 수용인원을 넘지 않은 서버에서 선택
|
||||
// /// </summary>
|
||||
// /// <param name="serverList">게임 서버 목록</param>
|
||||
// /// <returns>입력값 List<ServerInfo> serverList 의 인덱스, 선택된 서버가 없는 경우 -1</returns>
|
||||
// public static int GetBestGameServerIndex(in List<ServerInfo> serverList, LanguageType languageType)
|
||||
// {
|
||||
// int serverIndex = -1;
|
||||
// int limit_first = Constant.g_MaxUser * 5 / 10;
|
||||
// /*
|
||||
// foreach (var serverInfo in serverList.Select((value, index) => new { value, index }))
|
||||
// {
|
||||
// if (serverInfo.value.Language == languageType &&
|
||||
// limit_first > serverInfo.value.Sessions)
|
||||
// {
|
||||
// serverIndex = serverInfo.index;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (serverIndex == -1)
|
||||
// {
|
||||
// foreach (var serverInfo in serverList.Select((value, index) => new { value, index }))
|
||||
// {
|
||||
// if (limit_first > serverInfo.value.Sessions)
|
||||
// {
|
||||
// serverIndex = serverInfo.index;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// */
|
||||
// if (serverIndex == -1)
|
||||
// {
|
||||
// lock(loginToGameIndexLock)
|
||||
// {
|
||||
|
||||
// if (loginToGameIndex >= serverList.Count)
|
||||
// loginToGameIndex = 0;
|
||||
|
||||
// serverIndex = loginToGameIndex;
|
||||
|
||||
// ++loginToGameIndex;
|
||||
// }
|
||||
// }
|
||||
// return serverIndex;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// *게임 서버 현재 총 접속자 구하기*<br/>
|
||||
// /// </summary>
|
||||
// /// <param name="serverList">게임 서버 목록</param>
|
||||
// //public static bool GetGameServerCurrentUserCount(in List<ServerInfo> serverList, out int maxCapacity, out int userCount)
|
||||
// //{
|
||||
// // maxCapacity = Constant.g_MaxUser * serverList.Count;
|
||||
// // userCount = 0;
|
||||
// // //capPercent = 0.0F;
|
||||
// // if (serverList.Count == 0) return false;
|
||||
|
||||
// // foreach (var serverInfo in serverList.Select((value, index) => new { value, index }))
|
||||
// // {
|
||||
// // userCount += serverInfo.value.Sessions;
|
||||
// // }
|
||||
// // //capPercent = (userCount * 100.0F / maxCapacity) ;
|
||||
|
||||
// // return true;
|
||||
// //}
|
||||
|
||||
// /// <summary>
|
||||
// /// *인스턴스 룸을 생성할 인스턴스 서버 고르기*<br/>
|
||||
// /// 인스턴스 룸 최대 인원이 들어갈 수 있는 서버 중 수용인원이 가장 많은 서버 선택
|
||||
// /// </summary>
|
||||
// /// <param name="serverList">인스턴스 서버 목록</param>
|
||||
// /// <param name="roomCapacity">생성할 인스턴스 룸 최대 인원</param>
|
||||
// /// <returns>입력값 List<ServerInfo> serverList 의 인덱스, 선택된 서버가 없는 경우 -1</returns>
|
||||
// //public static int GetBestInstanceServerIndexForCreate(in List<ServerInfo> serverList, int roomCapacity)
|
||||
// //{
|
||||
// // int retIndex = -1;
|
||||
// // int maxCount = 0;
|
||||
|
||||
// // foreach (var (server_info, index) in serverList.Select((value, index) => (value, index)))
|
||||
// // {
|
||||
// // if (maxCount < server_info.RoomCapacity + roomCapacity && server_info.RoomCapacity + roomCapacity <= server_info.Capacity)
|
||||
// // {
|
||||
// // retIndex = index;
|
||||
// // maxCount = server_info.RoomCapacity + roomCapacity;
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // return retIndex;
|
||||
// //}
|
||||
|
||||
// //public static async Task RunPeriodicTask(Func<Task> action, TimeSpan interval, CancellationToken cancellationToken = default)
|
||||
// //{
|
||||
// // using var timer = new PeriodicTimer(interval);
|
||||
// // while (cancellationToken.IsCancellationRequested == false)
|
||||
// // {
|
||||
// // try
|
||||
// // {
|
||||
// // await action();
|
||||
// // await timer.WaitForNextTickAsync(cancellationToken);
|
||||
// // }
|
||||
// // catch (OperationCanceledException)
|
||||
// // {
|
||||
// // break;
|
||||
// // }
|
||||
// // catch (Exception ex)
|
||||
// // {
|
||||
// // Log.getLogger().error($"{ex}");
|
||||
// // throw;
|
||||
// // }
|
||||
// // }
|
||||
// //}
|
||||
|
||||
// //public static bool isExistProcess(string serverName)
|
||||
// //{
|
||||
// // duplicateProcessCheckMutex = new Mutex(true, serverName, out bool createNew);
|
||||
// // return createNew == true ? false : true;
|
||||
// //}
|
||||
|
||||
// //public static LanguageType getLanguageByChannel(int channel)
|
||||
// //{
|
||||
// // if(channel < 1)
|
||||
// // {
|
||||
// // return LanguageType.Ko;
|
||||
// // }
|
||||
|
||||
// // // 아래의 로직은 채널에 적용할 언어 설정을 메타로 별도 분리 하여
|
||||
// // // 채널 언어 설정 정책에 따라 로직화 될 수 있도록 수정 한다. - kangms
|
||||
// // var language_count = (Enum.GetValues(typeof(LanguageType)).Length - 1);
|
||||
|
||||
// // language_count -= 1; // 임시로 맨마지막 태국어는 제외 시킨다. - kangms
|
||||
|
||||
// // int returnValue = channel % language_count;
|
||||
|
||||
// // // 1번 채널을 영어로 설정하기 위해 변경 (현재 채널은 영어, 한국어만 사용중 2024.1.7)
|
||||
// // switch (returnValue)
|
||||
// // {
|
||||
// // case 0:
|
||||
// // returnValue = (int)LanguageType.Ko;
|
||||
// // break;
|
||||
// // case 1:
|
||||
// // returnValue = (int)LanguageType.En;
|
||||
// // break;
|
||||
// // }
|
||||
|
||||
// // return ((LanguageType)returnValue);
|
||||
// //}
|
||||
|
||||
// //public static readonly byte[] key = { 0xFF,0x10,0x24,0x31,0x44,
|
||||
// // 0x58,0x6F,0x79,0x8F,0x90,
|
||||
// // 0x0F,0x1E,0x2A,0x33,0x4B,
|
||||
// // 0x5A,0x67,0x70,0x83,0x90,
|
||||
// // 0x00,0x15,0x28,0x33,0x44,
|
||||
// // 0x51,0x65,0x7F,0x8E,0x91,
|
||||
// // 0x00,0x11 };
|
||||
// //public static readonly byte[] iv = { 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5 };
|
||||
|
||||
// //AES 암호화
|
||||
// /*
|
||||
// public static string AESEncrypt(string input)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// RijndaelManaged aes = new RijndaelManaged();
|
||||
// //aes.KeySize = 256; //AES256으로 사용시
|
||||
// aes.KeySize = 128; //AES128로 사용시
|
||||
// aes.BlockSize = 128;
|
||||
// aes.Mode = CipherMode.CBC;
|
||||
// aes.Padding = PaddingMode.PKCS7;
|
||||
// aes.Key = key;
|
||||
// aes.IV = iv;
|
||||
// var encrypt = aes.CreateEncryptor(aes.Key, aes.IV);
|
||||
// byte[] buf = null;
|
||||
// using (var ms = new MemoryStream())
|
||||
// {
|
||||
// using (var cs = new CryptoStream(ms, encrypt, CryptoStreamMode.Write))
|
||||
// {
|
||||
// byte[] xXml = Encoding.UTF8.GetBytes(input);
|
||||
// cs.Write(xXml, 0, xXml.Length);
|
||||
// }
|
||||
// buf = ms.ToArray();
|
||||
// }
|
||||
// string Output = Convert.ToBase64String(buf);
|
||||
// return Output;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error(ex.Message);
|
||||
// return string.Empty;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //AES 복호화
|
||||
// public static string AESDecrypt(string input)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// RijndaelManaged aes = new RijndaelManaged();
|
||||
// //aes.KeySize = 256; //AES256으로 사용시
|
||||
// aes.KeySize = 128; //AES128로 사용시
|
||||
// aes.BlockSize = 128;
|
||||
// aes.Mode = CipherMode.CBC;
|
||||
// aes.Padding = PaddingMode.PKCS7;
|
||||
// aes.Key = key;
|
||||
// aes.IV = iv;
|
||||
// var decrypt = aes.CreateDecryptor();
|
||||
// byte[] buf = null;
|
||||
// using (var ms = new MemoryStream())
|
||||
// {
|
||||
// using (var cs = new CryptoStream(ms, decrypt, CryptoStreamMode.Write))
|
||||
// {
|
||||
// byte[] xXml = Convert.FromBase64String(input);
|
||||
// cs.Write(xXml, 0, xXml.Length);
|
||||
// }
|
||||
// buf = ms.ToArray();
|
||||
// }
|
||||
// string Output = Encoding.UTF8.GetString(buf);
|
||||
// return Output;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Log.getLogger().error(ex.Message);
|
||||
// return string.Empty;
|
||||
// }
|
||||
// }
|
||||
// */
|
||||
// //public static string EncryptAes(string plainText)
|
||||
// //{
|
||||
// // // Check arguments.
|
||||
// // if (plainText == null || plainText.Length <= 0)
|
||||
// // NullReferenceCheckHelper.throwIfNull(plainText, () => $"plainText is null !!!");
|
||||
// // if (key == null || key.Length <= 0)
|
||||
// // NullReferenceCheckHelper.throwIfNull(key, () => $"key is null !!!");
|
||||
// // if (iv == null || iv.Length <= 0)
|
||||
// // NullReferenceCheckHelper.throwIfNull(iv, () => $"iv is null !!!");
|
||||
// // byte[] encrypted;
|
||||
|
||||
// // // Create an Aes object
|
||||
// // // with the specified key and IV.
|
||||
// // using (Aes aesAlg = Aes.Create())
|
||||
// // {
|
||||
// // aesAlg.Key = key;
|
||||
// // aesAlg.IV = iv;
|
||||
|
||||
// // // Create an encryptor to perform the stream transform.
|
||||
// // ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
// // // Create the streams used for encryption.
|
||||
// // using (MemoryStream msEncrypt = new MemoryStream())
|
||||
// // {
|
||||
// // using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||
// // {
|
||||
// // using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
|
||||
// // {
|
||||
// // //Write all data to the stream.
|
||||
// // swEncrypt.Write(plainText);
|
||||
// // }
|
||||
// // encrypted = msEncrypt.ToArray();
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // // Return the encrypted bytes from the memory stream.
|
||||
// // return Convert.ToBase64String(encrypted);
|
||||
// //}
|
||||
|
||||
// //public static string DecryptAes(string cipherText)
|
||||
// //{
|
||||
// // // Check arguments.
|
||||
// // if (cipherText == null || cipherText.Length <= 0)
|
||||
// // NullReferenceCheckHelper.throwIfNull(cipherText, () => $"cipherText is null !!!");
|
||||
// // if (key == null || key.Length <= 0)
|
||||
// // NullReferenceCheckHelper.throwIfNull(key, () => $"key is null !!!");
|
||||
// // if (iv == null || iv.Length <= 0)
|
||||
// // NullReferenceCheckHelper.throwIfNull(iv, () => $"iv is null !!!");
|
||||
|
||||
// // // Declare the string used to hold
|
||||
// // // the decrypted text.
|
||||
// // string plaintext = string.Empty;
|
||||
// // byte[] chipherBin = Convert.FromBase64String(cipherText);
|
||||
|
||||
// // // Create an Aes object
|
||||
// // // with the specified key and IV.
|
||||
// // using (Aes aesAlg = Aes.Create())
|
||||
// // {
|
||||
// // aesAlg.Key = key;
|
||||
// // aesAlg.IV = iv;
|
||||
|
||||
// // // Create a decryptor to perform the stream transform.
|
||||
// // ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
// // // Create the streams used for decryption.
|
||||
// // using (MemoryStream msDecrypt = new MemoryStream(chipherBin))
|
||||
// // {
|
||||
// // using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
|
||||
// // {
|
||||
// // using (StreamReader srDecrypt = new StreamReader(csDecrypt))
|
||||
// // {
|
||||
|
||||
// // // Read the decrypted bytes from the decrypting stream
|
||||
// // // and place them in a string.
|
||||
// // plaintext = srDecrypt.ReadToEnd();
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // return plaintext;
|
||||
// //}
|
||||
|
||||
|
||||
// //public static string getByteStringFromString(string input)
|
||||
// //{
|
||||
// // byte[] bytes = Encoding.Default.GetBytes(input);
|
||||
// // string byteString = BitConverter.ToString(bytes).Replace("-", "");
|
||||
// // return byteString;
|
||||
// //}
|
||||
|
||||
// //public static string getStringFromByteString(string input) {
|
||||
// // byte[] bytes = new byte[input.Length / 2];
|
||||
|
||||
// // for (int i = 0; i < bytes.Length; i++)
|
||||
// // {
|
||||
// // bytes[i] = Convert.ToByte(input.Substring(i * 2, 2), 16);
|
||||
// // }
|
||||
|
||||
// // string result = Encoding.Default.GetString(bytes);
|
||||
// // return result;
|
||||
// //}
|
||||
|
||||
// //public static async Task WriteServerInfoSaveData(AwsNewInstanceInfo myServerInfo)
|
||||
// //{
|
||||
// // using (var stream = new StreamWriter("./serverInfo.json"))
|
||||
// // {
|
||||
// // string json = JsonConvert.SerializeObject(myServerInfo);
|
||||
// // await stream.WriteAsync(json);
|
||||
// // }
|
||||
// //}
|
||||
// //public static AwsNewInstanceInfo? ReadServerInfoSaveData()
|
||||
// //{
|
||||
// // if (File.Exists("./serverInfo.json"))
|
||||
// // {
|
||||
// // string readData = File.ReadAllText("./serverInfo.json");
|
||||
// // if (readData != null)
|
||||
// // {
|
||||
// // var dicValue = JsonConvert.DeserializeObject<AwsNewInstanceInfo>(readData);
|
||||
// // if (dicValue != null)
|
||||
// // {
|
||||
// // return dicValue;
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // return null;
|
||||
// //}
|
||||
|
||||
// //public static bool isBanWorld(string word, bool includeNickname)
|
||||
// //{
|
||||
// // var lowered_word = word.ToLower();
|
||||
|
||||
// // if (MetaData.Instance._BanWordMetaTable.Any(banWord => lowered_word.Contains(banWord) == true))
|
||||
// // {
|
||||
// // return true;
|
||||
// // }
|
||||
|
||||
// // return includeNickname && isBanNickname(word);
|
||||
// //}
|
||||
|
||||
// //private static bool isBanNickname(string word)
|
||||
// //{
|
||||
// // var lowered_word = word.ToLower();
|
||||
|
||||
// // return MetaData.Instance._BanWordNicknameMetaTable.Any(banNickNameWord => lowered_word.Contains(banNickNameWord) == true);
|
||||
// //}
|
||||
|
||||
// //public static EPlaceType toPlaceType(this ContentsType contentsType)
|
||||
// //{
|
||||
// // switch (contentsType)
|
||||
// // {
|
||||
// // case ContentsType.None:
|
||||
// // return EPlaceType.NONE;
|
||||
// // case ContentsType.MyHome:
|
||||
// // return EPlaceType.MyHome;
|
||||
// // case ContentsType.DressRoom:
|
||||
// // return EPlaceType.DressRoom;
|
||||
// // case ContentsType.Concert:
|
||||
// // return EPlaceType.Concert;
|
||||
// // case ContentsType.Movie:
|
||||
// // return EPlaceType.Movie;
|
||||
// // case ContentsType.Instance:
|
||||
// // return EPlaceType.Instance;
|
||||
// // case ContentsType.BeaconCreateRoom:
|
||||
// // return EPlaceType.BeaconCreateRoom;
|
||||
// // case ContentsType.BeaconEditRoom:
|
||||
// // return EPlaceType.BeaconEditRoom;
|
||||
// // case ContentsType.BeaconDraftRoom:
|
||||
// // return EPlaceType.BeaconDraftRoom;
|
||||
// // case ContentsType.EditRoom:
|
||||
// // return EPlaceType.EditRoom;
|
||||
// // case ContentsType.BeaconCustomizeRoom:
|
||||
// // return EPlaceType.BeaconCustomizeRoom;
|
||||
// // case ContentsType.BattleRoom:
|
||||
// // return EPlaceType.BattleRoom;
|
||||
// // }
|
||||
|
||||
// // return EPlaceType.NONE;
|
||||
// //}
|
||||
// }
|
||||
//}
|
||||
55
ServerCommon/z.Backup/SocialActionCollectionEntity.cs
Normal file
55
ServerCommon/z.Backup/SocialActionCollectionEntity.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class SocialActionCollectionAttr
|
||||
// {
|
||||
// public HashSet<int> collectionInfos = new HashSet<int>();
|
||||
// }
|
||||
|
||||
// public class SocialActionCollectionEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public SocialActionCollectionAttr Attr { get; private set; } = new SocialActionCollectionAttr();
|
||||
|
||||
// public SocialActionCollectionEntity() { }
|
||||
|
||||
// public SocialActionCollectionEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.SocialActionCollection), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.SocialActionCollection), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<SocialActionCollectionAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.SocialActionCollection, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.SocialActionCollection, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
54
ServerCommon/z.Backup/SocialActionSlotEntity.cs
Normal file
54
ServerCommon/z.Backup/SocialActionSlotEntity.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class SocialActionSlotAttr
|
||||
// {
|
||||
// public Dictionary<int, int> slotInfos = new Dictionary<int, int>();
|
||||
// }
|
||||
|
||||
// public class SocialActionSlotEntity
|
||||
// {
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public SocialActionSlotAttr Attr { get; private set; } = new SocialActionSlotAttr();
|
||||
|
||||
// public SocialActionSlotEntity() { }
|
||||
|
||||
// public SocialActionSlotEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.SocialActionSlot), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.SocialActionSlot), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<SocialActionSlotAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.SocialActionSlot, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.SocialActionSlot, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
70
ServerCommon/z.Backup/SystemMailEntity.cs
Normal file
70
ServerCommon/z.Backup/SystemMailEntity.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class SystemMailInfo
|
||||
// {
|
||||
// public int Id = 0;
|
||||
// public string title = string.Empty;
|
||||
// public string text = string.Empty;
|
||||
// public string senderNickName = string.Empty;
|
||||
// public Timestamp startTime = new();
|
||||
// public Timestamp endTime = new();
|
||||
// public List<MailItem> ItemList = new();
|
||||
// }
|
||||
|
||||
// public class SystemMailEntityAttr
|
||||
// {
|
||||
// public List<SystemMailInfo> SystemMailList = new ();
|
||||
// }
|
||||
|
||||
// public class SystemMailEntity
|
||||
// {
|
||||
// public string PK_Empty { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public SystemMailEntityAttr Attr { get; private set; } = new();
|
||||
|
||||
// public SystemMailEntity()
|
||||
// {
|
||||
// }
|
||||
// public SystemMailEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// protected void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Empty = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.SystemMail), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.SystemMail), "");
|
||||
|
||||
// SystemMailEntityAttr? attr = JsonConvert.DeserializeObject<SystemMailEntityAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.SystemMail, PK_Empty);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.SystemMail, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// public Document DocumentForDelete()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.SystemMail, PK_Empty);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.SystemMail, SK_Empty);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
71
ServerCommon/z.Backup/TattooSlotEntity.cs
Normal file
71
ServerCommon/z.Backup/TattooSlotEntity.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class TattooSlotInfo
|
||||
// {
|
||||
// public string ItemGuid = string.Empty;
|
||||
// public bool IsVisible = true;
|
||||
// }
|
||||
|
||||
// public class TattooSlotAttr
|
||||
// {
|
||||
// public TattooSlotInfo[] slotInfos = Enumerable.Repeat(new TattooSlotInfo(), Constant.MAX_TATTOO_SLOT).ToArray();
|
||||
// }
|
||||
|
||||
// public class TattooSlotEntity
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// DB PK에 사용되는 charGuid
|
||||
// /// </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// /// <summary>
|
||||
// /// DB SK에 사용되지 않음. 빈값임
|
||||
// /// </summary>
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public TattooSlotAttr Attr { get; private set; } = new();
|
||||
|
||||
// public TattooSlotEntity() { }
|
||||
|
||||
// public TattooSlotEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.TattooSlot), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.TattooSlot), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<TattooSlotAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.TattooSlot, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.TattooSlot, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
61
ServerCommon/z.Backup/ToolSlotEntity.cs
Normal file
61
ServerCommon/z.Backup/ToolSlotEntity.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class ToolSlotAttr
|
||||
// {
|
||||
// public string[] slotInfos = Enumerable.Repeat("", Constant.MAX_TOOL_SLOT).ToArray();
|
||||
// }
|
||||
|
||||
// public class ToolSlotEntity
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// DB PK에 사용되는 charGuid
|
||||
// /// </summary>
|
||||
// public string PK_Guid { get; private set; } = string.Empty;
|
||||
// /// <summary>
|
||||
// /// DB SK에 사용되지 않음. 빈값임
|
||||
// /// </summary>
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public ToolSlotAttr Attr { get; private set; } = new();
|
||||
|
||||
// public ToolSlotEntity() { }
|
||||
|
||||
// public ToolSlotEntity(Document document)
|
||||
// {
|
||||
// if (!ReadFrom(document))
|
||||
// {
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Guid = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.ToolSlot), "");
|
||||
// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.ToolSlot), "");
|
||||
|
||||
// var attr = JsonConvert.DeserializeObject<ToolSlotAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// {
|
||||
// Log.getLogger().error($"{PK_Guid} Attr DeserializeObject error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Attr = attr;
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.ToolSlot, PK_Guid);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.ToolSlot, SK_Empty);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
56
ServerCommon/z.Backup/UserReportEntity.cs
Normal file
56
ServerCommon/z.Backup/UserReportEntity.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using Newtonsoft.Json;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class UserReportAttr
|
||||
// {
|
||||
// public string ReporterGuid = string.Empty;
|
||||
// public string ReporterNickName = string.Empty;
|
||||
// public string TargetGuid = string.Empty;
|
||||
// public string TargetNickName = string.Empty;
|
||||
|
||||
// public string Reason = string.Empty;
|
||||
// public string Title = string.Empty;
|
||||
// public string Detail = string.Empty;
|
||||
// public int State = 0;
|
||||
// public Timestamp CreateTime = new();
|
||||
// public Timestamp ResolutionTime = new();
|
||||
// }
|
||||
|
||||
// public class UserReportEntity
|
||||
// {
|
||||
// public string PK_Date { get; private set; } = string.Empty;
|
||||
// public string SK_TimeNickName { get; private set; } = string.Empty;
|
||||
// public UserReportAttr Attr { get; private set; } = new();
|
||||
|
||||
// public UserReportEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
// PK_Date = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.UserReport), "");
|
||||
// SK_TimeNickName = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.UserReport), "");
|
||||
|
||||
// UserReportAttr? attr = JsonConvert.DeserializeObject<UserReportAttr>(document["Attr"].AsString());
|
||||
// if (attr == null)
|
||||
// throw new Exception("Attr DeserializeObject error");
|
||||
|
||||
// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
// document["PK"] = MainDB.MakePK(EEntityType.UserReport, PK_Date);
|
||||
// document["SK"] = MainDB.MakeSK(EEntityType.UserReport, SK_TimeNickName);
|
||||
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
54
ServerCommon/z.Backup/WhiteListEntity.cs
Normal file
54
ServerCommon/z.Backup/WhiteListEntity.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using System.Data.SqlTypes;
|
||||
//using System.Collections.Concurrent;
|
||||
|
||||
//namespace ServerCommon.DB
|
||||
//{
|
||||
// public class WhiteListAttr
|
||||
// {
|
||||
// public ConcurrentDictionary<string, string> WhiteListByID = new();
|
||||
// public ConcurrentDictionary<string, string> WhiteListByPattern = new();
|
||||
// }
|
||||
|
||||
// public class WhiteListEntity
|
||||
// {
|
||||
// public string PK_Empty { get; private set; } = string.Empty;
|
||||
// public string SK_Empty { get; private set; } = string.Empty;
|
||||
// public WhiteListAttr Attr { get; private set; } = new();
|
||||
|
||||
// public WhiteListEntity()
|
||||
// {
|
||||
// }
|
||||
// public WhiteListEntity(Document document)
|
||||
// {
|
||||
// ReadFrom(document);
|
||||
// }
|
||||
|
||||
// void ReadFrom(Document document)
|
||||
// {
|
||||
//// PK_Empty = document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.WhiteList), "");
|
||||
//// SK_Empty = document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.WhiteList), "");
|
||||
////
|
||||
//// WhiteListAttr? attr = JsonConvert.DeserializeObject<WhiteListAttr>(document["Attr"].AsString());
|
||||
//// if (attr == null)
|
||||
//// throw new Exception("Attr DeserializeObject error");
|
||||
////
|
||||
//// Attr = attr;
|
||||
// }
|
||||
|
||||
// public Document DocumentForUpdate()
|
||||
// {
|
||||
// var document = new Document();
|
||||
//// document["PK"] = MainDB.MakePK(EEntityType.WhiteList, PK_Empty);
|
||||
//// document["SK"] = MainDB.MakeSK(EEntityType.WhiteList, SK_Empty);
|
||||
//// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
||||
// return document;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user