초기 커밋.

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

6
ssgrestserver/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

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;
}
}

89
ssgrestserver/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,89 @@
namespace ssgrestserver
{
partial class Form1
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.txbPort = new System.Windows.Forms.TextBox();
this.lstBoxLog = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(503, 118);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(196, 64);
this.button1.TabIndex = 0;
this.button1.Text = "start";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// txbPort
//
this.txbPort.Location = new System.Drawing.Point(341, 141);
this.txbPort.Name = "txbPort";
this.txbPort.Size = new System.Drawing.Size(100, 21);
this.txbPort.TabIndex = 1;
this.txbPort.Text = "60021";
this.txbPort.Visible = false;
//
// lstBoxLog
//
this.lstBoxLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstBoxLog.FormattingEnabled = true;
this.lstBoxLog.ItemHeight = 12;
this.lstBoxLog.Location = new System.Drawing.Point(0, 0);
this.lstBoxLog.Name = "lstBoxLog";
this.lstBoxLog.Size = new System.Drawing.Size(800, 450);
this.lstBoxLog.TabIndex = 2;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.txbPort);
this.Controls.Add(this.button1);
this.Controls.Add(this.lstBoxLog);
this.Name = "Form1";
this.Text = "Rest Server 25.10.15";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ListBox lstBoxLog;
public System.Windows.Forms.TextBox txbPort;
}
}

118
ssgrestserver/Form1.cs Normal file
View File

@@ -0,0 +1,118 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ssgrestserver
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
mLogPath = Application.StartupPath + @"\Log";
mImgPath = Application.StartupPath + @"\Image";
DirectoryInfo di = new DirectoryInfo(mLogPath);
DirectoryInfo di2 = new DirectoryInfo(mImgPath);
if (!di.Exists) di.Create();
if (!di2.Exists) di2.Create();
}
private void Form1_Load(object sender, EventArgs e)
{
button1_Click(null, null);
}
internal string mLogPath = "";
internal string mImgPath = "";
NetManager mNetManager = new NetManager();
public void recvLog(string TAG, string comment)
{
try
{
this.Invoke(new MethodInvoker(() => { updateLog(TAG + "___" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "____" + comment); }));
}
catch (Exception)
{
}
}
int OldFileChecker = 0;
void updateLog(string recvlog)
{
if (lstBoxLog.Items.Count == 50)
{
lstBoxLog.Items.Clear();
}
lstBoxLog.Items.Add(recvlog);
File.AppendAllText(mLogPath + @"\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", recvlog);
if (recvlog.Contains("{\"보낸사람\":\"web\",\"채팅\""))
{
string chatText = recvlog.Substring(recvlog.IndexOf("{"));
chatText = chatText.Substring(0, chatText.Length - 1);
JObject jObject = JObject.Parse(chatText);
jObject.Remove("보낸사람");
jObject.Remove("status");
File.AppendAllText(mLogPath + @"\" + DateTime.Now.ToString("채팅기록_yyyy-MM-dd") + ".txt", jObject.ToString());
}
//날짜가 지난 파일 삭제
OldFileChecker++;
if (OldFileChecker > 100)
{
DirectoryInfo directory = new DirectoryInfo(mLogPath);
DateTime now = DateTime.Now;
foreach (FileInfo file in directory.GetFiles())
{
TimeSpan timeDiff = now - file.LastWriteTime;
if (timeDiff.TotalHours > 170) file.Delete();
}
OldFileChecker = 0;
directory = new DirectoryInfo(mImgPath);
foreach (FileInfo file in directory.GetFiles())
{
TimeSpan timeDiff = now - file.LastWriteTime;
if (timeDiff.TotalHours > 170) file.Delete();
}
}
}
private void button1_Click(object sender, EventArgs e)
{
mNetManager = new NetManager();
mNetManager.start();
}
public string getStartupPath()
{
return Application.StartupPath;
}
}
}

120
ssgrestserver/Form1.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

258
ssgrestserver/NetManager.cs Normal file
View File

@@ -0,0 +1,258 @@
using HttpMultipartParser;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
namespace ssgrestserver
{
public class NetManager
{
const string TAG = "NETMANAGER";
HttpListener listener = null;
bool doListen = false;
Thread mListenTaskWorker = null;
ManualResetEvent mThreadCloseObserver = new ManualResetEvent(false);
internal void stop()
{
doListen = false;
listener.Stop();
mThreadCloseObserver.WaitOne();
}
internal bool IsAlive()
{
if (mListenTaskWorker == null || !mListenTaskWorker.IsAlive)
{
return false;
}
else
{
return true;
}
}
internal void start()
{
doListen = true;
mListenTaskWorker = new Thread(listenTask);
mListenTaskWorker.IsBackground = true;
mListenTaskWorker.Start();
}
private void listenTask()
{
listener = new HttpListener();
string port = Program.mainForm.txbPort.Text;
listener.Prefixes.Add("http://+:" + port + "/");
listener.Start();
Program.mainForm.recvLog(TAG, "httpListener Start!! ---- " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString());
while (doListen)
{
try
{
//string requestURL = listener.GetContext().Request.RawUrl;
//ThreadPool.QueueUserWorkItem(HandleRequest, new object[] { requestURL });
ThreadPool.QueueUserWorkItem(HandleRequest, new object[] { listener.GetContext() });
}
catch (Exception ex)
{
Program.mainForm.recvLog(TAG, ex.ToString());
}
}
mThreadCloseObserver.Set();
Program.mainForm.recvLog(TAG, "Listener Closed");
}
private Stream GetBody(HttpListenerContext context)
{
if (!context.Request.HasEntityBody)
{
return null;
}
System.IO.Stream body = context.Request.InputStream; // Stream형식으로 받아오기
return body;
}
public static byte[] streamToByteArray(Stream input)
{
MemoryStream ms = new MemoryStream();
input.CopyTo(ms);
return ms.ToArray();
}
private void HandleRequest(object state)
{
HttpListenerContext context = (HttpListenerContext)((object[])state)[0];
HttpListenerRequest request = context.Request;
try
{
//데이터핸들링부분
if (request.RawUrl != "/favicon.ico")
{
Program.mainForm.recvLog(TAG, request.RemoteEndPoint.ToString() + " " + request.RawUrl + " - Response Arrival" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + Environment.NewLine);
Console.WriteLine(request.RawUrl);
//업로드
if (request.HttpMethod.Equals("POST") && HttpUtility.UrlDecode(request.RawUrl).Equals("/파일업로드")){
Stream stream = GetBody(context);
var parser = MultipartFormDataParser.Parse(stream); //stream: Request Body (stream형식)
//Image Parse
int nCnt = parser.Files.Count; //파싱할 파일의 개수
byte[] arrByte;
string filename = "";
if (nCnt > 0) //파싱할 파일의 개수가 0보다 크면,
{
var file = parser.Files.First();
filename = file.FileName;
Stream data = file.Data; //stream 형식으로 읽기
arrByte = streamToByteArray(data); //Byte Array로 변환
var path = Path.Combine($"Image");
if (!Directory.Exists(path)) Directory.CreateDirectory(path); // 웹 서비스 내 업로드폴더가 없을 경우 자동생성을 위한 처리
DataCenter.getInstance().setFileStatus(filename, DataCenter.FILE_STATUS_CODE.UPLOADING);
FileStream fileStream = new FileStream(@"Image\" + filename, FileMode.Create);
fileStream.Write(arrByte, 0, arrByte.Length);
fileStream.Close();
DataCenter.getInstance().setFileStatus(filename, DataCenter.FILE_STATUS_CODE.UPDATE_COMPLETED);
}
context.Response.Headers.Clear();
//context.Response.SendChunked = false;
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
context.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET");
context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.StatusDescription = "OK";
string returnValue = filename + " 파일업로드 완료";
var bytes = Encoding.UTF8.GetBytes(returnValue);
context.Response.KeepAlive = false;
context.Response.OutputStream.Write(bytes, 0, bytes.Length);
context.Response.OutputStream.Close();
Console.WriteLine(returnValue);
Program.mainForm.recvLog(TAG, returnValue + Environment.NewLine);
}
//다운로드
else if (HttpUtility.UrlDecode(request.RawUrl).Contains("/파일다운로드"))
{
string = HttpUtility.UrlDecode(request.RawUrl).Replace("/파일다운로드/", "");
var path = Environment.CurrentDirectory + @"\image\";
path = Path.Combine(path, );
if (System.IO.File.Exists(path))
{
byte[] bytes;
using (FileStream file = new FileStream(path: path, mode: FileMode.Open)) // 배포환경에선 다운로드폴더에 대한 권한설정작업이 필요할 수 있다.
{
try
{
bytes = new byte[file.Length];
file.Read(bytes, 0, bytes.Length);
context.Response.Headers.Clear();
//context.Response.SendChunked = false;
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
context.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET");
context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.StatusDescription = "OK";
context.Response.KeepAlive = false;
context.Response.OutputStream.Write(bytes, 0, bytes.Length);
context.Response.OutputStream.Close();
return;
}
catch (Exception ex)
{
}
}
}
else
{
}
}
//기존방식의 값들
else
{
string returnValue = ARequestObject.create(HttpUtility.UrlDecode(request.RawUrl));
context.Response.Headers.Clear();
//context.Response.SendChunked = false;
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
context.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET");
context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.StatusDescription = "OK";
var bytes = Encoding.UTF8.GetBytes(returnValue);
context.Response.KeepAlive = false;
context.Response.OutputStream.Write(bytes, 0, bytes.Length);
context.Response.OutputStream.Close();
Console.WriteLine(returnValue);
Program.mainForm.recvLog(TAG, returnValue + Environment.NewLine);
return;
}
}
}
catch (Exception ex)
{
try
{
//var bytes = Encoding.UTF8.GetBytes(ex.ToString() + "____" + ex.Message + "____" + request.RawUrl);
//context.Response.OutputStream.Write(bytes, 0, bytes.Length);
Console.WriteLine(DateTime.Now.ToShortTimeString() + " " + ex.ToString() + "____" + ex.Message + "____" + request.RawUrl);
}
catch (Exception ex2)
{
//var bytes = Encoding.UTF8.GetBytes("알수없는오류");
//context.Response.OutputStream.Write(bytes, 0, bytes.Length);
Console.WriteLine(DateTime.Now.ToShortTimeString() + " " + ex2.ToString() + "____" + ex2.Message + "____" + request.RawUrl);
}
}
context.Response.OutputStream.Close();
}
}
}

59
ssgrestserver/Program.cs Normal file
View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ssgrestserver
{
static class Program
{
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
System.Diagnostics.Process[] processes = null;
string processName = System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToUpper();
processes = System.Diagnostics.Process.GetProcessesByName(processName);
if (processes.Length > 2)
{
MessageBox.Show("프로그램이 이미 실행중입니다.");
return;
}
if (IsAdministrator() == false)
{
ProcessStartInfo procInfo = new ProcessStartInfo();
procInfo.UseShellExecute = true;
procInfo.FileName = Application.ExecutablePath;
procInfo.WorkingDirectory = Environment.CurrentDirectory;
procInfo.Verb = "runas";
Process.Start(procInfo);
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
mainForm = new Form1();
Application.Run(mainForm);
}
}
public static Form1 mainForm;
public static bool IsAdministrator()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
if (identity != null)
{
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
return false;
}
}
}

View File

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

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ssgrestserver.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ssgrestserver.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ssgrestserver.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HttpMultipartParser" version="8.1.0" targetFramework="net48" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="2.2.1" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net451" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.116.0" targetFramework="net451" requireReinstallation="true" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Data.SQLite.Core" version="1.0.116.0" targetFramework="net451" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
</packages>

View File

@@ -0,0 +1,163 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ssgrestserver.request;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class CRUD : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/mfront/mobile/broadtalkNotice?";
DBManager mDB = DBManager.getInstance();
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("noticeAction");
mNeedKeyList.Add("vriNoticeNo");
mNeedKeyList.Add("content");
mNeedKeyList.Add("nickName");
mNeedKeyList.Add("insertDate");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = false;
string bufURLDataString = "";
//mAccessableDictionary = DataCenter.getInstance().getData(DataCenter.관리중인데이터들배열.CRUD데이터);
string bufFrameNumber = mRequestParameterKVPairList["seqGFrameNo"];
string bufNoticeNumber = mRequestParameterKVPairList["vriNoticeNo"];
if (mRequestParameterKVPairList["noticeAction"] == "S")
{
DataSet bufDataSet = mDB.sendSelectQuery(
$"select * from ssgCRUD where seqGFrameNo='{bufFrameNumber}' and vriNoticeNo='{bufNoticeNumber}'"
);
if (bufDataSet.Tables[0].Rows.Count != 0)
{
//return JsonConvert.SerializeObject(bufDataSet.Tables[0]["payload"]);
return JObject.Parse(bufDataSet.Tables[0].Rows[0]["payload"].ToString()).ToString(Newtonsoft.Json.Formatting.None);
}
else
{
return "조회되지 않는 S 요청인의 정보(보낸프레임번호에 데이터가 없음)";
}
/* if (mAccessableDictionary.ContainsKey(mRequestParameterKVPairList["seqGFrameNo"]))
{
return mAccessableDictionary[mRequestParameterKVPairList["seqGFrameNo"]].ToString(Newtonsoft.Json.Formatting.None);
}
else
{
return "조회되지 않는 S 요청인의 정보(보낸프레임번호에 데이터가 없음)";
}*/
}
else
{
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
//bufURLDataString += item.Key + @"=" + item.Value + @"&";
if (item.Key == "content")
{
bufURLDataString += item.Key + @"=" + DataCenter.getInstance().interpritURL(item.Value) + @"&";
}
else
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
// receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
//if (!mAccessableDictionary.ContainsKey(mRequestParameterKVPairList["seqGFrameNo"]))
//{
//mAccessableDictionary.Add(mRequestParameterKVPairList["seqGFrameNo"], new JObject());
//}
//요청이 제거였을경우 그동안 관리해온 인자값을 제거하고 서버의 상태를 리턴.
if (mRequestParameterKVPairList["noticeAction"] == "D" && receiveData["message"].ToString() == "SUCCESS")
{
mDB.sendInsertQuery($"Delete From ssgCRUD where seqGFrameNo='{bufFrameNumber}' and vriNoticeNo='{bufNoticeNumber}'");
//if (mAccessableDictionary.ContainsKey(mRequestParameterKVPairList["seqGFrameNo"]))
//{
// mAccessableDictionary.Remove(mRequestParameterKVPairList["seqGFrameNo"]);
// return receiveData.ToString();
//}
//else
//{
// return "조회되지 않는 D 요청인의 정보(보낸프레임번호에 데이터가 없음)";
//}
return receiveData.ToString();
}
foreach (var item in mRequestParameterKVPairList)
{
if (receiveData.ContainsKey(item.Key))
{
if (item.Key == "content")
{
receiveData[item.Key] = DataCenter.getInstance().interpritURL(item.Value, true);
}
else
{
receiveData[item.Key] = item.Value;
}
}
else
{
if (item.Key == "content")
{
receiveData.Add(item.Key, DataCenter.getInstance().interpritURL(item.Value, true));
}
else
{
receiveData.Add(item.Key, item.Value);
}
}
}
//mAccessableDictionary[mRequestParameterKVPairList["seqGFrameNo"]] = receiveData;
string bufPayload = receiveData.ToString(Newtonsoft.Json.Formatting.None).Replace("'", "''");
mDB.sendInsertQuery(
//$"insert into ssgCRUD (seqGFrameNo, vriNoticeNo, payload) VALUES ('{bufFrameNumber}','{bufNoticeNumber}', '{bufPayload}') "
//+ $" ON CONFLICT(seqGFrameNo, vriNoticeNo) DO UPDATE SET payload='{bufPayload}';");
$"replace into ssgCRUD (seqGFrameNo, vriNoticeNo, payload) VALUES ('{bufFrameNumber}','{bufNoticeNumber}', '{bufPayload}') "
);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}
}

