Commit a7b9b3a9 authored by agolybev's avatar agolybev

Updated application.

parent cd34405d
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6060D154-28A8-4E13-88A8-B82B02FDCA44}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DocService</RootNamespace>
<AssemblyName>DocService</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASC.Core.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>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>Bin\AWSSDK.dll</HintPath>
</Reference>
<Reference Include="Enyim.Caching, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Bin\Enyim.Caching.dll</HintPath>
</Reference>
<Reference Include="FileConverterUtils2, Version=1.0.0.131, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Bin\FileConverterUtils2.dll</HintPath>
</Reference>
<Reference Include="Ionic.Zip.Reduced, Version=1.9.1.5, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Bin\Ionic.Zip.Reduced.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Bin\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="OpenMcdf, Version=1.5.4.22637, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Bin\OpenMcdf.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<None Include="Properties\PublishProfiles\Deploy.pubxml" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="App_Code\DocServiceUtils.cs" />
<Compile Include="App_Code\ZBase32Encoder.cs" />
<Compile Include="CanvasService.ashx.cs">
<DependentUpon>CanvasService.ashx</DependentUpon>
</Compile>
<Compile Include="ConvertService.ashx.cs">
<DependentUpon>ConvertService.ashx</DependentUpon>
</Compile>
<Compile Include="fileDownloader.ashx.cs">
<DependentUpon>fileDownloader.ashx</DependentUpon>
</Compile>
<Compile Include="FileUploader.ashx.cs">
<DependentUpon>FileUploader.ashx</DependentUpon>
</Compile>
<Compile Include="FontService.ashx.cs">
<DependentUpon>FontService.ashx</DependentUpon>
</Compile>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceService.ashx.cs">
<DependentUpon>ResourceService.ashx</DependentUpon>
</Compile>
<Compile Include="TrackingService.ashx.cs">
<DependentUpon>TrackingService.ashx</DependentUpon>
</Compile>
<Compile Include="UploadService.ashx.cs">
<DependentUpon>UploadService.ashx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="CanvasService.ashx" />
<Content Include="ConvertService.ashx" />
<Content Include="fileDownloader.ashx" />
<Content Include="FileUploader.ashx" />
<Content Include="FontService.ashx" />
<Content Include="ResourceService.ashx" />
<Content Include="TrackingService.ashx" />
<Content Include="UploadService.ashx" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>54956</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:54956/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- 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>
\ No newline at end of file
<%@ WebHandler Language="C#" Class="FileUploader" %> <%@ WebHandler Language="C#" CodeBehind="FileUploader.ashx.cs" Class="DocService.FileUploader" %>
/* /*
* (c) Copyright Ascensio System SIA 2010-2015 * (c) Copyright Ascensio System SIA 2010-2015
* *
...@@ -32,174 +32,3 @@ ...@@ -32,174 +32,3 @@
*/ */
using System;
using System.Net;
using System.Configuration;
using System.Web;
using System.IO;
using System.Xml;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using System.Collections.Specialized;
using FileConverterUtils2;
using log4net;
public class FileUploader : IHttpAsyncHandler
{
private readonly ILog _log = LogManager.GetLogger(typeof(FileUploader));
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
{
bool bStartAsync = false;
ErrorTypes eError = ErrorTypes.Unknown;
try
{
_log.Info("Starting process request...");
_log.Info(context.Request.QueryString.ToString());
string vKey = context.Request.QueryString["vkey"];
string sKey = context.Request.QueryString["key"];
if (null != sKey && false == string.IsNullOrEmpty(sKey))
{
eError = ErrorTypes.NoError;
if (ErrorTypes.NoError == eError)
{
bStartAsync = true;
Storage oStorage = new Storage();
string sTempKey = "temp_" + sKey;
string sFilename = sKey + ".tmp";
string sPath = sTempKey + "/" + sFilename;
AsyncContextReadOperation asynch = new AsyncContextReadOperation();
TransportClass oTransportClass = new TransportClass(context, cb, oStorage, asynch, sPath, sTempKey, sFilename);
asynch.ReadContextBegin(context.Request.InputStream, ReadContextCallback, oTransportClass);
}
}
}
catch(Exception e)
{
eError = ErrorTypes.Unknown;
_log.Error(context.Request.QueryString.ToString());
_log.Error("Exeption: ", e);
}
finally
{
if (ErrorTypes.NoError != eError)
writeXml(context, null, null, null, eError);
}
TransportClass oTempTransportClass = new TransportClass(context, cb, null, null, null, null, null);
if (false == bStartAsync)
cb(new AsyncOperationData(oTempTransportClass));
return new AsyncOperationData(oTempTransportClass);
}
public void EndProcessRequest(IAsyncResult result)
{
}
public void ProcessRequest(HttpContext context)
{
throw new InvalidOperationException();
}
public bool IsReusable {
get {
return false;
}
}
private void ReadContextCallback(IAsyncResult result)
{
TransportClass oTransportClass = result.AsyncState as TransportClass;
try
{
oTransportClass.m_oAsyncContextRead.ReadContextEnd(result);
oTransportClass.m_oAsyncContextRead.m_aOutput.Position = 0;
oTransportClass.m_oStorage.WriteFileBegin(oTransportClass.m_sPath, oTransportClass.m_oAsyncContextRead.m_aOutput, WriteFileCallback, oTransportClass);
}
catch
{
writeXml(oTransportClass.m_oContext, null, null, null, ErrorTypes.StorageWrite);
oTransportClass.m_oCallback(new AsyncOperationData(oTransportClass));
}
}
private void WriteFileCallback(IAsyncResult result)
{
TransportClass oTransportClass = result.AsyncState as TransportClass;
try
{
int nWriteBytes;
ErrorTypes eError = oTransportClass.m_oStorage.WriteFileEnd(result, out nWriteBytes);
if (ErrorTypes.NoError == eError)
{
string sSiteUrl = UrlBuilder.UrlWithoutPath(oTransportClass.m_oContext.Request);
string sFileUrl = sSiteUrl + Constants.mc_sResourceServiceUrlRel + HttpUtility.UrlEncode(oTransportClass.m_sPath) + "&nocache=true" + "&deletepath=" + HttpUtility.UrlEncode(oTransportClass.m_sDeletePath) + "&filename=" + HttpUtility.UrlEncode(oTransportClass.m_sFilename);
writeXml(oTransportClass.m_oContext, sFileUrl, "100", true, null);
}
else
writeXml(oTransportClass.m_oContext, null, null, null, eError);
oTransportClass.m_oCallback(new AsyncOperationData(oTransportClass));
}
catch
{
writeXml(oTransportClass.m_oContext, null, null, null, ErrorTypes.StorageWrite);
oTransportClass.m_oCallback(new AsyncOperationData(oTransportClass));
}
}
private void writeXml(HttpContext context, string strFileUrl, string strPercent, bool? bIsEndConvert, ErrorTypes? eError)
{
XmlDocument oDoc = new XmlDocument();
XmlElement oRootElem = oDoc.CreateElement("FileResult");
oDoc.AppendChild(oRootElem);
if (null != strFileUrl)
{
XmlElement oFileUrl = oDoc.CreateElement("FileUrl");
oFileUrl.InnerText = strFileUrl;
oRootElem.AppendChild(oFileUrl);
}
if (null != strPercent)
{
XmlElement oPercent = oDoc.CreateElement("Percent");
oPercent.InnerText = strPercent;
oRootElem.AppendChild(oPercent);
}
if (bIsEndConvert.HasValue)
{
XmlElement oEndConvert = oDoc.CreateElement("EndConvert");
oEndConvert.InnerText = bIsEndConvert.Value.ToString();
oRootElem.AppendChild(oEndConvert);
}
if (eError.HasValue)
{
XmlElement oError = oDoc.CreateElement("Error");
oError.InnerText = Utils.mapAscServerErrorToOldError(eError.Value).ToString();
oRootElem.AppendChild(oError);
}
oDoc.Save(context.Response.Output);
context.Response.ContentType = "text/xml";
}
private class TransportClass
{
public HttpContext m_oContext;
public AsyncCallback m_oCallback;
public Storage m_oStorage;
public AsyncContextReadOperation m_oAsyncContextRead;
public string m_sPath;
public string m_sDeletePath;
public string m_sFilename;
public TransportClass(HttpContext oContext, AsyncCallback oCallback, Storage oStorage, AsyncContextReadOperation oAsyncContextRead, string sPath, string sDeletePath, string sFilename)
{
m_oContext = oContext;
m_oCallback = oCallback;
m_oStorage = oStorage;
m_oAsyncContextRead = oAsyncContextRead;
m_sPath = sPath;
m_sDeletePath = sDeletePath;
m_sFilename = sFilename;
}
}
}
\ No newline at end of file
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* 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.Net;
using System.Configuration;
using System.Web;
using System.IO;
using System.Xml;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using System.Collections.Specialized;
using FileConverterUtils2;
using log4net;
namespace DocService
{
public class FileUploader : IHttpAsyncHandler
{
private readonly ILog _log = LogManager.GetLogger(typeof(FileUploader));
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
{
bool bStartAsync = false;
ErrorTypes eError = ErrorTypes.Unknown;
try
{
_log.Info("Starting process request...");
_log.Info(context.Request.QueryString.ToString());
string vKey = context.Request.QueryString["vkey"];
string sKey = context.Request.QueryString["key"];
if (null != sKey && false == string.IsNullOrEmpty(sKey))
{
eError = ErrorTypes.NoError;
if (ErrorTypes.NoError == eError)
{
bStartAsync = true;
Storage oStorage = new Storage();
string sTempKey = "temp_" + sKey;
string sFilename = sKey + ".tmp";
string sPath = sTempKey + "/" + sFilename;
AsyncContextReadOperation asynch = new AsyncContextReadOperation();
TransportClass oTransportClass = new TransportClass(context, cb, oStorage, asynch, sPath, sTempKey, sFilename);
asynch.ReadContextBegin(context.Request.InputStream, ReadContextCallback, oTransportClass);
}
}
}
catch(Exception e)
{
eError = ErrorTypes.Unknown;
_log.Error(context.Request.QueryString.ToString());
_log.Error("Exeption: ", e);
}
finally
{
if (ErrorTypes.NoError != eError)
writeXml(context, null, null, null, eError);
}
TransportClass oTempTransportClass = new TransportClass(context, cb, null, null, null, null, null);
if (false == bStartAsync)
cb(new AsyncOperationData(oTempTransportClass));
return new AsyncOperationData(oTempTransportClass);
}
public void EndProcessRequest(IAsyncResult result)
{
}
public void ProcessRequest(HttpContext context)
{
throw new InvalidOperationException();
}
public bool IsReusable {
get {
return false;
}
}
private void ReadContextCallback(IAsyncResult result)
{
TransportClass oTransportClass = result.AsyncState as TransportClass;
try
{
oTransportClass.m_oAsyncContextRead.ReadContextEnd(result);
oTransportClass.m_oAsyncContextRead.m_aOutput.Position = 0;
oTransportClass.m_oStorage.WriteFileBegin(oTransportClass.m_sPath, oTransportClass.m_oAsyncContextRead.m_aOutput, WriteFileCallback, oTransportClass);
}
catch
{
writeXml(oTransportClass.m_oContext, null, null, null, ErrorTypes.StorageWrite);
oTransportClass.m_oCallback(new AsyncOperationData(oTransportClass));
}
}
private void WriteFileCallback(IAsyncResult result)
{
TransportClass oTransportClass = result.AsyncState as TransportClass;
try
{
int nWriteBytes;
ErrorTypes eError = oTransportClass.m_oStorage.WriteFileEnd(result, out nWriteBytes);
if (ErrorTypes.NoError == eError)
{
string sSiteUrl = UrlBuilder.UrlWithoutPath(oTransportClass.m_oContext.Request);
string sFileUrl = sSiteUrl + Constants.mc_sResourceServiceUrlRel + HttpUtility.UrlEncode(oTransportClass.m_sPath) + "&nocache=true" + "&deletepath=" + HttpUtility.UrlEncode(oTransportClass.m_sDeletePath) + "&filename=" + HttpUtility.UrlEncode(oTransportClass.m_sFilename);
writeXml(oTransportClass.m_oContext, sFileUrl, "100", true, null);
}
else
writeXml(oTransportClass.m_oContext, null, null, null, eError);
oTransportClass.m_oCallback(new AsyncOperationData(oTransportClass));
}
catch
{
writeXml(oTransportClass.m_oContext, null, null, null, ErrorTypes.StorageWrite);
oTransportClass.m_oCallback(new AsyncOperationData(oTransportClass));
}
}
private void writeXml(HttpContext context, string strFileUrl, string strPercent, bool? bIsEndConvert, ErrorTypes? eError)
{
XmlDocument oDoc = new XmlDocument();
XmlElement oRootElem = oDoc.CreateElement("FileResult");
oDoc.AppendChild(oRootElem);
if (null != strFileUrl)
{
XmlElement oFileUrl = oDoc.CreateElement("FileUrl");
oFileUrl.InnerText = strFileUrl;
oRootElem.AppendChild(oFileUrl);
}
if (null != strPercent)
{
XmlElement oPercent = oDoc.CreateElement("Percent");
oPercent.InnerText = strPercent;
oRootElem.AppendChild(oPercent);
}
if (bIsEndConvert.HasValue)
{
XmlElement oEndConvert = oDoc.CreateElement("EndConvert");
oEndConvert.InnerText = bIsEndConvert.Value.ToString();
oRootElem.AppendChild(oEndConvert);
}
if (eError.HasValue)
{
XmlElement oError = oDoc.CreateElement("Error");
oError.InnerText = Utils.mapAscServerErrorToOldError(eError.Value).ToString();
oRootElem.AppendChild(oError);
}
oDoc.Save(context.Response.Output);
context.Response.ContentType = "text/xml";
}
private class TransportClass
{
public HttpContext m_oContext;
public AsyncCallback m_oCallback;
public Storage m_oStorage;
public AsyncContextReadOperation m_oAsyncContextRead;
public string m_sPath;
public string m_sDeletePath;
public string m_sFilename;
public TransportClass(HttpContext oContext, AsyncCallback oCallback, Storage oStorage, AsyncContextReadOperation oAsyncContextRead, string sPath, string sDeletePath, string sFilename)
{
m_oContext = oContext;
m_oCallback = oCallback;
m_oStorage = oStorage;
m_oAsyncContextRead = oAsyncContextRead;
m_sPath = sPath;
m_sDeletePath = sDeletePath;
m_sFilename = sFilename;
}
}
}
}
\ No newline at end of file
<%@ WebHandler Language="C#" CodeBehind="App_Code/FontService.ashx.cs" Class="FontService" %> <%@ WebHandler Language="C#" CodeBehind="FontService.ashx.cs" Class="DocService.FontService" %>
/* /*
* (c) Copyright Ascensio System SIA 2010-2015 * (c) Copyright Ascensio System SIA 2010-2015
* *
...@@ -31,3 +31,4 @@ ...@@ -31,3 +31,4 @@
* *
*/ */
...@@ -45,6 +45,8 @@ using FileConverterUtils2; ...@@ -45,6 +45,8 @@ using FileConverterUtils2;
using log4net; using log4net;
namespace DocService
{
public class FontServiceRoute : IRouteHandler public class FontServiceRoute : IRouteHandler
{ {
public IHttpHandler GetHttpHandler(RequestContext requestContext) public IHttpHandler GetHttpHandler(RequestContext requestContext)
...@@ -358,4 +360,5 @@ public class FontService : IHttpAsyncHandler ...@@ -358,4 +360,5 @@ public class FontService : IHttpAsyncHandler
m_sFontNameDecoded = sFontNameDecoded; m_sFontNameDecoded = sFontNameDecoded;
} }
} }
}
} }
\ No newline at end of file
<%@ Application Language="C#" %> <%@ Application Codebehind="Global.asax.cs" Inherits="DocService.Global" Language="C#" %>
<%@ Assembly Name="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading"%>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Web.Routing" %>
<%@ Import Namespace="log4net.Config" %>
<%@ Import Namespace="FileConverterUtils2" %>
<script runat="server">
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* 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
*
*/
static public Object lockThis = new Object();
public static void RegisterRoutes(RouteCollection routes)
{
string sRoute = ConfigurationSettings.AppSettings["fonts.route"] ?? "fonts/";
routes.Add(new Route(sRoute + "native/{fontname}", new FontServiceRoute()));
routes.Add(new Route(sRoute + "js/{fontname}", new FontServiceRoute()));
routes.Add(new Route(sRoute + "odttf/{fontname}", new FontServiceRoute()));
}
void Application_Start(object sender, EventArgs e)
{
System.Diagnostics.Debug.Print("Application_Start() fired!" + sender.ToString());
try
{
XmlConfigurator.Configure();
}
catch(Exception ex)
{
}
RegisterRoutes(RouteTable.Routes);
}
void Application_End(object sender, EventArgs e)
{
System.Diagnostics.Debug.Print("Application_End() fired!" + sender.ToString());
}
void Application_Error(object sender, EventArgs e)
{
}
void Session_Start(object sender, EventArgs e)
{
}
void Session_End(object sender, EventArgs e)
{
}
void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
{
}
void Application_BeginRequest(Object sender, EventArgs e)
{
}
</script>
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* 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.Threading;
using System.Collections.Generic;
using System.Web.Routing;
using log4net.Config;
using FileConverterUtils2;
using System.Configuration;
using System.Web;
namespace DocService
{
public class Global : System.Web.HttpApplication
{
static public Object lockThis = new Object();
public static void RegisterRoutes(RouteCollection routes)
{
string sRoute = ConfigurationSettings.AppSettings["fonts.route"] ?? "fonts/";
routes.Add(new Route(sRoute + "native/{fontname}", new FontServiceRoute()));
routes.Add(new Route(sRoute + "js/{fontname}", new FontServiceRoute()));
routes.Add(new Route(sRoute + "odttf/{fontname}", new FontServiceRoute()));
}
void Application_Start(object sender, EventArgs e)
{
System.Diagnostics.Debug.Print("Application_Start() fired!" + sender.ToString());
try
{
XmlConfigurator.Configure();
}
catch(Exception ex)
{
}
RegisterRoutes(RouteTable.Routes);
}
void Application_End(object sender, EventArgs e)
{
System.Diagnostics.Debug.Print("Application_End() fired!" + sender.ToString());
}
void Application_Error(object sender, EventArgs e)
{
}
void Session_Start(object sender, EventArgs e)
{
}
void Session_End(object sender, EventArgs e)
{
}
void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
{
}
void Application_BeginRequest(Object sender, EventArgs e)
{
}
}
}
\ No newline at end of file
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* 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("DocService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DocService")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("868e7a06-b2c6-4e64-b900-b63bc55098ba")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
This diff is collapsed.
This diff is collapsed.
<%@ WebHandler Language="C#" Class="TrackingService" %> <%@ WebHandler Language="C#" CodeBehind="TrackingService.ashx.cs" Class="DocService.TrackingService" %>
/* /*
* (c) Copyright Ascensio System SIA 2010-2015 * (c) Copyright Ascensio System SIA 2010-2015
* *
...@@ -32,24 +32,3 @@ ...@@ -32,24 +32,3 @@
*/ */
using System;
using System.Web;
using System.Xml;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using FileConverterUtils2;
public class TrackingService : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
}
public bool IsReusable {
get {
return false;
}
}
}
\ No newline at end of file
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* 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.Web;
using System.Xml;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using FileConverterUtils2;
namespace DocService
{
public class TrackingService : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
}
public bool IsReusable {
get {
return false;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<%@ WebHandler Language="C#" Class="fileDownloader" %> <%@ WebHandler Language="C#" CodeBehind="fileDownloader.ashx.cs" Class="DocService.fileDownloader" %>
/* /*
* (c) Copyright Ascensio System SIA 2010-2015 * (c) Copyright Ascensio System SIA 2010-2015
* *
...@@ -32,75 +32,3 @@ ...@@ -32,75 +32,3 @@
*/ */
using System;
using System.Net;
using System.Configuration;
using System.Web;
using System.IO;
using System.Text;
public class fileDownloader : IHttpHandler {
public void ProcessRequest (HttpContext context) {
try
{
System.IO.FileInfo file = new System.IO.FileInfo(Convert.ToString(context.Server.MapPath(context.Server.UrlDecode("~" + context.Request.QueryString[0]))));
string sOutputFilename = null;
if (context.Request.QueryString.Count > 1)
sOutputFilename = context.Server.UrlDecode(context.Request.QueryString[1]);
if (string.IsNullOrEmpty(sOutputFilename))
sOutputFilename = file.Name;
if (!file.Exists)
return;
context.Response.Clear();
context.Response.ContentType = "application/octet-stream";
if (context.Request.ServerVariables.Get("HTTP_USER_AGENT").Contains("MSIE"))
context.Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + context.Server.UrlEncode(sOutputFilename) + "\"");
else
context.Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + sOutputFilename + "\"");
context.Response.AppendHeader("Content-Length", file.Length.ToString());
context.Response.TransmitFile(file.FullName);
context.Response.Flush();
context.ApplicationInstance.CompleteRequest();
}
catch(Exception){}
}
public bool IsReusable {
get {
return false;
}
}
public static string GetIP4Address()
{
string IP4Address = String.Empty;
foreach (IPAddress IPA in Dns.GetHostAddresses(HttpContext.Current.Request.UserHostAddress))
{
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;
}
}
\ No newline at end of file
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* 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.Net;
using System.Configuration;
using System.Web;
using System.IO;
using System.Text;
namespace DocService
{
public class fileDownloader : IHttpHandler {
public void ProcessRequest (HttpContext context) {
try
{
System.IO.FileInfo file = new System.IO.FileInfo(Convert.ToString(context.Server.MapPath(context.Server.UrlDecode("~" + context.Request.QueryString[0]))));
string sOutputFilename = null;
if (context.Request.QueryString.Count > 1)
sOutputFilename = context.Server.UrlDecode(context.Request.QueryString[1]);
if (string.IsNullOrEmpty(sOutputFilename))
sOutputFilename = file.Name;
if (!file.Exists)
return;
context.Response.Clear();
context.Response.ContentType = "application/octet-stream";
if (context.Request.ServerVariables.Get("HTTP_USER_AGENT").Contains("MSIE"))
context.Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + context.Server.UrlEncode(sOutputFilename) + "\"");
else
context.Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + sOutputFilename + "\"");
context.Response.AppendHeader("Content-Length", file.Length.ToString());
context.Response.TransmitFile(file.FullName);
context.Response.Flush();
context.ApplicationInstance.CompleteRequest();
}
catch(Exception){}
}
public bool IsReusable {
get {
return false;
}
}
public static string GetIP4Address()
{
string IP4Address = String.Empty;
foreach (IPAddress IPA in Dns.GetHostAddresses(HttpContext.Current.Request.UserHostAddress))
{
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;
}
}
}
\ No newline at end of file
...@@ -135,11 +135,11 @@ ...@@ -135,11 +135,11 @@
</system.web> </system.web>
<system.codedom> <system.codedom>
<compilers> <compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/d:OPEN_SOURCE"> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0" /> <providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" /> <providerOption name="WarnAsError" value="false" />
</compiler> </compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/d:OPEN_SOURCE"> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0" /> <providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="OptionInfer" value="true" /> <providerOption name="OptionInfer" value="true" />
<providerOption name="WarnAsError" value="false" /> <providerOption name="WarnAsError" value="false" />
......
This is a Portuguese (Portugal) dictionary for Hunspell:
Copyright (C) 2006-2009 Josй Joгo de Almeida <jj@di.uminho.pt> ,
Rui Vilela <ruivilela@di.uminho.pt> ,
Alberto Simхes <ambs@di.uminho.pt>
Dep. Informбtica, Universidade do Minho
Portugal
All dictionary files and associated programs are currently covered by
the (GPL/LGPL/MPL), by this order. See also COPYING file for more
details, if available.
Regarding license versions:
1. GPL Version 2
2. LGPL Version 2.1
3. MPL Version 1.1
To install : Find a suitable application that uses myspell
dictionaries like openoffice, or hunspell terminal aplication. Use
the program dictionary application (if it has) for installing the
dictionaries. For openoffice, you should make sure that the
dictionary.lst file has the following line: DICT pt PT pt_PT
Automatic instalation: You can automatically download our dictionary
using the available plugins, either from mozilla, or OpenOffice. See
our site for details.
Latest versions, suggestions, automatic install, informations at
http://natura.di.uminho.pt/
#This readme will change on next release
% Ukrainian hyphenation patterns.
% Copyright 1998-2002 Maksym Polyakov.
% Released 2002/12/19.
% Please, send bug reports via e-mail:
% polyama@auburn.edu
%
% This is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This file is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
HYPH uk UA hyph_uk_UA
This is Ukrainian thesaurus for OpenOffice.org version 1.6.0.
This thesaurus is based on:
П. М. Деркач, Короткий словник синонімів української мови, Радянська школа, Київ, 1960
С. Караванський, Пошук українського слова
Copyright (C) 2009
Andriy Rysin
This thesaurus is licensed under GPL, LGPL and MPL (Mozilla Public License) licenses.
This is Ukrainian spelling dictionary for myspell & hunspell version 1.8.0
This dictionary based on spell-uk project http://ispell-uk.sourceforge.net/
Copyright (C) 1999
Vladimir Yakovchuk
Oleg Podgurniy
Copyright (C) 2001
Dmytro Kovalyov
Maksym Polyakov
Andriy Rysin
Copyright (C) 2002
Valentyn Solomko
Volodymyr M. Lisivka
Copyright (C) 2005
Andriy Rysin
Eugeniy Meshcheryakov
Dmytro Kovalyov
Copyright (C) 2006-2013
Andriy Rysin
This dictionary is licensed under GPL 2.0 or above, LGPL 2.1 or above and MPL (Mozilla Public License) 1.1 licenses.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Module variables
var nativeNodeHun = require('./../src/build/Release/nodehun'),
os = require('os'),
fs = require('fs'),
path = require('path'),
dictionariesPath = (function(){
var dir = __dirname.split(path.sep);
dir.pop();
dir.push('dictionaries');
return dir.join(path.sep) + path.sep;
}()),
nativeKeys = Object.keys(nativeNodeHun),
i = nativeKeys.length,
privateRe = /^_/,
dictionaries = [],
key;
// Initializations that need to take place
nativeNodeHun._setDictionariesPath(dictionariesPath);
// Set all public methods to be exposed
while(i--){
key = nativeKeys[i];
if(!privateRe.test(key))
exports[key] = nativeNodeHun[key];
}
/*--exports--
name:addDictionaryPerm
description: adds a new dictionary to the dictionaries path.
The last two parameters are optional. The third parameter
specifies another dictionary on which to base this new
dictionary on. The fourth parameter, when false, which is
default, will copy the affixes and words into the new dictionary
folder; when true, only the affixes will be copied.
@param{string}
@param{function}
@param{string=}
@param{bool=}
*/
exports.addDictionaryPerm = function(dictionary,callback,base,notDict){
var dictPath = dictionariesPath + dictionary,
affPath = dictPath + path.sep + dictionary + '.aff',
dicPath = dictPath + path.sep + dictionary + '.dic',
oneDone = false,
error = false,
baseAff,baseDic;
// Make the dictionary directory
fs.mkdir(dictPath,function(err){
// If the directory already exists, error out.
if(err){
callback(err,false);
}
else{
//If a base dictionary was indicated let's read it
if(typeof base === "string"){
baseAff = dictionariesPath + base + path.sep + base + '.aff';
fs.readFile(baseAff,function(err,abuf){
if(err){
error = true;
callback(err,false);
}
else{
fs.open(affPath,'w',function(err,fd){
if(err && !error){
error = true
callback(err,false);
}
else if(!error){
fs.write(fd,abuf,0,abuf.length,null,function(err,written){
if(!error){
if(err){
callback(err,false);
error = true;
}
else{
if(oneDone) callback(null,true);
oneDone = true;
}
}
});
}
});
}
});
}
else{
fs.open(affPath,'w',function(err,fd){
if(err && !error){
callback(err,false);
}
else if(!error){
fs.write(fd,new Buffer('0\n'),0,2,null,function(err,written){
if(!error){
if(err){
callback(err,false);
error = true;
}
else{
if(oneDone) callback(null,true);
oneDone = true;
}
}
})
}
});
}
if(typeof base === "string" && !notDict){
baseDic = dictionariesPath + base + path.sep + base + '.dic';
fs.readFile(baseDic,function(err,abuf){
if(err && !error){
error = true;
callback(err);
}
else if(!error){
fs.open(dicPath,'w',function(err,fd){
if(err && !error){
callback(err,false);
}
else{
fs.write(fd,abuf,0,abuf.length,null,function(err,written){
if(!error){
if(err){
callback(err,false);
error = true;
}
else{
if(oneDone) callback(null,true);
oneDone = true;
}
}
})
}
});
}
});
}
else{
fs.open(dicPath,'w',function(err,fd){
if(err && !error){
callback(err,false);
}
else if(!error){
fs.write(fd,new Buffer('0\n'),0,2,null,function(err,written){
if(!error){
if(err){
callback(err,false);
error = true;
}
else{
if(oneDone) callback(null,true);
oneDone = true;
}
}
})
}
});
}
}
});
};
\ No newline at end of file
Copyright (c) 2012 Nathan Sweet, DataSphere Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
"name": "nodehun",
"version": "0.0.5",
"description": "The Hunspell binding for nodejs that exposes as much of hunspell as possible and also adds new features.",
"main": "lib/index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/nathanjsweet/nodehun.git"
},
"keywords": [
"spellcheck",
"spell",
"hunspell"
],
"author": {
"name": "Nathan Sweet"
},
"license": "MIT",
"readme": "Nodehun\n=======\n\nInstallation\n------------\nNodehun has no \"node_module\" dependencies (yet), so it can either be installed via npm or simply checked out of git. You'll need [node-gyp](https://github.com/TooTallNate/node-gyp) to build. Nodehun should work on Windows or Unix. You'll also need to make sure that libuv source\ncode is on your system. Usually having node installed is enough, but there are weird cases.\n\t\n\tnpm install nodehun\n\tcd src\n\tnode-gyp configure\n\tnode-gyp build\n\t\n\nIntroduction\n------------\nYes there are already two nodejs spell checkers based of off hunspell, but one doesn't seem to even be supported anymore, and the other seems to only support simple spelling suggestions. Nodehun aims to expose as much of hunspell's functionality as possible in an easy to understand and maintain way, while also offering additional functionality not even present in hunspell.\n\nSpell Suggest and Initialization, directory based\n-------------------------------------------------\nInitializing nodehun is very easy, it will automatically find the dictionary you are looking for as long as it is inside the dictionaries folder (nodehun ships with US english and Canadian English, but tons of languages are available for free at [open office](http://extensions.services.openoffice.org/dictionary), you should be able to just drop any of open office's dictionary folders into nodehun's dictionary folder and it should automatically work, see the readme file in the dictionaries folder for more directions). From initialization there are only a few built in objects that come with nodehun, most of the functionality you will use are methods in the built in object \"Dictionary\". Simple spell suggest is very easy.\n\t \n\tvar nodehun = require('nodehun'),\n\t USDictionary = new nodehun.Dictionary('en_US');\n\t\t\n\tUSDictionary.spellSuggest('color',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"color\" is a defined word in the US English dictionary\n\t\t// the output will be: true, null\n\t});\n\t\n\tUSDictionary.spellSuggest('calor',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"calor\" is not a defined word in the US English dictionary\n\t\t// the output will be: false, \"carol\"\n\t});\n\t\nSpell Suggest and Initialization, buffer based.\n-------------------------------------------------\nAnother option for initializing a nodehun dictionary is to pass the raw string output of both the affix and dictionary files of a particular language. This allows you to use an alternate data-store than the servers file system. Please do not actually use `readFileSync`.\n\t \n\tvar nodehun = require('nodehun'),\n\t fs = require('fs'),\n\t USDictionary = new nodehun.Dictionary(fs.readFileSync('./en_US.aff').toString(),fs.readFileSync('./en_US.dic').toString());\n\t\t\n\tUSDictionary.spellSuggest('color',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"color\" is a defined word in the US English dictionary\n\t\t// the output will be: true, null\n\t});\n\t\n\tUSDictionary.spellSuggest('calor',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"calor\" is not a defined word in the US English dictionary\n\t\t// the output will be: false, \"carol\"\n\t});\n\t\nSpell Suggestions\n-----------------\nNodehun also offers a method that returns an array of words that could possibly match a misspelled word, ordered by most likely to be correct.\n\t\n\tvar nodehun = require('nodehun'),\n\t\tUSDictionary = new nodehun.Dictionary('en_US');\n\t\n\tUSDictionary.spellSuggestions('color',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"color\" is a defined word in the US English dictionary\n\t\t// the output will be: true, []\n\t});\n\n\tUSDictionary.spellSuggest('calor',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"calor\" is not a defined word in the US English dictionary\n\t\t// the output will be: false, [ 'carol','valor','color','cal or','cal-or','caloric','calorie']\n\t});\n\t\nAdd Dictionary\n--------------\nNodehun also can add another dictionary on top of an existing dictionary object at runtime (this means it is not permanent) in order to merge two dictionaries.\n\t\n\tvar nodehun = require('nodehun'),\n\t\tUSDictionary = new nodehun.Dictionary('en_US');\n\t\n\tUSDictionary.spellSuggest('colour',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"colour\" is not a defined word in the US English dictionary\n\t\t// the output will be: false, \"color\"\n\t});\n\t\n\tUSDictionary.addDictionary('en_CA',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because the Canadian English dictionary exists,\n\t\t// the output will be: true, 'en_CA'\n\t\tUSDictionary.spellSuggest('colour',function(a,b){\n\t\t\tconsole.log(a,b);\n\t\t\t// because \"colour\" is a defined word in the Canadian English dictionary\n\t\t\t// the output will be: true, null\n\t\t});\n\t\t\n\t});\n\t\nAdd Dictionary, buffer based\n----------------------------\nSimilar to the alternate means of initializing a nodehun dictionary you can also add a dictionary to an existing one with a raw string, even if the original dictionary wasn't initialized that way. NOTICE: the second argument is now the boolean value `true`, which indicates that the string being passed is a dictionary; if the value was `false` then it would treat the first argument as a path. The callback can be either the 2nd or 3rd argument, if it is the second argument the function will assume you've passed a \"path\" string. Once again, please do not actually use `readFileSync`.\n\t\n\tvar nodehun = require('nodehun'),\n\t fs = require('fs'),\t \n\t USDictionary = new nodehun.Dictionary('en_US');\n\t\n\tUSDictionary.spellSuggest('colour',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"colour\" is not a defined word in the US English dictionary\n\t\t// the output will be: false, \"color\"\n\t});\n\t\n\tUSDictionary.addDictionary(fs.readFileSync('./en_CA.dic').toString(),true,function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because the Canadian English dictionary exists,\n\t\t// the output will be: true, 'en_CA'\n\t\tUSDictionary.spellSuggest('colour',function(a,b){\n\t\t\tconsole.log(a,b);\n\t\t\t// because \"colour\" is a defined word in the Canadian English dictionary\n\t\t\t// the output will be: true, null\n\t\t});\n\t\t\n\t});\n\t\n\nAdd Word\n--------\nNodehun can also add a single word to a dictionary at runtime (this means it is not permanent) in order to have a custom runtime dictionary. If you know anything about Hunspell you can also add flags to the word.\n\t\n\tvar nodehun = require('nodehun'),\n\t\tUSDictionary = new nodehun.Dictionary('en_US');\n\t\n\tUSDictionary.spellSuggest('colour',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"colour\" is not a defined word in the US English dictionary\n\t\t// the output will be: false, \"color\"\n\t});\n\t\n\tUSDictionary.addWord('colour',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// if the method succeeded then\n\t\t// the output will be: true, 'colour'\n\t\tUSDictionary.spellSuggest('colour',function(a,b){\n\t\t\tconsole.log(a,b);\n\t\t\t// because \"colour\" has been added to the US dictionary object.\n\t\t\t// the output will be: true, null\n\t\t});\n\t\t\n\t});\n\t\nRemove Word\n-----------\nNodehun can also remove a single word from a dictionary at runtime (this means it is not permanent) in order to have a custom runtime dictionary. If you know anything about Hunspell this method will ignore flags and just strip words that match.\n\t\n\tvar nodehun = require('nodehun'),\n\t\tUSDictionary = new nodehun.Dictionary('en_US');\n\t\n\tUSDictionary.spellSuggest('color',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// because \"color\" is a defined word in the US English dictionary\n\t\t// the output will be: true, null\n\t});\n\t\n\tUSDictionary.removeWord('color',function(a,b){\n\t\tconsole.log(a,b);\n\t\t// if the method succeeded then\n\t\t// the output will be: true, 'color'\n\t\tUSDictionary.spellSuggest('color',function(a,b){\n\t\t\tconsole.log(a,b);\n\t\t\t// because \"color\" has been removed from the US dictionary object.\n\t\t\t// the output will be: false, \"colors\"\n\t\t\t// note that plurals are considered separte words.\n\t\t});\n\t\t\n\t});\n\t\nAdd Dictionary Permanently and Add Word Permanently\n---------------------------------------------------\nI have deprecated and scrapped these methods as they really violate good design philosophy of a well written node module. These methods can both be easily replicated using node itself. I am trying to move nodehun away from needing files at all, as they are a poor data-store for a distributed system.",
"readmeFilename": "readme.md",
"bugs": {
"url": "https://github.com/nathanjsweet/nodehun/issues"
},
"_id": "nodehun@0.0.5",
"_from": "nodehun@"
}
Nodehun
=======
Installation
------------
Nodehun has no "node_module" dependencies (yet), so it can either be installed via npm or simply checked out of git. You'll need [node-gyp](https://github.com/TooTallNate/node-gyp) to build. Nodehun should work on Windows or Unix. You'll also need to make sure that libuv source
code is on your system. Usually having node installed is enough, but there are weird cases.
npm install nodehun
cd src
node-gyp configure
node-gyp build
Introduction
------------
Yes there are already two nodejs spell checkers based of off hunspell, but one doesn't seem to even be supported anymore, and the other seems to only support simple spelling suggestions. Nodehun aims to expose as much of hunspell's functionality as possible in an easy to understand and maintain way, while also offering additional functionality not even present in hunspell.
Spell Suggest and Initialization, directory based
-------------------------------------------------
Initializing nodehun is very easy, it will automatically find the dictionary you are looking for as long as it is inside the dictionaries folder (nodehun ships with US english and Canadian English, but tons of languages are available for free at [open office](http://extensions.services.openoffice.org/dictionary), you should be able to just drop any of open office's dictionary folders into nodehun's dictionary folder and it should automatically work, see the readme file in the dictionaries folder for more directions). From initialization there are only a few built in objects that come with nodehun, most of the functionality you will use are methods in the built in object "Dictionary". Simple spell suggest is very easy.
var nodehun = require('nodehun'),
USDictionary = new nodehun.Dictionary('en_US');
USDictionary.spellSuggest('color',function(a,b){
console.log(a,b);
// because "color" is a defined word in the US English dictionary
// the output will be: true, null
});
USDictionary.spellSuggest('calor',function(a,b){
console.log(a,b);
// because "calor" is not a defined word in the US English dictionary
// the output will be: false, "carol"
});
Spell Suggest and Initialization, buffer based.
-------------------------------------------------
Another option for initializing a nodehun dictionary is to pass the raw string output of both the affix and dictionary files of a particular language. This allows you to use an alternate data-store than the servers file system. Please do not actually use `readFileSync`.
var nodehun = require('nodehun'),
fs = require('fs'),
USDictionary = new nodehun.Dictionary(fs.readFileSync('./en_US.aff').toString(),fs.readFileSync('./en_US.dic').toString());
USDictionary.spellSuggest('color',function(a,b){
console.log(a,b);
// because "color" is a defined word in the US English dictionary
// the output will be: true, null
});
USDictionary.spellSuggest('calor',function(a,b){
console.log(a,b);
// because "calor" is not a defined word in the US English dictionary
// the output will be: false, "carol"
});
Spell Suggestions
-----------------
Nodehun also offers a method that returns an array of words that could possibly match a misspelled word, ordered by most likely to be correct.
var nodehun = require('nodehun'),
USDictionary = new nodehun.Dictionary('en_US');
USDictionary.spellSuggestions('color',function(a,b){
console.log(a,b);
// because "color" is a defined word in the US English dictionary
// the output will be: true, []
});
USDictionary.spellSuggest('calor',function(a,b){
console.log(a,b);
// because "calor" is not a defined word in the US English dictionary
// the output will be: false, [ 'carol','valor','color','cal or','cal-or','caloric','calorie']
});
Add Dictionary
--------------
Nodehun also can add another dictionary on top of an existing dictionary object at runtime (this means it is not permanent) in order to merge two dictionaries.
var nodehun = require('nodehun'),
USDictionary = new nodehun.Dictionary('en_US');
USDictionary.spellSuggest('colour',function(a,b){
console.log(a,b);
// because "colour" is not a defined word in the US English dictionary
// the output will be: false, "color"
});
USDictionary.addDictionary('en_CA',function(a,b){
console.log(a,b);
// because the Canadian English dictionary exists,
// the output will be: true, 'en_CA'
USDictionary.spellSuggest('colour',function(a,b){
console.log(a,b);
// because "colour" is a defined word in the Canadian English dictionary
// the output will be: true, null
});
});
Add Dictionary, buffer based
----------------------------
Similar to the alternate means of initializing a nodehun dictionary you can also add a dictionary to an existing one with a raw string, even if the original dictionary wasn't initialized that way. NOTICE: the second argument is now the boolean value `true`, which indicates that the string being passed is a dictionary; if the value was `false` then it would treat the first argument as a path. The callback can be either the 2nd or 3rd argument, if it is the second argument the function will assume you've passed a "path" string. Once again, please do not actually use `readFileSync`.
var nodehun = require('nodehun'),
fs = require('fs'),
USDictionary = new nodehun.Dictionary('en_US');
USDictionary.spellSuggest('colour',function(a,b){
console.log(a,b);
// because "colour" is not a defined word in the US English dictionary
// the output will be: false, "color"
});
USDictionary.addDictionary(fs.readFileSync('./en_CA.dic').toString(),true,function(a,b){
console.log(a,b);
// because the Canadian English dictionary exists,
// the output will be: true, 'en_CA'
USDictionary.spellSuggest('colour',function(a,b){
console.log(a,b);
// because "colour" is a defined word in the Canadian English dictionary
// the output will be: true, null
});
});
Add Word
--------
Nodehun can also add a single word to a dictionary at runtime (this means it is not permanent) in order to have a custom runtime dictionary. If you know anything about Hunspell you can also add flags to the word.
var nodehun = require('nodehun'),
USDictionary = new nodehun.Dictionary('en_US');
USDictionary.spellSuggest('colour',function(a,b){
console.log(a,b);
// because "colour" is not a defined word in the US English dictionary
// the output will be: false, "color"
});
USDictionary.addWord('colour',function(a,b){
console.log(a,b);
// if the method succeeded then
// the output will be: true, 'colour'
USDictionary.spellSuggest('colour',function(a,b){
console.log(a,b);
// because "colour" has been added to the US dictionary object.
// the output will be: true, null
});
});
Remove Word
-----------
Nodehun can also remove a single word from a dictionary at runtime (this means it is not permanent) in order to have a custom runtime dictionary. If you know anything about Hunspell this method will ignore flags and just strip words that match.
var nodehun = require('nodehun'),
USDictionary = new nodehun.Dictionary('en_US');
USDictionary.spellSuggest('color',function(a,b){
console.log(a,b);
// because "color" is a defined word in the US English dictionary
// the output will be: true, null
});
USDictionary.removeWord('color',function(a,b){
console.log(a,b);
// if the method succeeded then
// the output will be: true, 'color'
USDictionary.spellSuggest('color',function(a,b){
console.log(a,b);
// because "color" has been removed from the US dictionary object.
// the output will be: false, "colors"
// note that plurals are considered separte words.
});
});
Add Dictionary Permanently and Add Word Permanently
---------------------------------------------------
I have deprecated and scrapped these methods as they really violate good design philosophy of a well written node module. These methods can both be easily replicated using node itself. I am trying to move nodehun away from needing files at all, as they are a poor data-store for a distributed system.
\ No newline at end of file
{
'targets': [
{
'target_name': 'nodehun',
'sources': [
'nodehun.cpp'
],
'cflags': [ '-O3' ],
'dependencies': [
'hunspell/binding.gyp:hunspell',
],
},
],
}
Author of Hunspell:
Németh László nemeth (at) OpenOffice.org
Hunspell based on OpenOffice.org's Myspell. MySpell's author:
Kevin Hendricks kevin.hendricks (at) sympatico.ca
* Interactive interface has some visualization problem with long lines
* Experimental -U, -u options don't support Unicode.
* Compound handling is not thread safe in Hungarian specific code.
GPL 2.0/LGPL 2.1/MPL 1.1 tri-license
The contents of this software may be used under the terms of
the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL",
see COPYING.LGPL) or (excepting the LGPLed GNU gettext library in the
intl/ directory) the Mozilla Public License Version 1.1 or later
(the "MPL", see COPYING.MPL).
Software distributed under these licenses is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the licences
for the specific language governing rights and limitations under the licenses.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS= intl po src man m4 tests
pkgconfdir = $(libdir)/pkgconfig
pkgconf_DATA = hunspell.pc
EXTRA_DIST = BUGS README.myspell AUTHORS.myspell license.myspell license.hunspell \
ChangeLog.O COPYING.MPL COPYING.LGPL hunspell.pc.in
This diff is collapsed.
* shared dictionaries for multi-user environment
* improve compound handling
* Unicode unmunch (munch)
* forbiddenword and pseudoword support in unmunch
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
includedir=@includedir@
Name: hunspell
Description: Hunspell spellchecking library
Version: @VERSION@
Libs: -L${libdir} -lhunspell-@HUNSPELL_VERSION_MAJOR@.@HUNSPELL_VERSION_MINOR@
Cflags: -I${includedir}/hunspell
2007-11-07 GNU <bug-gnu-gettext@gnu.org>
* Version 0.17 released.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment