초기 커밋.

This commit is contained in:
2026-04-01 20:16:50 +09:00
parent f78d79089f
commit 93394e54ac
59 changed files with 3440 additions and 0 deletions

213
ssgrestserver/DataCenter.cs Normal file
View File

@@ -0,0 +1,213 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using static ssgrestserver.DataCenter;
namespace ssgrestserver
{
class DataCenter
{
#region Singleton
private volatile static DataCenter mInstance = null;
private static object mSingletonLocker = new object();
internal enum
{
,
,
,
,
,
,
CRUD데이터,
,
,
QNA,
,
,
,
,
,
VVIP
}
private readonly Dictionary<, Dictionary<string, JObject>> m관리중인데이터들 = null;
private DataCenter()
{
m관리중인데이터들 = new Dictionary<, Dictionary<string, JObject>>();
foreach ( item in Enum.GetValues(typeof()).Cast<>().ToArray())
{
m관리중인데이터들.Add(item, new Dictionary<string, JObject>());
}
}
public static DataCenter getInstance()
{
lock (mSingletonLocker)
{
if (mInstance == null)
{
mInstance = new DataCenter();
}
}
return mInstance;
}
#endregion
internal int mServerPort = 60001;
internal Dictionary<string, JObject> getData( recvDataType)
{
lock (mSingletonLocker)
{
return m관리중인데이터들[recvDataType];
}
}
public List<Tuple<string, string>> PareURLTupleList = null;
public string interpritURL(string recvURL, bool isReverse = false)
//public string interpritURL(string recvURL)
{
string rtnValue = "";
if (PareURLTupleList == null)
{
/*
Replace("!", "뚫꽵1").
Replace("*", "뚫꽵2").
Replace("'", "뚫꽵3").
replace("(", "뚫꽵4").
replace(")", "뚫꽵5").
Replace(";", "뚫꽵6").
Replace(":", "뚫꽵7").
Replace("@", "뚫꽵8").
Replace("&", "뚫꽵9").
Replace("=", "뚫꽵10").
Replace("+", "뚫꽵11").
Replace("$", "뚫꽵12").
Replace("/", "뚫꽵13").
Replace("?", "뚫꽵14").
Replace("#", "뚫꽵15").
Replace("[", "뚫꽵16").
Replace("]", "뚫꽵17") + @"&";
*/
PareURLTupleList = new List<Tuple<string, string>>();
PareURLTupleList.Add(new Tuple<string, string>("!", "뚫꽵1"));
PareURLTupleList.Add(new Tuple<string, string>("*", "뚫꽵2"));
PareURLTupleList.Add(new Tuple<string, string>("'", "뚫꽵3"));
PareURLTupleList.Add(new Tuple<string, string>("(", "뚫꽵4"));
PareURLTupleList.Add(new Tuple<string, string>(")", "뚫꽵5"));
PareURLTupleList.Add(new Tuple<string, string>(";", "뚫꽵6"));
PareURLTupleList.Add(new Tuple<string, string>(":", "뚫꽵7"));
PareURLTupleList.Add(new Tuple<string, string>("@", "뚫꽵8"));
PareURLTupleList.Add(new Tuple<string, string>("&", "뚫꽵9"));
PareURLTupleList.Add(new Tuple<string, string>("=", "뚫꽵10"));
PareURLTupleList.Add(new Tuple<string, string>("+", "뚫꽵11"));
PareURLTupleList.Add(new Tuple<string, string>("$", "뚫꽵12"));
PareURLTupleList.Add(new Tuple<string, string>("/", "뚫꽵13"));
PareURLTupleList.Add(new Tuple<string, string>("?", "뚫꽵14"));
PareURLTupleList.Add(new Tuple<string, string>("#", "뚫꽵15"));
PareURLTupleList.Add(new Tuple<string, string>("[", "뚫꽵16"));
PareURLTupleList.Add(new Tuple<string, string>("]", "뚫꽵17"));
PareURLTupleList.Reverse();
}
//rtnValue = isReverse ? WebUtility.UrlDecode(recvURL) : recvURL;
rtnValue = recvURL;
foreach (Tuple<string,string> item in PareURLTupleList)
{
//if (isReverse)
//{
// rtnValue = rtnValue.Replace(item.Item1, item.Item2);
//}
//else
//{
rtnValue = rtnValue.Replace(item.Item2, item.Item1);
////}
}
if (isReverse)
{
return rtnValue;
}
else
{
return WebUtility.UrlEncode(rtnValue);
}
}
internal enum FILE_STATUS_CODE
{
UPLOADING = 0,
UPDATE_COMPLETED = 1,
NOTFOUND = 2
}
private object fileManagerLocker = new object();
private Dictionary<string, FileStatus> mFileUpdateManager = new Dictionary<string, FileStatus>();
internal void setFileStatus(string fileName, FILE_STATUS_CODE status)
{
lock (fileManagerLocker)
{
if (!mFileUpdateManager.ContainsKey(fileName))
{
FileStatus bufStats = new FileStatus();
bufStats.fileName = fileName;
bufStats.status = status;
bufStats.changedTime = DateTime.Now;
mFileUpdateManager.Add(fileName, bufStats);
}
else
{
mFileUpdateManager[fileName].status = status;
mFileUpdateManager[fileName].changedTime = DateTime.Now;
}
}
}
internal FileStatus getFileStatus(string filename)
{
lock (fileManagerLocker)
{
if (mFileUpdateManager.ContainsKey(filename))
{
return mFileUpdateManager[filename];
}
else
{
return null;
}
}
}
}
internal class FileStatus
{
internal string fileName;
internal FILE_STATUS_CODE status;
internal DateTime changedTime;
}
}