View File

@@ -0,0 +1,45 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/broad/cg?";
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = true;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
//receiveData.
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,43 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class VVIP : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/broadcast/masterGoodsInfo?";
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = false;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,45 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/mfront/mobile/broadtalkAdopt?";
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("talkSeq");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = false;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,46 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/broadcast/callScheduleChart?";
public void setNeedKeys()
{
mNeedKeyList.Add("mediaCode");
mNeedKeyList.Add("broadStartFromDate");
mNeedKeyList.Add("broadStartToDate");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = false;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,43 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class QnA : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/mfront/mobile/goodsCounselList?";
public void setNeedKeys()
{
mNeedKeyList.Add("goodsCode");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = true;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,43 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/mfront/mobile/goodsCommentList?";
public void setNeedKeys()
{
mNeedKeyList.Add("goodsCode");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = true;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,61 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/mfront/mobile/broadtalkAnswer?";
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("content");
mNeedKeyList.Add("nickName");
mNeedKeyList.Add("retalkSeq");
mNeedKeyList.Add("insertDate");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = false;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
if (item.Key == "content")
{
bufURLDataString += item.Key + @"=" + DataCenter.getInstance().interpritURL(item.Value) + @"&";
}
else
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
//if (receiveData.ContainsKey("content"))
//{
// receiveData["content"] = DataCenter.getInstance().interpritURL(receiveData["content"].ToString(), true);
//}
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,47 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/mfront/mobile/broadtalkList?";
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("startDate");
mNeedKeyList.Add("endDate");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = true;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
//receiveData.
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,44 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "/realorder/broadCallResponseInfo?";
public void setNeedKeys()
{
mNeedKeyList.Add("seqGFrameNo");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
mIsSendTypeGet = true;
string bufURLDataString = "";
foreach (KeyValuePair<string, string> item in mRequestParameterKVPairList)
{
bufURLDataString += item.Key + @"=" + item.Value + @"&";
}
bufURLDataString = bufURLDataString.Substring(0, bufURLDataString.Length - 1);
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + bufURLDataString));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
//receiveData.
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,517 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
abstract class ARequestObject
{
protected string TAG = "DB Connection Abstarct Class";
//private const string SSG_REST_SERVER_REAL = "http://inf.shinsegaetvshopping.com/";
private const string SSG_REST_SERVER_REAL = "http://202.3.21.200/";
private const string SSG_REST_SERVER_REAL_New = "https://m.shinsegaetvshopping.com/";
private const string SSG_REST_SERVER_TEST = "http://sinf-dev.shinsegaetvshopping.com/";
protected List<string> mNeedKeyList = new List<string>();
protected Dictionary<string, JObject> mAccessableDictionary = null;
internal ARequestObject()
{
mRequestParameterKVPairList = new Dictionary<string, string>();
}
/// <summary>
/// 접근할 테이블명
/// </summary>
protected string TABLE_NAME = "";
protected bool mIsSendTypeGet = false;
protected Dictionary<string, string> mRequestParameterKVPairList = null;
protected DataCenter mDataCenter = DataCenter.getInstance();
protected string m채널이름 = "";
protected readonly string[] = { "상품", "경품", "텍스트", "채팅", "상품평", "QNA", "공지", "채팅판", "동영상", "콜데이터", "매진" };
/// <summary>
/// 테스트중
/// </summary>
public bool mIsRealURL = true;
internal static string create(string receiveValue)
{
string returnValue = "";
try
{
//인스턴스에서 쓸 값 초기화.
ARequestObject bufInstance = null;
///요청종류/씬포멧명/적용범위 ?Key=Value&Key=Value...
///방송용/코스피지수?Key=Value&Key=Value... 1타입
//////방송용/9?적용범위=코스피지수&종류=당일 2타입
//URL에서 Request부분(?)과 address부분을 분리
string[] bufURLSplit = receiveValue.Split('?');
//리퀘스트타입은 Get으로 넘어오는 Address데이터의 마지막부분 -> /RequestType
string[] bufRequestArray = bufURLSplit[0].Split('/');
string = bufRequestArray[2];
string = bufRequestArray[3];
///씬에따라 구분.
///사용처는 나중에 User Key로 사용할예정 현재는 그냥 쓰자. 테스트용임
switch ()
{
#region "방송용데이터"
case "새데이터조회":
switch ()
{
case "상품수량":
bufInstance = new ();
break;
case "경품프로모션":
bufInstance = new ();
break;
case "채팅리스트":
bufInstance = new ();
break;
case "채팅답변등록":
bufInstance = new ();
break;
case "방송채택":
bufInstance = new ();
break;
case "방송편성":
bufInstance = new ();
break;
case "상품평조회":
bufInstance = new ();
break;
case "상품QnA":
bufInstance = new QnA();
break;
case "공지CRUD":
bufInstance = new CRUD();
break;
case "콜데이터조회":
bufInstance = new ();
break;
case "방송VVIP":
bufInstance = new VVIP();
break;
case "매진조회":
bufInstance = new ();
break;
default:
returnValue = "알수없는 분류 - " + + "----" + ;
break;
}
break;
#endregion
case "데이터입력":
switch ()
{
case "상품수량":
bufInstance = new ();
break;
case "경품프로모션":
bufInstance = new ();
break;
default:
returnValue = "알수없는 분류 - " + + "----" + ;
break;
}
break;
case "입력데이터조회":
switch ()
{
case "상품수량":
bufInstance = new ();
break;
case "경품프로모션":
bufInstance = new ();
break;
default:
returnValue = "알수없는 분류 - " + + "----" + ;
break;
}
break;
case "자막상황":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
default:
returnValue = "알수없는 분류 - " + + "----" + ;
break;
}
break;
default:
break;
case "텍스트":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "씬이름":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "QNA":
switch ()
{
case "조회":
bufInstance = new QNA();
break;
case "입력":
bufInstance = new QNA();
break;
}
break;
case "공지":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "상품평":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "채팅":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "채팅판":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "동영상":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "콜데이터":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "매진":
switch ()
{
case "조회":
bufInstance = new ();
break;
case "입력":
bufInstance = new ();
break;
}
break;
case "test":
switch ()
{
case "test":
bufInstance = new ();
break;
}
break;
}
bufInstance.mNeedKeyList = new List<string>();
if (bufRequestArray[1].Trim() == "")
{
throw new Exception("잘못된 채널정보");
}
bufInstance.m채널이름 = bufRequestArray[1];
if (bufInstance != null)
{
//URL이 충분히 왔을때만 작업
if (bufURLSplit.Length > 1)
{
bufInstance.mRequestParameterKVPairList = bufInstance.parseParameter(bufURLSplit[1]);
}
//필수키가 있는 리퀘스트에 한해서 체크한다.
string checkString = "";
if (bufInstance is INeedKeyRequest)
{
((INeedKeyRequest)bufInstance).setNeedKeys();
checkString = bufInstance.checkNeedUpdateKey();
}
if (checkString == "")
{
returnValue = bufInstance.startUpdateWork();
}
else
{
returnValue = checkString;
}
}
return returnValue;
}
catch (DuplicateNameException dne)
{
return "같은 종목을 여러번 요청하였습니다. " + dne.ToString();
}
}
protected Dictionary<string, string> parseParameter(string recvParametersInURL)
{
Dictionary<string, string> rtnValue = new Dictionary<string, string>();
string[] bufGetDataArray = recvParametersInURL.Split('&');
foreach (string item in bufGetDataArray)
{
string[] bufKVDataArray = item.Split('=');
rtnValue.Add(bufKVDataArray[0], bufKVDataArray[1]);
}
return rtnValue;
}
protected abstract string startUpdateWork();
protected string httpRequest(string requestURL)
{
string rtnValue = "";
try
{
bool isMasterGoodsInfo = requestURL.Contains("masterGoodsInfo");
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create((mIsRealURL ? SSG_REST_SERVER_REAL : SSG_REST_SERVER_TEST) + requestURL);
if (isMasterGoodsInfo)
{
httpWebRequest = (HttpWebRequest)WebRequest.Create((SSG_REST_SERVER_REAL_New) + requestURL);
}
;
// 인코딩 UTF-8
byte[] sendData = UTF8Encoding.UTF8.GetBytes("");
if (mIsSendTypeGet || isMasterGoodsInfo)
{
httpWebRequest.Method = "GET";
}
else
{
httpWebRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = sendData.Length;
Stream requestStream = httpWebRequest.GetRequestStream();
requestStream.Write(sendData, 0, sendData.Length);
requestStream.Close();
}
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.GetEncoding("UTF-8"));
rtnValue = streamReader.ReadToEnd();
streamReader.Close();
httpWebResponse.Close();
return rtnValue;
}
catch (Exception ex)
{
return ex.ToString();
}
}
private string checkNeedUpdateKey()
{
foreach (string item in mNeedKeyList)
{
if (!mRequestParameterKVPairList.ContainsKey(item))
{
return "필수키가 없음 - " + item;
}
}
return "";
}
protected void ()
{
Dictionary<string, JObject> bufTargetDictionary = DataCenter.getInstance().getData(DataCenter..);
if (mRequestParameterKVPairList.ContainsKey("보낸사람"))
{
if (mRequestParameterKVPairList["보낸사람"] == "코더")
{
bufTargetDictionary[m채널이름]["코더조회시간"] = DateTime.Now;
}
}
TimeSpan = DateTime.Now - Convert.ToDateTime(bufTargetDictionary[m채널이름]["코더조회시간"]);
if (.TotalSeconds > 3)
{
bufTargetDictionary[m채널이름]["코더"] = "N";
}
else
{
bufTargetDictionary[m채널이름]["코더"] = "Y";
}
bufTargetDictionary[m채널이름]["현재서버시간"] = DateTime.Now;
}
protected void ()
{
if (!DataCenter.getInstance().getData(DataCenter..).ContainsKey(m채널이름))
{
JObject buf코더상태 = new JObject();
foreach (string item in )
{
buf코더상태.Add(item, "N");
}
buf코더상태.Add("코더", "N");
buf코더상태.Add("코더조회시간", new DateTime(1990, 1, 1));
buf코더상태.Add("현재서버시간", DateTime.Now);
DataCenter.getInstance().getData(DataCenter..).Add(m채널이름, buf코더상태);
}
}
}
}

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver.request
{
class DBManager
{
#region Singleton
private volatile static DBManager mInstance = null;
private static object mSingletonLocker = new object();
private DBManager()
{
CONNECT_STRING = Program.mainForm.getStartupPath() + @"\ssgCRUD.db";
DB_SOURCE = $@"Data Source={CONNECT_STRING}";
try
{
using (var conn = new SQLiteConnection(DB_SOURCE))
{
int result = 0;
conn.Open();
using (var command = new SQLiteCommand("select count(*) from sqlite_master WHERE Name = 'ssgCRUD'", conn))
{
result = Convert.ToInt32(command.ExecuteScalar());
}
if (result < 1)
{
string bufTableBuildQuery = @"create table ssgCRUD (seqGFrameNo TEXT PRIMARY KEY, vriNoticeNo TEXT UNIQUE, payload TEXT)";
using (var command = new SQLiteCommand(bufTableBuildQuery, conn))
{
command.ExecuteNonQuery();
}
}
}
}
catch (Exception)
{
throw;
}
}
string CONNECT_STRING = "";
string DB_SOURCE = "";
public static DBManager getInstance()
{
lock (mSingletonLocker)
{
if (mInstance == null)
{
mInstance = new DBManager();
}
}
return mInstance;
}
#endregion
public DataSet sendSelectQuery(string query)
{
DataSet rtnValue = new DataSet();
try
{
using (var adapter = new SQLiteDataAdapter(query, DB_SOURCE))
{
adapter.Fill(rtnValue, "rtnTable");
}
}
catch (Exception ex)
{
Program.mainForm.recvLog("SQLQUERY_SELECT", ex.ToString());
}
return rtnValue;
}
public bool sendInsertQuery(string query)
{
try
{
using (var conn = new SQLiteConnection(DB_SOURCE))
{
conn.Open();
using (var command = new SQLiteCommand(query, conn))
{
command.ExecuteNonQuery();
}
}
return true;
}
catch (Exception ex)
{
Program.mainForm.recvLog("SQLQUERY_INSERT", ex.ToString());
return false;
}
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
interface INeedKeyRequest
{
void setNeedKeys();
}
}

View File

@@ -0,0 +1,63 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
abstract class AInputTextHandler : ARequestObject
{
protected string updateTextName = "";
protected abstract void setUpdateData();
protected override string startUpdateWork()
{
this.setUpdateData();
if (!mRequestParameterKVPairList.ContainsKey("보낸사람"))
{
return "없는데이터 - 보낸사람";
}
if (!mRequestParameterKVPairList.ContainsKey(updateTextName))
{
return "없는데이터 - " + updateTextName;
}
();
JObject bufObj = new JObject();
bufObj.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
bufObj.Add(updateTextName, mRequestParameterKVPairList[updateTextName]);
bufObj.Add("입력시간", DateTime.Now.ToString());
if (mAccessableDictionary.ContainsKey(m채널이름))
{
mAccessableDictionary[m채널이름] = bufObj;
}
else
{
mAccessableDictionary.Add(m채널이름, bufObj);
}
JObject retObj = new JObject();
foreach (var item in mAccessableDictionary[m채널이름])
{
retObj.Add(item.Key, item.Value);
}
retObj.Add("status", "200");
return retObj.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class QNA : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "QNA";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..QNA);
}
}
}

