3.0 source code
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileConverterUtils2", "FileConverterUtils2\FileConverterUtils2.csproj", "{665D791F-4A42-4EB0-A766-300783379D40}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LicenseTest", "LicenseTest\LicenseTest.csproj", "{02FD89FC-7CFB-4269-B082-5DE063F0FC37}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{665D791F-4A42-4EB0-A766-300783379D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{665D791F-4A42-4EB0-A766-300783379D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{665D791F-4A42-4EB0-A766-300783379D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{665D791F-4A42-4EB0-A766-300783379D40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{02FD89FC-7CFB-4269-B082-5DE063F0FC37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{02FD89FC-7CFB-4269-B082-5DE063F0FC37}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{02FD89FC-7CFB-4269-B082-5DE063F0FC37}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02FD89FC-7CFB-4269-B082-5DE063F0FC37}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,548 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Net;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
#region TransportClass
|
||||
public class TransportClassMainAshx
|
||||
{
|
||||
public HttpContext m_oHttpContext;
|
||||
public AsyncCallback m_oAsyncCallback;
|
||||
public TransportClassMainAshx(HttpContext oHttpContext, AsyncCallback oAsyncCallback)
|
||||
{
|
||||
m_oHttpContext = oHttpContext;
|
||||
m_oAsyncCallback = oAsyncCallback;
|
||||
}
|
||||
}
|
||||
public abstract class TransportClassAsyncOperation
|
||||
{
|
||||
public AsyncCallback m_fCallback = null;
|
||||
public object m_oParam = null;
|
||||
public TransportClassAsyncOperation(AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_fCallback = fCallback;
|
||||
m_oParam = oParam;
|
||||
}
|
||||
public abstract void Close();
|
||||
public abstract void Dispose();
|
||||
public void DisposeAndCallback()
|
||||
{
|
||||
Dispose();
|
||||
FireCallback();
|
||||
}
|
||||
public void FireCallback()
|
||||
{
|
||||
m_fCallback(new AsyncOperationData(m_oParam));
|
||||
}
|
||||
}
|
||||
public class AsyncOperationData : IAsyncResult
|
||||
{
|
||||
protected bool _completed;
|
||||
protected Object _state;
|
||||
|
||||
bool IAsyncResult.IsCompleted { get { return _completed; } }
|
||||
WaitHandle IAsyncResult.AsyncWaitHandle { get { return null; } }
|
||||
Object IAsyncResult.AsyncState { get { return _state; } }
|
||||
bool IAsyncResult.CompletedSynchronously { get { return false; } }
|
||||
|
||||
public AsyncOperationData(Object state)
|
||||
{
|
||||
_state = state;
|
||||
_completed = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region For action
|
||||
public class AsyncContextReadOperation
|
||||
{
|
||||
private Stream m_oStream = null;
|
||||
public byte[] m_aBuffer;
|
||||
private object m_oParam;
|
||||
private ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
public AsyncContextReadOperation()
|
||||
{
|
||||
}
|
||||
public void ReadContextBegin(Stream oStream, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_oStream = oStream;
|
||||
m_oParam = oParam;
|
||||
int nInputLength = (int)m_oStream.Length;
|
||||
m_aBuffer = new byte[nInputLength];
|
||||
m_oStream.BeginRead(m_aBuffer, 0, nInputLength, fCallback, oParam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.ReadRequestStream;
|
||||
}
|
||||
if (ErrorTypes.NoError != m_eError)
|
||||
fCallback.Invoke(new AsyncOperationData(oParam));
|
||||
}
|
||||
public ErrorTypes ReadContextEnd(IAsyncResult ar)
|
||||
{
|
||||
if (ErrorTypes.NoError == m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_oStream.EndRead(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.ReadRequestStream;
|
||||
}
|
||||
}
|
||||
return m_eError;
|
||||
}
|
||||
}
|
||||
public class AsyncClearCacheOperation
|
||||
{
|
||||
private string m_sKey;
|
||||
private TaskResult m_oTaskResult = new TaskResult();
|
||||
private Storage m_oStorage = new Storage();
|
||||
private ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
private AsyncCallback m_fAsyncCallback;
|
||||
private object m_oParam;
|
||||
public void ClearCacheBegin(string sKey, AsyncCallback fAsyncCallback, object oParam)
|
||||
{
|
||||
m_sKey = sKey;
|
||||
m_fAsyncCallback = fAsyncCallback;
|
||||
m_oParam = oParam;
|
||||
try
|
||||
{
|
||||
m_oTaskResult.RemoveBegin(m_sKey, ClearCacheTaskResultCallback, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Unknown;
|
||||
}
|
||||
}
|
||||
public ErrorTypes ClearCacheEnd(IAsyncResult ar)
|
||||
{
|
||||
return m_eError;
|
||||
}
|
||||
private void FireCallback()
|
||||
{
|
||||
m_fAsyncCallback.Invoke(new AsyncOperationData(m_oParam));
|
||||
}
|
||||
private void ClearCacheTaskResultCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_eError = m_oTaskResult.RemoveEnd(ar);
|
||||
if (ErrorTypes.NoError == m_eError)
|
||||
m_oStorage.RemovePathBegin(m_sKey, ClearCacheAllCallback, null);
|
||||
else
|
||||
FireCallback();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Unknown;
|
||||
FireCallback();
|
||||
}
|
||||
}
|
||||
private void ClearCacheAllCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_eError = m_oStorage.RemovePathEnd(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Unknown;
|
||||
}
|
||||
FireCallback();
|
||||
}
|
||||
}
|
||||
public class AsyncMediaXmlOperation
|
||||
{
|
||||
private class TransportClass : TransportClassAsyncOperation
|
||||
{
|
||||
public string m_sPath;
|
||||
public Storage m_oStorage = new Storage();
|
||||
public MemoryStream m_oMemoryStream = new MemoryStream();
|
||||
public Dictionary<string, string> m_aMediaXmlMapHash;
|
||||
public Dictionary<string, string> m_aMediaXmlMapFilename;
|
||||
public Utils.getMD5HexStringDelegate m_ogetMD5HexStringDelegate;
|
||||
public StorageTreeNode m_oStorageTreeNode;
|
||||
public int m_nIndex;
|
||||
public int m_nLength;
|
||||
public ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
public TransportClass(AsyncCallback fCallback, object oParam)
|
||||
: base(fCallback, oParam)
|
||||
{
|
||||
}
|
||||
public override void Close()
|
||||
{
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
m_eError = ErrorTypes.Unknown;
|
||||
}
|
||||
public void SetStorageTreeNode(StorageTreeNode oStorageTreeNode)
|
||||
{
|
||||
m_oStorageTreeNode = oStorageTreeNode;
|
||||
m_nIndex = -1;
|
||||
m_nLength = oStorageTreeNode.m_aSubNodes.Count;
|
||||
}
|
||||
public StorageTreeNode getNextTreeNode()
|
||||
{
|
||||
StorageTreeNode oRes = null;
|
||||
if (m_nIndex < 0)
|
||||
m_nIndex = 0;
|
||||
else
|
||||
m_nIndex++;
|
||||
if (m_nIndex < m_nLength)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
StorageTreeNode oCurItem = m_oStorageTreeNode.m_aSubNodes[m_nIndex];
|
||||
if (false == oCurItem.m_bIsDirectory)
|
||||
{
|
||||
oRes = oCurItem;
|
||||
break;
|
||||
}
|
||||
if (m_nIndex >= m_nLength)
|
||||
break;
|
||||
m_nIndex++;
|
||||
}
|
||||
}
|
||||
return oRes;
|
||||
}
|
||||
}
|
||||
private TransportClass m_oGetMediaXml;
|
||||
private TransportClass m_oWriteMediaXml;
|
||||
public void GetMediaXmlBegin(string sPath, AsyncCallback fAsyncCallback, object oParam)
|
||||
{
|
||||
m_oGetMediaXml = new TransportClass(fAsyncCallback, oParam);
|
||||
m_oGetMediaXml.m_sPath = sPath;
|
||||
m_oGetMediaXml.m_aMediaXmlMapFilename = new Dictionary<string, string>();
|
||||
m_oGetMediaXml.m_aMediaXmlMapHash = new Dictionary<string, string>();
|
||||
|
||||
StorageFileInfo oStorageFileInfo;
|
||||
ErrorTypes eFileExist = m_oGetMediaXml.m_oStorage.GetFileInfo(sPath, out oStorageFileInfo);
|
||||
if (ErrorTypes.NoError == eFileExist && null != oStorageFileInfo)
|
||||
{
|
||||
|
||||
m_oGetMediaXml.m_oStorage.ReadFileBegin(sPath, m_oGetMediaXml.m_oMemoryStream, ReadMediaXmlCallback, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
m_oGetMediaXml.m_oStorage.GetTreeNodeBegin(Path.GetDirectoryName(sPath), GetTreeNodeCallback, null);
|
||||
}
|
||||
}
|
||||
public ErrorTypes GetMediaXmlEnd(IAsyncResult ar, out Dictionary<string, string> aMediaXmlMapHash, out Dictionary<string, string> aMediaXmlMapFilename)
|
||||
{
|
||||
aMediaXmlMapHash = m_oGetMediaXml.m_aMediaXmlMapHash;
|
||||
aMediaXmlMapFilename = m_oGetMediaXml.m_aMediaXmlMapFilename;
|
||||
return ErrorTypes.NoError;
|
||||
}
|
||||
private void ReadMediaXmlCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
int nReadWriteBytes;
|
||||
m_oGetMediaXml.m_eError = m_oGetMediaXml.m_oStorage.ReadFileEnd(ar, out nReadWriteBytes);
|
||||
if (ErrorTypes.NoError == m_oGetMediaXml.m_eError || ErrorTypes.StorageFileNoFound == m_oGetMediaXml.m_eError)
|
||||
{
|
||||
MemoryStream oMemoryStream = m_oGetMediaXml.m_oMemoryStream;
|
||||
if (nReadWriteBytes > 0)
|
||||
{
|
||||
string sXml = Encoding.UTF8.GetString(oMemoryStream.GetBuffer(), 0, (int)oMemoryStream.Position);
|
||||
using (XmlTextReader reader = new XmlTextReader(new StringReader(sXml)))
|
||||
{
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if ("image" == reader.Name)
|
||||
{
|
||||
string sHash = null;
|
||||
string sFilename = null;
|
||||
while (reader.MoveToNextAttribute())
|
||||
{
|
||||
if ("md5" == reader.Name)
|
||||
sHash = reader.Value;
|
||||
else if ("filename" == reader.Name)
|
||||
sFilename = reader.Value;
|
||||
}
|
||||
if (null != sHash && null != sFilename)
|
||||
{
|
||||
m_oGetMediaXml.m_aMediaXmlMapHash[sHash] = sFilename;
|
||||
m_oGetMediaXml.m_aMediaXmlMapFilename[sFilename] = sHash;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_oGetMediaXml.FireCallback();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetMediaXml.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
private void GetTreeNodeCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_oGetMediaXml.SetStorageTreeNode(m_oGetMediaXml.m_oStorage.GetTreeNodeEnd(ar));
|
||||
m_oGetMediaXml.m_ogetMD5HexStringDelegate = new Utils.getMD5HexStringDelegate(Utils.getMD5HexString);
|
||||
m_oGetMediaXml.m_oMemoryStream = new MemoryStream();
|
||||
StorageTreeNode oFirstItem = m_oGetMediaXml.getNextTreeNode();
|
||||
if (null != oFirstItem)
|
||||
{
|
||||
|
||||
m_oGetMediaXml.m_oStorage.ReadFileBegin(Path.Combine(Path.GetDirectoryName(m_oGetMediaXml.m_sPath), oFirstItem.m_sName), m_oGetMediaXml.m_oMemoryStream, ReadNextMediaXmlCallback, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oGetMediaXml.FireCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetMediaXml.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
private void ReadNextMediaXmlCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
int nReadWriteBytes;
|
||||
ErrorTypes eError = m_oGetMediaXml.m_oStorage.ReadFileEnd(ar, out nReadWriteBytes);
|
||||
if (ErrorTypes.NoError == eError)
|
||||
{
|
||||
StorageTreeNode oCurNode = m_oGetMediaXml.m_oStorageTreeNode.m_aSubNodes[m_oGetMediaXml.m_nIndex];
|
||||
|
||||
m_oGetMediaXml.m_oMemoryStream.Position = 0;
|
||||
string sHex = Utils.getMD5HexString(m_oGetMediaXml.m_oMemoryStream);
|
||||
if (false == m_oGetMediaXml.m_aMediaXmlMapFilename.ContainsKey(oCurNode.m_sName))
|
||||
m_oGetMediaXml.m_aMediaXmlMapFilename.Add(oCurNode.m_sName, sHex);
|
||||
if (false == m_oGetMediaXml.m_aMediaXmlMapHash.ContainsKey(sHex))
|
||||
m_oGetMediaXml.m_aMediaXmlMapHash.Add(sHex, oCurNode.m_sName);
|
||||
oCurNode = m_oGetMediaXml.getNextTreeNode();
|
||||
if (null == oCurNode)
|
||||
{
|
||||
m_oGetMediaXml.FireCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oGetMediaXml.m_oMemoryStream = new MemoryStream();
|
||||
m_oGetMediaXml.m_oStorage.ReadFileBegin(Path.Combine(Path.GetDirectoryName(m_oGetMediaXml.m_sPath), oCurNode.m_sName), m_oGetMediaXml.m_oMemoryStream, ReadNextMediaXmlCallback, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
m_oGetMediaXml.DisposeAndCallback();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetMediaXml.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public void WriteMediaXmlBegin(string sPath, Dictionary<string, string> aMediaXmlMapHash, AsyncCallback fAsyncCallback, object oParam)
|
||||
{
|
||||
m_oWriteMediaXml = new TransportClass(fAsyncCallback, oParam);
|
||||
try
|
||||
{
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
sb.Append("<images>");
|
||||
foreach (KeyValuePair<string, string> kvp in aMediaXmlMapHash)
|
||||
sb.AppendFormat("<image md5=\"{0}\" filename=\"{1}\"/>", kvp.Key, kvp.Value);
|
||||
sb.Append("</images>");
|
||||
byte[] aBuffer = Encoding.UTF8.GetBytes(sb.ToString());
|
||||
MemoryStream ms = new MemoryStream(aBuffer);
|
||||
m_oWriteMediaXml.m_oStorage = new Storage();
|
||||
m_oWriteMediaXml.m_oStorage.WriteFileBegin(sPath, ms, fAsyncCallback, oParam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oWriteMediaXml.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public ErrorTypes WriteMediaXmlEnd(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
int nReadWriteBytes;
|
||||
m_oWriteMediaXml.m_eError = m_oWriteMediaXml.m_oStorage.WriteFileEnd(ar, out nReadWriteBytes);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oWriteMediaXml.Dispose();
|
||||
}
|
||||
return m_oWriteMediaXml.m_eError;
|
||||
}
|
||||
}
|
||||
public class AsyncDownloadOperation
|
||||
{
|
||||
private int m_nMaxSize;
|
||||
private AsyncCallback m_fAsyncCallback;
|
||||
private object m_oParam;
|
||||
private WebClient m_oWebClient;
|
||||
private Stream m_oReadStream;
|
||||
private byte[] m_aBuffer;
|
||||
private MemoryStream m_oOutput;
|
||||
private ErrorTypes m_eError;
|
||||
public AsyncDownloadOperation(int nMaxSize)
|
||||
{
|
||||
m_nMaxSize = nMaxSize;
|
||||
m_eError = ErrorTypes.NoError;
|
||||
m_oWebClient = null;
|
||||
m_oReadStream = null;
|
||||
m_oOutput = null;
|
||||
}
|
||||
private void Clear()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null != m_oWebClient)
|
||||
m_oWebClient.Dispose();
|
||||
if (null != m_oReadStream)
|
||||
m_oReadStream.Dispose();
|
||||
if (null != m_oOutput)
|
||||
m_oOutput.Dispose();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
private void FireCallback()
|
||||
{
|
||||
if (null != m_fAsyncCallback)
|
||||
m_fAsyncCallback.Invoke(new AsyncOperationData(m_oParam));
|
||||
}
|
||||
private void ClearAndCallback()
|
||||
{
|
||||
Clear();
|
||||
FireCallback();
|
||||
}
|
||||
public void DownloadBegin(string sUrl, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_fAsyncCallback = fCallback;
|
||||
m_oParam = oParam;
|
||||
m_oWebClient = new WebClient();
|
||||
m_oWebClient.Headers.Add(HttpRequestHeader.UserAgent, Constants.mc_sWebClientUserAgent);
|
||||
m_oWebClient.OpenReadCompleted += new OpenReadCompletedEventHandler(m_oWebClient_OpenReadCompleted);
|
||||
m_oWebClient.OpenReadAsync(new Uri(sUrl));
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Upload;
|
||||
ClearAndCallback();
|
||||
}
|
||||
}
|
||||
private void m_oWebClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!e.Cancelled && e.Error == null)
|
||||
{
|
||||
m_oReadStream = e.Result;
|
||||
int nCurBytes = Convert.ToInt32(m_oWebClient.ResponseHeaders["Content-Length"]);
|
||||
if (m_nMaxSize > 0 && nCurBytes > m_nMaxSize)
|
||||
{
|
||||
m_eError = ErrorTypes.UploadContentLength;
|
||||
ClearAndCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oOutput = new MemoryStream((int)nCurBytes);
|
||||
m_aBuffer = new byte[nCurBytes];
|
||||
m_oReadStream.BeginRead(m_aBuffer, 0, nCurBytes, ReadCallback, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eError = ErrorTypes.Upload;
|
||||
ClearAndCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Upload;
|
||||
ClearAndCallback();
|
||||
}
|
||||
}
|
||||
private void ReadCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
int nBytesReaded = m_oReadStream.EndRead(ar);
|
||||
if (nBytesReaded > 0)
|
||||
{
|
||||
m_oOutput.Write(m_aBuffer, 0, nBytesReaded);
|
||||
m_oReadStream.BeginRead(m_aBuffer, 0, m_aBuffer.Length, ReadCallback, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
FireCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Upload;
|
||||
ClearAndCallback();
|
||||
}
|
||||
}
|
||||
public void DownloadEnd(IAsyncResult ar, out ErrorTypes eError, out byte[] aBuffer)
|
||||
{
|
||||
eError = m_eError;
|
||||
aBuffer = null;
|
||||
try
|
||||
{
|
||||
if (ErrorTypes.NoError == m_eError)
|
||||
aBuffer = m_oOutput.ToArray();
|
||||
Clear();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.Upload;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,546 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Net;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Data;
|
||||
using ASC.Common.Data.Sql;
|
||||
using ASC.Common.Data.Sql.Expressions;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
public class Constants
|
||||
{
|
||||
public const string mc_sDateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
public static System.Globalization.CultureInfo mc_oCultureInfo = new System.Globalization.CultureInfo(0x409);
|
||||
public const string mc_sResourceServiceUrlRel = "/ResourceService.ashx?path=";
|
||||
|
||||
public const string mc_sWebClientUserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
|
||||
}
|
||||
public class Utils
|
||||
{
|
||||
private class TxtCsvPropertiesEncoding
|
||||
{
|
||||
public int codepage;
|
||||
public string name;
|
||||
public TxtCsvPropertiesEncoding(int _codepage, string _name)
|
||||
{
|
||||
codepage = _codepage;
|
||||
name = _name;
|
||||
}
|
||||
}
|
||||
private class TxtCsvProperties
|
||||
{
|
||||
public int? codepage;
|
||||
public int? delimiter;
|
||||
public List<TxtCsvPropertiesEncoding> encodings = new List<TxtCsvPropertiesEncoding>();
|
||||
}
|
||||
private static readonly System.Collections.Generic.Dictionary<string, string> _mappings = new System.Collections.Generic.Dictionary<string, string>()
|
||||
{
|
||||
{".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
|
||||
{".doc", "application/msword"},
|
||||
{".odt", "application/vnd.oasis.opendocument.text"},
|
||||
{".rtf", "application/rtf"},
|
||||
{".txt", "text/plain"},
|
||||
{".html", "text/html"},
|
||||
{".mht", "message/rfc822"},
|
||||
{".epub", "application/zip"},
|
||||
{".fb2", "text/xml"},
|
||||
{".mobi", "application/x-mobipocket-ebook"},
|
||||
{".prc", "application/x-mobipocket-ebook"},
|
||||
{".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
|
||||
{".ppt", "application/vnd.ms-powerpoint"},
|
||||
{".odp", "application/vnd.oasis.opendocument.presentation"},
|
||||
{".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
|
||||
{".xls", "application/vnd.ms-excel"},
|
||||
{".ods", "application/vnd.oasis.opendocument.spreadsheet"},
|
||||
{".csv", "text/csv"},
|
||||
{".pdf", "application/pdf"},
|
||||
{".swf", "application/x-shockwave-flash"},
|
||||
{".djvu", "image/vnd.djvu"},
|
||||
{".xps", "application/vnd.ms-xpsdocument"},
|
||||
{".svg", "image/svg+xml"},
|
||||
{ ".jpg", "image/jpeg" },
|
||||
{ ".jpeg", "image/jpeg" },
|
||||
{ ".jpe", "image/jpeg" },
|
||||
{ ".png", "image/png" },
|
||||
{ ".gif", "image/gif" },
|
||||
{ ".bmp", "image/bmp" },
|
||||
{ ".json", "application/json" },
|
||||
{ ".ttc", "application/octet-stream" },
|
||||
{ ".otf", "application/octet-stream" }
|
||||
};
|
||||
public delegate string getMD5HexStringDelegate(Stream stream);
|
||||
public static string getMD5HexString(Stream stream)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
using (System.Security.Cryptography.MD5 oMD5 = System.Security.Cryptography.MD5.Create())
|
||||
{
|
||||
byte[] aHash = oMD5.ComputeHash(stream);
|
||||
for (int i = 0, length = aHash.Length; i < length; ++i)
|
||||
sb.Append(aHash[i].ToString("X2"));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
public static string GetSerializedEncodingProperty(int? codepage, int? delimiter)
|
||||
{
|
||||
TxtCsvProperties oCsvProperties = new TxtCsvProperties();
|
||||
oCsvProperties.codepage = codepage;
|
||||
oCsvProperties.delimiter = delimiter;
|
||||
System.Text.EncodingInfo[] aSystemEncodings = System.Text.Encoding.GetEncodings();
|
||||
for (int i = 0; i < aSystemEncodings.Length; i++)
|
||||
{
|
||||
System.Text.EncodingInfo oEncodingInfo = aSystemEncodings[i];
|
||||
oCsvProperties.encodings.Add(new TxtCsvPropertiesEncoding(oEncodingInfo.CodePage, oEncodingInfo.DisplayName));
|
||||
}
|
||||
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
||||
return serializer.Serialize(oCsvProperties);
|
||||
}
|
||||
|
||||
public static string GetIP4Address(string strUserHostAddress)
|
||||
{
|
||||
string IP4Address = String.Empty;
|
||||
|
||||
foreach (IPAddress IPA in Dns.GetHostAddresses(strUserHostAddress))
|
||||
{
|
||||
if (IPA.AddressFamily.ToString() == "InterNetwork")
|
||||
{
|
||||
IP4Address = IPA.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (IP4Address != String.Empty)
|
||||
{
|
||||
return IP4Address;
|
||||
}
|
||||
|
||||
foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName()))
|
||||
{
|
||||
if (IPA.AddressFamily.ToString() == "InterNetwork")
|
||||
{
|
||||
IP4Address = IPA.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return IP4Address;
|
||||
}
|
||||
public static string MySqlEscape(string strString, string strConnectionString)
|
||||
{
|
||||
string strConnectionProviderName = GetDbConnectionProviderName(strConnectionString);
|
||||
if (strConnectionProviderName == "System.Data.SQLite")
|
||||
return strString;
|
||||
if (strString == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return System.Text.RegularExpressions.Regex.Replace(strString, @"[\r\n\x00\x1a\\'""]", @"\$0");
|
||||
}
|
||||
private static string GetDbConnectionProviderName(string strConnectionString)
|
||||
{
|
||||
ConnectionStringSettings oConnectionSettings = ConfigurationManager.ConnectionStrings[strConnectionString];
|
||||
return oConnectionSettings.ProviderName;
|
||||
}
|
||||
public static int mapAscServerErrorToOldError(ErrorTypes eError)
|
||||
{
|
||||
int nRes = -1;
|
||||
switch(eError)
|
||||
{
|
||||
case ErrorTypes.NoError : nRes = 0;break;
|
||||
case ErrorTypes.TaskQueue :
|
||||
case ErrorTypes.TaskResult : nRes = -6;break;
|
||||
case ErrorTypes.ConvertDownload : nRes = -4;break;
|
||||
case ErrorTypes.ConvertTimeout : nRes = -2;break;
|
||||
case ErrorTypes.ConvertMS_OFFCRYPTO:
|
||||
case ErrorTypes.ConvertUnknownFormat :
|
||||
case ErrorTypes.ConvertReadFile :
|
||||
case ErrorTypes.Convert : nRes = -3;break;
|
||||
case ErrorTypes.UploadContentLength : nRes = -9;break;
|
||||
case ErrorTypes.UploadExtension : nRes = -10;break;
|
||||
case ErrorTypes.UploadCountFiles : nRes = -11;break;
|
||||
case ErrorTypes.VKey : nRes = -8;break;
|
||||
case ErrorTypes.VKeyEncrypt : nRes = -20;break;
|
||||
case ErrorTypes.VKeyKeyExpire : nRes = -21;break;
|
||||
case ErrorTypes.VKeyUserCountExceed : nRes = -22;break;
|
||||
case ErrorTypes.Storage :
|
||||
case ErrorTypes.StorageFileNoFound :
|
||||
case ErrorTypes.StorageRead :
|
||||
case ErrorTypes.StorageWrite :
|
||||
case ErrorTypes.StorageRemoveDir :
|
||||
case ErrorTypes.StorageCreateDir :
|
||||
case ErrorTypes.StorageGetInfo :
|
||||
case ErrorTypes.Upload :
|
||||
case ErrorTypes.ReadRequestStream :
|
||||
case ErrorTypes.Unknown : nRes = -1;break;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
public static int GetFileFormat(byte[] aBuffer)
|
||||
{
|
||||
|
||||
int nLength = aBuffer.Length;
|
||||
|
||||
if ((3 <= nLength) && (0xFF == aBuffer[0]) && (0xD8 == aBuffer[1]) && (0xFF == aBuffer[2]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_JPG;
|
||||
|
||||
if ((34 <= nLength) && (0x42 == aBuffer[0]) && (0x4D == aBuffer[1]) &&
|
||||
(0x00 == aBuffer[6]) && (0x00 == aBuffer[7]) && (0x01 == aBuffer[26]) && (0x00 == aBuffer[27]) &&
|
||||
((0x00 == aBuffer[28]) || (0x01 == aBuffer[28]) || (0x04 == aBuffer[28]) || (0x08 == aBuffer[28]) ||
|
||||
(0x10 == aBuffer[28]) || (0x18 == aBuffer[28]) || (0x20 == aBuffer[28])) && (0x00 == aBuffer[29]) &&
|
||||
((0x00 == aBuffer[30]) || (0x01 == aBuffer[30]) || (0x02 == aBuffer[30]) || (0x03 == aBuffer[30]) ||
|
||||
(0x04 == aBuffer[30]) || (0x05 == aBuffer[30])) && (0x00 == aBuffer[31]) && (0x00 == aBuffer[32]) && (0x00 == aBuffer[33]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_BMP;
|
||||
|
||||
if ((4 <= nLength) && "GIF8" == System.Text.Encoding.ASCII.GetString(aBuffer, 0, "GIF8".Length))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_GIF;
|
||||
if ((6 <= nLength) && ("GIF87a" == System.Text.Encoding.ASCII.GetString(aBuffer, 0, "GIF87a".Length) || "GIF89a" == System.Text.Encoding.ASCII.GetString(aBuffer, 0, "GIF89a".Length)))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_GIF;
|
||||
|
||||
if ((16 <= nLength) && (0x89 == aBuffer[0]) && (0x50 == aBuffer[1]) && (0x4E == aBuffer[2]) && (0x47 == aBuffer[3])
|
||||
&& (0x0D == aBuffer[4]) && (0x0A == aBuffer[5]) && (0x1A == aBuffer[6]) && (0x0A == aBuffer[7])
|
||||
&& (0x00 == aBuffer[8]) && (0x00 == aBuffer[9]) && (0x00 == aBuffer[10]) && (0x0D == aBuffer[11])
|
||||
&& (0x49 == aBuffer[12]) && (0x48 == aBuffer[13]) && (0x44 == aBuffer[14]) && (0x52 == aBuffer[15]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_PNG;
|
||||
|
||||
if ((10 <= nLength) && (0x49 == aBuffer[0]) && (0x49 == aBuffer[1]) && (0x2A == aBuffer[2])
|
||||
&& (0x00 == aBuffer[3]) && (0x10 == aBuffer[4]) && (0x00 == aBuffer[5]) && (0x00 == aBuffer[6])
|
||||
&& (0x00 == aBuffer[7]) && (0x43 == aBuffer[8]) && (0x52 == aBuffer[9]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_CR2;
|
||||
|
||||
if (4 <= nLength)
|
||||
{
|
||||
if (((0x49 == aBuffer[0]) && (0x49 == aBuffer[1]) && (0x2A == aBuffer[2]) && (0x00 == aBuffer[3])) ||
|
||||
((0x4D == aBuffer[0]) && (0x4D == aBuffer[1]) && (0x00 == aBuffer[2]) && (0x2A == aBuffer[3])) ||
|
||||
((0x49 == aBuffer[0]) && (0x49 == aBuffer[1]) && (0x2A == aBuffer[2]) && (0x00 == aBuffer[3])))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_TIFF;
|
||||
}
|
||||
|
||||
if (6 <= nLength)
|
||||
{
|
||||
if (((0xD7 == aBuffer[0]) && (0xCD == aBuffer[1]) && (0xC6 == aBuffer[2]) && (0x9A == aBuffer[3]) && (0x00 == aBuffer[4]) && (0x00 == aBuffer[5])) ||
|
||||
((0x01 == aBuffer[0]) && (0x00 == aBuffer[1]) && (0x09 == aBuffer[2]) && (0x00 == aBuffer[3]) && (0x00 == aBuffer[4]) && (0x03 == aBuffer[5])))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_WMF;
|
||||
}
|
||||
|
||||
if ((44 <= nLength) && (0x01 == aBuffer[0]) && (0x00 == aBuffer[1]) && (0x00 == aBuffer[2]) && (0x00 == aBuffer[3]) &&
|
||||
(0x20 == aBuffer[40]) && (0x45 == aBuffer[41]) && (0x4D == aBuffer[42]) && (0x46 == aBuffer[43]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_EMF;
|
||||
|
||||
if ((4 <= nLength) && (0x0A == aBuffer[0]) && (0x00 == aBuffer[1] || 0x01 == aBuffer[1] ||
|
||||
0x02 == aBuffer[1] || 0x03 == aBuffer[1] || 0x04 == aBuffer[1] || 0x05 == aBuffer[1]) &&
|
||||
(0x01 == aBuffer[3] || 0x02 == aBuffer[3] || 0x04 == aBuffer[3] || 0x08 == aBuffer[3]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_PCX;
|
||||
|
||||
if ((17 <= nLength) && ((0x01 == aBuffer[1] && 0x01 == aBuffer[2]) || (0x00 == aBuffer[1] && 0x02 == aBuffer[2]) ||
|
||||
(0x00 == aBuffer[1] && 0x03 == aBuffer[2]) || (0x01 == aBuffer[1] && 0x09 == aBuffer[2]) ||
|
||||
(0x00 == aBuffer[1] && 0x0A == aBuffer[2]) || (0x00 == aBuffer[1] && 0x0B == aBuffer[2]))
|
||||
&& (0x08 == aBuffer[16] || 0x10 == aBuffer[16] || 0x18 == aBuffer[16] || 0x20 == aBuffer[16]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_TGA;
|
||||
|
||||
if ((4 <= nLength) && (0x59 == aBuffer[0]) && (0xA6 == aBuffer[1]) && (0x6A == aBuffer[2]) && (0x95 == aBuffer[3]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_RAS;
|
||||
|
||||
if ((13 <= nLength) && (0x38 == aBuffer[0]) && (0x42 == aBuffer[1]) && (0x50 == aBuffer[2])
|
||||
&& (0x53 == aBuffer[3]) && (0x00 == aBuffer[4]) && (0x01 == aBuffer[5]) && (0x00 == aBuffer[6])
|
||||
&& (0x00 == aBuffer[7]) && (0x00 == aBuffer[8]) && (0x00 == aBuffer[9]) && (0x00 == aBuffer[10])
|
||||
&& (0x00 == aBuffer[11]) && (0x00 == aBuffer[12]))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_PSD;
|
||||
|
||||
if ((4 <= nLength) && "<svg" == System.Text.Encoding.ASCII.GetString(aBuffer, 0, "<svg".Length))
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG;
|
||||
|
||||
return FileFormats.AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
||||
}
|
||||
public static string GetMimeType(string sPath)
|
||||
{
|
||||
string sExt = Path.GetExtension(sPath).ToLower();
|
||||
string mime;
|
||||
return _mappings.TryGetValue(sExt, out mime) ? mime : "application/octet-stream";
|
||||
}
|
||||
}
|
||||
public class FileFormats
|
||||
{
|
||||
public static int FromString(string sFormat)
|
||||
{
|
||||
switch (sFormat.ToLower())
|
||||
{
|
||||
case "docx": return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
|
||||
case "doc": return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC;
|
||||
case "odt": return AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT;
|
||||
case "rtf": return AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF;
|
||||
case "txt": return AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT;
|
||||
case "html": return AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
|
||||
case "mht": return AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
|
||||
case "epub": return AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB;
|
||||
case "fb2": return AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2;
|
||||
case "mobi": return AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI;
|
||||
|
||||
case "pptx": return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
|
||||
case "ppt": return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT;
|
||||
case "odp": return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP;
|
||||
|
||||
case "xlsx": return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
|
||||
case "xls": return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
|
||||
case "ods": return AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS;
|
||||
case "csv": return AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
|
||||
case "jpeg":
|
||||
case "jpe":
|
||||
case "jpg": return AVS_OFFICESTUDIO_FILE_IMAGE_JPG;
|
||||
case "tif":
|
||||
case "tiff": return AVS_OFFICESTUDIO_FILE_IMAGE_TIFF;
|
||||
case "tga": return AVS_OFFICESTUDIO_FILE_IMAGE_TGA;
|
||||
case "gif": return AVS_OFFICESTUDIO_FILE_IMAGE_GIF;
|
||||
case "png": return AVS_OFFICESTUDIO_FILE_IMAGE_PNG;
|
||||
case "emf": return AVS_OFFICESTUDIO_FILE_IMAGE_EMF;
|
||||
case "wmf": return AVS_OFFICESTUDIO_FILE_IMAGE_WMF;
|
||||
case "bmp": return AVS_OFFICESTUDIO_FILE_IMAGE_BMP;
|
||||
case "cr2": return AVS_OFFICESTUDIO_FILE_IMAGE_CR2;
|
||||
case "pcx": return AVS_OFFICESTUDIO_FILE_IMAGE_PCX;
|
||||
case "ras": return AVS_OFFICESTUDIO_FILE_IMAGE_RAS ;
|
||||
case "psd": return AVS_OFFICESTUDIO_FILE_IMAGE_PSD;
|
||||
|
||||
case "pdf": return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
|
||||
case "swf": return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SWF;
|
||||
case "djvu": return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU;
|
||||
case "xps": return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS;
|
||||
case "svg": return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG;
|
||||
case "htmlr": return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR;
|
||||
case "doct": return AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY;
|
||||
case "xlst": return AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY;
|
||||
case "pptt": return AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY;
|
||||
default: return AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
public static string ToString(int nFormat)
|
||||
{
|
||||
switch (nFormat)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: return "docx";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: return "doc";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT: return "odt";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: return "rtf";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT: return "txt";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML: return "html";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT: return "mht";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB: return "epub";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2: return "fb2";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI: return "mobi";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: return "pptx";
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: return "ppt";
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP: return "odp";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: return "xlsx";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: return "xls";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS: return "ods";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: return "csv";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF: return "pdf";
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SWF: return "swf";
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU: return "djvu";
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS: return "xps";
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG: return "svg";
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR: return "htmlr";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP: return "zip";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE: return "jpg";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_JPG: return "jpg";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_TIFF: return "tiff";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_TGA: return "tga";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_GIF: return "gif";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_PNG: return "png";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_EMF: return "emf";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_WMF: return "wmf";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_BMP: return "bmp";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_CR2: return "cr2";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_PCX: return "pcx";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_RAS: return "ras";
|
||||
case AVS_OFFICESTUDIO_FILE_IMAGE_PSD: return "psd";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_WORD:
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET:
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION: return "bin";
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT:
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY: return "doct";
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY: return "xlst";
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION:
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING:
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY: return "pptt";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
public const int AVS_OFFICESTUDIO_FILE_UNKNOWN = 0x0000;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT = 0x0040;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0003;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0004;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0005;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0006;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0007;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0008;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0009;
|
||||
public const int AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI = AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000a;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_PRESENTATION = 0x0080;
|
||||
public const int AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX = AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT = AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP = AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0003;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_SPREADSHEET = 0x0100;
|
||||
public const int AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX = AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS = AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS = AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0003;
|
||||
public const int AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV = AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0004;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM = 0x0200;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SWF = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0003;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0004;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0005;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0006;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRMenu = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0007;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRCanvas = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0008;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE = 0x0400;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_JPG = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_TIFF = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_TGA = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0003;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_GIF = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0004;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_PNG = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0005;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_EMF = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0006;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_WMF = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0007;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_BMP = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0008;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_CR2 = AVS_OFFICESTUDIO_FILE_IMAGE + 0x0009;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_PCX = AVS_OFFICESTUDIO_FILE_IMAGE + 0x000a;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_RAS = AVS_OFFICESTUDIO_FILE_IMAGE + 0x000b;
|
||||
public const int AVS_OFFICESTUDIO_FILE_IMAGE_PSD = AVS_OFFICESTUDIO_FILE_IMAGE + 0x000c;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER = 0x0800;
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER_EXTRACT_IMAGE = AVS_OFFICESTUDIO_FILE_OTHER + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO = AVS_OFFICESTUDIO_FILE_OTHER + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP = AVS_OFFICESTUDIO_FILE_OTHER + 0x0003;
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT = AVS_OFFICESTUDIO_FILE_OTHER + 0x0004;
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION = AVS_OFFICESTUDIO_FILE_OTHER + 0x0005;
|
||||
public const int AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING = AVS_OFFICESTUDIO_FILE_OTHER + 0x0006;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_TEAMLAB = 0x1000;
|
||||
public const int AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY = AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY = AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY = AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0003;
|
||||
|
||||
public const int AVS_OFFICESTUDIO_FILE_CANVAS = 0x2000;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CANVAS_WORD = AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET = AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002;
|
||||
public const int AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION = AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003;
|
||||
}
|
||||
public enum FileStatus : byte
|
||||
{
|
||||
None = 0,
|
||||
Ok = 1,
|
||||
WaitQueue = 2,
|
||||
NeedParams = 3,
|
||||
Convert = 4,
|
||||
Err = 5,
|
||||
ErrToReload = 6
|
||||
};
|
||||
public enum ErrorTypes : int
|
||||
{
|
||||
NoError = 0,
|
||||
Unknown = -1,
|
||||
ReadRequestStream = -3,
|
||||
TaskQueue = -20,
|
||||
TaskResult = -40,
|
||||
Storage = -60,
|
||||
StorageFileNoFound = -61,
|
||||
StorageRead = -62,
|
||||
StorageWrite = -63,
|
||||
StorageRemoveDir = -64,
|
||||
StorageCreateDir = -65,
|
||||
StorageGetInfo = -66,
|
||||
Convert = -80,
|
||||
ConvertDownload = -81,
|
||||
ConvertUnknownFormat = -82,
|
||||
ConvertTimeout = -83,
|
||||
ConvertReadFile = -84,
|
||||
ConvertMS_OFFCRYPTO = -85,
|
||||
Upload = -100,
|
||||
UploadContentLength = -101,
|
||||
UploadExtension = -102,
|
||||
UploadCountFiles = -103,
|
||||
VKey = -120,
|
||||
VKeyEncrypt = -121,
|
||||
VKeyKeyExpire = -122,
|
||||
VKeyUserCountExceed = -123,
|
||||
VKeyTimeExpire = -124,
|
||||
VKeyTimeIncorrect = -125,
|
||||
LicenseError = -140,
|
||||
LicenseErrorType = -141,
|
||||
LicenseErrorArgument = -142,
|
||||
LicenseErrorPermission = -143,
|
||||
LicenseErrorActiveConnectionQuotaExceed = -144,
|
||||
LicenseErrorInvalidDate = -145,
|
||||
LicenseErrorFile = -146
|
||||
};
|
||||
|
||||
public enum CsvDelimiter : int
|
||||
{
|
||||
None = 0,
|
||||
Tab = 1,
|
||||
Semicolon = 2,
|
||||
Сolon = 3,
|
||||
Comma = 4,
|
||||
Space = 5
|
||||
}
|
||||
public enum Priority : int
|
||||
{
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 2
|
||||
};
|
||||
public enum PostMessageType : int
|
||||
{
|
||||
UploadImage = 0
|
||||
};
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{665D791F-4A42-4EB0-A766-300783379D40}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FileConverterUtils2</RootNamespace>
|
||||
<AssemblyName>FileConverterUtils2</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASC.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\ASC.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASC.Core.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\ASC.Core.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AWSSDK, Version=1.5.2.2, Culture=neutral, PublicKeyToken=cd2d24cd2bace800, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\AWSSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Enyim.Caching, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\Enyim.Caching.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AsyncOperation.cs" />
|
||||
<Compile Include="FileConverterUtils2.cs" />
|
||||
<Compile Include="LicenseInfo.cs" />
|
||||
<Compile Include="LicenseMerger.cs" />
|
||||
<Compile Include="LicenseReader.cs" />
|
||||
<Compile Include="LicenseUtils.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="QueueData.cs" />
|
||||
<Compile Include="Storage.cs" />
|
||||
<Compile Include="TaskQueue.cs" />
|
||||
<Compile Include="TaskResult.cs" />
|
||||
<Compile Include="TaskResultCachedDB.cs" />
|
||||
<Compile Include="TaskResultDB.cs" />
|
||||
<Compile Include="TrackingInfo.cs" />
|
||||
<Compile Include="VariousUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy $(TargetPath) $(ProjectDir)..\..\..\wwwroot\Bin\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,242 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
|
||||
public abstract class LicenseInfo
|
||||
{
|
||||
protected DateTime m_dtBuildTime;
|
||||
|
||||
public enum EditorType : int
|
||||
{
|
||||
Word = 0,
|
||||
Spreadsheet = 1,
|
||||
Presentation = 2,
|
||||
Convertation = 3
|
||||
}
|
||||
|
||||
public enum LicenseType : int
|
||||
{
|
||||
NoValidation = 0,
|
||||
ByVKey = 1,
|
||||
ByUserCount = 2,
|
||||
ByActiveConnections = 3,
|
||||
ByTimeUsage = 4,
|
||||
ByDocumentSessions = 5,
|
||||
OpenSource = 6,
|
||||
ByUserCount2 = 7,
|
||||
|
||||
};
|
||||
public class LicenseRights
|
||||
{
|
||||
private bool _bCanOpen;
|
||||
private bool _bCanSave;
|
||||
private bool _bCanCoAuthoring;
|
||||
private bool _bCanExport;
|
||||
private bool _bCanPrint;
|
||||
private bool _bCanBranding;
|
||||
|
||||
public bool CanOpen
|
||||
{
|
||||
get { return _bCanOpen; }
|
||||
set { _bCanOpen = value; }
|
||||
}
|
||||
public bool CanSave
|
||||
{
|
||||
get { return _bCanSave; }
|
||||
set { _bCanSave = value; }
|
||||
}
|
||||
public bool CanCoAuthoring
|
||||
{
|
||||
get { return _bCanCoAuthoring; }
|
||||
set { _bCanCoAuthoring = value; }
|
||||
}
|
||||
public bool CanExport
|
||||
{
|
||||
get { return _bCanExport; }
|
||||
set { _bCanExport = value; }
|
||||
}
|
||||
public bool CanPrint
|
||||
{
|
||||
get { return _bCanPrint; }
|
||||
set { _bCanPrint = value; }
|
||||
}
|
||||
public bool CanBranding
|
||||
{
|
||||
get { return _bCanBranding; }
|
||||
set { _bCanBranding = value; }
|
||||
}
|
||||
public LicenseRights()
|
||||
{
|
||||
_bCanOpen = true;
|
||||
_bCanSave = false;
|
||||
_bCanCoAuthoring = false;
|
||||
_bCanExport = false;
|
||||
_bCanPrint = true;
|
||||
_bCanBranding = false;
|
||||
}
|
||||
public LicenseRights(bool bIsAllEnabled)
|
||||
: this()
|
||||
{
|
||||
if (bIsAllEnabled)
|
||||
{
|
||||
_bCanOpen = true;
|
||||
_bCanSave = true;
|
||||
_bCanCoAuthoring = true;
|
||||
_bCanExport = true;
|
||||
_bCanPrint = true;
|
||||
_bCanBranding = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
public class LicenseMetaData
|
||||
{
|
||||
private string _strVKey;
|
||||
private string _strDocId;
|
||||
private string _strUserId;
|
||||
private bool _bCheckIP;
|
||||
private string _strCurrentIP;
|
||||
private int _nEditorId;
|
||||
|
||||
public string VKey
|
||||
{
|
||||
get { return _strVKey; }
|
||||
set { _strVKey = value; }
|
||||
}
|
||||
public string DocId
|
||||
{
|
||||
get { return _strDocId; }
|
||||
set { _strDocId = value; }
|
||||
}
|
||||
public string UserId
|
||||
{
|
||||
get { return _strUserId; }
|
||||
set { _strUserId = value; }
|
||||
}
|
||||
public bool IsCheckIP
|
||||
{
|
||||
get { return _bCheckIP; }
|
||||
set { _bCheckIP = value; }
|
||||
}
|
||||
public string CurrentIP
|
||||
{
|
||||
get { return _strCurrentIP; }
|
||||
set { _strCurrentIP = value; }
|
||||
}
|
||||
public int EditorId
|
||||
{
|
||||
get { return _nEditorId; }
|
||||
set { _nEditorId = value; }
|
||||
}
|
||||
|
||||
public LicenseMetaData(string vkey, string docId, string userId, int editorId)
|
||||
{
|
||||
_strVKey = vkey;
|
||||
|
||||
_strDocId = docId;
|
||||
if (null == _strDocId || _strDocId == "")
|
||||
_strDocId = "doc";
|
||||
|
||||
_strUserId = userId;
|
||||
if (null == _strUserId || _strUserId == "")
|
||||
_strUserId = "usr";
|
||||
|
||||
_nEditorId = editorId;
|
||||
}
|
||||
};
|
||||
public class LicenseCustomerInfo
|
||||
{
|
||||
public string customer;
|
||||
public string customer_addr;
|
||||
public string customer_www;
|
||||
public string customer_mail;
|
||||
public string customer_info;
|
||||
public string customer_logo;
|
||||
}
|
||||
|
||||
protected LicenseInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public static LicenseInfo CreateLicenseInfo(DateTime buildTime)
|
||||
{
|
||||
|
||||
return new OpenSourceLicenseInfo();
|
||||
|
||||
}
|
||||
|
||||
public abstract LicenseCustomerInfo getCustomerInfo();
|
||||
|
||||
public abstract LicenseRights getRights(LicenseMetaData metaData, out ErrorTypes errorCode);
|
||||
|
||||
public static bool isPaid(string vkey)
|
||||
{
|
||||
bool bPaid;
|
||||
Signature.getVKeyParams(vkey, out bPaid);
|
||||
return bPaid;
|
||||
}
|
||||
protected DateTime getBuildTime()
|
||||
{
|
||||
return m_dtBuildTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class OpenSourceLicenseInfo : LicenseInfo
|
||||
{
|
||||
public override LicenseRights getRights(LicenseMetaData metaData, out ErrorTypes errorCode)
|
||||
{
|
||||
LicenseRights oRights = new LicenseRights(true);
|
||||
errorCode = ErrorTypes.NoError;
|
||||
return oRights;
|
||||
}
|
||||
public override LicenseCustomerInfo getCustomerInfo()
|
||||
{
|
||||
LicenseCustomerInfo info = new LicenseCustomerInfo();
|
||||
info.customer = "Licensed under GNU Affero General Public License v3.0";
|
||||
info.customer_addr = null;
|
||||
info.customer_www = "http://www.gnu.org/licenses/agpl-3.0.html";
|
||||
info.customer_mail = null;
|
||||
info.customer_info = null;
|
||||
info.customer_logo = null;
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Xml;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
|
||||
public class LicenseUtils
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("FileConverterUtils2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("FileConverterUtils2")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA Copyright (c) 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("9a6d8058-b3ef-4586-8492-0136f44cedd5")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.45")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.45")]
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
public abstract class IQueueData
|
||||
{
|
||||
public abstract string SerializeToXml();
|
||||
public abstract byte[] SerializeToBinary();
|
||||
public abstract void DeserializeFromBinary(byte[] aBuffer);
|
||||
public abstract void DeserializeFromXml(string sXml);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,891 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Configuration;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Data;
|
||||
using log4net;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
[Serializable()]
|
||||
public class TaskQueueData
|
||||
{
|
||||
public string m_sKey;
|
||||
public int m_nToFormat;
|
||||
public string m_sToFile;
|
||||
|
||||
public string m_sFromFormat = "";
|
||||
public string m_sFromUrl;
|
||||
public string m_sFromKey;
|
||||
|
||||
public object m_oDataKey;
|
||||
|
||||
public string m_sToUrl;
|
||||
public int? m_nCsvTxtEncoding;
|
||||
public int? m_nCsvDelimiter;
|
||||
public bool? m_bFromOrigin;
|
||||
public bool? m_bFromChanges;
|
||||
public bool? m_bPaid;
|
||||
public bool? m_bEmbeddedFonts;
|
||||
public TaskQueueData()
|
||||
{
|
||||
}
|
||||
public TaskQueueData(string sKey, int nToFormat, string sToFile)
|
||||
{
|
||||
m_sKey = sKey;
|
||||
m_nToFormat = nToFormat;
|
||||
m_sToFile = sToFile;
|
||||
}
|
||||
public static string SerializeToXml(TaskQueueData oData)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
XmlWriterSettings ws = new XmlWriterSettings();
|
||||
ws.NewLineHandling = NewLineHandling.None;
|
||||
ws.Indent = false;
|
||||
XmlWriter xw = System.Xml.XmlWriter.Create(sb, ws);
|
||||
System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(TaskQueueData));
|
||||
formatter.Serialize(xw, oData);
|
||||
return sb.ToString();
|
||||
}
|
||||
public static TaskQueueData DeserializeFromXml(string sXml)
|
||||
{
|
||||
System.IO.StringReader sr = new System.IO.StringReader(sXml);
|
||||
System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(TaskQueueData));
|
||||
return formatter.Deserialize(sr) as TaskQueueData;
|
||||
}
|
||||
}
|
||||
[Serializable()]
|
||||
public class TaskQueueDataConvert
|
||||
{
|
||||
public string m_sKey;
|
||||
public string m_sFileFrom;
|
||||
public string m_sFileTo;
|
||||
public int m_nFormatFrom;
|
||||
public int m_nFormatTo;
|
||||
|
||||
public int? m_nCsvTxtEncoding;
|
||||
public int? m_nCsvDelimiter;
|
||||
public bool? m_bPaid;
|
||||
public bool? m_bEmbeddedFonts;
|
||||
public bool? m_bFromChanges;
|
||||
|
||||
public TaskQueueDataConvert()
|
||||
{
|
||||
}
|
||||
public TaskQueueDataConvert(string sKey, string sFileFrom, int nFormatFrom, string sFileTo, int nFormatTo)
|
||||
{
|
||||
m_sKey = sKey;
|
||||
m_sFileFrom = sFileFrom;
|
||||
m_nFormatFrom = nFormatFrom;
|
||||
m_sFileTo = sFileTo;
|
||||
m_nFormatTo = nFormatTo;
|
||||
}
|
||||
public static string SerializeToXml(TaskQueueDataConvert oData)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
XmlWriterSettings ws = new XmlWriterSettings();
|
||||
ws.NewLineHandling = NewLineHandling.None;
|
||||
ws.Indent = false;
|
||||
XmlWriter xw = System.Xml.XmlWriter.Create(sb, ws);
|
||||
System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(TaskQueueDataConvert));
|
||||
formatter.Serialize(xw, oData);
|
||||
return sb.ToString();
|
||||
}
|
||||
public static TaskQueueDataConvert DeserializeFromXml(string sXml)
|
||||
{
|
||||
System.IO.StringReader sr = new System.IO.StringReader(sXml);
|
||||
System.Xml.Serialization.XmlSerializer formatter = new System.Xml.Serialization.XmlSerializer(typeof(TaskQueueDataConvert));
|
||||
return formatter.Deserialize(sr) as TaskQueueDataConvert;
|
||||
}
|
||||
}
|
||||
public interface ITaskQueue
|
||||
{
|
||||
ErrorTypes AddTask(TaskQueueData oTask, Priority oPriority);
|
||||
void AddTaskBegin(TaskQueueData oTask, Priority oPriority, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes AddTaskEnd(IAsyncResult ar);
|
||||
|
||||
TaskQueueData GetTask();
|
||||
void GetTaskBegin(AsyncCallback fCallback, object oParam);
|
||||
TaskQueueData GetTaskEnd(IAsyncResult ar);
|
||||
|
||||
ErrorTypes RemoveTask(object key);
|
||||
void RemoveTaskBegin(object key, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes RemoveTaskEnd(IAsyncResult ar);
|
||||
}
|
||||
public class CTaskQueue : ITaskQueue
|
||||
{
|
||||
private ITaskQueue m_oTaskQueue;
|
||||
public CTaskQueue()
|
||||
{
|
||||
switch (ConfigurationManager.AppSettings["utils.taskqueue.impl"])
|
||||
{
|
||||
case "sqs":
|
||||
m_oTaskQueue = new CTaskQueueAmazonSQS();
|
||||
break;
|
||||
|
||||
case "db":
|
||||
default:
|
||||
m_oTaskQueue = new CTaskQueueDataBase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public ErrorTypes AddTask(TaskQueueData oTask, Priority oPriority)
|
||||
{
|
||||
return m_oTaskQueue.AddTask(oTask, oPriority);
|
||||
}
|
||||
public void AddTaskBegin(TaskQueueData oTask, Priority oPriority, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oTaskQueue.AddTaskBegin(oTask, oPriority, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
return m_oTaskQueue.AddTaskEnd(ar);
|
||||
}
|
||||
|
||||
public TaskQueueData GetTask()
|
||||
{
|
||||
return m_oTaskQueue.GetTask();
|
||||
}
|
||||
public void GetTaskBegin(AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oTaskQueue.GetTaskBegin(fCallback, oParam);
|
||||
}
|
||||
public TaskQueueData GetTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
return m_oTaskQueue.GetTaskEnd(ar);
|
||||
}
|
||||
|
||||
public ErrorTypes RemoveTask(object key)
|
||||
{
|
||||
return m_oTaskQueue.RemoveTask(key);
|
||||
}
|
||||
public void RemoveTaskBegin(object key, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oTaskQueue.RemoveTaskBegin(key, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes RemoveTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
return m_oTaskQueue.RemoveTaskEnd(ar);
|
||||
}
|
||||
}
|
||||
|
||||
class CTaskQueueDataBase : ITaskQueue
|
||||
{
|
||||
private string m_sConnectionString = ConfigurationManager.AppSettings["utils.taskqueue.db.connectionstring"];
|
||||
private const string m_cstrTableName = "convert_queue";
|
||||
private const string m_cstrMaxConvertTime = "maxconverttime";
|
||||
private const string m_cstrMaxConvertTimeIddle = "maxconverttimeiddle";
|
||||
private double m_dMaxConvertTimeInSeconds = 0;
|
||||
|
||||
private delegate IDataReader ExecuteReader();
|
||||
private delegate int ExecuteNonQuery();
|
||||
|
||||
private enum BusyType : int
|
||||
{
|
||||
not_busy = 0,
|
||||
busy = 1
|
||||
}
|
||||
private delegate ErrorTypes DelegateRemoveTask(object key);
|
||||
private delegate ErrorTypes DelegateAddTask(TaskQueueData oTask, Priority oPriority);
|
||||
private class TransportClass : TransportClassAsyncOperation
|
||||
{
|
||||
public ExecuteReader m_delegateReader = null;
|
||||
public ExecuteNonQuery m_delegateNonQuery = null;
|
||||
public IDbConnection m_oSqlCon = null;
|
||||
public IDbCommand m_oCommand = null;
|
||||
public TaskQueueData m_oTaskQueueData = null;
|
||||
public ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
public TransportClass(AsyncCallback fCallback, object oParam)
|
||||
: base(fCallback, oParam)
|
||||
{
|
||||
}
|
||||
public override void Close()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null != m_oCommand)
|
||||
{
|
||||
m_oCommand.Dispose();
|
||||
m_oCommand = null;
|
||||
}
|
||||
if (null != m_oSqlCon)
|
||||
{
|
||||
m_oSqlCon.Close();
|
||||
m_oSqlCon.Dispose();
|
||||
m_oSqlCon = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_eError = ErrorTypes.TaskQueue;
|
||||
}
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
m_eError = ErrorTypes.TaskQueue;
|
||||
try
|
||||
{
|
||||
if (null != m_oCommand)
|
||||
{
|
||||
m_oCommand.Dispose();
|
||||
m_oCommand = null;
|
||||
}
|
||||
if (null != m_oSqlCon)
|
||||
{
|
||||
m_oSqlCon.Dispose();
|
||||
m_oSqlCon = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
private TransportClass m_GetTask = null;
|
||||
private DelegateRemoveTask m_RemoveTask = null;
|
||||
private DelegateAddTask m_AddTask = null;
|
||||
|
||||
public CTaskQueueDataBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
string sMaxconverttime = ConfigurationManager.AppSettings[m_cstrMaxConvertTime];
|
||||
string sMaxconverttimeiddle = ConfigurationManager.AppSettings[m_cstrMaxConvertTimeIddle];
|
||||
if (false == string.IsNullOrEmpty(sMaxconverttime) && false == string.IsNullOrEmpty(sMaxconverttimeiddle))
|
||||
{
|
||||
double dMaxconverttime = double.Parse(sMaxconverttime, Constants.mc_oCultureInfo);
|
||||
double dMaxconverttimeiddle = double.Parse(sMaxconverttimeiddle, Constants.mc_oCultureInfo);
|
||||
m_dMaxConvertTimeInSeconds = dMaxconverttime + dMaxconverttimeiddle;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorTypes AddTask(TaskQueueData oTask, Priority oPriority)
|
||||
{
|
||||
ErrorTypes eResult = ErrorTypes.TaskQueue;
|
||||
try
|
||||
{
|
||||
string strId = (string)oTask.m_sKey;
|
||||
|
||||
string strInsertRow = GetInsertString(oTask, oPriority);
|
||||
using (System.Data.IDbConnection dbConnection = GetDbConnection())
|
||||
{
|
||||
dbConnection.Open();
|
||||
using (System.Data.IDbCommand oInsertCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
oInsertCommand.CommandText = strInsertRow;
|
||||
oInsertCommand.ExecuteNonQuery();
|
||||
|
||||
eResult = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
eResult = ErrorTypes.TaskQueue;
|
||||
}
|
||||
return eResult;
|
||||
}
|
||||
public void AddTaskBegin(TaskQueueData oTask, Priority oPriority, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_AddTask = AddTask;
|
||||
m_AddTask.BeginInvoke(oTask, oPriority, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eRes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eRes = m_AddTask.EndInvoke(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eRes = ErrorTypes.TaskQueue;
|
||||
}
|
||||
return eRes;
|
||||
}
|
||||
public TaskQueueData GetTask()
|
||||
{
|
||||
TaskQueueData oData = null;
|
||||
bool bResult = false;
|
||||
|
||||
uint ncq_id = 0;
|
||||
|
||||
string strSelectSQL = GetSelectString();
|
||||
string strUpdateSQL = GetUpdateString();
|
||||
try
|
||||
{
|
||||
using (System.Data.IDbConnection dbConnection = GetDbConnection())
|
||||
{
|
||||
dbConnection.Open();
|
||||
bool bIsExist = false;
|
||||
using (IDbCommand oSelectCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
oSelectCommand.CommandText = strSelectSQL;
|
||||
using (System.Data.IDataReader oDataReader = oSelectCommand.ExecuteReader())
|
||||
{
|
||||
if (true == oDataReader.Read())
|
||||
{
|
||||
ncq_id = Convert.ToUInt32(oDataReader["cq_id"]);
|
||||
oData = TaskQueueData.DeserializeFromXml(Convert.ToString(oDataReader["cq_data"]));
|
||||
oData.m_oDataKey = ncq_id;
|
||||
|
||||
bIsExist = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsExist)
|
||||
{
|
||||
using (System.Data.IDbCommand oUpdateCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
oUpdateCommand.CommandText = strUpdateSQL + ncq_id + "';";
|
||||
|
||||
if (oUpdateCommand.ExecuteNonQuery() > 0)
|
||||
bResult = true;
|
||||
else
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return (bResult) ? oData : null;
|
||||
}
|
||||
public void GetTaskBegin(AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_GetTask = new TransportClass(fCallback, oParam);
|
||||
try
|
||||
{
|
||||
DateTime oDateTimeNow = DateTime.UtcNow;
|
||||
DateTime oDateTimeNowMinusConvertTime = oDateTimeNow.AddSeconds(-1 * m_dMaxConvertTimeInSeconds);
|
||||
string strDateTimeNow = oDateTimeNow.ToString(Constants.mc_sDateTimeFormat);
|
||||
string strDateTimeNowMinusConvertTime = oDateTimeNowMinusConvertTime.ToString(Constants.mc_sDateTimeFormat);
|
||||
|
||||
string strSelectSQL = GetSelectString();
|
||||
|
||||
m_GetTask.m_oSqlCon = GetDbConnection();
|
||||
m_GetTask.m_oSqlCon.Open();
|
||||
IDbCommand oSelCommand = m_GetTask.m_oSqlCon.CreateCommand();
|
||||
oSelCommand.CommandText = strSelectSQL;
|
||||
m_GetTask.m_oCommand = oSelCommand;
|
||||
m_GetTask.m_delegateReader = new ExecuteReader(oSelCommand.ExecuteReader);
|
||||
m_GetTask.m_delegateReader.BeginInvoke(GetTaskCallback, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_GetTask.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public TaskQueueData GetTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
bool bResult = false;
|
||||
if (ErrorTypes.NoError == m_GetTask.m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null != m_GetTask.m_delegateNonQuery)
|
||||
{
|
||||
if (m_GetTask.m_delegateNonQuery.EndInvoke(ar) > 0)
|
||||
bResult = true;
|
||||
else
|
||||
bResult = false;
|
||||
|
||||
}
|
||||
m_GetTask.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_GetTask.Dispose();
|
||||
}
|
||||
}
|
||||
return (bResult) ? m_GetTask.m_oTaskQueueData : null;
|
||||
}
|
||||
public ErrorTypes RemoveTask(object key)
|
||||
{
|
||||
ErrorTypes eResult = ErrorTypes.TaskQueue;
|
||||
|
||||
try
|
||||
{
|
||||
uint nId = (uint)key;
|
||||
string strDeleteRow = GetDeleteString(nId);
|
||||
using (System.Data.IDbConnection dbConnection = GetDbConnection())
|
||||
{
|
||||
dbConnection.Open();
|
||||
using (IDbCommand oDelCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
oDelCommand.CommandText = strDeleteRow;
|
||||
oDelCommand.ExecuteNonQuery();
|
||||
|
||||
eResult = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return eResult;
|
||||
}
|
||||
public void RemoveTaskBegin(object key, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_RemoveTask = RemoveTask;
|
||||
m_RemoveTask.BeginInvoke(key, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes RemoveTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eRes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eRes = m_RemoveTask.EndInvoke(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eRes = ErrorTypes.TaskQueue;
|
||||
}
|
||||
return eRes;
|
||||
}
|
||||
|
||||
private void GetTaskCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
uint ncq_id = 0;
|
||||
bool bIsExist = false;
|
||||
using (IDataReader oReader = m_GetTask.m_delegateReader.EndInvoke(ar))
|
||||
{
|
||||
if (true == oReader.Read())
|
||||
{
|
||||
ncq_id = Convert.ToUInt32(oReader["cq_id"]);
|
||||
m_GetTask.m_oTaskQueueData = TaskQueueData.DeserializeFromXml(Convert.ToString(oReader["cq_data"]));
|
||||
m_GetTask.m_oTaskQueueData.m_oDataKey = ncq_id;
|
||||
|
||||
bIsExist = true;
|
||||
}
|
||||
}
|
||||
if (null != m_GetTask.m_oCommand)
|
||||
{
|
||||
m_GetTask.m_oCommand.Dispose();
|
||||
m_GetTask.m_oCommand = null;
|
||||
}
|
||||
m_GetTask.Close();
|
||||
if (bIsExist)
|
||||
{
|
||||
|
||||
IDbCommand oUpdateCommand = m_GetTask.m_oSqlCon.CreateCommand();
|
||||
oUpdateCommand.CommandText = GetUpdateString();
|
||||
m_GetTask.m_oCommand = oUpdateCommand;
|
||||
m_GetTask.m_delegateNonQuery = new ExecuteNonQuery(oUpdateCommand.ExecuteNonQuery);
|
||||
m_GetTask.m_delegateNonQuery.BeginInvoke(m_GetTask.m_fCallback, m_GetTask.m_oParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_GetTask.m_delegateNonQuery = null;
|
||||
m_GetTask.FireCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_GetTask.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private System.Data.IDbConnection GetDbConnection()
|
||||
{
|
||||
ConnectionStringSettings oConnectionSettings = ConfigurationManager.ConnectionStrings[m_sConnectionString];
|
||||
System.Data.Common.DbProviderFactory dbProvider = System.Data.Common.DbProviderFactories.GetFactory(oConnectionSettings.ProviderName);
|
||||
System.Data.IDbConnection newConnection = dbProvider.CreateConnection();
|
||||
newConnection.ConnectionString = oConnectionSettings.ConnectionString;
|
||||
return newConnection;
|
||||
}
|
||||
private string GetSelectString()
|
||||
{
|
||||
DateTime oDateTimeNow = DateTime.UtcNow;
|
||||
DateTime oDateTimeNowMinusConvertTime = oDateTimeNow.AddSeconds(-1 * m_dMaxConvertTimeInSeconds);
|
||||
string strDateTimeNow = oDateTimeNow.ToString(Constants.mc_sDateTimeFormat);
|
||||
string strDateTimeNowMinusConvertTime = oDateTimeNowMinusConvertTime.ToString(Constants.mc_sDateTimeFormat);
|
||||
return "SELECT * FROM " + m_cstrTableName + " WHERE cq_isbusy <> '" + BusyType.busy.ToString("d") + "' OR cq_time <= '" + strDateTimeNowMinusConvertTime + "' ORDER BY cq_priority";
|
||||
}
|
||||
private string GetInsertString(TaskQueueData oTask, Priority ePriority)
|
||||
{
|
||||
|
||||
string sData = TaskQueueData.SerializeToXml(oTask);
|
||||
return "INSERT INTO " + m_cstrTableName + " ( cq_data, cq_priority, cq_time, cq_isbusy ) VALUES ( '" + sData + "', '" + ePriority.ToString("d") + "', '" + DateTime.UtcNow.ToString(Constants.mc_sDateTimeFormat) + "', '" + BusyType.not_busy.ToString("d") + "' );";
|
||||
}
|
||||
private string GetDeleteString(uint nId)
|
||||
{
|
||||
return "DELETE FROM " + m_cstrTableName + " WHERE cq_id='" + nId.ToString() + "'";
|
||||
}
|
||||
private string GetUpdateString()
|
||||
{
|
||||
DateTime oDateTimeNow = DateTime.UtcNow;
|
||||
DateTime oDateTimeNowMinusConvertTime = oDateTimeNow.AddSeconds(-1 * m_dMaxConvertTimeInSeconds);
|
||||
string strDateTimeNowMinusConvertTime = oDateTimeNowMinusConvertTime.ToString(Constants.mc_sDateTimeFormat);
|
||||
|
||||
return "UPDATE " + m_cstrTableName + " SET cq_isbusy = '" + BusyType.busy.ToString("d") + "',cq_time = '" + DateTime.UtcNow.ToString(Constants.mc_sDateTimeFormat) + "' WHERE (cq_isbusy <> '" + BusyType.busy.ToString("d") + "' OR cq_time <= '" + strDateTimeNowMinusConvertTime + "') AND cq_id = '";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CTaskQueueAmazonSQS : ITaskQueue
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(CTaskQueueAmazonSQS));
|
||||
private struct SQSDataKey
|
||||
{
|
||||
public string m_strReceiptHandle;
|
||||
public Priority m_oPriority;
|
||||
}
|
||||
|
||||
private const string m_cstrLowPriorityQueueSettings = "utils.taskqueue.sqs.lp";
|
||||
private const string m_cstrNormalPriorityQueueSettings = "utils.taskqueue.sqs.np";
|
||||
private const string m_cstrHighPriorityQueueSettings = "utils.taskqueue.sqs.hp";
|
||||
|
||||
private string m_strLowPriorityQueueUrl = ConfigurationManager.AppSettings[m_cstrLowPriorityQueueSettings];
|
||||
private string m_strNormalPriorityQueueUrl = ConfigurationManager.AppSettings[m_cstrNormalPriorityQueueSettings];
|
||||
private string m_strHighPriorityQueueUrl = ConfigurationManager.AppSettings[m_cstrHighPriorityQueueSettings];
|
||||
private bool m_LongPoolingEnable = bool.Parse(ConfigurationManager.AppSettings["utils.taskqueue.sqs.longpooling"] ?? "false");
|
||||
|
||||
private static int m_nIsHPRead;
|
||||
private static int m_nIsNPRead;
|
||||
private static int m_nIsLPRead;
|
||||
|
||||
private delegate ErrorTypes ExecuteTaskAdder(TaskQueueData oTask, Priority oPriority);
|
||||
private delegate TaskQueueData ExecuteTaskGetter();
|
||||
private delegate ErrorTypes ExecuteTaskRemover(object key);
|
||||
|
||||
private class TransportClass : TransportClassAsyncOperation
|
||||
{
|
||||
public ExecuteTaskAdder m_delegateAdder = null;
|
||||
public ExecuteTaskGetter m_delegateGetter = null;
|
||||
public ExecuteTaskRemover m_delegateRemover = null;
|
||||
|
||||
public ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
public TransportClass(AsyncCallback fCallback, object oParam): base(fCallback, oParam)
|
||||
{
|
||||
}
|
||||
public override void Close()
|
||||
{
|
||||
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
m_eError = ErrorTypes.TaskQueue;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private TransportClass m_oAddTask = null;
|
||||
private TransportClass m_oGetTask = null;
|
||||
private TransportClass m_oRemoveTask = null;
|
||||
private string GetQueueUrl(Priority oPriority)
|
||||
{
|
||||
string strUrlQueue = "";
|
||||
switch (oPriority)
|
||||
{
|
||||
case Priority.Low:
|
||||
strUrlQueue = m_strLowPriorityQueueUrl;
|
||||
break;
|
||||
case Priority.Normal:
|
||||
strUrlQueue = m_strNormalPriorityQueueUrl;
|
||||
break;
|
||||
case Priority.High:
|
||||
strUrlQueue = m_strHighPriorityQueueUrl;
|
||||
break;
|
||||
}
|
||||
return strUrlQueue;
|
||||
}
|
||||
|
||||
public ErrorTypes AddTask(TaskQueueData oTask, Priority oPriority)
|
||||
{
|
||||
ErrorTypes eResult = ErrorTypes.Unknown;
|
||||
string strUrlQueue = GetQueueUrl(oPriority);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string strData = TaskQueueData.SerializeToXml(oTask);
|
||||
|
||||
using (Amazon.SQS.AmazonSQS oSQSClient = Amazon.AWSClientFactory.CreateAmazonSQSClient())
|
||||
{
|
||||
|
||||
Amazon.SQS.Model.SendMessageRequest oSendMessageRequest = new Amazon.SQS.Model.SendMessageRequest();
|
||||
oSendMessageRequest.QueueUrl = strUrlQueue;
|
||||
oSendMessageRequest.MessageBody = strData;
|
||||
oSQSClient.SendMessage(oSendMessageRequest);
|
||||
eResult = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
catch (Amazon.SQS.AmazonSQSException)
|
||||
{
|
||||
eResult = ErrorTypes.TaskQueue;
|
||||
}
|
||||
catch
|
||||
{
|
||||
eResult = ErrorTypes.TaskQueue;
|
||||
}
|
||||
|
||||
return eResult;
|
||||
}
|
||||
public void AddTaskBegin(TaskQueueData oTask, Priority oPriority, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
|
||||
m_oAddTask = new TransportClass(fCallback, oParam);
|
||||
try
|
||||
{
|
||||
m_oAddTask.m_delegateAdder = AddTask;
|
||||
m_oAddTask.m_delegateAdder.BeginInvoke(oTask, oPriority, m_oAddTask.m_fCallback, m_oAddTask.m_oParam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oAddTask.DisposeAndCallback();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public ErrorTypes AddTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eResult = m_oAddTask.m_eError;
|
||||
if (ErrorTypes.NoError == m_oAddTask.m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_oAddTask.m_delegateAdder.EndInvoke(ar);
|
||||
m_oAddTask.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oAddTask.Dispose();
|
||||
}
|
||||
}
|
||||
return eResult;
|
||||
}
|
||||
|
||||
private TaskQueueData GetTask(Priority oPriority)
|
||||
{
|
||||
string strUrlQueue = GetQueueUrl(oPriority);
|
||||
|
||||
TaskQueueData oData = null;
|
||||
try
|
||||
{
|
||||
|
||||
using (Amazon.SQS.AmazonSQS oSQSClient = Amazon.AWSClientFactory.CreateAmazonSQSClient())
|
||||
{
|
||||
|
||||
Amazon.SQS.Model.ReceiveMessageRequest oReceiveMessageRequest = new Amazon.SQS.Model.ReceiveMessageRequest();
|
||||
oReceiveMessageRequest.QueueUrl = strUrlQueue;
|
||||
oReceiveMessageRequest.MaxNumberOfMessages = 1;
|
||||
|
||||
Amazon.SQS.Model.ReceiveMessageResponse oReceiveMessageResponse = oSQSClient.ReceiveMessage(oReceiveMessageRequest);
|
||||
if (oReceiveMessageResponse.IsSetReceiveMessageResult())
|
||||
{
|
||||
Amazon.SQS.Model.ReceiveMessageResult oReceiveMessageResult = oReceiveMessageResponse.ReceiveMessageResult;
|
||||
foreach (Amazon.SQS.Model.Message oMessage in oReceiveMessageResult.Message)
|
||||
{
|
||||
oData = TaskQueueData.DeserializeFromXml(oMessage.Body);
|
||||
|
||||
SQSDataKey oSQSDataKey = new SQSDataKey();
|
||||
oSQSDataKey.m_oPriority = oPriority;
|
||||
oSQSDataKey.m_strReceiptHandle = oMessage.ReceiptHandle;
|
||||
oData.m_oDataKey = oSQSDataKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Amazon.SQS.AmazonSQSException)
|
||||
{
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return oData;
|
||||
}
|
||||
public TaskQueueData GetTask()
|
||||
{
|
||||
TaskQueueData oData = null;
|
||||
|
||||
if(m_LongPoolingEnable)
|
||||
oData = GetTaskFromLongPoolingQueue();
|
||||
else
|
||||
oData = GetTaskFromQueue();
|
||||
|
||||
return oData;
|
||||
}
|
||||
private TaskQueueData GetTaskFromLongPoolingQueue()
|
||||
{
|
||||
TaskQueueData oData = null;
|
||||
|
||||
if (0 == Interlocked.CompareExchange(ref m_nIsHPRead, 1, 0))
|
||||
{
|
||||
_log.Debug("Try to get high priority task...");
|
||||
oData = GetTask(Priority.High);
|
||||
Interlocked.Exchange(ref m_nIsHPRead, 0);
|
||||
}
|
||||
else if (0 == Interlocked.CompareExchange(ref m_nIsNPRead, 1, 0))
|
||||
{
|
||||
_log.Debug("Try to get normal priority task...");
|
||||
oData = GetTask(Priority.Normal);
|
||||
Interlocked.Exchange(ref m_nIsNPRead, 0);
|
||||
}
|
||||
else if (0 == Interlocked.CompareExchange(ref m_nIsLPRead, 1, 0))
|
||||
{
|
||||
_log.Debug("Try to get low priority task...");
|
||||
oData = GetTask(Priority.Low);
|
||||
Interlocked.Exchange(ref m_nIsLPRead, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Debug("All task queue listening!");
|
||||
}
|
||||
|
||||
return oData;
|
||||
}
|
||||
private TaskQueueData GetTaskFromQueue()
|
||||
{
|
||||
TaskQueueData oData = null;
|
||||
|
||||
oData = GetTask(Priority.High);
|
||||
if (null != oData)
|
||||
return oData;
|
||||
|
||||
oData = GetTask(Priority.Normal);
|
||||
if (null != oData)
|
||||
return oData;
|
||||
|
||||
oData = GetTask(Priority.Low);
|
||||
|
||||
return oData;
|
||||
}
|
||||
public void GetTaskBegin(AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oGetTask = new TransportClass(fCallback, oParam);
|
||||
try
|
||||
{
|
||||
m_oGetTask.m_delegateGetter = GetTask;
|
||||
m_oGetTask.m_delegateGetter.BeginInvoke(m_oGetTask.m_fCallback, m_oGetTask.m_oParam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetTask.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public TaskQueueData GetTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
TaskQueueData oTaskQueueDate = null;
|
||||
if (ErrorTypes.NoError == m_oGetTask.m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null != m_oGetTask.m_delegateGetter)
|
||||
{
|
||||
oTaskQueueDate = m_oGetTask.m_delegateGetter.EndInvoke(ar);
|
||||
}
|
||||
m_oGetTask.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetTask.Dispose();
|
||||
}
|
||||
}
|
||||
return oTaskQueueDate;
|
||||
}
|
||||
public ErrorTypes RemoveTask(object key)
|
||||
{
|
||||
ErrorTypes eResult = ErrorTypes.Unknown;
|
||||
try
|
||||
{
|
||||
SQSDataKey oSQSDataKey = (SQSDataKey)key;
|
||||
string strUrlQueue = GetQueueUrl(oSQSDataKey.m_oPriority);
|
||||
|
||||
using (Amazon.SQS.AmazonSQS oSQSClient = Amazon.AWSClientFactory.CreateAmazonSQSClient())
|
||||
{
|
||||
|
||||
Amazon.SQS.Model.DeleteMessageRequest oDeleteRequest = new Amazon.SQS.Model.DeleteMessageRequest();
|
||||
oDeleteRequest.QueueUrl = strUrlQueue;
|
||||
oDeleteRequest.ReceiptHandle = (string)oSQSDataKey.m_strReceiptHandle;
|
||||
|
||||
oSQSClient.DeleteMessage(oDeleteRequest);
|
||||
eResult = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
catch (Amazon.SQS.AmazonSQSException)
|
||||
{
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return eResult;
|
||||
}
|
||||
public void RemoveTaskBegin(object key, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oRemoveTask = new TransportClass(fCallback, oParam);
|
||||
try
|
||||
{
|
||||
m_oRemoveTask.m_delegateRemover = RemoveTask;
|
||||
m_oRemoveTask.m_delegateRemover.BeginInvoke(key, fCallback, oParam);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oRemoveTask.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public ErrorTypes RemoveTaskEnd(IAsyncResult ar)
|
||||
{
|
||||
if (ErrorTypes.NoError == m_oRemoveTask.m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_oRemoveTask.m_delegateRemover.EndInvoke(ar);
|
||||
m_oRemoveTask.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oRemoveTask.Dispose();
|
||||
}
|
||||
}
|
||||
return ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
|
||||
using ASC.Common.Data;
|
||||
using ASC.Common.Data.Sql;
|
||||
using ASC.Common.Data.Sql.Expressions;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
[Serializable]
|
||||
public class TaskResultData
|
||||
{
|
||||
|
||||
public string sKey;
|
||||
public string sFormat;
|
||||
public FileStatus eStatus;
|
||||
public int nStatusInfo;
|
||||
public DateTime oLastOpenDate;
|
||||
public string sTitle;
|
||||
public TaskResultData()
|
||||
{
|
||||
sFormat = "";
|
||||
sKey = "";
|
||||
eStatus = FileStatus.None;
|
||||
nStatusInfo = 0;
|
||||
oLastOpenDate = DateTime.UtcNow;
|
||||
sTitle = "";
|
||||
}
|
||||
public TaskResultData Clone()
|
||||
{
|
||||
TaskResultData oRes = new TaskResultData();
|
||||
oRes.sFormat = sFormat;
|
||||
oRes.sKey = sKey;
|
||||
oRes.eStatus = eStatus;
|
||||
oRes.nStatusInfo = nStatusInfo;
|
||||
oRes.oLastOpenDate = oLastOpenDate;
|
||||
oRes.sTitle = sTitle;
|
||||
return oRes;
|
||||
}
|
||||
public void Update(TaskResultDataToUpdate oUpdate)
|
||||
{
|
||||
if (oUpdate != null)
|
||||
{
|
||||
if (oUpdate.eStatus != null)
|
||||
this.eStatus = (FileStatus)oUpdate.eStatus;
|
||||
|
||||
if (oUpdate.oLastOpenDate != null)
|
||||
this.oLastOpenDate = (DateTime)oUpdate.oLastOpenDate;
|
||||
|
||||
if (oUpdate.nStatusInfo != null)
|
||||
this.nStatusInfo = (int)oUpdate.nStatusInfo;
|
||||
|
||||
if (oUpdate.sFormat != null)
|
||||
this.sFormat = oUpdate.sFormat;
|
||||
|
||||
if (oUpdate.sTitle != null)
|
||||
this.sTitle = oUpdate.sTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class TaskResultDataToUpdate
|
||||
{
|
||||
public string sFormat;
|
||||
public FileStatus? eStatus;
|
||||
public int? nStatusInfo;
|
||||
public DateTime? oLastOpenDate;
|
||||
public string sTitle;
|
||||
public TaskResultDataToUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
public interface ITaskResultInterface
|
||||
{
|
||||
ErrorTypes Add(string sKey, TaskResultData oTast);
|
||||
void AddBegin(string sKey, TaskResultData oTast, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes AddEnd(IAsyncResult ar);
|
||||
ErrorTypes AddRandomKey(string sKey, TaskResultData oTastToAdd, out TaskResultData oTastAdded);
|
||||
void AddRandomKeyBegin(string sKey, TaskResultData oTastToAdd, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes AddRandomKeyEnd(IAsyncResult ar, out TaskResultData oTastAdded);
|
||||
ErrorTypes Update(string sKey, TaskResultDataToUpdate oTast);
|
||||
void UpdateBegin(string sKey, TaskResultDataToUpdate oTast, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes UpdateEnd(IAsyncResult ar);
|
||||
ErrorTypes Get(string sKey, out TaskResultData oTast);
|
||||
void GetBegin(string sKey, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes GetEnd(IAsyncResult ar, out TaskResultData oTast);
|
||||
ErrorTypes GetExpired( int nMaxCount, out List <TaskResultData> aTasts);
|
||||
ErrorTypes GetOrCreate(string sKey, TaskResultData oDataToAdd, out TaskResultData oDataAdded, out bool bCreate);
|
||||
void GetOrCreateBegin(string sKey, TaskResultData oDataToAdd, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes GetOrCreateEnd(IAsyncResult ar, out TaskResultData oDataAdded, out bool bCreate);
|
||||
ErrorTypes Remove(string sKey);
|
||||
void RemoveBegin(string sKey, AsyncCallback fCallback, object oParam);
|
||||
ErrorTypes RemoveEnd(IAsyncResult ar);
|
||||
}
|
||||
public class TaskResult : ITaskResultInterface
|
||||
{
|
||||
private ITaskResultInterface piTaskResult;
|
||||
public TaskResult()
|
||||
{
|
||||
string sTaskResultImpl = ConfigurationManager.AppSettings["utils.taskresult.impl"];
|
||||
switch (sTaskResultImpl)
|
||||
{
|
||||
case "cacheddb":
|
||||
piTaskResult = new TaskResultCachedDB();
|
||||
break;
|
||||
|
||||
case "db":
|
||||
default:
|
||||
piTaskResult = new TaskResultDataBase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public ErrorTypes Add(string sKey, TaskResultData oTast)
|
||||
{
|
||||
return piTaskResult.Add(sKey, oTast);
|
||||
}
|
||||
public void AddBegin(string sKey, TaskResultData oTast, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
piTaskResult.AddBegin(sKey, oTast, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddEnd(IAsyncResult ar)
|
||||
{
|
||||
return piTaskResult.AddEnd(ar);
|
||||
}
|
||||
public ErrorTypes AddRandomKey(string sKey, TaskResultData oTastToAdd, out TaskResultData oTastAdded)
|
||||
{
|
||||
return piTaskResult.AddRandomKey(sKey, oTastToAdd, out oTastAdded);
|
||||
}
|
||||
public void AddRandomKeyBegin(string sKey, TaskResultData oTastToAdd, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
piTaskResult.AddRandomKeyBegin(sKey, oTastToAdd, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddRandomKeyEnd(IAsyncResult ar, out TaskResultData oTastAdded)
|
||||
{
|
||||
return piTaskResult.AddRandomKeyEnd(ar, out oTastAdded);
|
||||
}
|
||||
public ErrorTypes Update(string sKey, TaskResultDataToUpdate oTast)
|
||||
{
|
||||
return piTaskResult.Update(sKey, oTast);
|
||||
}
|
||||
public void UpdateBegin(string sKey, TaskResultDataToUpdate oTast, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
piTaskResult.UpdateBegin(sKey, oTast, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes UpdateEnd(IAsyncResult ar)
|
||||
{
|
||||
return piTaskResult.UpdateEnd(ar);
|
||||
}
|
||||
public ErrorTypes Get(string sKey, out TaskResultData oTast)
|
||||
{
|
||||
return piTaskResult.Get(sKey, out oTast);
|
||||
}
|
||||
public void GetBegin(string sKey, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
piTaskResult.GetBegin(sKey, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes GetEnd(IAsyncResult ar, out TaskResultData oTast)
|
||||
{
|
||||
return piTaskResult.GetEnd(ar, out oTast);
|
||||
}
|
||||
public ErrorTypes GetExpired(int nMaxCount, out List<TaskResultData> aTasts)
|
||||
{
|
||||
return piTaskResult.GetExpired(nMaxCount, out aTasts);
|
||||
}
|
||||
public ErrorTypes GetOrCreate(string sKey, TaskResultData oDataToAdd, out TaskResultData oDataAdded, out bool bCreate)
|
||||
{
|
||||
return piTaskResult.GetOrCreate(sKey, oDataToAdd, out oDataAdded, out bCreate);
|
||||
}
|
||||
public void GetOrCreateBegin(string sKey, TaskResultData oDataToAdd, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
piTaskResult.GetOrCreateBegin(sKey, oDataToAdd, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes GetOrCreateEnd(IAsyncResult ar, out TaskResultData oDataAdded, out bool bCreate)
|
||||
{
|
||||
return piTaskResult.GetOrCreateEnd(ar, out oDataAdded, out bCreate);
|
||||
}
|
||||
public ErrorTypes Remove(string sKey)
|
||||
{
|
||||
return piTaskResult.Remove(sKey);
|
||||
}
|
||||
public void RemoveBegin(string sKey, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
piTaskResult.RemoveBegin(sKey, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes RemoveEnd(IAsyncResult ar)
|
||||
{
|
||||
return piTaskResult.RemoveEnd(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Net;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using ASC.Common.Data;
|
||||
using ASC.Common.Data.Sql;
|
||||
using ASC.Common.Data.Sql.Expressions;
|
||||
|
||||
using Enyim.Caching;
|
||||
using Enyim.Caching.Configuration;
|
||||
using Enyim.Caching.Memcached;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
class TaskResultCachedDB : ITaskResultInterface
|
||||
{
|
||||
private static int mc_nRandomMaxNumber = 10000;
|
||||
private static System.Random m_oRandom = new System.Random();
|
||||
private string m_sConnectionString = ConfigurationManager.AppSettings["utils.taskresult.db.connectionstring"];
|
||||
private TimeSpan m_oTtl = TimeSpan.Parse(ConfigurationManager.AppSettings["utils.taskresult.cacheddb.ttl"] ?? "0.00:15:00");
|
||||
|
||||
private TaskResultDataBase m_oTaskResultDB = new TaskResultDataBase();
|
||||
MemcachedClientConfiguration m_oMcConfig = null;
|
||||
|
||||
private delegate IDataReader ExecuteReader();
|
||||
private delegate int ExecuteNonQuery();
|
||||
private delegate ErrorTypes DelegateAdd(string sKey, TaskResultData oTast);
|
||||
private delegate ErrorTypes DelegateUpdate(string sKey, TaskResultDataToUpdate oTast);
|
||||
private delegate ErrorTypes DelegateGet(string sKey, out TaskResultData oTaskResultData);
|
||||
private delegate ErrorTypes DelegateGetBegin(string sKey, AsyncCallback fCallback, object oParam);
|
||||
private delegate ErrorTypes DelegateRemove(string sKey);
|
||||
|
||||
private delegate ErrorTypes DelegateAddToMC(string sKey, TaskResultData oTast);
|
||||
|
||||
private class TransportClass : TransportClassAsyncOperation
|
||||
{
|
||||
|
||||
public ExecuteReader m_delegateReader = null;
|
||||
public ExecuteNonQuery m_delegateNonQuery = null;
|
||||
public DelegateGet m_delegateGet = null;
|
||||
|
||||
public TaskResultData m_oTast = null;
|
||||
public ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
public bool m_bCreate = false;
|
||||
public string m_sKey = null;
|
||||
public bool m_bReadFromDB = false;
|
||||
public TransportClass(AsyncCallback fCallback, object oParam)
|
||||
: base(fCallback, oParam)
|
||||
{
|
||||
}
|
||||
public override void Close()
|
||||
{
|
||||
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
m_eError = ErrorTypes.TaskResult;
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
private TransportClass m_oAddRandomKey = null;
|
||||
private TransportClass m_oGetOrCreate = null;
|
||||
|
||||
private TransportClass m_oGet = null;
|
||||
|
||||
public TaskResultCachedDB()
|
||||
{
|
||||
InitMC();
|
||||
}
|
||||
private void InitMC()
|
||||
{
|
||||
if (null == m_oMcConfig)
|
||||
{
|
||||
m_oMcConfig = new MemcachedClientConfiguration();
|
||||
|
||||
string sServerName = ConfigurationManager.AppSettings["utils.taskresult.cacheddb.mc.server"] ?? "localhost:11211";
|
||||
|
||||
m_oMcConfig.AddServer(sServerName);
|
||||
m_oMcConfig.Protocol = MemcachedProtocol.Text;
|
||||
}
|
||||
}
|
||||
public ErrorTypes Add(string sKey, TaskResultData oTast)
|
||||
{
|
||||
AddToMC(sKey, oTast);
|
||||
|
||||
return m_oTaskResultDB.Add(sKey, oTast);
|
||||
}
|
||||
public void AddBegin(string sKey, TaskResultData oTast, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
DelegateAdd oDelegateAdd = new DelegateAdd(AddToMC);
|
||||
|
||||
oDelegateAdd.BeginInvoke(sKey, oTast, null, null);
|
||||
|
||||
m_oTaskResultDB.AddBegin(sKey, oTast, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddEnd(IAsyncResult ar)
|
||||
{
|
||||
return m_oTaskResultDB.AddEnd(ar);
|
||||
}
|
||||
public ErrorTypes AddRandomKey(string sKey, TaskResultData oTastToAdd, out TaskResultData oTastAdded)
|
||||
{
|
||||
return m_oTaskResultDB.AddRandomKey(sKey, oTastToAdd, out oTastAdded);
|
||||
}
|
||||
public void AddRandomKeyBegin(string sKey, TaskResultData oTastToAdd, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
|
||||
m_oTaskResultDB.AddRandomKeyBegin(sKey, oTastToAdd, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddRandomKeyEnd(IAsyncResult ar, out TaskResultData oTast)
|
||||
{
|
||||
|
||||
return m_oTaskResultDB.AddRandomKeyEnd(ar, out oTast);
|
||||
}
|
||||
public ErrorTypes Update(string sKey, TaskResultDataToUpdate oTast)
|
||||
{
|
||||
ErrorTypes oError = ErrorTypes.NoError;
|
||||
|
||||
UpdateInMC(sKey, oTast);
|
||||
|
||||
return oError;
|
||||
}
|
||||
public void UpdateBegin(string sKey, TaskResultDataToUpdate oTast, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oTaskResultDB.UpdateBegin(sKey, oTast, fCallback, oParam);
|
||||
|
||||
}
|
||||
public ErrorTypes UpdateEnd(IAsyncResult ar)
|
||||
{
|
||||
return m_oTaskResultDB.UpdateEnd(ar);
|
||||
}
|
||||
public ErrorTypes Get(string sKey, out TaskResultData oTaskResultData)
|
||||
{
|
||||
oTaskResultData = null;
|
||||
ErrorTypes oError = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
GetFromMC(sKey, out oTaskResultData);
|
||||
|
||||
if (null == oTaskResultData)
|
||||
{
|
||||
oError = m_oTaskResultDB.Get(sKey, out oTaskResultData);
|
||||
if (oError == ErrorTypes.NoError && oTaskResultData != null)
|
||||
{
|
||||
AddToMC(sKey, oTaskResultData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
oError = ErrorTypes.TaskResult;
|
||||
}
|
||||
|
||||
return oError;
|
||||
}
|
||||
public void GetBegin(string sKey, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oGet = new TransportClass(fCallback, oParam);
|
||||
try
|
||||
{
|
||||
m_oGet.m_sKey = sKey;
|
||||
m_oGet.m_delegateGet = new DelegateGet(GetFromMC);
|
||||
m_oGet.m_delegateGet.BeginInvoke(sKey, out m_oGet.m_oTast, GetCallback, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGet.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public ErrorTypes GetEnd(IAsyncResult ar, out TaskResultData oTast)
|
||||
{
|
||||
oTast = null;
|
||||
if (m_oGet.m_eError == ErrorTypes.NoError)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_oGet.m_bReadFromDB)
|
||||
{
|
||||
m_oTaskResultDB.GetEnd(ar, out oTast);
|
||||
DelegateAddToMC oDelegateAdd = new DelegateAddToMC(AddToMC);
|
||||
oDelegateAdd.BeginInvoke(m_oGet.m_sKey, oTast, null, null);
|
||||
}
|
||||
else if (m_oGet.m_oTast != null)
|
||||
oTast = m_oGet.m_oTast.Clone();
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGet.m_eError = ErrorTypes.TaskResult;
|
||||
}
|
||||
}
|
||||
return m_oGet.m_eError;
|
||||
}
|
||||
public ErrorTypes GetExpired(int nMaxCount, out List<TaskResultData> aTasts)
|
||||
{
|
||||
return m_oTaskResultDB.GetExpired(nMaxCount, out aTasts);
|
||||
}
|
||||
public ErrorTypes GetOrCreate(string sKey, TaskResultData oDefaultTast, out TaskResultData oTaskResultData, out bool bCreate)
|
||||
{
|
||||
return m_oTaskResultDB.GetOrCreate(sKey, oDefaultTast, out oTaskResultData, out bCreate);
|
||||
}
|
||||
public void GetOrCreateBegin(string sKey, TaskResultData oDataToAdd, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oGetOrCreate = new TransportClass(fCallback, oParam);
|
||||
m_oGetOrCreate.m_oTast = oDataToAdd;
|
||||
m_oGetOrCreate.m_bCreate = true;
|
||||
m_oGetOrCreate.m_sKey = sKey;
|
||||
try
|
||||
{
|
||||
TaskResultData oTast = null;
|
||||
m_oGetOrCreate.m_delegateGet = new DelegateGet(GetFromMC);
|
||||
m_oGetOrCreate.m_delegateGet.BeginInvoke(sKey, out oTast, GetOrCreateCallback, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public ErrorTypes GetOrCreateEnd(IAsyncResult ar, out TaskResultData oDataAdded, out bool bCreate)
|
||||
{
|
||||
bCreate = m_oGetOrCreate.m_bCreate;
|
||||
oDataAdded = null;
|
||||
if (ErrorTypes.NoError == m_oGetOrCreate.m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_oGetOrCreate.m_bReadFromDB)
|
||||
{
|
||||
m_oTaskResultDB.GetOrCreateEnd(ar, out oDataAdded, out bCreate);
|
||||
if (oDataAdded != null)
|
||||
{
|
||||
DelegateAddToMC oDelegateAddToMC = new DelegateAddToMC(AddToMC);
|
||||
oDelegateAddToMC.BeginInvoke(m_oGetOrCreate.m_sKey, oDataAdded, null, null);
|
||||
}
|
||||
}
|
||||
else if (null != m_oGetOrCreate.m_oTast)
|
||||
oDataAdded = m_oGetOrCreate.m_oTast.Clone();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.Dispose();
|
||||
}
|
||||
}
|
||||
return m_oGetOrCreate.m_eError;
|
||||
}
|
||||
public ErrorTypes Remove(string sKey)
|
||||
{
|
||||
RemoveFromMC(sKey);
|
||||
return m_oTaskResultDB.Remove(sKey);
|
||||
}
|
||||
public void RemoveBegin(string sKey, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
DelegateRemove oDelegateRemove = new DelegateRemove(RemoveFromMC);
|
||||
oDelegateRemove.BeginInvoke(sKey, null, null);
|
||||
m_oTaskResultDB.RemoveBegin(sKey, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes RemoveEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eErrorTypes = m_oTaskResultDB.RemoveEnd(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eErrorTypes = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
private ErrorTypes AddToMC(string sKey, TaskResultData oTast)
|
||||
{
|
||||
return AddToMCWithCas(sKey, oTast, 0);
|
||||
}
|
||||
private ErrorTypes AddToMCWithCas(string sKey, TaskResultData oTast, ulong cas)
|
||||
{
|
||||
ErrorTypes oError = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
using (MemcachedClient oMc = new MemcachedClient(m_oMcConfig))
|
||||
{
|
||||
string sDataToStore = null;
|
||||
|
||||
XmlSerializer oXmlSerializer = new XmlSerializer(typeof(TaskResultData));
|
||||
using (StringWriter oStringWriter = new StringWriter())
|
||||
{
|
||||
oXmlSerializer.Serialize(oStringWriter, oTast);
|
||||
sDataToStore = oStringWriter.ToString();
|
||||
}
|
||||
|
||||
if (cas != 0)
|
||||
oMc.Cas(StoreMode.Set, sKey, sDataToStore, m_oTtl, cas);
|
||||
else
|
||||
oMc.Store(StoreMode.Set, sKey, sDataToStore, m_oTtl);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
oError = ErrorTypes.TaskResult;
|
||||
}
|
||||
|
||||
return oError;
|
||||
}
|
||||
private ErrorTypes GetFromMC(string sKey, out TaskResultData oTast)
|
||||
{
|
||||
ulong cas = 0;
|
||||
return GetFromMCWithCas(sKey, out oTast, out cas);
|
||||
}
|
||||
private ErrorTypes GetFromMCWithCas(string sKey, out TaskResultData oTast, out ulong cas)
|
||||
{
|
||||
ErrorTypes oError = ErrorTypes.NoError;
|
||||
oTast = null;
|
||||
cas = 0;
|
||||
try
|
||||
{
|
||||
using (MemcachedClient oMc = new MemcachedClient(m_oMcConfig))
|
||||
{
|
||||
CasResult<string> oGetData = oMc.GetWithCas<string>(sKey);
|
||||
|
||||
if (oGetData.Result != null)
|
||||
{
|
||||
cas = oGetData.Cas;
|
||||
|
||||
XmlSerializer oXmlSerializer = new XmlSerializer(typeof(TaskResultData));
|
||||
using (StringReader oStringReader = new StringReader(oGetData.Result))
|
||||
{
|
||||
oTast = (TaskResultData)oXmlSerializer.Deserialize(oStringReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
oError = ErrorTypes.TaskResult;
|
||||
}
|
||||
|
||||
return oError;
|
||||
}
|
||||
private ErrorTypes UpdateInMC(string sKey, TaskResultDataToUpdate oTast)
|
||||
{
|
||||
ErrorTypes oError = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
TaskResultData oTask = null;
|
||||
ulong cas = 0;
|
||||
GetFromMCWithCas(sKey, out oTask, out cas);
|
||||
|
||||
if (oTask == null)
|
||||
m_oTaskResultDB.Get(sKey, out oTask);
|
||||
|
||||
if (oTask != null && oTask.eStatus != FileStatus.Ok)
|
||||
{
|
||||
oTask.Update(oTast);
|
||||
|
||||
AddToMCWithCas(sKey, oTask, cas);
|
||||
|
||||
if (oTask.eStatus != FileStatus.Convert)
|
||||
oError = m_oTaskResultDB.Update(sKey, oTast);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
oError = ErrorTypes.TaskResult;
|
||||
}
|
||||
|
||||
return oError;
|
||||
}
|
||||
private ErrorTypes RemoveFromMC(string sKey)
|
||||
{
|
||||
ErrorTypes oError = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
using (MemcachedClient oMc = new MemcachedClient(m_oMcConfig))
|
||||
{
|
||||
oMc.Remove(sKey);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
oError = ErrorTypes.TaskResult;
|
||||
}
|
||||
return oError;
|
||||
}
|
||||
private void GetCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
TaskResultData oTast = null;
|
||||
m_oGet.m_eError = m_oGet.m_delegateGet.EndInvoke(out oTast, ar);
|
||||
m_oGet.m_delegateGet = null;
|
||||
|
||||
if (oTast != null)
|
||||
{
|
||||
m_oGet.m_sKey = null;
|
||||
m_oGet.m_oTast = oTast;
|
||||
m_oGet.FireCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oGet.m_bReadFromDB = true;
|
||||
m_oTaskResultDB.GetBegin(m_oGet.m_sKey, m_oGet.m_fCallback, m_oGet.m_oParam);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGet.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
private void GetOrCreateCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
TaskResultData oTaskResult = null;
|
||||
m_oGetOrCreate.m_delegateGet.EndInvoke(out oTaskResult, ar);
|
||||
m_oGetOrCreate.m_delegateGet = null;
|
||||
|
||||
if (oTaskResult != null)
|
||||
{
|
||||
m_oGetOrCreate.m_bCreate = false;
|
||||
m_oGetOrCreate.m_oTast = oTaskResult;
|
||||
m_oGetOrCreate.FireCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oGetOrCreate.m_bReadFromDB = true;
|
||||
m_oTaskResultDB.GetOrCreateBegin(m_oGetOrCreate.m_sKey, m_oGetOrCreate.m_oTast, m_oGetOrCreate.m_fCallback, m_oGetOrCreate.m_oParam);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,684 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
|
||||
using ASC.Common.Data;
|
||||
using ASC.Common.Data.Sql;
|
||||
using ASC.Common.Data.Sql.Expressions;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
class TaskResultDataBase : ITaskResultInterface
|
||||
{
|
||||
private static int mc_nRandomMaxNumber = 10000;
|
||||
private static System.Random m_oRandom = new System.Random();
|
||||
private string m_sConnectionString = ConfigurationManager.AppSettings["utils.taskresult.db.connectionstring"];
|
||||
|
||||
private delegate IDataReader ExecuteReader();
|
||||
private delegate int ExecuteNonQuery();
|
||||
private delegate ErrorTypes DelegateAdd(string sKey, TaskResultData oTast);
|
||||
private delegate ErrorTypes DelegateUpdate(string sKey, TaskResultDataToUpdate oTast);
|
||||
private delegate ErrorTypes DelegateGet(string sKey, out TaskResultData oTaskResultData);
|
||||
private delegate ErrorTypes DelegateRemove(string sKey);
|
||||
|
||||
private class TransportClass : TransportClassAsyncOperation
|
||||
{
|
||||
public ExecuteReader m_delegateReader = null;
|
||||
public ExecuteNonQuery m_delegateNonQuery = null;
|
||||
public IDbConnection m_oSqlCon = null;
|
||||
public IDbCommand m_oCommand = null;
|
||||
public TaskResultData m_oTast = null;
|
||||
public ErrorTypes m_eError = ErrorTypes.NoError;
|
||||
public bool m_bCreate = false;
|
||||
public TransportClass(AsyncCallback fCallback, object oParam)
|
||||
: base(fCallback, oParam)
|
||||
{
|
||||
}
|
||||
public override void Close()
|
||||
{
|
||||
if (null != m_oCommand)
|
||||
{
|
||||
m_oCommand.Dispose();
|
||||
m_oCommand = null;
|
||||
}
|
||||
if (null != m_oSqlCon)
|
||||
{
|
||||
m_oSqlCon.Close();
|
||||
m_oSqlCon.Dispose();
|
||||
m_oSqlCon = null;
|
||||
}
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
m_eError = ErrorTypes.TaskResult;
|
||||
try
|
||||
{
|
||||
if (null != m_oCommand)
|
||||
{
|
||||
m_oCommand.Dispose();
|
||||
m_oCommand = null;
|
||||
}
|
||||
if (null != m_oSqlCon)
|
||||
{
|
||||
m_oSqlCon.Dispose();
|
||||
m_oSqlCon = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
private TransportClass m_oAddRandomKey = null;
|
||||
private TransportClass m_oGetOrCreate = null;
|
||||
private DelegateAdd m_oAdd = null;
|
||||
private DelegateUpdate m_oUpdate = null;
|
||||
private DelegateGet m_oGet = null;
|
||||
private DelegateRemove m_oRemove = null;
|
||||
|
||||
public ErrorTypes Add(string sKey, TaskResultData oTast)
|
||||
{
|
||||
ErrorTypes eError = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
sqlCon.Open();
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetINSERTString(oTast);
|
||||
oSelCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
eError = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eError;
|
||||
}
|
||||
public void AddBegin(string sKey, TaskResultData oTast, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
DelegateAdd oDelegateAdd = new DelegateAdd(Add);
|
||||
m_oAdd = oDelegateAdd;
|
||||
oDelegateAdd.BeginInvoke(sKey, oTast, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes AddEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eError = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eError = m_oAdd.EndInvoke(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eError = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eError;
|
||||
}
|
||||
public ErrorTypes AddRandomKey(string sKey, TaskResultData oTastToAdd, out TaskResultData oTastAdded)
|
||||
{
|
||||
ErrorTypes eError = ErrorTypes.TaskResult;
|
||||
oTastAdded = oTastToAdd.Clone();
|
||||
try
|
||||
{
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
sqlCon.Open();
|
||||
while (true)
|
||||
{
|
||||
string sNewKey = sKey + "_" + m_oRandom.Next(mc_nRandomMaxNumber);
|
||||
oTastAdded.sKey = sNewKey;
|
||||
using (IDbCommand oAddCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oAddCommand.CommandText = GetINSERTString(oTastAdded);
|
||||
bool bExist = false;
|
||||
try
|
||||
{
|
||||
oAddCommand.ExecuteNonQuery();
|
||||
}
|
||||
catch
|
||||
{
|
||||
bExist = true;
|
||||
}
|
||||
if (false == bExist)
|
||||
{
|
||||
eError = ErrorTypes.NoError;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
eError = ErrorTypes.TaskResult;
|
||||
}
|
||||
if (ErrorTypes.NoError != eError)
|
||||
{
|
||||
oTastAdded = null;
|
||||
}
|
||||
return eError;
|
||||
}
|
||||
public void AddRandomKeyBegin(string sKey, TaskResultData oTastToAdd, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oAddRandomKey = new TransportClass(fCallback, oParam);
|
||||
m_oAddRandomKey.m_oTast = oTastToAdd.Clone();
|
||||
try
|
||||
{
|
||||
m_oAddRandomKey.m_oSqlCon = GetDbConnection();
|
||||
m_oAddRandomKey.m_oSqlCon.Open();
|
||||
string sNewKey = sKey + "_" + m_oRandom.Next(mc_nRandomMaxNumber);
|
||||
m_oAddRandomKey.m_oTast.sKey = sNewKey;
|
||||
IDbCommand oSelCommand = m_oAddRandomKey.m_oSqlCon.CreateCommand();
|
||||
m_oAddRandomKey.m_oCommand = oSelCommand;
|
||||
oSelCommand.CommandText = GetINSERTString(m_oAddRandomKey.m_oTast);
|
||||
m_oAddRandomKey.m_delegateNonQuery = new ExecuteNonQuery(oSelCommand.ExecuteNonQuery);
|
||||
m_oAddRandomKey.m_delegateNonQuery.BeginInvoke(AddRandomKeyCallback, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oAddRandomKey.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public ErrorTypes AddRandomKeyEnd(IAsyncResult ar, out TaskResultData oTast)
|
||||
{
|
||||
oTast = null;
|
||||
if (ErrorTypes.NoError == m_oAddRandomKey.m_eError)
|
||||
{
|
||||
oTast = m_oAddRandomKey.m_oTast;
|
||||
}
|
||||
return m_oAddRandomKey.m_eError;
|
||||
}
|
||||
public ErrorTypes Update(string sKey, TaskResultDataToUpdate oTast)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
sqlCon.Open();
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetUPDATEString(sKey, oTast);
|
||||
oSelCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
eErrorTypes = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public void UpdateBegin(string sKey, TaskResultDataToUpdate oTast, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oUpdate = Update;
|
||||
m_oUpdate.BeginInvoke(sKey, oTast, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes UpdateEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eErrorTypes = m_oUpdate.EndInvoke(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eErrorTypes = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public ErrorTypes Get(string sKey, out TaskResultData oTaskResultData)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.TaskResult;
|
||||
oTaskResultData = null;
|
||||
try
|
||||
{
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
sqlCon.Open();
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetSELECTString(sKey);
|
||||
using (IDataReader oReader = oSelCommand.ExecuteReader())
|
||||
{
|
||||
if (true == oReader.Read())
|
||||
{
|
||||
oTaskResultData = new TaskResultData();
|
||||
TaskResultFromReader(oTaskResultData, oReader);
|
||||
eErrorTypes = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public void GetBegin(string sKey, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
TaskResultData oTast;
|
||||
m_oGet = Get;
|
||||
m_oGet.BeginInvoke(sKey, out oTast, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes GetEnd(IAsyncResult ar, out TaskResultData oTast)
|
||||
{
|
||||
oTast = null;
|
||||
ErrorTypes eErrorTypes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eErrorTypes = m_oGet.EndInvoke(out oTast, ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eErrorTypes = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public ErrorTypes GetExpired(int nMaxCount, out List<TaskResultData> aTasts)
|
||||
{
|
||||
aTasts = null;
|
||||
ErrorTypes eErrorTypes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
sqlCon.Open();
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetSELECTExpiredTasksString(nMaxCount);
|
||||
using (IDataReader oReader = oSelCommand.ExecuteReader())
|
||||
{
|
||||
aTasts = new List<TaskResultData>();
|
||||
while (oReader.Read())
|
||||
{
|
||||
TaskResultData oTaskResultData = new TaskResultData();
|
||||
TaskResultFromReader(oTaskResultData, oReader);
|
||||
aTasts.Add(oTaskResultData);
|
||||
eErrorTypes = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public ErrorTypes GetOrCreate(string sKey, TaskResultData oDefaultTast, out TaskResultData oTaskResultData, out bool bCreate)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.TaskResult;
|
||||
oTaskResultData = null;
|
||||
bCreate = false;
|
||||
try
|
||||
{
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
sqlCon.Open();
|
||||
bool bEmptyRead = true;
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetSELECTString(sKey);
|
||||
using (IDataReader oReader = oSelCommand.ExecuteReader())
|
||||
{
|
||||
if (true == oReader.Read())
|
||||
{
|
||||
oTaskResultData = new TaskResultData();
|
||||
TaskResultFromReader(oTaskResultData, oReader);
|
||||
|
||||
bEmptyRead = false;
|
||||
bCreate = false;
|
||||
eErrorTypes = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bEmptyRead)
|
||||
{
|
||||
using (IDbCommand oAddCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oAddCommand.CommandText = GetINSERTString(oDefaultTast);
|
||||
bool bExist = false;
|
||||
try
|
||||
{
|
||||
oAddCommand.ExecuteNonQuery();
|
||||
oTaskResultData = oDefaultTast.Clone();
|
||||
eErrorTypes = ErrorTypes.NoError;
|
||||
bCreate = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
bExist = true;
|
||||
}
|
||||
if (bExist)
|
||||
{
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetSELECTString(sKey);
|
||||
using (IDataReader oReader = oSelCommand.ExecuteReader())
|
||||
{
|
||||
if (true == oReader.Read())
|
||||
{
|
||||
oTaskResultData = new TaskResultData();
|
||||
TaskResultFromReader(oTaskResultData, oReader);
|
||||
|
||||
bCreate = false;
|
||||
eErrorTypes = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public void GetOrCreateBegin(string sKey, TaskResultData oDataToAdd, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oGetOrCreate = new TransportClass(fCallback, oParam);
|
||||
m_oGetOrCreate.m_oTast = oDataToAdd;
|
||||
m_oGetOrCreate.m_bCreate = true;
|
||||
try
|
||||
{
|
||||
m_oGetOrCreate.m_oSqlCon = GetDbConnection();
|
||||
m_oGetOrCreate.m_oSqlCon.Open();
|
||||
IDbCommand oSelCommand = m_oGetOrCreate.m_oSqlCon.CreateCommand();
|
||||
oSelCommand.CommandText = GetSELECTString(sKey);
|
||||
m_oGetOrCreate.m_oCommand = oSelCommand;
|
||||
m_oGetOrCreate.m_delegateReader = new ExecuteReader(oSelCommand.ExecuteReader);
|
||||
m_oGetOrCreate.m_delegateReader.BeginInvoke(GetOrCreateCallback, null);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
public ErrorTypes GetOrCreateEnd(IAsyncResult ar, out TaskResultData oDataAdded, out bool bCreate)
|
||||
{
|
||||
bCreate = m_oGetOrCreate.m_bCreate;
|
||||
oDataAdded = null;
|
||||
if (ErrorTypes.NoError == m_oGetOrCreate.m_eError)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null != m_oGetOrCreate.m_delegateReader)
|
||||
{
|
||||
using (IDataReader oReader = m_oGetOrCreate.m_delegateReader.EndInvoke(ar))
|
||||
{
|
||||
if (true == oReader.Read())
|
||||
{
|
||||
m_oGetOrCreate.m_oTast = new TaskResultData();
|
||||
TaskResultFromReader(m_oGetOrCreate.m_oTast, oReader);
|
||||
}
|
||||
else
|
||||
m_oGetOrCreate.m_eError = ErrorTypes.TaskResult;
|
||||
}
|
||||
}
|
||||
m_oGetOrCreate.Close();
|
||||
if (null != m_oGetOrCreate.m_oTast)
|
||||
oDataAdded = m_oGetOrCreate.m_oTast.Clone();
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.Dispose();
|
||||
}
|
||||
}
|
||||
return m_oGetOrCreate.m_eError;
|
||||
}
|
||||
public ErrorTypes Remove(string sKey)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.TaskResult;
|
||||
using (IDbConnection sqlCon = GetDbConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
sqlCon.Open();
|
||||
using (IDbCommand oSelCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oSelCommand.CommandText = GetDELETEString(sKey);
|
||||
oSelCommand.ExecuteNonQuery();
|
||||
eErrorTypes = ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
public void RemoveBegin(string sKey, AsyncCallback fCallback, object oParam)
|
||||
{
|
||||
m_oRemove = Remove;
|
||||
m_oRemove.BeginInvoke(sKey, fCallback, oParam);
|
||||
}
|
||||
public ErrorTypes RemoveEnd(IAsyncResult ar)
|
||||
{
|
||||
ErrorTypes eErrorTypes = ErrorTypes.NoError;
|
||||
try
|
||||
{
|
||||
eErrorTypes = m_oRemove.EndInvoke(ar);
|
||||
}
|
||||
catch
|
||||
{
|
||||
eErrorTypes = ErrorTypes.TaskResult;
|
||||
}
|
||||
return eErrorTypes;
|
||||
}
|
||||
private void GetOrCreateCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool bEmptyRead = false;
|
||||
using (IDataReader oReader = m_oGetOrCreate.m_delegateReader.EndInvoke(ar))
|
||||
{
|
||||
if (true == oReader.Read())
|
||||
{
|
||||
m_oGetOrCreate.m_oTast = new TaskResultData();
|
||||
TaskResultFromReader(m_oGetOrCreate.m_oTast, oReader);
|
||||
}
|
||||
else
|
||||
bEmptyRead = true;
|
||||
}
|
||||
if (null != m_oGetOrCreate.m_oCommand)
|
||||
{
|
||||
m_oGetOrCreate.m_oCommand.Dispose();
|
||||
m_oGetOrCreate.m_oCommand = null;
|
||||
}
|
||||
if (bEmptyRead)
|
||||
{
|
||||
IDbCommand oSelCommand = m_oGetOrCreate.m_oSqlCon.CreateCommand();
|
||||
oSelCommand.CommandText = GetINSERTString(m_oGetOrCreate.m_oTast);
|
||||
m_oGetOrCreate.m_oCommand = oSelCommand;
|
||||
m_oGetOrCreate.m_delegateNonQuery = new ExecuteNonQuery(oSelCommand.ExecuteNonQuery);
|
||||
m_oGetOrCreate.m_delegateNonQuery.BeginInvoke(GetOrCreateCallback2, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oGetOrCreate.m_bCreate = false;
|
||||
m_oGetOrCreate.m_delegateReader = null;
|
||||
m_oGetOrCreate.FireCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
private void GetOrCreateCallback2(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool bExist = false;
|
||||
try
|
||||
{
|
||||
m_oGetOrCreate.m_delegateNonQuery.EndInvoke(ar);
|
||||
m_oGetOrCreate.m_bCreate = true;
|
||||
if (null != m_oGetOrCreate.m_oCommand)
|
||||
{
|
||||
m_oGetOrCreate.m_oCommand.Dispose();
|
||||
m_oGetOrCreate.m_oCommand = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.m_bCreate = false;
|
||||
bExist = true;
|
||||
}
|
||||
if (bExist)
|
||||
{
|
||||
IDbCommand oSelCommand = m_oGetOrCreate.m_oSqlCon.CreateCommand();
|
||||
oSelCommand.CommandText = GetSELECTString(m_oGetOrCreate.m_oTast.sKey);
|
||||
m_oGetOrCreate.m_oCommand = oSelCommand;
|
||||
m_oGetOrCreate.m_delegateReader = new ExecuteReader(oSelCommand.ExecuteReader);
|
||||
m_oGetOrCreate.m_delegateReader.BeginInvoke(m_oGetOrCreate.m_fCallback, m_oGetOrCreate.m_oParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oGetOrCreate.m_delegateReader = null;
|
||||
m_oGetOrCreate.FireCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oGetOrCreate.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
private void AddRandomKeyCallback(IAsyncResult ar)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool bExist = false;
|
||||
try
|
||||
{
|
||||
m_oAddRandomKey.m_delegateNonQuery.EndInvoke(ar);
|
||||
if (null != m_oAddRandomKey.m_oCommand)
|
||||
{
|
||||
m_oAddRandomKey.m_oCommand.Dispose();
|
||||
m_oAddRandomKey.m_oCommand = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
bExist = true;
|
||||
}
|
||||
if(bExist)
|
||||
{
|
||||
string sNewKey = m_oAddRandomKey.m_oTast.sKey + "_" + m_oRandom.Next(mc_nRandomMaxNumber);
|
||||
m_oAddRandomKey.m_oTast.sKey = sNewKey;
|
||||
IDbCommand oSelCommand = m_oAddRandomKey.m_oSqlCon.CreateCommand();
|
||||
m_oAddRandomKey.m_oCommand = oSelCommand;
|
||||
oSelCommand.CommandText = GetINSERTString(m_oAddRandomKey.m_oTast);
|
||||
m_oAddRandomKey.m_delegateNonQuery = new ExecuteNonQuery(oSelCommand.ExecuteNonQuery);
|
||||
m_oAddRandomKey.m_delegateNonQuery.BeginInvoke(AddRandomKeyCallback, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oAddRandomKey.Close();
|
||||
m_oAddRandomKey.FireCallback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_oAddRandomKey.DisposeAndCallback();
|
||||
}
|
||||
}
|
||||
private IDbConnection GetDbConnection()
|
||||
{
|
||||
var cs = ConfigurationManager.ConnectionStrings[m_sConnectionString];
|
||||
var dbProvider = System.Data.Common.DbProviderFactories.GetFactory(cs.ProviderName);
|
||||
var connection = dbProvider.CreateConnection();
|
||||
connection.ConnectionString = cs.ConnectionString;
|
||||
return connection;
|
||||
}
|
||||
private DbManager GetDbManager(string connectionStringName)
|
||||
{
|
||||
var cs = ConfigurationManager.ConnectionStrings[connectionStringName];
|
||||
if (!DbRegistry.IsDatabaseRegistered(connectionStringName))
|
||||
{
|
||||
DbRegistry.RegisterDatabase(connectionStringName, cs);
|
||||
}
|
||||
return new DbManager(connectionStringName);
|
||||
}
|
||||
private void TaskResultFromReader(TaskResultData oTaskResultData, IDataReader oReader)
|
||||
{
|
||||
oTaskResultData.sKey = Convert.ToString(oReader["tr_key"]);
|
||||
oTaskResultData.sFormat = Convert.ToString(oReader["tr_format"]);
|
||||
oTaskResultData.eStatus = (FileStatus)Convert.ToByte(oReader["tr_status"]);
|
||||
oTaskResultData.nStatusInfo = Convert.ToInt32(oReader["tr_status_info"]);
|
||||
oTaskResultData.oLastOpenDate = Convert.ToDateTime(oReader["tr_last_open_date"]);
|
||||
oTaskResultData.sTitle = Convert.ToString(oReader["tr_title"]);
|
||||
}
|
||||
private string GetINSERTString(TaskResultData oTast)
|
||||
{
|
||||
return string.Format("INSERT INTO tast_result ( tr_key, tr_format, tr_status, tr_status_info, tr_last_open_date, tr_title ) VALUES ('{0}', '{1}', '{2}' , '{3}', '{4}', '{5}');", oTast.sKey, oTast.sFormat, oTast.eStatus.ToString("d"), oTast.nStatusInfo.ToString(), DateTime.UtcNow.ToString(Constants.mc_sDateTimeFormat), Utils.MySqlEscape(oTast.sTitle, m_sConnectionString));
|
||||
}
|
||||
private string GetUPDATEString(string sKey, TaskResultDataToUpdate oTast)
|
||||
{
|
||||
List<string> aValues = new List<string>();
|
||||
if (false == string.IsNullOrEmpty(oTast.sFormat))
|
||||
aValues.Add("tr_format='" + oTast.sFormat + "'");
|
||||
if (oTast.eStatus.HasValue)
|
||||
aValues.Add("tr_status='" + oTast.eStatus.Value.ToString("d") + "'");
|
||||
if (oTast.nStatusInfo.HasValue)
|
||||
aValues.Add("tr_status_info='" + oTast.nStatusInfo.Value.ToString() + "'");
|
||||
aValues.Add("tr_last_open_date='" + DateTime.UtcNow.ToString(Constants.mc_sDateTimeFormat) + "'");
|
||||
if (false == string.IsNullOrEmpty(oTast.sTitle))
|
||||
aValues.Add("tr_title='" + Utils.MySqlEscape(oTast.sTitle, m_sConnectionString) + "'");
|
||||
return string.Format("UPDATE tast_result SET {0} WHERE tr_key='{1}';", string.Join(",", aValues.ToArray()), sKey);
|
||||
}
|
||||
private string GetSELECTString(string sKey)
|
||||
{
|
||||
return string.Format("SELECT * FROM tast_result WHERE tr_key='{0}';", sKey);
|
||||
}
|
||||
private string GetDELETEString(string sKey)
|
||||
{
|
||||
return string.Format("DELETE FROM tast_result WHERE tr_key='{0}';", sKey);
|
||||
}
|
||||
private string GetSELECTExpiredTasksString(int nMaxCount)
|
||||
{
|
||||
DateTime oDateTimeExpired = DateTime.UtcNow - TimeSpan.Parse(ConfigurationManager.AppSettings["utils.taskresult.ttl"] ?? "7.00:00:00");
|
||||
string strDateTimeExpired = oDateTimeExpired.ToString(Constants.mc_sDateTimeFormat);
|
||||
return string.Format("SELECT * FROM tast_result WHERE tr_last_open_date <= '{0}' LIMIT {1};", strDateTimeExpired, nMaxCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using ASC.Common.Data;
|
||||
|
||||
namespace FileConverterUtils2
|
||||
{
|
||||
public class FileStatistic
|
||||
{
|
||||
private string m_sConnectionString = ConfigurationManager.AppSettings["utils.filestatistic.db.connectionstring"];
|
||||
private IDbConnection GetDbConnection(string connectionStringName)
|
||||
{
|
||||
var cs = ConfigurationManager.ConnectionStrings[connectionStringName];
|
||||
var dbProvider = System.Data.Common.DbProviderFactories.GetFactory(cs.ProviderName);
|
||||
var connection = dbProvider.CreateConnection();
|
||||
connection.ConnectionString = cs.ConnectionString;
|
||||
return connection;
|
||||
}
|
||||
|
||||
private DbManager GetDbManager(string connectionStringName)
|
||||
{
|
||||
var cs = ConfigurationManager.ConnectionStrings[connectionStringName];
|
||||
if (!DbRegistry.IsDatabaseRegistered(connectionStringName))
|
||||
{
|
||||
DbRegistry.RegisterDatabase(connectionStringName, cs);
|
||||
}
|
||||
return new DbManager(connectionStringName);
|
||||
|
||||
}
|
||||
public bool insert(string sAffiliateID, string sFileName, DateTime dtTime, string sTag)
|
||||
{
|
||||
|
||||
bool bResult = true;
|
||||
string sInsertSQL = string.Format("INSERT INTO file_statistic2 (fsc_affiliate, fsc_filename, fsc_time, fsc_tag) VALUES ('{0}', '{1}', '{2}', '{3}')",
|
||||
sAffiliateID, Utils.MySqlEscape(sFileName, m_sConnectionString), dtTime.ToString(Constants.mc_sDateTimeFormat), sTag);
|
||||
|
||||
using (IDbConnection sqlCon = GetDbConnection(m_sConnectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
sqlCon.Open();
|
||||
|
||||
using (IDbCommand oInsertCommand = sqlCon.CreateCommand())
|
||||
{
|
||||
oInsertCommand.CommandText = sInsertSQL;
|
||||
oInsertCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
return bResult;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class Signature
|
||||
{
|
||||
private const double mc_dKeyDateEpsilon = 300;
|
||||
|
||||
public static string Create<T>(T obj, string secret)
|
||||
{
|
||||
var serializer = new JavaScriptSerializer();
|
||||
var str = serializer.Serialize(obj);
|
||||
var payload = GetHashBase64(str + secret) + "?" + str;
|
||||
return HttpServerUtility.UrlTokenEncode(Encoding.UTF8.GetBytes(payload));
|
||||
}
|
||||
|
||||
private static string GetHashBase64(string str)
|
||||
{
|
||||
return Convert.ToBase64String(SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(str)));
|
||||
}
|
||||
|
||||
private static string GetHashBase64MD5(string str)
|
||||
{
|
||||
return Convert.ToBase64String(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(str)));
|
||||
}
|
||||
|
||||
private static T Read<T>(string signature, string secret, bool bUseSecret)
|
||||
{
|
||||
try
|
||||
{
|
||||
var payloadParts = Encoding.UTF8.GetString(HttpServerUtility.UrlTokenDecode(signature)).Split('?');
|
||||
if (false == bUseSecret || (GetHashBase64(payloadParts[1] + secret) == payloadParts[0]) || (GetHashBase64MD5(payloadParts[1] + secret) == payloadParts[0]))
|
||||
{
|
||||
|
||||
return new JavaScriptSerializer().Deserialize<T>(payloadParts[1]);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public static ErrorTypes isAccept(string strVKey, string strCurrentKey, bool bCheckIP, string strCurrentIp)
|
||||
{
|
||||
try
|
||||
{
|
||||
string strKeyId = null;
|
||||
System.Collections.Generic.Dictionary<string, object> arrElements = null;
|
||||
ASC.Core.Billing.PaymentOffice oPaymentOffice = null;
|
||||
try
|
||||
{
|
||||
getVKeyStringParam(strVKey, ConfigurationSettings.AppSettings["keyKeyID"], out strKeyId);
|
||||
|
||||
oPaymentOffice = getPaymentOffice(strKeyId);
|
||||
var vElement = Read<object>(strVKey, oPaymentOffice.Key2, true);
|
||||
if (null == vElement)
|
||||
return ErrorTypes.VKeyEncrypt;
|
||||
arrElements = (System.Collections.Generic.Dictionary<string, object>)vElement;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return ErrorTypes.VKeyEncrypt;
|
||||
}
|
||||
object objValue = null;
|
||||
|
||||
DateTime oDateTimeNow = DateTime.UtcNow;
|
||||
|
||||
if (false == ( (oDateTimeNow - oPaymentOffice.EndDate).TotalSeconds < mc_dKeyDateEpsilon))
|
||||
return ErrorTypes.VKeyKeyExpire;
|
||||
|
||||
int nUserCount = 0;
|
||||
|
||||
arrElements.TryGetValue(ConfigurationSettings.AppSettings["keyUserCount"], out objValue);
|
||||
|
||||
if (null != objValue)
|
||||
nUserCount = (int)objValue;
|
||||
|
||||
if (nUserCount > oPaymentOffice.UsersCount)
|
||||
return ErrorTypes.VKeyUserCountExceed;
|
||||
|
||||
if (bCheckIP)
|
||||
{
|
||||
arrElements.TryGetValue(ConfigurationSettings.AppSettings["keyIp"], out objValue);
|
||||
if (null == objValue)
|
||||
return ErrorTypes.VKey;
|
||||
string strUserIp = (string)objValue;
|
||||
if (strCurrentIp != strUserIp)
|
||||
return ErrorTypes.VKey;
|
||||
}
|
||||
|
||||
arrElements.TryGetValue(ConfigurationSettings.AppSettings["keyKey"], out objValue);
|
||||
if (null == objValue)
|
||||
return ErrorTypes.VKey;
|
||||
string strKey = (string)objValue;
|
||||
|
||||
if (strCurrentKey.Length > strKey.Length)
|
||||
{
|
||||
int nIndexStartFormat = strCurrentKey.LastIndexOf(".");
|
||||
if (-1 != nIndexStartFormat)
|
||||
strCurrentKey = strCurrentKey.Substring(0, nIndexStartFormat);
|
||||
}
|
||||
|
||||
if (strKey != strCurrentKey && strKey + "_temp" != strCurrentKey)
|
||||
return ErrorTypes.VKey;
|
||||
|
||||
arrElements.TryGetValue(ConfigurationSettings.AppSettings["keyDate"], out objValue);
|
||||
if (null != objValue)
|
||||
{
|
||||
DateTime oDateTimeKey = (DateTime)objValue;
|
||||
DateTime oDateTimeKeyAddHour = oDateTimeKey;
|
||||
oDateTimeKeyAddHour = oDateTimeKeyAddHour.AddHours(double.Parse(ConfigurationSettings.AppSettings["keyDateInterval"] ?? "1", Constants.mc_oCultureInfo));
|
||||
|
||||
if ((oDateTimeKey - oDateTimeNow).TotalSeconds > mc_dKeyDateEpsilon)
|
||||
return ErrorTypes.VKeyTimeIncorrect;
|
||||
|
||||
if( mc_dKeyDateEpsilon < (oDateTimeNow - oDateTimeKeyAddHour).TotalSeconds)
|
||||
return ErrorTypes.VKeyTimeExpire;
|
||||
}
|
||||
}
|
||||
catch { return ErrorTypes.VKey; }
|
||||
return ErrorTypes.NoError;
|
||||
}
|
||||
public static void getVKeyParams(string strVKey, out bool bPaid)
|
||||
{
|
||||
bPaid = true;
|
||||
try
|
||||
{
|
||||
string strKeyId = null;
|
||||
getVKeyStringParam(strVKey, ConfigurationSettings.AppSettings["keyKeyID"], out strKeyId);
|
||||
|
||||
ASC.Core.Billing.PaymentOffice oPaymentOffice = getPaymentOffice(strKeyId);
|
||||
|
||||
var vElement = Read<object>(strVKey, oPaymentOffice.Key2, true);
|
||||
if (null == vElement)
|
||||
return;
|
||||
System.Collections.Generic.Dictionary<string, object> arrElements = (System.Collections.Generic.Dictionary<string, object>)vElement;
|
||||
object objValue = null;
|
||||
arrElements.TryGetValue(ConfigurationSettings.AppSettings["keyPaid"], out objValue);
|
||||
if (null == objValue)
|
||||
return;
|
||||
bPaid = (bool)objValue;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
public static void getVKeyStringParam(string strVKey, string strParamName, out string strParam)
|
||||
{
|
||||
strParam = null;
|
||||
try
|
||||
{
|
||||
var vElement = Read<object>(strVKey, null, false);
|
||||
if (null == vElement)
|
||||
return;
|
||||
System.Collections.Generic.Dictionary<string, object> arrElements = (System.Collections.Generic.Dictionary<string, object>)vElement;
|
||||
object objValue = null;
|
||||
arrElements.TryGetValue(strParamName, out objValue);
|
||||
if (null == objValue)
|
||||
return;
|
||||
strParam = (string)objValue;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static ASC.Core.Billing.PaymentOffice getPaymentOffice(string strKeyId)
|
||||
{
|
||||
ASC.Core.Billing.PaymentOffice oPaymentOffice = null;
|
||||
Cache oCache = HttpRuntime.Cache;
|
||||
object oCacheVal = oCache.Get(strKeyId);
|
||||
if (null == oCacheVal)
|
||||
{
|
||||
ASC.Core.Billing.BillingClient oBillingClient = new ASC.Core.Billing.BillingClient();
|
||||
oPaymentOffice = oBillingClient.GetPaymentOffice(strKeyId);
|
||||
string sWebCacheExpireSeconds = ConfigurationSettings.AppSettings["WebCacheExpireSeconds"];
|
||||
oCache.Add(strKeyId, oPaymentOffice, null, DateTime.Now.AddSeconds(int.Parse(sWebCacheExpireSeconds)), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
|
||||
}
|
||||
else
|
||||
oPaymentOffice = oCacheVal as ASC.Core.Billing.PaymentOffice;
|
||||
return oPaymentOffice;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
namespace LicenseTest
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
|
||||
this.button1.Location = new System.Drawing.Point(12, 40);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(117, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Select license file";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
|
||||
this.button2.Location = new System.Drawing.Point(136, 40);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(136, 23);
|
||||
this.button2.TabIndex = 1;
|
||||
this.button2.Text = "Select license folder";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LicenseTest
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?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=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>
|
||||
@@ -1,90 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{02FD89FC-7CFB-4269-B082-5DE063F0FC37}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LicenseTest</RootNamespace>
|
||||
<AssemblyName>LicenseTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</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>
|
||||
</Compile>
|
||||
<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" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LicenseTest
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("LicenseTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LicenseTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("666ba679-5877-43d9-9ff3-49e15e8a1ff5")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
namespace LicenseTest.Properties
|
||||
{
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.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()
|
||||
{
|
||||
}
|
||||
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LicenseTest.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
namespace LicenseTest.Properties
|
||||
{
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user