View File

@@ -0,0 +1,52 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
if (!mRequestParameterKVPairList.ContainsKey("보낸사람"))
{
return "없는데이터 - 보낸사람";
}
if (!mRequestParameterKVPairList.ContainsKey("텍스트"))
{
return "없는데이터 - 텍스트";
}
JObject retObj = new JObject();
retObj.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
retObj.Add("텍스트", mRequestParameterKVPairList["텍스트"]);
retObj.Add("입력시간", DateTime.Now.ToString());
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
if (mAccessableDictionary.ContainsKey(m채널이름))
{
mAccessableDictionary[m채널이름] = retObj;
}
else
{
mAccessableDictionary.Add(m채널이름, retObj);
}
retObj.Add("status", "200");
return retObj.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "공지";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "동영상";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "매진";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,48 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
if (!mRequestParameterKVPairList.ContainsKey("보낸사람"))
{
return "없는데이터 - 보낸사람";
}
if (!mRequestParameterKVPairList.ContainsKey("텍스트"))
{
return "없는데이터 - 텍스트";
}
JObject retObj = new JObject();
retObj.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
retObj.Add("텍스트", mRequestParameterKVPairList["텍스트"]);
retObj.Add("입력시간", DateTime.Now.ToString());
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
if (mAccessableDictionary.ContainsKey(m채널이름))
{
mAccessableDictionary[m채널이름] = retObj;
}
else
{
mAccessableDictionary.Add(m채널이름, retObj);
}
retObj.Add("status", "200");
return retObj.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "상품평";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,49 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
if (!mRequestParameterKVPairList.ContainsKey("씬이름"))
{
return "없는데이터 - 씬이름";
}
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
if (!mAccessableDictionary.ContainsKey(m채널이름))
{
JObject bufObj = new JObject();
bufObj.Add("씬이름", mRequestParameterKVPairList["씬이름"]);
mAccessableDictionary.Add(m채널이름, bufObj);
}
else
{
mAccessableDictionary[m채널이름]["씬이름"] = mRequestParameterKVPairList["씬이름"];
}
JObject retObj = new JObject();
foreach (var item in mAccessableDictionary[m채널이름])
{
retObj.Add(item.Key, item.Value);
}
retObj.Add("status", "200");
return retObj.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "채팅";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "채팅판";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "콜데이터";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AInputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "텍스트";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,50 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
();
if (.Except(mRequestParameterKVPairList.Keys).Count() == .Length)
{
return "없는데이터 - 입력될 자막정보가 하나도 없음";
}
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
foreach (string item in )
{
if (mRequestParameterKVPairList.ContainsKey(item))
{
if (mRequestParameterKVPairList[item] != "Y" && mRequestParameterKVPairList[item] != "N")
{
return "이상한데이터 - " + item + " 입력할 자막정보가 잘못됨(Y,N)";
}
mAccessableDictionary[m채널이름][item] = mRequestParameterKVPairList[item];
}
}
();
if (!mAccessableDictionary[m채널이름].ContainsKey("status"))
{
mAccessableDictionary[m채널이름].Add("status", "200");
}
return mAccessableDictionary[m채널이름].ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,43 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
abstract class AOutputTextHandler : ARequestObject
{
protected string updateTextName = "";
protected abstract void setUpdateData();
protected override string startUpdateWork()
{
setUpdateData();
//mAccessableDictionary = DataCenter.getInstance().getData(DataCenter.관리중인데이터들배열.코더상태);
if (!mAccessableDictionary.ContainsKey(m채널이름))
{
return "서버에 없는 정보 - 텍스트";
}
();
();
JObject retObj = new JObject();
foreach (var item in mAccessableDictionary[m채널이름])
{
retObj.Add(item.Key, item.Value);
}
return retObj.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class QNA : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "QNA";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..QNA);
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
if (!mAccessableDictionary.ContainsKey(this.m채널이름))
{
return "서버에 없는 정보 - 경품데이터";
}
return mAccessableDictionary[this.m채널이름].ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "공지";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "동영상";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "매진";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
if (!mAccessableDictionary.ContainsKey(m채널이름))
{
return "서버에 없는 정보 - 상품데이터";
}
return mAccessableDictionary[m채널이름].ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "상품평";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "채팅";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "채팅판";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "콜데이터";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : AOutputTextHandler
{
protected override void setUpdateData()
{
updateTextName = "텍스트";
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
}
}
}

View File

@@ -0,0 +1,29 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
();
();
mAccessableDictionary = DataCenter.getInstance().getData(DataCenter..);
if (!mAccessableDictionary[m채널이름].ContainsKey("status"))
{
mAccessableDictionary[m채널이름].Add("status", "200");
}
return mAccessableDictionary[m채널이름].ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,27 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
JObject retObj = new JObject();
foreach (var item in DataCenter.getInstance().getData(DataCenter..)[m채널이름])
{
retObj.Add(item.Key, item.Value);
}
retObj.Add("status", "200");
return retObj.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,33 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
//string mRequestURL = "promo/lotteryPromo.do?promoNo=";
string mRequestURL = "promo/lotteryPromo.do?promoNo=";
public void setNeedKeys()
{
mNeedKeyList.Add("프로모션코드");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
JObject receiveData = JObject.Parse(httpRequest(mRequestURL + mRequestParameterKVPairList["프로모션코드"]));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,38 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject, INeedKeyRequest
{
string mRequestURL = "goods/soldQty.do?";
public void setNeedKeys()
{
mNeedKeyList.Add("방송일");
mNeedKeyList.Add("조회시작일");
mNeedKeyList.Add("PGM코드");
mNeedKeyList.Add("보낸사람");
}
protected override string startUpdateWork()
{
string req = mRequestURL + "bDate=" + mRequestParameterKVPairList["조회시작일"];
req += "&broadDate=" + mRequestParameterKVPairList["방송일"];
req += "&pgmCode=" + mRequestParameterKVPairList["PGM코드"];
JObject receiveData = JObject.Parse(httpRequest(req));
receiveData.Add("조회시간", DateTime.Now.ToString());
receiveData.Add("보낸사람", mRequestParameterKVPairList["보낸사람"]);
return receiveData.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ssgrestserver
{
class : ARequestObject
{
protected override string startUpdateWork()
{
JObject buf코더상태 = new JObject();
buf코더상태.Add("test", "testtt");
buf코더상태.Add("status", "200");
return buf코더상태.ToString(Newtonsoft.Json.Formatting.None);
}
}
}

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5C389AE4-6059-4A1D-8E62-BD97C5FF5E8C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ssgrestserver</RootNamespace>
<AssemblyName>ssgrestserver</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpo.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="HttpMultipartParser, Version=8.1.0.0, Culture=neutral, PublicKeyToken=6d293681fa6c7a03, processorArchitecture=MSIL">
<HintPath>..\packages\HttpMultipartParser.8.1.0\lib\net48\HttpMultipartParser.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.2.2.1\lib\net462\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.116.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\lib\net451\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataCenter.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="NetManager.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="request\6월추가개발\공지CRUD.cs" />
<Compile Include="request\6월추가개발\방송VVIP.cs" />
<Compile Include="request\6월추가개발\상품QnA.cs" />
<Compile Include="request\6월추가개발\상품평조회.cs" />
<Compile Include="request\6월추가개발\방송편성.cs" />
<Compile Include="request\6월추가개발\방송채택.cs" />
<Compile Include="request\6월추가개발\채팅답변등록.cs" />
<Compile Include="request\6월추가개발\매진조회.cs" />
<Compile Include="request\6월추가개발\콜데이터조회.cs" />
<Compile Include="request\6월추가개발\채팅리스트.cs" />
<Compile Include="request\ARequestObject.cs" />
<Compile Include="request\DBManager.cs" />
<Compile Include="request\INeedKeyRequest.cs" />
<Compile Include="request\웹핸들링\입력\AInputTextHandler.cs" />
<Compile Include="request\웹핸들링\입력\입력공지.cs" />
<Compile Include="request\웹핸들링\입력\입력콜데이터.cs" />
<Compile Include="request\웹핸들링\입력\입력매진.cs" />
<Compile Include="request\웹핸들링\입력\입력동영상.cs" />
<Compile Include="request\웹핸들링\입력\입력채팅판.cs" />
<Compile Include="request\웹핸들링\입력\입력채팅.cs" />
<Compile Include="request\웹핸들링\입력\입력상품평.cs" />
<Compile Include="request\웹핸들링\입력\입력QNA.cs" />
<Compile Include="request\웹핸들링\조회\AOutputTextHandler.cs" />
<Compile Include="request\웹핸들링\조회\기존공지.cs" />
<Compile Include="request\웹핸들링\조회\기존콜데이터.cs" />
<Compile Include="request\웹핸들링\조회\기존매진.cs" />
<Compile Include="request\웹핸들링\조회\기존동영상.cs" />
<Compile Include="request\웹핸들링\조회\기존상품평.cs" />
<Compile Include="request\웹핸들링\조회\기존QNA.cs" />
<Compile Include="request\웹핸들링\조회\기존채팅판.cs" />
<Compile Include="request\웹핸들링\조회\기존채팅.cs" />
<Compile Include="request\웹핸들링\조회\조회씬목록.cs" />
<Compile Include="request\웹핸들링\조회\기존텍스트.cs" />
<Compile Include="request\웹핸들링\입력\입력씬목록.cs" />
<Compile Include="request\웹핸들링\입력\입력텍스트.cs" />
<Compile Include="request\웹핸들링\입력\입력상품수량.cs" />
<Compile Include="request\웹핸들링\입력\입력경품프로모션.cs" />
<Compile Include="request\웹핸들링\입력\자막입력.cs" />
<Compile Include="request\테스트.cs" />
<Compile Include="request\웹핸들링\조회\자막조회.cs" />
<Compile Include="request\웹핸들링\조회\기존경품프로모션.cs" />
<Compile Include="request\웹핸들링\조회\기존상품수량.cs" />
<Compile Include="request\최초개발\새경품프로모션.cs" />
<Compile Include="request\최초개발\새상품수량.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
</Project>