init repo
This commit is contained in:
7
ServerComponents/Bin/ConnectionStrings.config
Normal file
7
ServerComponents/Bin/ConnectionStrings.config
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<connectionStrings>
|
||||
<clear />
|
||||
<!-- Line to connect to the main base -->
|
||||
<add name="ConnectionString2" connectionString="Server=localhost;database=onlyoffice;user id=root;password=onlyoffice;pooling=True;Character Set=utf8" providerName="MySql.Data.MySqlClient" />
|
||||
<add name="FileStatisticConnectionString" connectionString="Server=localhost;database=onlyoffice;user id=root;password=onlyoffice;pooling=True;Character Set=utf8" providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
BIN
ServerComponents/Bin/FileConverter2.exe
Normal file
BIN
ServerComponents/Bin/FileConverter2.exe
Normal file
Binary file not shown.
27
ServerComponents/Bin/FileConverter2.exe.config
Normal file
27
ServerComponents/Bin/FileConverter2.exe.config
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||
</configSections>
|
||||
<log4net>
|
||||
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
|
||||
</layout>
|
||||
<param name="File" value="E:\\Logs\\fileconverter-log-file.txt" />
|
||||
<param name="AppendToFile" value="true" />
|
||||
<param name="RollingStyle" value="Size" />
|
||||
<param name="MaximumFileSize" value="1MB" />
|
||||
<param name="MaxSizeRollBackups" value="10" />
|
||||
</appender>
|
||||
<root>
|
||||
<level value="ALL" />
|
||||
<appender-ref ref="RollingLogFileAppender" />
|
||||
</root>
|
||||
</log4net>
|
||||
<appSettings file="Settings.config">
|
||||
<add key="fileconverter.convert.presentationthemesdir" value="..\presentationthemes" />
|
||||
<add key="fileconverter.merge.script" value="merge.js" />
|
||||
<add key="fileconverter.merge.workdir" value="E:\Subversion\AVS\Sources\TeamlabOffice\trunk\OfficeWeb\Word\merge\" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
BIN
ServerComponents/Bin/FileConverterService2.exe
Normal file
BIN
ServerComponents/Bin/FileConverterService2.exe
Normal file
Binary file not shown.
41
ServerComponents/Bin/FileConverterService2.exe.config
Normal file
41
ServerComponents/Bin/FileConverterService2.exe.config
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||
</configSections>
|
||||
<log4net>
|
||||
<appender name="DebugAppender" type="log4net.Appender.DebugAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<level value="ERROR" />
|
||||
<appender-ref ref="DebugAppender" />
|
||||
</root>
|
||||
</log4net>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<clear />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
|
||||
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
<connectionStrings configSource="ConnectionStrings.config"/>
|
||||
<appSettings file="Settings.config">
|
||||
<add key="sleeptimeout" value="5"/>
|
||||
<add key="sleeptimeoutiddle" value="5"/>
|
||||
<add key="maxconverttime" value="60"/>
|
||||
<add key="maxconverttimeiddle" value="300"/>
|
||||
<add key="maxconvertiddlefiles" value="5"/>
|
||||
<add key="maxdownloadbytes" value="100000000"/>
|
||||
<!--number of processes per processor-->
|
||||
<add key="maxprocesscount" value="1"/>
|
||||
|
||||
<!--download folder-->
|
||||
<add key="fileconverterservice.relativedir" value="..\origin"/>
|
||||
<add key="fileconverterservice.gc.removedtaskatonce" value="10" />
|
||||
<add key="fileconverterservice.gc.runperiod" value="3600" />
|
||||
<add key="fileconverterservice.percent.runperiod" value="500" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
BIN
ServerComponents/Bin/FileConverterUtils2.dll
Normal file
BIN
ServerComponents/Bin/FileConverterUtils2.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.ASCOfficeDocxFile2.dll
Normal file
BIN
ServerComponents/Bin/Interop.ASCOfficeDocxFile2.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.ASCOfficeFile.dll
Normal file
BIN
ServerComponents/Bin/Interop.ASCOfficeFile.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.ASCOfficePDFWriter.dll
Normal file
BIN
ServerComponents/Bin/Interop.ASCOfficePDFWriter.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.ASCOfficePPTXFile.dll
Normal file
BIN
ServerComponents/Bin/Interop.ASCOfficePPTXFile.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.ASCOfficeUtils.dll
Normal file
BIN
ServerComponents/Bin/Interop.ASCOfficeUtils.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.OfficeCore.dll
Normal file
BIN
ServerComponents/Bin/Interop.OfficeCore.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/Interop.XlsxSerializerCom.dll
Normal file
BIN
ServerComponents/Bin/Interop.XlsxSerializerCom.dll
Normal file
Binary file not shown.
BIN
ServerComponents/Bin/PdfWriter.dll
Normal file
BIN
ServerComponents/Bin/PdfWriter.dll
Normal file
Binary file not shown.
18
ServerComponents/Bin/Settings.config
Normal file
18
ServerComponents/Bin/Settings.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<appSettings>
|
||||
<add key="utils.common.fontdir" value=""/>
|
||||
|
||||
<add key="utils.storage.impl" value="fs" />
|
||||
<!--Filesystem storage settings-->
|
||||
<add key="utils.storage.fs.keyfiles" value=""/>
|
||||
|
||||
<add key="utils.taskresult.impl" value="db" />
|
||||
<add key="utils.taskresult.ttl" value="7.00:00:00" />
|
||||
<add key="utils.taskresult.db.connectionstring" value="ConnectionString2" />
|
||||
|
||||
<add key="utils.taskqueue.impl" value="db" />
|
||||
<add key="utils.taskqueue.db.connectionstring" value="ConnectionString2" />
|
||||
|
||||
<add key="utils.filestatistic.impl" value="db" />
|
||||
<add key="utils.filestatistic.db.connectionstring" value="ConnectionString2" />
|
||||
</appSettings>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||
</configSections>
|
||||
<log4net>
|
||||
<appender name="DebugAppender" type="log4net.Appender.DebugAppender">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<level value="ERROR" />
|
||||
<appender-ref ref="DebugAppender" />
|
||||
</root>
|
||||
</log4net>
|
||||
<appSettings file="Settings.config">
|
||||
<add key="fileconverter.convert.presentationthemesdir" value="..\presentationthemes" />
|
||||
<add key="fileconverter.merge.script" value="merge.js" />
|
||||
<add key="fileconverter.merge.workdir" value="E:\Subversion\AVS\Sources\TeamlabOffice\trunk\OfficeWeb\Word\merge\" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?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>{321E9746-26BB-484F-BA34-266CBAF38008}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FileConverter2</RootNamespace>
|
||||
<AssemblyName>FileConverter2</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugOpenSource|AnyCPU' ">
|
||||
<IsOpenSource>true</IsOpenSource>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;OPEN_SOURCE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseOpenSource|AnyCPU' ">
|
||||
<IsOpenSource>true</IsOpenSource>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;OPEN_SOURCE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Condition=" '$(IsOpenSource)' == '' " Include="ASCOfficeEWSEditor, Version=1.0.0.113, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\ASCOfficeEWSEditor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FileConverterUtils2, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\FileConverterUtils2.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="PdfWriter, Version=1.0.0.2, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\PdfWriter.dll</HintPath>
|
||||
</Reference>
|
||||
<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.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCDocxFile">
|
||||
<Guid>{CBCEF68A-61B4-49FA-A35F-3BFF46FD3BE8}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCGraphics">
|
||||
<Guid>{AB5F2678-2773-44C4-A637-33DFBC51233B}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCHTMLRenderer">
|
||||
<Guid>{08DC1F03-6867-4585-B939-422C9078F5FD}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCImageStudio3">
|
||||
<Guid>{69DBBABC-8D59-40B8-9906-DAFD4F3EC346}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCMediaCore3">
|
||||
<Guid>{F0A0AAE5-06FE-4ABC-A9F1-26BFFEE2A11F}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="ASCOfficeDocxFile2">
|
||||
<Guid>{A1EEE61A-FAA7-47AF-B078-4E955623B9CA}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCOfficeFile">
|
||||
<Guid>{74CBF220-BF08-11DE-8A39-0800200C9A66}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCOfficeOdfFile">
|
||||
<Guid>{9AEF1F19-91CE-46C0-A380-06A7F56CE4AE}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCOfficePDFWriter">
|
||||
<Guid>{E0DC00B5-13BE-451C-92B5-078A5B44BEEA}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="ASCOfficePPTXFile">
|
||||
<Guid>{95DEE027-7707-4078-A314-33D35AE842FD}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="ASCOfficeUtils">
|
||||
<Guid>{92F87FA9-D3C2-4820-82F6-DEAEC0A3539D}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCOfficeWSHtmlFile">
|
||||
<Guid>{25B7D44B-94A1-4C94-9718-102CFA8F00D5}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCOfficeXlsFile">
|
||||
<Guid>{D9F21C35-D46C-42F3-996D-D4912435F7E7}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCPresentationEditor">
|
||||
<Guid>{B34974D7-C020-45B2-8A19-AFC20526B083}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="XlsxSerializerCom">
|
||||
<Guid>{E4E17295-6FF8-4BAC-B4C2-E17D72111035}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</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 $(ProjectDir)bin\Release\$(TargetFileName) $(SolutionDir)..\..\wwwroot\Bin\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
754
ServerComponents/FileConverterService2/FileConverter2/Program.cs
Normal file
754
ServerComponents/FileConverterService2/FileConverter2/Program.cs
Normal file
@@ -0,0 +1,754 @@
|
||||
/*
|
||||
* (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.Configuration;
|
||||
using System.IO;
|
||||
|
||||
using FileConverterUtils2;
|
||||
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
|
||||
#if! OPEN_SOURCE
|
||||
using ASCOfficeEWSEditor.Editor;
|
||||
#endif
|
||||
|
||||
namespace FileConverter2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static string m_strGuidFile = "";
|
||||
static string m_strFormatFile = "";
|
||||
static int m_cnPercentConst = 10000;
|
||||
static int m_nStageIndex = 1;
|
||||
static int m_nStageCount = 1;
|
||||
|
||||
static uint c_nPageType = 0x0001;
|
||||
static int c_nHtmlRendererMode = 0x04 | 0x10;
|
||||
|
||||
static int c_nSvgDefaultWidth = 960;
|
||||
static int c_nSvgDefaultHeight = 720;
|
||||
|
||||
const int ZIP_NO_COMPRESSION = 0;
|
||||
const int ZIP_BEST_SPEED = 1;
|
||||
const int ZIP_BEST_COMPRESSION = 9;
|
||||
const int ZIP_DEFAULT_COMPRESSION = (-1);
|
||||
|
||||
const int PresentationEditorSavePptx = 1;
|
||||
const int PresentationEditorSavePdf = 2;
|
||||
const int PresentationEditorSaveHtml = 3;
|
||||
|
||||
#if! OPEN_SOURCE
|
||||
static string m_sConfigFontDir = Environment.ExpandEnvironmentVariables(ConfigurationSettings.AppSettings["utils.common.fontdir"]);
|
||||
#else
|
||||
static string m_sConfigFontDir = "";
|
||||
#endif
|
||||
static string m_sConfigThemeDir = ConfigurationSettings.AppSettings["fileconverter.convert.presentationthemesdir"];
|
||||
static string m_sTMImageGuid = "TMImageGuid";
|
||||
static int Main(string[] args)
|
||||
{
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
ILog _log = LogManager.GetLogger(typeof(Program));
|
||||
|
||||
int nResult = (int)FileConverterUtils2.ErrorTypes.NoError;
|
||||
int nArgLength = args.Length;
|
||||
if (nArgLength < 1)
|
||||
return (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
try
|
||||
{
|
||||
ASCOfficeUtils.COfficeUtilsClass OfficeUtils = new ASCOfficeUtils.COfficeUtilsClass();
|
||||
TaskQueueDataConvert oTaskQueueDataConvert = TaskQueueDataConvert.DeserializeFromXml(File.ReadAllText(args[0], System.Text.Encoding.UTF8));
|
||||
int nFormatFrom = oTaskQueueDataConvert.m_nFormatFrom;
|
||||
int nFormatTo = oTaskQueueDataConvert.m_nFormatTo;
|
||||
string sFileFrom = oTaskQueueDataConvert.m_sFileFrom;
|
||||
string sFileTo = oTaskQueueDataConvert.m_sFileTo;
|
||||
m_strGuidFile = oTaskQueueDataConvert.m_sKey;
|
||||
m_strFormatFile = nFormatTo.ToString();
|
||||
bool? bPaid = oTaskQueueDataConvert.m_bPaid;
|
||||
bool? bEmbeddedFonts = oTaskQueueDataConvert.m_bEmbeddedFonts;
|
||||
|
||||
if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB & nFormatFrom) && 0 != (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS & nFormatTo))
|
||||
{
|
||||
OfficeUtils.ExtractToDirectory(sFileFrom, Path.GetDirectoryName(sFileTo), null, 0);
|
||||
}
|
||||
else if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB & nFormatTo) && 0 != (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS & nFormatFrom))
|
||||
{
|
||||
OfficeUtils.CompressFileOrDirectory(Path.GetDirectoryName(sFileFrom), sFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nSourceFormatFrom = nFormatFrom;
|
||||
string sSourceFileFrom = sFileFrom;
|
||||
int nSourceFormatTo = nFormatTo;
|
||||
string sSourceFileTo = sFileTo;
|
||||
|
||||
string sTempDirectory = Path.Combine(Path.GetDirectoryName(sFileTo), "Temp");
|
||||
Directory.CreateDirectory(sTempDirectory);
|
||||
|
||||
string sTempConvertDir = Path.Combine(sTempDirectory, "Convert");
|
||||
Directory.CreateDirectory(sTempConvertDir);
|
||||
|
||||
if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB & nFormatFrom) || FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT == nFormatFrom ||
|
||||
FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING == nFormatFrom || FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION == nFormatFrom)
|
||||
{
|
||||
string sUnzipDir = Path.Combine(sTempDirectory, "Unzip");
|
||||
Directory.CreateDirectory(sUnzipDir);
|
||||
OfficeUtils.ExtractToDirectory(sFileFrom, sUnzipDir, null, 0);
|
||||
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == nFormatFrom)
|
||||
{
|
||||
sFileFrom = Path.Combine(sUnzipDir, "Editor.bin");
|
||||
nFormatFrom = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_WORD;
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == nFormatFrom)
|
||||
{
|
||||
sFileFrom = Path.Combine(sUnzipDir, "Editor.bin");
|
||||
nFormatFrom = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET;
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == nFormatFrom)
|
||||
{
|
||||
sFileFrom = Path.Combine(sUnzipDir, "Editor.bin");
|
||||
nFormatFrom = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT == nFormatFrom)
|
||||
{
|
||||
string sFileFromArch = Path.Combine(sUnzipDir, "Editor.html.arch");
|
||||
sFileFrom = Path.Combine(sUnzipDir, "Editor.html");
|
||||
if (File.Exists(sFileFromArch))
|
||||
File.Copy(sFileFromArch, sFileFrom, true);
|
||||
nFormatFrom = FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
|
||||
|
||||
OldDocumentReplaceImages oOldDocumentReplaceImages = new OldDocumentReplaceImages();
|
||||
oOldDocumentReplaceImages.sPath = Path.GetDirectoryName(sFileFrom);
|
||||
string sContent = File.ReadAllText(sFileFrom, System.Text.Encoding.UTF8);
|
||||
sContent = System.Text.RegularExpressions.Regex.Replace(sContent, "<img(.*?) src=\"(.*?)\"", oOldDocumentReplaceImages.undoReplace);
|
||||
File.WriteAllText(sFileFrom, sContent, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION == nFormatFrom)
|
||||
{
|
||||
sFileFrom = Path.Combine(sUnzipDir, "Editor.xml");
|
||||
|
||||
string sEditorPath = Path.Combine(sUnzipDir, "Editor.xml");
|
||||
string sThemesPath = Path.Combine(sUnzipDir, "Themes.xml");
|
||||
string sReplacePath = Path.GetDirectoryName(sFileFrom);
|
||||
if (File.Exists(sEditorPath))
|
||||
{
|
||||
string sContent = File.ReadAllText(sEditorPath, System.Text.Encoding.UTF8);
|
||||
sContent = sContent.Replace(m_sTMImageGuid, sReplacePath);
|
||||
File.WriteAllText(sEditorPath, sContent, System.Text.Encoding.UTF8);
|
||||
}
|
||||
if (File.Exists(sThemesPath))
|
||||
{
|
||||
string sContent = File.ReadAllText(sThemesPath, System.Text.Encoding.UTF8);
|
||||
sContent = sContent.Replace(m_sTMImageGuid, sReplacePath);
|
||||
File.WriteAllText(sThemesPath, sContent, System.Text.Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING == nFormatFrom)
|
||||
{
|
||||
sFileFrom = Path.Combine(sUnzipDir, "Editor.svg");
|
||||
|
||||
string sContent = File.ReadAllText(sFileFrom, System.Text.Encoding.UTF8);
|
||||
sContent = sContent.Replace(m_sTMImageGuid, Path.GetDirectoryName(sFileFrom) + "/");
|
||||
|
||||
File.WriteAllText(sFileFrom, sContent, new System.Text.UTF8Encoding(false));
|
||||
}
|
||||
}
|
||||
string sTempToZipDir = Path.Combine(sTempDirectory, "ToZip"); ;
|
||||
if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB & nFormatTo))
|
||||
{
|
||||
Directory.CreateDirectory(sTempToZipDir);
|
||||
|
||||
sFileTo = Path.Combine(sTempToZipDir, "Editor.bin");
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == nFormatTo)
|
||||
nFormatTo = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_WORD;
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == nFormatTo)
|
||||
nFormatTo = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET;
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == nFormatTo)
|
||||
nFormatTo = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
|
||||
ASCOfficeFile.CAVSOfficeFileConverterClass converter = new ASCOfficeFile.CAVSOfficeFileConverterClass();
|
||||
converter.OnProgressEx += new ASCOfficeFile._IAVSOfficeFileConverterEvents_OnProgressExEventHandler(converter_OnProgressEx);
|
||||
#endif
|
||||
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatTo)
|
||||
{
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_UNKNOWN == nFormatFrom)
|
||||
{
|
||||
PdfWriter.CPdfWriter oPdfWriter = new PdfWriter.CPdfWriter();
|
||||
oPdfWriter.SetThemesPlace(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), m_sConfigThemeDir));
|
||||
oPdfWriter.SetHtmlPlace(Path.GetDirectoryName(sFileFrom));
|
||||
if (bPaid.HasValue && false == bPaid.Value)
|
||||
oPdfWriter.SetUnregistredVersion(true);
|
||||
if (false == oPdfWriter.SavePdf(sFileFrom, sFileTo))
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (nFormatTo == nFormatFrom || (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatFrom))
|
||||
{
|
||||
File.Copy(sFileFrom, sFileTo);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if! OPEN_SOURCE
|
||||
string sAdditionalOptions = "";
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT == nFormatFrom && oTaskQueueDataConvert.m_nCsvTxtEncoding.HasValue)
|
||||
sAdditionalOptions = "<TXTOptions><Encoding>" + oTaskQueueDataConvert.m_nCsvTxtEncoding.Value + "</Encoding></TXTOptions>";
|
||||
converter.LoadFromFile(sFileFrom, sTempConvertDir, "<Options><Display/><DownloadImages>1</DownloadImages><FB2Options><GenerateContent val=\"1\"/></FB2Options>" + sAdditionalOptions + "</Options>");
|
||||
converter.FileType = FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
|
||||
|
||||
m_nStageIndex = 2;
|
||||
converter.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
#else
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRCanvas == nFormatTo || (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_WORD == nFormatTo && 0 == (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatFrom)))
|
||||
{
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_WORD == nFormatTo && 0 == (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatFrom))
|
||||
{
|
||||
nFormatTo = FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRCanvas;
|
||||
sFileTo = Path.GetDirectoryName(sFileTo);
|
||||
}
|
||||
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION == nFormatFrom)
|
||||
{
|
||||
ASCPresentationEditor.CAVSPresentationEditor oPresEditor = new ASCPresentationEditor.CAVSPresentationEditor();
|
||||
oPresEditor.TempDirectory = sTempConvertDir;
|
||||
oPresEditor.OpenXmlFile(sFileFrom);
|
||||
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR == nFormatTo)
|
||||
oPresEditor.Save(3, sFileTo);
|
||||
else
|
||||
oPresEditor.Save(4, sFileTo);
|
||||
oPresEditor.CloseFile(false);
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING == nFormatFrom)
|
||||
{
|
||||
ASCGraphics.SVGTransformerClass piSvgTransformer = new ASCGraphics.SVGTransformerClass();
|
||||
piSvgTransformer.SetAdditionalParam("DefaultWidth", c_nSvgDefaultWidth);
|
||||
piSvgTransformer.SetAdditionalParam("DefaultHeight", c_nSvgDefaultHeight);
|
||||
piSvgTransformer.LoadFile(sFileFrom);
|
||||
int nWidthPx = piSvgTransformer.Width;
|
||||
int nHeightPx = piSvgTransformer.Height;
|
||||
double dWidthMm = 2.54 * 10 * nWidthPx / 96;
|
||||
double dHeightMm = 2.54 * 10 * nHeightPx / 96;
|
||||
|
||||
ASCHTMLRenderer.CASCHTMLRenderer2 piHtmlRenderer = new ASCHTMLRenderer.CASCHTMLRenderer2();
|
||||
piHtmlRenderer.Mode = c_nHtmlRendererMode;
|
||||
piHtmlRenderer.CreateOfficeFile(sFileTo);
|
||||
piHtmlRenderer.NewPage();
|
||||
piHtmlRenderer.Width = dWidthMm;
|
||||
piHtmlRenderer.Height = dHeightMm;
|
||||
piHtmlRenderer.BeginCommand(c_nPageType);
|
||||
piSvgTransformer.Draw(piHtmlRenderer, 0, 0, dWidthMm, dHeightMm);
|
||||
piHtmlRenderer.EndCommand(c_nPageType);
|
||||
piHtmlRenderer.CloseFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nStageCount = 2;
|
||||
m_nStageIndex = 1;
|
||||
|
||||
string sAdditionalOptions = "";
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT == nFormatFrom && oTaskQueueDataConvert.m_nCsvTxtEncoding.HasValue)
|
||||
sAdditionalOptions = "<TXTOptions><Encoding>" + oTaskQueueDataConvert.m_nCsvTxtEncoding.Value + "</Encoding></TXTOptions>";
|
||||
converter.LoadFromFile(sFileFrom, sTempConvertDir, "<Options><Display/><DownloadImages>1</DownloadImages><FB2Options><GenerateContent val=\"1\"/></FB2Options>" + sAdditionalOptions + "</Options>");
|
||||
converter.FileType = nFormatTo;
|
||||
|
||||
m_nStageIndex = 2;
|
||||
converter.SaveToFile(sFileTo, sTempConvertDir, "<Options><LoadInCommandRenderer/><HtmlRendererMode>" + c_nHtmlRendererMode + "</HtmlRendererMode></Options>");
|
||||
}
|
||||
|
||||
if (File.Exists(sFileFrom) && Directory.Exists(sFileTo))
|
||||
File.Copy(sFileFrom, Path.Combine(sFileTo, "origin"), true);
|
||||
|
||||
string sDirTo = sFileTo;
|
||||
string sDocumentJs = Path.Combine(sDirTo, "document.js");
|
||||
string sEditorBin = Path.Combine(sDirTo, "Editor.bin");
|
||||
if (File.Exists(sDocumentJs) && false == File.Exists(sEditorBin))
|
||||
File.Move(sDocumentJs, sEditorBin);
|
||||
}
|
||||
#endif
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_WORD == nFormatTo)
|
||||
{
|
||||
#if! OPEN_SOURCE
|
||||
string sAdditionalOptions = "";
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT == nFormatFrom && oTaskQueueDataConvert.m_nCsvTxtEncoding.HasValue)
|
||||
sAdditionalOptions = "<TXTOptions><Encoding>" + oTaskQueueDataConvert.m_nCsvTxtEncoding.Value + "</Encoding></TXTOptions>";
|
||||
converter.LoadFromFile(sFileFrom, sTempConvertDir, "<Options><Display/><FB2Options><GenerateContent val=\"0\"/></FB2Options>" + sAdditionalOptions + "</Options>");
|
||||
#else
|
||||
OfficeUtils.ExtractToDirectory(sFileFrom, sTempConvertDir, null, 0);
|
||||
#endif
|
||||
ASCOfficeDocxFile2.CAVSOfficeDocxFile2Class oDocxFile = new ASCOfficeDocxFile2.CAVSOfficeDocxFile2Class();
|
||||
oDocxFile.SetFontDir(m_sConfigFontDir);
|
||||
|
||||
if (bEmbeddedFonts.HasValue && true == bEmbeddedFonts.Value)
|
||||
oDocxFile.SetAdditionalParam("EmbeddedFontsDirectory", Path.Combine(Path.GetDirectoryName(sFileTo), "fonts"));
|
||||
oDocxFile.OpenFile(sTempConvertDir, sFileTo);
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_WORD == nFormatFrom)
|
||||
{
|
||||
if (oTaskQueueDataConvert.m_bFromChanges.HasValue && oTaskQueueDataConvert.m_bFromChanges.Value)
|
||||
{
|
||||
|
||||
string sDirFrom = Path.GetDirectoryName(sFileFrom);
|
||||
string sDirChanges = Path.Combine(sDirFrom, "changes");
|
||||
|
||||
string sNewFileFrom = Path.Combine(sDirFrom, "Editor1.bin");
|
||||
System.Diagnostics.Process convertProc = new System.Diagnostics.Process();
|
||||
convertProc.StartInfo.FileName = "node";
|
||||
convertProc.StartInfo.CreateNoWindow = true;
|
||||
convertProc.StartInfo.UseShellExecute = false;
|
||||
convertProc.StartInfo.WorkingDirectory = ConfigurationSettings.AppSettings["fileconverter.merge.workdir"];
|
||||
convertProc.StartInfo.Arguments = "\"" + ConfigurationSettings.AppSettings["fileconverter.merge.script"] +
|
||||
"\" \"" + sFileFrom +
|
||||
"\" \"" + sDirChanges +
|
||||
"\" \"" + sNewFileFrom + "\"";
|
||||
convertProc.Start();
|
||||
convertProc.WaitForExit();
|
||||
sFileFrom = sNewFileFrom;
|
||||
if(0 != convertProc.ExitCode)
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Unknown;
|
||||
}
|
||||
if (nResult == (int)FileConverterUtils2.ErrorTypes.NoError)
|
||||
{
|
||||
ASCOfficeDocxFile2.CAVSOfficeDocxFile2Class oDocxWriter = new ASCOfficeDocxFile2.CAVSOfficeDocxFile2Class();
|
||||
oDocxWriter.SetAdditionalParam("FontDir", m_sConfigFontDir);
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX != nFormatTo)
|
||||
oDocxWriter.SetAdditionalParam("SaveChartAsImg", true);
|
||||
oDocxWriter.Write(sFileFrom, sTempConvertDir);
|
||||
#if! OPEN_SOURCE
|
||||
if (bPaid.HasValue && false == bPaid)
|
||||
{
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFile = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFile.AddObjects(sTempConvertDir, "<AddObjects><Paragraph><Text value=\"Created by YoursDocs\"/></Paragraph><Paragraph><Link value=\"http://www.yoursdocs.com/\" href=\"http://www.yoursdocs.com/\"/></Paragraph></AddObjects>");
|
||||
}
|
||||
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP != nFormatTo)
|
||||
{
|
||||
converter.FileType = nFormatTo;
|
||||
converter.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string sTempConvertDir2 = Path.Combine(sTempDirectory, "Convert2");
|
||||
Directory.CreateDirectory(sTempConvertDir2);
|
||||
|
||||
converter.FileType = FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
|
||||
string sConvertFileTo = Path.Combine(sTempConvertDir2, Path.GetFileNameWithoutExtension(sFileTo) + ".html");
|
||||
converter.SaveToFile(sConvertFileTo, sTempConvertDir, "");
|
||||
|
||||
OfficeUtils.CompressFileOrDirectory(sTempConvertDir2, sFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
Directory.Delete(sTempConvertDir2, true);
|
||||
}
|
||||
#else
|
||||
OfficeUtils.CompressFileOrDirectory(sTempConvertDir, sFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == nFormatTo)
|
||||
{
|
||||
#if! OPEN_SOURCE
|
||||
ASCPresentationEditor.CAVSPresentationEditorClass oPresentationEditor = new ASCPresentationEditor.CAVSPresentationEditorClass();
|
||||
oPresentationEditor.TempDirectory = sTempConvertDir;
|
||||
oPresentationEditor.SetFontDir(m_sConfigFontDir);
|
||||
oPresentationEditor.ConvertToPPTY(sFileFrom, sFileTo);
|
||||
#else
|
||||
ASCOfficePPTXFile.CAVSOfficePPTXFileClass oCAVSOfficePPTXFile = new ASCOfficePPTXFile.CAVSOfficePPTXFileClass();
|
||||
oCAVSOfficePPTXFile.TempDirectory = sTempConvertDir;
|
||||
oCAVSOfficePPTXFile.SetFontDir(m_sConfigFontDir);
|
||||
if (bEmbeddedFonts.HasValue && true == bEmbeddedFonts.Value)
|
||||
oCAVSOfficePPTXFile.SetAdditionalParam("EmbeddedFontsDirectory", Path.Combine(Path.GetDirectoryName(sFileTo), "fonts"));
|
||||
oCAVSOfficePPTXFile.OpenFileToPPTY(sFileFrom, sFileTo);
|
||||
#endif
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == nFormatFrom)
|
||||
{
|
||||
ASCOfficePPTXFile.CAVSOfficePPTXFileClass oCAVSOfficePPTXFile = new ASCOfficePPTXFile.CAVSOfficePPTXFileClass();
|
||||
oCAVSOfficePPTXFile.TempDirectory = sTempConvertDir;
|
||||
oCAVSOfficePPTXFile.SetThemesDir(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), m_sConfigThemeDir));
|
||||
oCAVSOfficePPTXFile.ConvertPPTYToPPTX(sFileFrom, sFileTo);
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == nFormatTo)
|
||||
{
|
||||
XlsxSerializerCom.CAVSOfficeXlsxSerizer oXlsxSerizer = new XlsxSerializerCom.CAVSOfficeXlsxSerizer();
|
||||
oXlsxSerizer.SetFontDir(m_sConfigFontDir);
|
||||
if (bEmbeddedFonts.HasValue && true == bEmbeddedFonts.Value)
|
||||
oXlsxSerizer.SetAdditionalParam("EmbeddedFontsDirectory", Path.Combine(Path.GetDirectoryName(sFileTo), "fonts"));
|
||||
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatFrom)
|
||||
{
|
||||
int nCsvEncoding = 65001;
|
||||
char cDelimiter = ',';
|
||||
if (oTaskQueueDataConvert.m_nCsvDelimiter.HasValue)
|
||||
{
|
||||
switch (oTaskQueueDataConvert.m_nCsvDelimiter.Value)
|
||||
{
|
||||
case (int)CsvDelimiter.Tab: cDelimiter = '\t'; break;
|
||||
case (int)CsvDelimiter.Semicolon: cDelimiter = ';'; break;
|
||||
case (int)CsvDelimiter.Сolon: cDelimiter = ':'; break;
|
||||
case (int)CsvDelimiter.Comma: cDelimiter = ','; break;
|
||||
case (int)CsvDelimiter.Space: cDelimiter = ' '; break;
|
||||
}
|
||||
}
|
||||
if (oTaskQueueDataConvert.m_nCsvTxtEncoding.HasValue)
|
||||
nCsvEncoding = oTaskQueueDataConvert.m_nCsvTxtEncoding.Value;
|
||||
|
||||
string strXmlOptions = string.Format("<xmlOptions><fileOptions fileType='2' codePage='{0}' delimiter='{1}' /></xmlOptions>", nCsvEncoding, cDelimiter);
|
||||
|
||||
oXlsxSerizer.SaveToFile(sFileTo, sFileFrom, strXmlOptions);
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatFrom)
|
||||
{
|
||||
ASCOfficeOdfFile.COfficeOdfFileClass oOdfFile = new ASCOfficeOdfFile.COfficeOdfFileClass();
|
||||
oOdfFile.LoadFromFile(sFileFrom, sTempConvertDir, "");
|
||||
oXlsxSerizer.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatFrom)
|
||||
{
|
||||
ASCOfficeXlsFile.CXlsFileClass oXlsFile = new ASCOfficeXlsFile.CXlsFileClass();
|
||||
oXlsFile.LoadFromFile(sFileFrom, sTempConvertDir, "");
|
||||
oXlsxSerizer.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
}
|
||||
#endif
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatFrom)
|
||||
{
|
||||
OfficeUtils.ExtractToDirectory(sFileFrom, sTempConvertDir, null, 0);
|
||||
oXlsxSerizer.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
}
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == nFormatFrom)
|
||||
{
|
||||
XlsxSerializerCom.CAVSOfficeXlsxSerizer oXlsxSerizer = new XlsxSerializerCom.CAVSOfficeXlsxSerizer();
|
||||
oXlsxSerizer.LoadFromFile(sFileFrom, sTempConvertDir, "");
|
||||
|
||||
string sTempConvertDir2 = Path.Combine(sTempDirectory, "Convert2");
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
{
|
||||
#if! OPEN_SOURCE
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFile = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFile.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
#else
|
||||
OfficeUtils.CompressFileOrDirectory(sTempConvertDir, sFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
#endif
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
{
|
||||
ASCOfficeXlsFile.CXlsFileClass oXlsFile = new ASCOfficeXlsFile.CXlsFileClass();
|
||||
oXlsFile.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
{
|
||||
Directory.CreateDirectory(sTempConvertDir2);
|
||||
string sFileXlsx = Path.Combine(sTempConvertDir2, "converted.xlsx");
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFile = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFile.SaveToFile(sFileXlsx, sTempConvertDir, "");
|
||||
ASCOfficeEWSEditor.Editor.ODSConverter.ODSConverter.ConvertFile(sFileXlsx, sFileTo, CleverAge.OdfConverter.OdfConverterLib.ConversionDirection.XlsxToOds);
|
||||
}
|
||||
#endif
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatTo)
|
||||
{
|
||||
int nCsvEncoding = System.Text.Encoding.UTF8.CodePage;
|
||||
if (oTaskQueueDataConvert.m_nCsvTxtEncoding.HasValue)
|
||||
nCsvEncoding = oTaskQueueDataConvert.m_nCsvTxtEncoding.Value;
|
||||
char cDelimiter = ',';
|
||||
if (oTaskQueueDataConvert.m_nCsvDelimiter.HasValue)
|
||||
{
|
||||
switch (oTaskQueueDataConvert.m_nCsvDelimiter.Value)
|
||||
{
|
||||
case 1: cDelimiter = (char)0x09; break;
|
||||
case 2: cDelimiter = ';'; break;
|
||||
case 3: cDelimiter = ':'; break;
|
||||
case 4: cDelimiter = ','; break;
|
||||
case 5: cDelimiter = ' '; break;
|
||||
}
|
||||
}
|
||||
string strXmlOptions = string.Format("<xmlOptions><fileOptions fileType='2' codePage='{0}' delimiter='{1}' /></xmlOptions>", nCsvEncoding, cDelimiter);
|
||||
oXlsxSerizer.LoadFromFile(sFileFrom, sFileTo, strXmlOptions);
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP == nFormatTo)
|
||||
{
|
||||
Directory.CreateDirectory(sTempConvertDir2);
|
||||
ASCOfficeWSHtmlFile.CWSHtmlFileClass oWSHtmlFile = new ASCOfficeWSHtmlFile.CWSHtmlFileClass();
|
||||
oWSHtmlFile.SaveToFile(Path.Combine(sTempConvertDir2, "main.html"), sTempConvertDir, "");
|
||||
OfficeUtils.CompressFileOrDirectory(sTempConvertDir2, sFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING == nFormatFrom)
|
||||
{
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatTo)
|
||||
{
|
||||
ASCGraphics.SVGTransformerClass piSvgTransformer = new ASCGraphics.SVGTransformerClass();
|
||||
piSvgTransformer.LoadFile(sFileFrom);
|
||||
int nWidthPx = piSvgTransformer.Width;
|
||||
int nHeightPx = piSvgTransformer.Height;
|
||||
double dWidthMm = 2.54 * 10 * nWidthPx / 72;
|
||||
double dHeightMm = 2.54 * 10 * nHeightPx / 72;
|
||||
|
||||
ASCOfficePDFWriter.CPDFWriterClass piPdfWriter = new ASCOfficePDFWriter.CPDFWriterClass();
|
||||
piPdfWriter.CreatePDF();
|
||||
piPdfWriter.NewPage();
|
||||
piPdfWriter.Width = dWidthMm;
|
||||
piPdfWriter.Height = dHeightMm;
|
||||
piPdfWriter.BeginCommand(c_nPageType);
|
||||
piSvgTransformer.Draw(piPdfWriter, 0, 0, dWidthMm, dHeightMm);
|
||||
piPdfWriter.EndCommand(c_nPageType);
|
||||
piPdfWriter.SaveToFile(sFileTo);
|
||||
piPdfWriter.DeletePDF();
|
||||
}
|
||||
else
|
||||
{
|
||||
string sXmlTo = "";
|
||||
string sXmlAddition = "";
|
||||
switch (nFormatTo)
|
||||
{
|
||||
case FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_PNG: sXmlTo = "Png"; break;
|
||||
case FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_JPG: sXmlTo = "Jpeg"; sXmlAddition = " quality=\"80\""; break;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
ASCImageStudio3.ImageTransformsClass piImageTransform = new ASCImageStudio3.ImageTransformsClass();
|
||||
string sXml = "<transforms>";
|
||||
sXml += "<ImageFile-LoadImage sourcepath='" + sFileFrom + "'/>";
|
||||
|
||||
sXml += "</transforms>";
|
||||
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
if (piImageTransform.SetXml(sXml))
|
||||
if (piImageTransform.Transform())
|
||||
{
|
||||
object oFullImage;
|
||||
piImageTransform.GetResult(0, out oFullImage);
|
||||
|
||||
ASCMediaCore3.CAVSUncompressedVideoFrame piUnkFrame = (ASCMediaCore3.CAVSUncompressedVideoFrame)oFullImage;
|
||||
|
||||
if (piUnkFrame.BufferSize > 0)
|
||||
{
|
||||
piImageTransform.SetSource(0, oFullImage);
|
||||
sXml = "<transforms>";
|
||||
sXml += "<ImageFile-SaveAs" + sXmlTo + " destinationpath=\"" + sFileTo + "\" format=\"8888\"" + sXmlAddition + "/>";
|
||||
sXml += "</transforms>";
|
||||
if (piImageTransform.SetXml(sXml))
|
||||
if (piImageTransform.Transform())
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
_log.Error("Exception catched while image transform.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatFrom) && 0 != (FileFormats.AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatTo))
|
||||
{
|
||||
m_nStageCount = 2;
|
||||
m_nStageIndex = 1;
|
||||
|
||||
converter.LoadFromFile(sFileFrom, sTempConvertDir, "");
|
||||
converter.FileType = nFormatTo;
|
||||
|
||||
m_nStageIndex = 2;
|
||||
converter.SaveToFile(sFileTo, sTempConvertDir, "");
|
||||
}
|
||||
else if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatFrom) && 0 != (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo))
|
||||
{
|
||||
string sXlsxDir = Path.Combine(sTempConvertDir, "xlsx");
|
||||
Directory.CreateDirectory(sXlsxDir);
|
||||
if(FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatFrom)
|
||||
{
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFileClass = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFileClass.LoadFromFile(sFileFrom, sXlsxDir, "");
|
||||
}
|
||||
else if(FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatFrom)
|
||||
{
|
||||
ASCOfficeXlsFile.CXlsFileClass oXlsFileClass = new ASCOfficeXlsFile.CXlsFileClass();
|
||||
oXlsFileClass.LoadFromFile(sFileFrom, sXlsxDir, "");
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatFrom)
|
||||
{
|
||||
ASCOfficeOdfFile.COfficeOdfFileClass oOdfFile = new ASCOfficeOdfFile.COfficeOdfFileClass();
|
||||
oOdfFile.LoadFromFile(sFileFrom, sXlsxDir, "");
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatFrom)
|
||||
{
|
||||
string sTempFile = Path.Combine(sTempConvertDir, "temp_from.xlsx");
|
||||
using (EWSEditor oEditor = new EWSEditor())
|
||||
{
|
||||
Workbook wb = oEditor.LoadWorkbookFromCSV(sFileFrom, System.Text.Encoding.UTF8.CodePage, ',');
|
||||
wb.Save(sTempFile, ASCOfficeEWSEditor.Editor.FileFormats.Format.XLSX);
|
||||
}
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFileClass = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFileClass.LoadFromFile(sTempFile, sXlsxDir, "");
|
||||
}
|
||||
else
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
if (nResult == (int)FileConverterUtils2.ErrorTypes.NoError)
|
||||
{
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
{
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFileClass = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFileClass.SaveToFile(sFileTo, sXlsxDir, "");
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
{
|
||||
ASCOfficeXlsFile.CXlsFileClass oXlsFileClass = new ASCOfficeXlsFile.CXlsFileClass();
|
||||
oXlsFileClass.SaveToFile(sFileTo, sXlsxDir, "");
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
{
|
||||
string sTempFile = Path.Combine(sTempConvertDir, "temp_to.xlsx");
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFileClass = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFileClass.SaveToFile(sTempFile, sXlsxDir, "");
|
||||
ASCOfficeEWSEditor.Editor.ODSConverter.ODSConverter.ConvertFile(sTempFile, sFileTo, CleverAge.OdfConverter.OdfConverterLib.ConversionDirection.XlsxToOds);
|
||||
}
|
||||
else if (FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatTo)
|
||||
{
|
||||
string sTempFile = Path.Combine(sTempConvertDir, "temp_to.xlsx");
|
||||
ASCDocxFile.COfficeDocxFileClass oDocxFileClass = new ASCDocxFile.COfficeDocxFileClass();
|
||||
oDocxFileClass.SaveToFile(sTempFile, sXlsxDir, "");
|
||||
using (EWSEditor oEditor = new EWSEditor())
|
||||
{
|
||||
Workbook wb = oEditor.LoadWorkbook(sTempFile);
|
||||
int nCsvEncoding = System.Text.Encoding.UTF8.CodePage;
|
||||
if (oTaskQueueDataConvert.m_nCsvTxtEncoding.HasValue)
|
||||
nCsvEncoding = oTaskQueueDataConvert.m_nCsvTxtEncoding.Value;
|
||||
char cDelimiter = ',';
|
||||
if (oTaskQueueDataConvert.m_nCsvDelimiter.HasValue)
|
||||
{
|
||||
switch (oTaskQueueDataConvert.m_nCsvDelimiter.Value)
|
||||
{
|
||||
case 1: cDelimiter = (char)0x09; break;
|
||||
case 2: cDelimiter = ';'; break;
|
||||
case 3: cDelimiter = ':'; break;
|
||||
case 4: cDelimiter = ','; break;
|
||||
case 5: cDelimiter = ' '; break;
|
||||
}
|
||||
}
|
||||
wb.SaveToCSV(sFileTo, nCsvEncoding, cDelimiter);
|
||||
}
|
||||
}
|
||||
else
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
}
|
||||
}
|
||||
else if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_PRESENTATION & nFormatFrom) && 0 != (FileFormats.AVS_OFFICESTUDIO_FILE_PRESENTATION & nFormatTo))
|
||||
{
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
|
||||
{
|
||||
ASCPresentationEditor.CAVSPresentationEditorClass oPresentationEditor = new ASCPresentationEditor.CAVSPresentationEditorClass();
|
||||
oPresentationEditor.TempDirectory = sTempConvertDir;
|
||||
oPresentationEditor.SetFontDir(m_sConfigFontDir);
|
||||
oPresentationEditor.OpenFile(sFileFrom);
|
||||
oPresentationEditor.Save(PresentationEditorSavePptx, sFileTo);
|
||||
}
|
||||
else
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
|
||||
if (0 != (FileFormats.AVS_OFFICESTUDIO_FILE_TEAMLAB & nSourceFormatTo))
|
||||
{
|
||||
if (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRCanvas == nFormatTo)
|
||||
OfficeUtils.CompressFileOrDirectory(sFileTo, sSourceFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
else
|
||||
OfficeUtils.CompressFileOrDirectory(Path.GetDirectoryName(sFileTo), sSourceFileTo, ZIP_DEFAULT_COMPRESSION);
|
||||
}
|
||||
#if! OPEN_SOURCE
|
||||
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
|
||||
#endif
|
||||
Directory.Delete(sTempDirectory, true);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is System.Runtime.InteropServices.COMException)
|
||||
{
|
||||
System.Runtime.InteropServices.COMException eCOMException = e as System.Runtime.InteropServices.COMException;
|
||||
nResult = eCOMException.ErrorCode;
|
||||
}
|
||||
else
|
||||
nResult = (int)FileConverterUtils2.ErrorTypes.Convert;
|
||||
|
||||
_log.Error("Exception catched in Main() method.", e);
|
||||
}
|
||||
return nResult;
|
||||
}
|
||||
|
||||
private static void converter_OnProgressEx(int nID, int nPercent, ref short Cancel)
|
||||
{
|
||||
nPercent /= m_cnPercentConst;
|
||||
int nStagePercentStart = (100 / m_nStageCount) * (m_nStageIndex - 1);
|
||||
int nOutputPercent = (nStagePercentStart + (nPercent / m_nStageCount));
|
||||
|
||||
nOutputPercent = nOutputPercent * 95 / 100;
|
||||
Console.WriteLine("\"" + m_strGuidFile + "\" \"" + nOutputPercent.ToString() + "\" \"" + m_strFormatFile + "\"");
|
||||
}
|
||||
private class OldDocumentReplaceImages
|
||||
{
|
||||
public string sPath;
|
||||
public string undoReplace(System.Text.RegularExpressions.Match m)
|
||||
{
|
||||
if (m.Groups.Count >= 3)
|
||||
{
|
||||
string href = m.Groups[2].Value;
|
||||
int index = href.IndexOf(m_sTMImageGuid);
|
||||
if (-1 != index)
|
||||
href = sPath + href.Substring(index + m_sTMImageGuid.Length);
|
||||
return "<img" + m.Groups[1].Value + " src=\"" + href + "\"";
|
||||
}
|
||||
else
|
||||
return m.Groups[0].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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("FileConverter2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("FileConverter2")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA Copyright (c) 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("54616771-b4e0-4242-b6f8-af0fea15f794")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.15")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.15")]
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C# Express 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileConverterService2", "FileConverterService2\FileConverterService2.csproj", "{290A48D1-F7E2-4478-AFE6-AE5C744CD633}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileConverter2", "FileConverter2\FileConverter2.csproj", "{321E9746-26BB-484F-BA34-266CBAF38008}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
DebugOpenSource|Any CPU = DebugOpenSource|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
ReleaseOpenSource|Any CPU = ReleaseOpenSource|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.DebugOpenSource|Any CPU.ActiveCfg = DebugOpenSource|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.DebugOpenSource|Any CPU.Build.0 = DebugOpenSource|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.ReleaseOpenSource|Any CPU.ActiveCfg = ReleaseOpenSource|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.ReleaseOpenSource|Any CPU.Build.0 = ReleaseOpenSource|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.DebugOpenSource|Any CPU.ActiveCfg = DebugOpenSource|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.DebugOpenSource|Any CPU.Build.0 = DebugOpenSource|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.ReleaseOpenSource|Any CPU.ActiveCfg = ReleaseOpenSource|Any CPU
|
||||
{321E9746-26BB-484F-BA34-266CBAF38008}.ReleaseOpenSource|Any CPU.Build.0 = ReleaseOpenSource|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||
</configSections>
|
||||
<!--<log4net>
|
||||
<appender name="FileAppender" type="log4net.Appender.FileAppender">
|
||||
<param name="File" value="e:\\logs\\log-file.txt" />
|
||||
<param name="AppendToFile" value="true" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<level value="ALL" />
|
||||
<appender-ref ref="FileAppender" />
|
||||
</root>
|
||||
</log4net>-->
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<clear />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
|
||||
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
<connectionStrings>
|
||||
<!--<add name="ConnectionString" connectionString="data source=D:\Projects\AVS\Sources\AVSOfficeStudio\AVSOfficeWeb\wwwroot\App_Data\sqlite.db3" providerName="System.Data.SQLite" />-->
|
||||
<add name="ConnectionString" connectionString="server=localhost;user id=usrFileConv;password=usrFileConv;database=convertdb;pooling=false;Character Set=utf8;" providerName="MySql.Data.MySqlClient" />
|
||||
<add name="ConnectionString2" connectionString="Server=localhost;database=canvaseditors;user id=canvas_usr;password=canvas_usr;pooling=True;Character Set=utf8" providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<appSettings file="Settings.config">
|
||||
<add key="sleeptimeout" value="5" />
|
||||
<add key="sleeptimeoutiddle" value="5" />
|
||||
<add key="maxconverttime" value="60" />
|
||||
<add key="maxconverttimeiddle" value="300" />
|
||||
<add key="maxconvertiddlefiles" value="5" />
|
||||
<add key="maxdownloadbytes" value="10000000" />
|
||||
<!--number of processes per processor-->
|
||||
<add key="maxprocesscount" value="1" />
|
||||
|
||||
<!--download folder-->
|
||||
<add key="fileconverterservice.relativedir" value="..\origin" />
|
||||
<add key="fileconverterservice.gc.removedtaskatonce" value="10" />
|
||||
<add key="fileconverterservice.gc.runperiod" value="3600" />
|
||||
<add key="fileconverterservice.percent.runperiod" value="500" />
|
||||
<add key="utils.taskqueue.db.connectionstring" value="ConnectionString2"/>
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="AWSSDK" publicKeyToken="CD2D24CD2BACE800" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.3.19.0" newVersion="1.3.19.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* (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.ServiceProcess;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
|
||||
namespace FileConverterService2
|
||||
{
|
||||
public sealed class FileConverterService2 : ServiceBase
|
||||
{
|
||||
public const string AscFileConverterServiceName = "ASC File Converter Service2";
|
||||
private readonly ILog _log;
|
||||
private readonly FileConverter fileConverter;
|
||||
|
||||
public FileConverterService2()
|
||||
{
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
_log = LogManager.GetLogger(typeof(FileConverterService2));
|
||||
|
||||
this.ServiceName = AscFileConverterServiceName;
|
||||
this.EventLog.Log = "Application";
|
||||
fileConverter = new FileConverter(System.Environment.MachineName);
|
||||
|
||||
this.CanHandlePowerEvent = false;
|
||||
this.CanHandleSessionChangeEvent = false;
|
||||
this.CanPauseAndContinue = false;
|
||||
this.CanShutdown = true;
|
||||
this.CanStop = true;
|
||||
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override void OnStart(string[] args)
|
||||
{
|
||||
_log.Info("Service start");
|
||||
StartDaemon();
|
||||
base.OnStart(args);
|
||||
}
|
||||
|
||||
protected override void OnStop()
|
||||
{
|
||||
_log.Info("Service stop");
|
||||
fileConverter.Stop();
|
||||
base.OnStop();
|
||||
}
|
||||
|
||||
protected override void OnPause()
|
||||
{
|
||||
_log.Info("Service pause");
|
||||
base.OnPause();
|
||||
}
|
||||
|
||||
protected override void OnContinue()
|
||||
{
|
||||
_log.Info("Service continue");
|
||||
base.OnContinue();
|
||||
}
|
||||
|
||||
protected override void OnShutdown()
|
||||
{
|
||||
_log.Info("Service shutdown");
|
||||
fileConverter.Stop();
|
||||
base.OnShutdown();
|
||||
}
|
||||
|
||||
protected override void OnCustomCommand(int command)
|
||||
{
|
||||
|
||||
base.OnCustomCommand(command);
|
||||
}
|
||||
|
||||
protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
|
||||
{
|
||||
if (powerStatus == PowerBroadcastStatus.Suspend)
|
||||
{
|
||||
fileConverter.Stop();
|
||||
}
|
||||
return base.OnPowerEvent(powerStatus);
|
||||
}
|
||||
|
||||
protected override void OnSessionChange(
|
||||
SessionChangeDescription changeDescription)
|
||||
{
|
||||
base.OnSessionChange(changeDescription);
|
||||
}
|
||||
|
||||
public void StartDaemon()
|
||||
{
|
||||
fileConverter.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?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>{290A48D1-F7E2-4478-AFE6-AE5C744CD633}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FileConverterService2</RootNamespace>
|
||||
<AssemblyName>FileConverterService2</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugOpenSource|AnyCPU' ">
|
||||
<IsOpenSource>true</IsOpenSource>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;OPEN_SOURCE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseOpenSource|AnyCPU' ">
|
||||
<IsOpenSource>true</IsOpenSource>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;OPEN_SOURCE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include="FileConverter.cs" />
|
||||
<Compile Include="FileConverterService2.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FileConverterService2Installer.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AWSSDK, Version=1.3.19.0, Culture=neutral, PublicKeyToken=cd2d24cd2bace800, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\Bin\AWSSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FileConverterUtils2, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\wwwroot\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>..\..\..\wwwroot\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>..\..\..\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.Configuration.Install" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<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>
|
||||
<None Include="App.config" />
|
||||
<None Include="Settings.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == '' " Include="ASCGraphics">
|
||||
<Guid>{AB5F2678-2773-44C4-A637-33DFBC51233B}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="ASCOfficeFile">
|
||||
<Guid>{74CBF220-BF08-11DE-8A39-0800200C9A66}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Condition=" '$(IsOpenSource)' == 'true' " Include="OfficeCore">
|
||||
<Guid>{2FA8EF81-55E5-4F98-B399-2DF9A5DA5E41}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy $(ProjectDir)bin\Release\$(TargetFileName) $(SolutionDir)..\..\wwwroot\Bin\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* (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.ComponentModel;
|
||||
using System.Configuration.Install;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace FileConverterService2
|
||||
{
|
||||
|
||||
[RunInstaller(true)]
|
||||
public class FileConverterServiceInstaller : Installer
|
||||
{
|
||||
|
||||
public FileConverterServiceInstaller()
|
||||
{
|
||||
ServiceProcessInstaller serviceProcessInstaller =
|
||||
new ServiceProcessInstaller();
|
||||
ServiceInstaller serviceInstaller = new ServiceInstaller();
|
||||
|
||||
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
|
||||
serviceProcessInstaller.Username = null;
|
||||
serviceProcessInstaller.Password = null;
|
||||
|
||||
serviceInstaller.DisplayName = FileConverterService2.AscFileConverterServiceName;
|
||||
serviceInstaller.StartType = ServiceStartMode.Automatic;
|
||||
|
||||
serviceInstaller.ServiceName = FileConverterService2.AscFileConverterServiceName;
|
||||
this.Installers.Add(serviceProcessInstaller);
|
||||
this.Installers.Add(serviceInstaller);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* (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.ServiceProcess;
|
||||
|
||||
namespace FileConverterService2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var service = new FileConverterService2();
|
||||
if ((args.Length > 0 && args[0] == "-d") || Environment.UserInteractive)
|
||||
{
|
||||
service.StartDaemon();
|
||||
}
|
||||
else
|
||||
{
|
||||
ServiceBase.Run(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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("FileConverterService2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("FileConverterService2")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA Copyright (c) 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("2f0ef597-725c-4954-976e-9808c513f9a5")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.26")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.26")]
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<appSettings>
|
||||
<add key="utils.common.fontdir" value="D:\Subversion\AVS\Sources\AVSOfficeStudio\OfficeWebCommon\TM_Fonts_Generator\Generations\Input"/>
|
||||
<!--Access credentinals-->
|
||||
<add key="AWSAccessKey" value="AKIAJXWUXR4MUL4MKZMA"/>
|
||||
<add key="AWSSecretKey" value="U5yvGrCYkQBaw39DggsM9Ygt5VZoJ80Gok/YdeSv"/>
|
||||
|
||||
<add key="utils.storage.impl" value="fs"/>
|
||||
|
||||
<!--S3 storage settings-->
|
||||
<add key="utils.storage.s3.region" value="us-west-2"/>
|
||||
<add key="utils.storage.s3.bucketname" value="static-doc.teamlab.com"/>
|
||||
<add key="utils.storage.s3.foldername" value="storage"/>
|
||||
<add key="utils.storage.s3.readbuffersize" value="5242880" />
|
||||
|
||||
<!--Filesystem storage settings-->
|
||||
<add key="utils.storage.fs.keyfiles" value="E:\Subversion\AVS\Sources\TeamlabOffice\trunk\wwwroot\files"/>
|
||||
|
||||
<add key="utils.taskresult.impl" value="db"/>
|
||||
<add key="utils.taskresult.ttl" value="7.00:00:00"/>
|
||||
<add key="utils.taskresult.db.connectionstring" value="ConnectionString2"/>
|
||||
|
||||
<add key="utils.taskqueue.impl" value="db"/>
|
||||
<add key="utils.taskqueue.db.connectionstring" value="ConnectionString2"/>
|
||||
|
||||
<add key="utils.filestatistic.impl" value="db"/>
|
||||
<add key="utils.filestatistic.db.connectionstring" value="ConnectionString2"/>
|
||||
|
||||
<!--SQS settings-->
|
||||
<add key="utils.taskqueue.sqs.lp" value="https://sqs.us-west-2.amazonaws.com/997789372772/document-tasks-queue-high-priority" />
|
||||
<add key="utils.taskqueue.sqs.np" value="https://sqs.us-west-2.amazonaws.com/997789372772/document-tasks-queue-high-priority" />
|
||||
<add key="utils.taskqueue.sqs.hp" value="https://sqs.us-west-2.amazonaws.com/997789372772/document-tasks-queue-high-priority" />
|
||||
</appSettings>
|
||||
26
ServerComponents/FileConverterUtils2/FileConverterUtils2.sln
Normal file
26
ServerComponents/FileConverterUtils2/FileConverterUtils2.sln
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
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
|
||||
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
* (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
|
||||
}
|
||||
@@ -0,0 +1,546 @@
|
||||
/*
|
||||
* (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
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,678 @@
|
||||
/*
|
||||
* (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)
|
||||
{
|
||||
#if OPEN_SOURCE
|
||||
return new OpenSourceLicenseInfo();
|
||||
#else
|
||||
|
||||
LicenseType licType = (LicenseType)int.Parse(ConfigurationManager.AppSettings["license.type"] ?? "3");
|
||||
|
||||
LicenseInfo lic = null;
|
||||
switch (licType)
|
||||
{
|
||||
case LicenseType.ByVKey:
|
||||
lic = new VKeyLicenseInfo();
|
||||
break;
|
||||
|
||||
case LicenseType.ByUserCount:
|
||||
lic = new UserCountLicenseInfo();
|
||||
break;
|
||||
|
||||
case LicenseType.ByDocumentSessions:
|
||||
lic = new DocumentSessionLicenseInfo();
|
||||
break;
|
||||
|
||||
case LicenseType.ByUserCount2:
|
||||
lic = new UserCount2LicenseInfo();
|
||||
break;
|
||||
|
||||
case LicenseType.ByActiveConnections:
|
||||
default:
|
||||
lic = new ActiveConnectionLicenseInfo();
|
||||
break;
|
||||
}
|
||||
if (null != lic)
|
||||
lic.m_dtBuildTime = buildTime;
|
||||
|
||||
return lic;
|
||||
#endif
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
#if OPEN_SOURCE
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
public class MockLicenseInfo : LicenseInfo
|
||||
{
|
||||
public override LicenseRights getRights(LicenseMetaData metaData, out ErrorTypes errorCode)
|
||||
{
|
||||
LicenseRights oRights = new LicenseRights(true);
|
||||
errorCode = ErrorTypes.NoError;
|
||||
return oRights;
|
||||
}
|
||||
public override LicenseCustomerInfo getCustomerInfo()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class VKeyLicenseInfo : LicenseInfo
|
||||
{
|
||||
public VKeyLicenseInfo()
|
||||
{
|
||||
}
|
||||
public override LicenseRights getRights(LicenseMetaData metaData, out ErrorTypes errorCode)
|
||||
{
|
||||
errorCode = ErrorTypes.NoError;
|
||||
LicenseRights oRights = new LicenseRights();
|
||||
if (metaData is LicenseMetaData)
|
||||
{
|
||||
LicenseMetaData metaVKey = (LicenseMetaData)metaData;
|
||||
errorCode = Signature.isAccept(metaVKey.VKey, metaVKey.DocId, false, null);
|
||||
|
||||
if (ErrorTypes.NoError == errorCode ||
|
||||
ErrorTypes.VKeyTimeExpire == errorCode)
|
||||
{
|
||||
|
||||
oRights.CanOpen = (ErrorTypes.VKeyTimeExpire != errorCode);
|
||||
|
||||
string sAffilieteId = null;
|
||||
Signature.getVKeyStringParam(metaVKey.VKey, ConfigurationSettings.AppSettings["keyKeyID"], out sAffilieteId);
|
||||
ASC.Core.Billing.PaymentOffice oPaymentOffice = Signature.getPaymentOffice(sAffilieteId);
|
||||
if (32 <= sAffilieteId.Length)
|
||||
{
|
||||
oRights.CanSave = oPaymentOffice.Editing;
|
||||
oRights.CanCoAuthoring = oPaymentOffice.CoEditing;
|
||||
oRights.CanExport = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
oRights.CanSave = true;
|
||||
oRights.CanCoAuthoring = true;
|
||||
oRights.CanExport = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorCode = ErrorTypes.LicenseErrorArgument;
|
||||
}
|
||||
return oRights;
|
||||
}
|
||||
public override LicenseCustomerInfo getCustomerInfo()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class ActiveConnectionLicenseInfo : LicenseInfo
|
||||
{
|
||||
protected ITrackingInfo trackInfo;
|
||||
|
||||
protected virtual ActiveConnectionsLicenseReader createLicenseReader(string licensePath)
|
||||
{
|
||||
return new ActiveConnectionsLicenseReader(licensePath);
|
||||
}
|
||||
protected virtual ITrackingInfo createTrackingInfo ()
|
||||
{
|
||||
return new TrackingInfo ();
|
||||
}
|
||||
public ActiveConnectionLicenseInfo ()
|
||||
{
|
||||
trackInfo = createTrackingInfo ();
|
||||
|
||||
int interval = int.Parse(ConfigurationSettings.AppSettings["license.activeconnections.tracking.interval"] ?? "300");
|
||||
string licensePath = ConfigurationSettings.AppSettings["license.file.path"];
|
||||
|
||||
trackInfo.setLicense(createLicenseReader(licensePath));
|
||||
}
|
||||
|
||||
public virtual void track(string clientId, string docId, int isAlive)
|
||||
{
|
||||
trackInfo.track (clientId, docId, isAlive);
|
||||
}
|
||||
|
||||
public void getUserCount (out int active, out int inactive)
|
||||
{
|
||||
trackInfo.getUserCount(out active, out inactive);
|
||||
}
|
||||
|
||||
public override LicenseCustomerInfo getCustomerInfo()
|
||||
{
|
||||
ActiveConnectionsLicenseReader lic = (ActiveConnectionsLicenseReader) trackInfo.getLicense();
|
||||
if (null == lic)
|
||||
return null;
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
bool found = lic.isLicenseFound();
|
||||
bool correct = lic.isLicenseCorrect();
|
||||
bool notStarted = (lic.getStartDate() > now);
|
||||
bool expired = (lic.getEndDate() < now) && (lic.getEndDateThreshold() > now);
|
||||
bool fully_expired = notStarted || (lic.getEndDateThreshold() < now);
|
||||
|
||||
if (notStarted && found && correct)
|
||||
{
|
||||
LicenseCustomerInfo infoUnreg = new LicenseCustomerInfo();
|
||||
infoUnreg.customer = lic.getCustomer();
|
||||
infoUnreg.customer_addr = lic.getCustomerAddr();
|
||||
infoUnreg.customer_www = lic.getCustomerWww();
|
||||
infoUnreg.customer_mail = lic.getCustomerMail();
|
||||
infoUnreg.customer_logo = lic.getCustomerLogo();
|
||||
infoUnreg.customer_info = "License starts on " + lic.getStartDate().ToUniversalTime().ToString("MM/dd/yyyy H:mm:ss zzz")+ "(UTC)";
|
||||
return infoUnreg;
|
||||
}
|
||||
if (fully_expired || !found || !correct)
|
||||
{
|
||||
LicenseCustomerInfo infoUnreg = new LicenseCustomerInfo();
|
||||
infoUnreg.customer = "Unregistered";
|
||||
return infoUnreg;
|
||||
}
|
||||
|
||||
LicenseCustomerInfo info = new LicenseCustomerInfo();
|
||||
info.customer = lic.getCustomer();
|
||||
info.customer_addr = lic.getCustomerAddr();
|
||||
info.customer_www = lic.getCustomerWww();
|
||||
info.customer_mail = lic.getCustomerMail();
|
||||
info.customer_info = expired ? "License has expired" : lic.getCustomerInfo();
|
||||
info.customer_logo = lic.getCustomerLogo();
|
||||
|
||||
return info;
|
||||
}
|
||||
protected virtual string getUserId(LicenseMetaData metaData)
|
||||
{
|
||||
return metaData.UserId;
|
||||
}
|
||||
protected virtual string getDocumentId(LicenseMetaData metaData)
|
||||
{
|
||||
return metaData.DocId;
|
||||
}
|
||||
protected bool checkQuotaExceeded(LicenseMetaData metaData)
|
||||
{
|
||||
string userId = getUserId(metaData);
|
||||
string documentId = getDocumentId(metaData);
|
||||
bool bQuotaExceed = trackInfo.isQuotaExceed(userId, documentId);
|
||||
|
||||
if (bQuotaExceed)
|
||||
{
|
||||
|
||||
trackInfo.Cleanup();
|
||||
bQuotaExceed = trackInfo.isQuotaExceed(userId, documentId);
|
||||
}
|
||||
|
||||
return bQuotaExceed;
|
||||
}
|
||||
public ILicenseReader getLicense()
|
||||
{
|
||||
return trackInfo.getLicense();
|
||||
}
|
||||
public override LicenseRights getRights(LicenseMetaData metaData, out ErrorTypes errorCode)
|
||||
{
|
||||
errorCode = ErrorTypes.NoError;
|
||||
|
||||
LicenseRights oRights = new LicenseRights();
|
||||
|
||||
bool bValidLicenseFile = trackInfo.isLicenseFileValid();
|
||||
if (!bValidLicenseFile)
|
||||
{
|
||||
errorCode = ErrorTypes.LicenseErrorFile;
|
||||
|
||||
bool bUnlicensedQuotaExceed = checkQuotaExceeded (metaData);
|
||||
|
||||
if (bUnlicensedQuotaExceed)
|
||||
{
|
||||
errorCode = ErrorTypes.LicenseErrorActiveConnectionQuotaExceed;
|
||||
}
|
||||
else
|
||||
{
|
||||
oRights.CanSave = true;
|
||||
oRights.CanCoAuthoring = true;
|
||||
oRights.CanExport = true;
|
||||
}
|
||||
|
||||
return oRights;
|
||||
}
|
||||
|
||||
bool bValidDate = false;
|
||||
|
||||
if (trackInfo.isLicenseDateValid())
|
||||
{
|
||||
|
||||
bValidDate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
errorCode = ErrorTypes.LicenseErrorInvalidDate;
|
||||
|
||||
if (!trackInfo.isLicenseDateTresholdExpired())
|
||||
bValidDate = true;
|
||||
}
|
||||
|
||||
bool bBuildTimeValid = trackInfo.isLicenseEndDateGreater(m_dtBuildTime);
|
||||
bool bQuotaExceed = true;
|
||||
bool bEditorAllowed = false;
|
||||
|
||||
uint permissions = trackInfo.getLicense().getPermissions();
|
||||
|
||||
if ((metaData.EditorId == (int)EditorType.Convertation)
|
||||
&& (permissions != EditorPermissions.PERMISSION_NONE))
|
||||
{
|
||||
|
||||
bQuotaExceed = false;
|
||||
bEditorAllowed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
bQuotaExceed = checkQuotaExceeded(metaData);
|
||||
|
||||
if (bQuotaExceed)
|
||||
{
|
||||
errorCode = ErrorTypes.LicenseErrorActiveConnectionQuotaExceed;
|
||||
}
|
||||
|
||||
if (((metaData.EditorId == (int)EditorType.Word) && (0 != (permissions & EditorPermissions.PERMISSION_WRITER)))
|
||||
|| ((metaData.EditorId == (int)EditorType.Spreadsheet) && (0 != (permissions & EditorPermissions.PERMISSION_SPREADSHEET)))
|
||||
|| ((metaData.EditorId == (int)EditorType.Presentation) && (0 != (permissions & EditorPermissions.PERMISSION_PRESENTATION)))
|
||||
)
|
||||
{
|
||||
|
||||
bEditorAllowed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (bValidDate && bEditorAllowed && !bQuotaExceed && bBuildTimeValid)
|
||||
{
|
||||
oRights.CanSave = true;
|
||||
oRights.CanCoAuthoring = true;
|
||||
oRights.CanExport = true;
|
||||
}
|
||||
|
||||
return oRights;
|
||||
}
|
||||
}
|
||||
|
||||
public class UserCountLicenseInfo : ActiveConnectionLicenseInfo
|
||||
{
|
||||
public UserCountLicenseInfo()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
public override void track(string clientId, string docId, int isAlive)
|
||||
{
|
||||
trackInfo.track(clientId, "", isAlive);
|
||||
}
|
||||
protected override string getDocumentId(LicenseMetaData metaData)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
protected override ActiveConnectionsLicenseReader createLicenseReader(string licensePath)
|
||||
{
|
||||
return new UserCountLicenseReader(licensePath);
|
||||
}
|
||||
protected override ITrackingInfo createTrackingInfo()
|
||||
{
|
||||
return new TrackingInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public class UserCount2LicenseInfo : UserCountLicenseInfo
|
||||
{
|
||||
public UserCount2LicenseInfo()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
protected override ActiveConnectionsLicenseReader createLicenseReader(string licensePath)
|
||||
{
|
||||
return new UserCount2LicenseReader(licensePath);
|
||||
}
|
||||
protected override ITrackingInfo createTrackingInfo()
|
||||
{
|
||||
return new UserCount2TrackingInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public class DocumentSessionLicenseInfo : LicenseInfo
|
||||
{
|
||||
DocumentSessionLicenseReader license;
|
||||
|
||||
public DocumentSessionLicenseInfo()
|
||||
{
|
||||
string licensePath = ConfigurationSettings.AppSettings["license.file.path"];
|
||||
license = new DocumentSessionLicenseReader(licensePath);
|
||||
}
|
||||
public string getTrackingUrl()
|
||||
{
|
||||
return null == license ? null : license.GetTrackingUrl();
|
||||
}
|
||||
public string getLicenseId()
|
||||
{
|
||||
return null == license ? null : license.getId();
|
||||
}
|
||||
|
||||
public override LicenseRights getRights(LicenseMetaData metaData, out ErrorTypes errorCode)
|
||||
{
|
||||
errorCode = ErrorTypes.NoError;
|
||||
|
||||
LicenseRights oRights = new LicenseRights();
|
||||
|
||||
if (null == license
|
||||
|| !license.isLicenseFound()
|
||||
|| !license.isLicenseCorrect())
|
||||
{
|
||||
errorCode = ErrorTypes.LicenseErrorFile;
|
||||
return oRights;
|
||||
}
|
||||
|
||||
bool bValidDate = false;
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
DateTime start = license.getStartDate();
|
||||
DateTime end = license.getEndDate();
|
||||
DateTime treshold = license.getEndDateThreshold();
|
||||
|
||||
if (start < now && end > now)
|
||||
{
|
||||
|
||||
bValidDate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
errorCode = ErrorTypes.LicenseErrorInvalidDate;
|
||||
|
||||
if (now < treshold)
|
||||
bValidDate = true;
|
||||
}
|
||||
|
||||
if (bValidDate)
|
||||
{
|
||||
oRights.CanSave = true;
|
||||
oRights.CanCoAuthoring = true;
|
||||
oRights.CanExport = true;
|
||||
}
|
||||
|
||||
return oRights;
|
||||
}
|
||||
public override LicenseCustomerInfo getCustomerInfo()
|
||||
{
|
||||
if (null == license)
|
||||
return null;
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
bool found = license.isLicenseFound();
|
||||
bool correct = license.isLicenseCorrect();
|
||||
bool notStarted = (license.getStartDate() > now);
|
||||
bool expired = (license.getEndDate() < now) && (license.getEndDateThreshold() > now);
|
||||
bool fully_expired = notStarted || (license.getEndDateThreshold() < now);
|
||||
|
||||
if (notStarted && found && correct)
|
||||
{
|
||||
LicenseCustomerInfo infoUnreg = new LicenseCustomerInfo();
|
||||
infoUnreg.customer = license.getCustomer();
|
||||
infoUnreg.customer_addr = license.getCustomerAddr();
|
||||
infoUnreg.customer_www = license.getCustomerWww();
|
||||
infoUnreg.customer_mail = license.getCustomerMail();
|
||||
infoUnreg.customer_logo = license.getCustomerLogo();
|
||||
infoUnreg.customer_info = "License starts on " + license.getStartDate().ToUniversalTime().ToString("MM/dd/yyyy H:mm:ss zzz") + "(UTC)";
|
||||
}
|
||||
if (fully_expired || !found || !correct)
|
||||
{
|
||||
LicenseCustomerInfo infoUnreg = new LicenseCustomerInfo();
|
||||
infoUnreg.customer = "Unregistered";
|
||||
return infoUnreg;
|
||||
}
|
||||
|
||||
LicenseCustomerInfo info = new LicenseCustomerInfo();
|
||||
info.customer = license.getCustomer();
|
||||
info.customer_addr = license.getCustomerAddr();
|
||||
info.customer_www = license.getCustomerWww();
|
||||
info.customer_mail = license.getCustomerMail();
|
||||
info.customer_info = expired ? "License has expired" : license.getCustomerInfo();
|
||||
info.customer_logo = license.getCustomerLogo();
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
* (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
|
||||
{
|
||||
#if !OPEN_SOURCE
|
||||
public class ActiveConnectionsLicenseReader : ILicenseReader
|
||||
{
|
||||
|
||||
protected List<ActiveConnectionsLicenseReaderSingle> m_licnenses = new List<ActiveConnectionsLicenseReaderSingle>();
|
||||
|
||||
protected virtual ActiveConnectionsLicenseReaderSingle createSingleFileReader(string licFileName)
|
||||
{
|
||||
return new ActiveConnectionsLicenseReaderSingle(licFileName);
|
||||
}
|
||||
public ActiveConnectionsLicenseReader (string ciphiredXmlPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
bool isFileExists = System.IO.File.Exists(ciphiredXmlPath);
|
||||
bool isDirExists = System.IO.Directory.Exists(ciphiredXmlPath);
|
||||
|
||||
if (isFileExists)
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(ciphiredXmlPath);
|
||||
string licFileName = fileInfo.FullName;
|
||||
ActiveConnectionsLicenseReaderSingle item = createSingleFileReader (licFileName);
|
||||
if (item.isLicenseFound() && item.isLicenseCorrect())
|
||||
{
|
||||
m_licnenses.Add(item);
|
||||
}
|
||||
}
|
||||
else if (isDirExists)
|
||||
{
|
||||
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(ciphiredXmlPath);
|
||||
FileInfo[] licFiles = rootDirectory.GetFiles("*.lic");
|
||||
if (null != licFiles)
|
||||
{
|
||||
foreach (FileInfo file in licFiles)
|
||||
{
|
||||
string licFileName = file.FullName;
|
||||
ActiveConnectionsLicenseReaderSingle item = createSingleFileReader (licFileName);
|
||||
if (item.isLicenseFound() && item.isLicenseCorrect())
|
||||
{
|
||||
|
||||
string licId = item.getId();
|
||||
bool unique = true;
|
||||
foreach (ActiveConnectionsLicenseReaderSingle lic_added in m_licnenses)
|
||||
{
|
||||
if (lic_added.getId() == licId)
|
||||
{
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique)
|
||||
m_licnenses.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_found = _correct = (m_licnenses.Count() > 0);
|
||||
|
||||
if (_found)
|
||||
{
|
||||
DateTime minDate, maxDate, tresholdDate;
|
||||
minDate = m_licnenses[0].getStartDate ();
|
||||
maxDate = m_licnenses[0].getEndDate ();
|
||||
tresholdDate = m_licnenses[0].getEndDateThreshold();
|
||||
|
||||
foreach (ActiveConnectionsLicenseReaderSingle lic in m_licnenses)
|
||||
{
|
||||
DateTime startDate = lic.getStartDate();
|
||||
DateTime endDate = lic.getEndDate();
|
||||
DateTime endDateTres = lic.getEndDateThreshold();
|
||||
if (minDate > startDate)
|
||||
minDate = startDate;
|
||||
if (maxDate < endDate)
|
||||
maxDate = endDate;
|
||||
if (tresholdDate < endDateTres)
|
||||
tresholdDate = endDateTres;
|
||||
}
|
||||
_startDate = minDate;
|
||||
_endDate = maxDate;
|
||||
_endDateThreshold = tresholdDate;
|
||||
|
||||
_customer = m_licnenses[0].getCustomer();
|
||||
_customer_www = m_licnenses[0].getCustomerWww();
|
||||
_customer_addr = m_licnenses[0].getCustomerAddr();
|
||||
_customer_mail = m_licnenses[0].getCustomerMail();
|
||||
_customer_info = m_licnenses[0].getCustomerInfo();
|
||||
_customer_logo = m_licnenses[0].getCustomerLogo();
|
||||
}
|
||||
else
|
||||
{
|
||||
_customer = "Unregistered";
|
||||
_customer_www = null;
|
||||
_customer_addr = null;
|
||||
_customer_mail = null;
|
||||
_customer_info = null;
|
||||
_customer_logo = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorTypes GetAccessByInfo()
|
||||
{
|
||||
return ErrorTypes.NoError;
|
||||
}
|
||||
|
||||
public DateTime getStartDate()
|
||||
{
|
||||
return _startDate;
|
||||
}
|
||||
|
||||
public DateTime getEndDate()
|
||||
{
|
||||
return _endDate;
|
||||
}
|
||||
|
||||
public DateTime getEndDateThreshold()
|
||||
{
|
||||
return _endDateThreshold;
|
||||
}
|
||||
|
||||
public string getId()
|
||||
{
|
||||
|
||||
string id = "";
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
id = lics[0].getId();
|
||||
return id;
|
||||
}
|
||||
|
||||
public string getCustomer()
|
||||
{
|
||||
string res = null;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getCustomer();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public string getCustomerAddr()
|
||||
{
|
||||
string res = null;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getCustomerAddr();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public string getCustomerWww()
|
||||
{
|
||||
string res = null;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getCustomerWww();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public string getCustomerMail()
|
||||
{
|
||||
string res = null;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getCustomerMail();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public string getCustomerInfo()
|
||||
{
|
||||
string res = null;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, false);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getCustomerInfo();
|
||||
else
|
||||
res = "License has expired";
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public string getCustomerLogo()
|
||||
{
|
||||
string res = null;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getCustomerLogo();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public bool isLicenseFound()
|
||||
{
|
||||
return _found;
|
||||
}
|
||||
public bool isLicenseCorrect()
|
||||
{
|
||||
return _correct;
|
||||
}
|
||||
public int getUserQuota()
|
||||
{
|
||||
int res = 0;
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
foreach (ActiveConnectionsLicenseReaderSingle lic in lics)
|
||||
{
|
||||
res += lic.getUserQuota();
|
||||
}
|
||||
if (0 == res)
|
||||
res = 2;
|
||||
return res;
|
||||
}
|
||||
|
||||
public uint getPermissions()
|
||||
{
|
||||
uint res = EditorPermissions.PERMISSION_NONE;
|
||||
|
||||
ActiveConnectionsLicenseReaderSingle[] lics = getLicensesByTime(DateTime.Now, true);
|
||||
if (lics.Count() > 0)
|
||||
res = lics[0].getPermissions();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
protected string _id;
|
||||
protected DateTime _startDate;
|
||||
protected DateTime _endDate;
|
||||
|
||||
protected string _customer;
|
||||
protected string _customer_addr;
|
||||
protected string _customer_www;
|
||||
protected string _customer_mail;
|
||||
protected string _customer_info;
|
||||
protected string _customer_logo;
|
||||
|
||||
protected DateTime _endDateThreshold;
|
||||
protected bool _correct;
|
||||
protected bool _found;
|
||||
protected int _quota;
|
||||
|
||||
protected ActiveConnectionsLicenseReaderSingle[] getLicensesByTime (DateTime time, bool useTreshold)
|
||||
{
|
||||
List<ActiveConnectionsLicenseReaderSingle> array = new List<ActiveConnectionsLicenseReaderSingle>();
|
||||
foreach (ActiveConnectionsLicenseReaderSingle item in m_licnenses)
|
||||
{
|
||||
DateTime startTime = item.getStartDate();
|
||||
DateTime endTime = item.getEndDate();
|
||||
DateTime endTimeTreshold = item.getEndDateThreshold();
|
||||
if ((startTime <= time)
|
||||
&& (useTreshold ? (time <= endTimeTreshold) : (time <= endTime)))
|
||||
{
|
||||
array.Add(item);
|
||||
}
|
||||
}
|
||||
return array.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public class UserCountLicenseReader : ActiveConnectionsLicenseReader
|
||||
{
|
||||
protected override ActiveConnectionsLicenseReaderSingle createSingleFileReader(string licFileName)
|
||||
{
|
||||
return new UserCountLicenseReaderSingle(licFileName);
|
||||
}
|
||||
|
||||
public UserCountLicenseReader(string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class UserCount2LicenseReader : ActiveConnectionsLicenseReader
|
||||
{
|
||||
protected override ActiveConnectionsLicenseReaderSingle createSingleFileReader(string licFileName)
|
||||
{
|
||||
return new UserCount2LicenseReaderSingle(licFileName);
|
||||
}
|
||||
|
||||
public UserCount2LicenseReader(string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,668 @@
|
||||
/*
|
||||
* (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
|
||||
{
|
||||
#if !OPEN_SOURCE
|
||||
|
||||
public class LicenseReaderException: Exception
|
||||
{
|
||||
}
|
||||
public class LicenseReaderNotFoundException : LicenseReaderException
|
||||
{
|
||||
}
|
||||
public class LicenseReaderFormatException : LicenseReaderException
|
||||
{
|
||||
}
|
||||
public class LicenseReaderSigantureException : LicenseReaderException
|
||||
{
|
||||
}
|
||||
public static class LicenseReader
|
||||
{
|
||||
|
||||
private static string _copyright = "Copyright TeamLab.com. All Rights Reserved.";
|
||||
|
||||
private static byte[] _public = { 127, 61, 35, 56, 57, 12, 30, 62, 21, 76, 33, 0, 95, 81, 1, 14, 6, 91,
|
||||
15, 26, 30, 16, 22, 0, 32, 36, 115, 21, 12, 2, 42, 17, 67, 111, 96,
|
||||
38, 33, 81, 55, 30, 80, 33, 97, 21, 27, 51, 52, 0, 15, 82, 45, 69,
|
||||
18, 61, 33, 7, 35, 59, 21, 90, 120, 53, 58, 3, 79, 119, 8, 92, 37,
|
||||
74, 59, 3, 6, 60, 26, 39, 101, 4, 87, 35, 2, 25, 89, 14, 16, 105,
|
||||
20, 40, 7, 54, 56, 95, 30, 1, 58, 22, 28, 36, 82, 2, 37, 48, 19,
|
||||
95, 42, 12, 7, 97, 82, 0, 39, 67, 98, 28, 48, 3, 49, 63, 57, 72,
|
||||
49, 43, 58, 4, 22, 49, 22, 55, 94, 50, 11, 25, 48, 27, 81, 37, 95,
|
||||
53, 65, 24, 15, 11, 94, 35, 21, 42, 95, 41, 88, 40, 89, 25, 53, 95,
|
||||
92, 72, 125, 29, 95, 37, 16, 70, 89, 0, 21, 20, 40, 54, 1, 28, 53,
|
||||
120, 13, 0, 56, 55, 33, 94, 41, 1, 91, 116, 109, 84, 88, 59, 40, 24,
|
||||
40, 84, 55, 87, 6, 107, 23, 36, 41, 30, 70, 27, 15, 35, 61, 2, 70,
|
||||
15, 23, 44, 26, 81, 39, 64, 52, 79, 69, 39, 68, 20, 12, 65, 26, 86,
|
||||
24, 76, 25, 2, 63, 52, 30, 24, 37, 87, 108, 50, 46, 27, 102, 89, 114,
|
||||
4, 67, 25, 32, 45, 10, 7, 50, 48, 87, 121, 22, 6, 35, 40, 17, 80, 85,
|
||||
124, 15, 2, 30, 20, 20, 30, 52, 42, 68, 22, 50, 35, 13, 10, 36, 20,
|
||||
50, 66, 12, 33, 88, 28, 108, 44, 24, 62, 19, 101, 14, 85, 33, 53, 52,
|
||||
73, 37, 85, 49, 43, 68, 32, 14, 81, 94, 38, 41, 68, 8, 16, 16, 43,
|
||||
30, 48, 73, 54, 23, 8, 10, 32, 18, 47, 1, 41, 41, 1, 76, 16, 121,
|
||||
57, 58, 16, 7, 80, 51, 56, 5, 30, 21, 63, 13, 50, 60, 65, 33, 32,
|
||||
38, 107, 14, 8, 5, 15, 56, 70, 37, 45, 63, 82, 53, 4, 2, 33, 45,
|
||||
37, 13, 1, 91, 62, 80, 19, 28, 110, 33, 3, 68, 39, 5, 18, 27, 74,
|
||||
79, 101, 42, 21, 28, 11, 23, 24, 17, 90, 111, 18, 46, 50, 69, 93,
|
||||
44, 31, 24, 27, 78, 49, 11, 21, 83, 112, 78, 48, 125, 34, 36, 8,
|
||||
87, 118, 32, 0, 25, 69, 108 };
|
||||
|
||||
public static XmlDocument Read (string path)
|
||||
{
|
||||
|
||||
byte[] ciphiredXml = File.ReadAllBytes(path);
|
||||
|
||||
return ParseLicenseXml (ciphiredXml);
|
||||
}
|
||||
private static XmlDocument ParseLicenseXml(byte[] ciphiredXml)
|
||||
{
|
||||
XmlDocument xmlDoc = null;
|
||||
|
||||
if (null == ciphiredXml)
|
||||
throw new ArgumentNullException("ciphiredXml is null");
|
||||
|
||||
string signaturedXml = LicenseUtils.symmetricDecrypt(ciphiredXml, _public);
|
||||
|
||||
string publicKey = makePublicKey(_public, _copyright);
|
||||
|
||||
RSACryptoServiceProvider rsaKey = new RSACryptoServiceProvider();
|
||||
rsaKey.PersistKeyInCsp = false;
|
||||
|
||||
rsaKey.FromXmlString(publicKey);
|
||||
|
||||
xmlDoc = new XmlDocument();
|
||||
|
||||
xmlDoc.PreserveWhitespace = true;
|
||||
|
||||
xmlDoc.LoadXml(signaturedXml);
|
||||
|
||||
bool res = LicenseUtils.VerifyXml(xmlDoc, rsaKey);
|
||||
|
||||
rsaKey.Clear();
|
||||
rsaKey = null;
|
||||
|
||||
if (!res)
|
||||
{
|
||||
throw new LicenseReaderSigantureException();
|
||||
}
|
||||
|
||||
return xmlDoc;
|
||||
}
|
||||
|
||||
private static string makePublicKey(byte[] unread, string copyright)
|
||||
{
|
||||
|
||||
int copyrightLength = _copyright.Length;
|
||||
int unreadLength = unread.Length;
|
||||
int index_unread = 0;
|
||||
int index_copyright = 0;
|
||||
|
||||
string result = "";
|
||||
while (index_unread < unreadLength)
|
||||
{
|
||||
int byteCopyright = (int)(Convert.ToByte(_copyright[index_copyright]));
|
||||
int byteUnread = (int)unread[index_unread];
|
||||
int resultByte = byteUnread ^ byteCopyright;
|
||||
|
||||
result += (char)(resultByte & 0x00FF);
|
||||
|
||||
++index_unread;
|
||||
++index_copyright;
|
||||
|
||||
if (index_copyright >= copyrightLength)
|
||||
index_copyright = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EditorPermissions
|
||||
{
|
||||
public const uint PERMISSION_NONE = 0;
|
||||
public const uint PERMISSION_WRITER = 1;
|
||||
public const uint PERMISSION_SPREADSHEET = 2;
|
||||
public const uint PERMISSION_PRESENTATION = 4;
|
||||
public const uint PERMISSION_ALL = PERMISSION_WRITER | PERMISSION_SPREADSHEET | PERMISSION_PRESENTATION;
|
||||
}
|
||||
public interface ILicenseReader
|
||||
{
|
||||
ErrorTypes GetAccessByInfo();
|
||||
|
||||
DateTime getStartDate();
|
||||
DateTime getEndDate();
|
||||
DateTime getEndDateThreshold();
|
||||
|
||||
string getId();
|
||||
string getCustomer();
|
||||
string getCustomerAddr();
|
||||
string getCustomerWww();
|
||||
string getCustomerMail();
|
||||
string getCustomerInfo();
|
||||
string getCustomerLogo();
|
||||
|
||||
uint getPermissions();
|
||||
|
||||
bool isLicenseFound();
|
||||
bool isLicenseCorrect();
|
||||
}
|
||||
|
||||
public class AllRightsLicenseReader : ILicenseReader
|
||||
{
|
||||
public ErrorTypes GetAccessByInfo()
|
||||
{
|
||||
return ErrorTypes.NoError;
|
||||
}
|
||||
|
||||
#region Standard license fields getters
|
||||
public DateTime getStartDate()
|
||||
{
|
||||
return DateTime.Now;
|
||||
}
|
||||
public DateTime getEndDate()
|
||||
{
|
||||
return DateTime.Now.AddDays(10.0);
|
||||
}
|
||||
public DateTime getEndDateThreshold()
|
||||
{
|
||||
return DateTime.Now.AddDays(20.0);
|
||||
}
|
||||
|
||||
public string getId()
|
||||
{
|
||||
return "fake";
|
||||
}
|
||||
public string getCustomer()
|
||||
{
|
||||
return "fake_customer";
|
||||
}
|
||||
public string getCustomerAddr()
|
||||
{
|
||||
return "fake_addr";
|
||||
}
|
||||
public string getCustomerWww()
|
||||
{
|
||||
return "fake_www";
|
||||
}
|
||||
public string getCustomerMail()
|
||||
{
|
||||
return "fake_mail";
|
||||
}
|
||||
public string getCustomerInfo()
|
||||
{
|
||||
return "fake_info";
|
||||
}
|
||||
public string getCustomerLogo()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
public bool isLicenseFound()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public bool isLicenseCorrect()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public uint getPermissions()
|
||||
{
|
||||
return EditorPermissions.PERMISSION_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class LicenseReaderBase: ILicenseReader
|
||||
{
|
||||
protected string _id;
|
||||
|
||||
protected string _license_type;
|
||||
protected string _ciphiredXmlPath;
|
||||
|
||||
protected DateTime _startDate;
|
||||
protected DateTime _endDate;
|
||||
|
||||
protected string _customer;
|
||||
protected string _customer_addr;
|
||||
protected string _customer_www;
|
||||
protected string _customer_mail;
|
||||
protected string _customer_info;
|
||||
protected string _customer_logo;
|
||||
|
||||
protected DateTime _endDateThreshold;
|
||||
protected bool _correct;
|
||||
protected bool _found;
|
||||
|
||||
protected uint _permissions = EditorPermissions.PERMISSION_NONE;
|
||||
|
||||
public LicenseReaderBase(string ciphiredXmlPath)
|
||||
{
|
||||
|
||||
_startDate = DateTime.Now;
|
||||
_endDate = _startDate.AddDays(10.0);
|
||||
_endDateThreshold = _endDate.AddDays(1.0);
|
||||
|
||||
_found = false;
|
||||
_correct = false;
|
||||
|
||||
try
|
||||
{
|
||||
_ciphiredXmlPath = ciphiredXmlPath;
|
||||
XmlDocument xmlDoc = LicenseReader.Read (ciphiredXmlPath);
|
||||
|
||||
_found = true;
|
||||
|
||||
bool res = FillMembersBase(xmlDoc);
|
||||
if (!res)
|
||||
{
|
||||
throw new LicenseReaderFormatException();
|
||||
}
|
||||
|
||||
_correct = true;
|
||||
}
|
||||
catch (LicenseReaderSigantureException ex)
|
||||
{
|
||||
_correct = false;
|
||||
}
|
||||
catch (LicenseReaderNotFoundException ex)
|
||||
{
|
||||
_found = false;
|
||||
}
|
||||
catch (LicenseReaderFormatException ex)
|
||||
{
|
||||
_correct = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_found = false;
|
||||
_correct = false;
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorTypes GetAccessByInfo()
|
||||
{
|
||||
return ErrorTypes.NoError;
|
||||
}
|
||||
|
||||
#region Standard license fields getters
|
||||
public DateTime getStartDate()
|
||||
{
|
||||
return _startDate;
|
||||
}
|
||||
public DateTime getEndDate()
|
||||
{
|
||||
return _endDate;
|
||||
}
|
||||
public DateTime getEndDateThreshold()
|
||||
{
|
||||
return _endDateThreshold;
|
||||
}
|
||||
public string getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
public string getCustomer()
|
||||
{
|
||||
return _customer;
|
||||
}
|
||||
public string getCustomerAddr()
|
||||
{
|
||||
return _customer_addr;
|
||||
}
|
||||
public string getCustomerWww()
|
||||
{
|
||||
return _customer_www;
|
||||
}
|
||||
public string getCustomerMail()
|
||||
{
|
||||
return _customer_mail;
|
||||
}
|
||||
public string getCustomerInfo()
|
||||
{
|
||||
return _customer_info;
|
||||
}
|
||||
public string getCustomerLogo()
|
||||
{
|
||||
return _customer_logo;
|
||||
}
|
||||
#endregion
|
||||
public bool isLicenseFound()
|
||||
{
|
||||
return _found;
|
||||
}
|
||||
public bool isLicenseCorrect()
|
||||
{
|
||||
return _correct;
|
||||
}
|
||||
public uint getPermissions()
|
||||
{
|
||||
return _permissions;
|
||||
}
|
||||
|
||||
private bool FillMembersBase(XmlDocument xmlDoc)
|
||||
{
|
||||
bool res = false;
|
||||
try
|
||||
{
|
||||
|
||||
XmlNodeList list = xmlDoc.GetElementsByTagName("teamlaboffice").Item(0).ChildNodes;
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
foreach (XmlNode node in list)
|
||||
{
|
||||
if (node.NodeType == XmlNodeType.Element && node.HasChildNodes)
|
||||
{
|
||||
dict.Add(node.Name, node.FirstChild.Value);
|
||||
}
|
||||
}
|
||||
|
||||
string license_type;
|
||||
string startDate;
|
||||
string endDate;
|
||||
string endDateThreshold;
|
||||
string id;
|
||||
string customer;
|
||||
string customer_addr;
|
||||
string customer_www;
|
||||
string customer_mail;
|
||||
string customer_info;
|
||||
string customer_logo;
|
||||
string permissions;
|
||||
|
||||
if (!dict.TryGetValue("startdate", out startDate))
|
||||
startDate = null;
|
||||
if (!dict.TryGetValue("enddate", out endDate))
|
||||
endDate = null;
|
||||
if (!dict.TryGetValue("enddatethreshold", out endDateThreshold))
|
||||
endDateThreshold = null;
|
||||
if (!dict.TryGetValue("id", out id))
|
||||
id = null;
|
||||
if (!dict.TryGetValue("customer", out customer))
|
||||
customer = "";
|
||||
if (!dict.TryGetValue("customer_addr", out customer_addr))
|
||||
customer_addr = "";
|
||||
if (!dict.TryGetValue("customer_www", out customer_www))
|
||||
customer_www = "";
|
||||
if (!dict.TryGetValue("customer_mail", out customer_mail))
|
||||
customer_mail = "";
|
||||
if (!dict.TryGetValue("customer_info", out customer_info))
|
||||
customer_info = "";
|
||||
if (!dict.TryGetValue("customer_logo", out customer_logo))
|
||||
customer_logo = "";
|
||||
if (!dict.TryGetValue("lictype", out license_type))
|
||||
license_type = "";
|
||||
|
||||
if (!dict.TryGetValue("permissions", out permissions))
|
||||
{
|
||||
_permissions = EditorPermissions.PERMISSION_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
string perm_lo = permissions.ToLower();
|
||||
_permissions |= perm_lo.Contains("w") ? EditorPermissions.PERMISSION_WRITER : EditorPermissions.PERMISSION_NONE;
|
||||
_permissions |= perm_lo.Contains("e") ? EditorPermissions.PERMISSION_SPREADSHEET : EditorPermissions.PERMISSION_NONE;
|
||||
_permissions |= perm_lo.Contains("p") ? EditorPermissions.PERMISSION_PRESENTATION : EditorPermissions.PERMISSION_NONE;
|
||||
}
|
||||
|
||||
if (null == startDate
|
||||
|| null == endDate
|
||||
|| null == id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this._startDate = DateTime.Parse(startDate);
|
||||
this._endDate = DateTime.Parse(endDate);
|
||||
if (null == endDateThreshold || endDateThreshold == "")
|
||||
this._endDateThreshold = _endDate.AddMonths(1);
|
||||
else
|
||||
this._endDateThreshold = DateTime.Parse(endDateThreshold);
|
||||
this._id = id;
|
||||
this._customer = customer;
|
||||
this._customer_addr = customer_addr;
|
||||
this._customer_www = customer_www;
|
||||
this._customer_mail = customer_mail;
|
||||
this._customer_info = customer_info;
|
||||
this._customer_logo = customer_logo;
|
||||
this._license_type = license_type;
|
||||
|
||||
res = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
return res & FillMembers(xmlDoc);
|
||||
}
|
||||
|
||||
protected abstract bool FillMembers(XmlDocument xmlDoc);
|
||||
}
|
||||
|
||||
public class LicenseReaderSimple : LicenseReaderBase
|
||||
{
|
||||
|
||||
protected LicenseReaderSimple(string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
protected override bool FillMembers(XmlDocument xmlDoc)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public static ILicenseReader GetLicenseReaderObject(string ciphiredXmlPath, LicenseInfo.LicenseType licenseType)
|
||||
{
|
||||
ILicenseReader result = null;
|
||||
|
||||
switch (licenseType)
|
||||
{
|
||||
|
||||
case LicenseInfo.LicenseType.ByUserCount:
|
||||
result = new UserCountLicenseReader (ciphiredXmlPath);
|
||||
break;
|
||||
|
||||
case LicenseInfo.LicenseType.ByDocumentSessions:
|
||||
result = new DocumentSessionLicenseReader(ciphiredXmlPath);
|
||||
break;
|
||||
|
||||
case LicenseInfo.LicenseType.ByUserCount2:
|
||||
result = new UserCount2LicenseReader(ciphiredXmlPath);
|
||||
break;
|
||||
|
||||
case LicenseInfo.LicenseType.ByActiveConnections:
|
||||
result = new ActiveConnectionsLicenseReader(ciphiredXmlPath);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
LicenseReaderSimple simple = new LicenseReaderSimple(ciphiredXmlPath);
|
||||
|
||||
if (null != simple && simple.isLicenseFound() && simple.isLicenseCorrect())
|
||||
{
|
||||
if (simple._license_type == "ActiveConnections")
|
||||
result = new ActiveConnectionsLicenseReader(ciphiredXmlPath);
|
||||
else if (simple._license_type == "UserCount")
|
||||
result = new UserCountLicenseReader(ciphiredXmlPath);
|
||||
else if (simple._license_type == "UserCount2")
|
||||
result = new UserCount2LicenseReader(ciphiredXmlPath);
|
||||
else if (simple._license_type == "DocumentSessions")
|
||||
result = new DocumentSessionLicenseReader(ciphiredXmlPath);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class ActiveConnectionsLicenseReaderSingle : LicenseReaderBase
|
||||
{
|
||||
|
||||
protected int _quota;
|
||||
|
||||
public int getUserQuota()
|
||||
{
|
||||
return _quota;
|
||||
}
|
||||
|
||||
public ActiveConnectionsLicenseReaderSingle(string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool FillMembers(XmlDocument xmlDoc)
|
||||
{
|
||||
bool res = false;
|
||||
try
|
||||
{
|
||||
|
||||
XmlNodeList list = xmlDoc.GetElementsByTagName("teamlaboffice").Item(0).ChildNodes;
|
||||
Dictionary <string, string> dict = new Dictionary<string,string> ();
|
||||
foreach (XmlNode node in list)
|
||||
{
|
||||
if (node.NodeType == XmlNodeType.Element && node.HasChildNodes)
|
||||
{
|
||||
dict.Add(node.Name, node.FirstChild.Value);
|
||||
}
|
||||
}
|
||||
|
||||
string connectionQuota = dict["connectionquota"];
|
||||
string licType = dict["lictype"];
|
||||
|
||||
if (null == connectionQuota
|
||||
|| null == licType
|
||||
|| licType != getLicenseTypeName())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this._quota = int.Parse (connectionQuota);
|
||||
res = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
protected virtual string getLicenseTypeName()
|
||||
{
|
||||
return "ActiveConnections";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class UserCountLicenseReaderSingle : ActiveConnectionsLicenseReaderSingle
|
||||
{
|
||||
protected override string getLicenseTypeName()
|
||||
{
|
||||
return "UserCount";
|
||||
}
|
||||
public UserCountLicenseReaderSingle(string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class UserCount2LicenseReaderSingle : ActiveConnectionsLicenseReaderSingle
|
||||
{
|
||||
protected override string getLicenseTypeName()
|
||||
{
|
||||
return "UserCount2";
|
||||
}
|
||||
public UserCount2LicenseReaderSingle(string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class DocumentSessionLicenseReader : LicenseReaderBase
|
||||
{
|
||||
protected string _trackingUrl = "";
|
||||
|
||||
public string GetTrackingUrl()
|
||||
{
|
||||
return _trackingUrl;
|
||||
}
|
||||
|
||||
public DocumentSessionLicenseReader (string ciphiredXmlPath)
|
||||
: base(ciphiredXmlPath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool FillMembers(XmlDocument xmlDoc)
|
||||
{
|
||||
bool res = false;
|
||||
try
|
||||
{
|
||||
|
||||
XmlNodeList list = xmlDoc.GetElementsByTagName("teamlaboffice").Item(0).ChildNodes;
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
foreach (XmlNode node in list)
|
||||
{
|
||||
if (node.NodeType == XmlNodeType.Element && node.HasChildNodes)
|
||||
{
|
||||
dict.Add(node.Name, node.FirstChild.Value);
|
||||
}
|
||||
}
|
||||
|
||||
string trackingUrl = dict["trackingurl"];
|
||||
string licType = dict["lictype"];
|
||||
|
||||
if (null == trackingUrl
|
||||
|| null == licType
|
||||
|| licType != "DocumentSessions")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this._trackingUrl = trackingUrl;
|
||||
|
||||
res = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* (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
|
||||
{
|
||||
#if !OPEN_SOURCE
|
||||
|
||||
public static Boolean VerifyXml(XmlDocument Doc, RSA Key)
|
||||
{
|
||||
|
||||
if (Doc == null)
|
||||
throw new ArgumentException("Doc");
|
||||
if (Key == null)
|
||||
throw new ArgumentException("Key");
|
||||
|
||||
SignedXml signedXml = new SignedXml(Doc);
|
||||
|
||||
XmlNodeList nodeList = Doc.GetElementsByTagName("Signature");
|
||||
|
||||
if (nodeList.Count <= 0)
|
||||
{
|
||||
throw new CryptographicException("Verification failed: No Signature was found in the document.");
|
||||
}
|
||||
|
||||
if (nodeList.Count >= 2)
|
||||
{
|
||||
throw new CryptographicException("Verification failed: More that one signature was found for the document.");
|
||||
}
|
||||
|
||||
signedXml.LoadXml((XmlElement)nodeList[0]);
|
||||
|
||||
return signedXml.CheckSignature(Key);
|
||||
}
|
||||
|
||||
public static string symmetricDecrypt(byte[] content, byte[] keyAndIv)
|
||||
{
|
||||
RijndaelManaged RMCrypto = new RijndaelManaged();
|
||||
KeySizes[] keySizes = RMCrypto.LegalKeySizes;
|
||||
|
||||
if (keySizes.Length == 0)
|
||||
throw new InvalidOperationException("No Rijndael key sizes");
|
||||
|
||||
int keySize = (keySizes[0].MaxSize / 8);
|
||||
int blockSize = (RMCrypto.BlockSize / 8);
|
||||
|
||||
byte[] Key = new byte[keySize];
|
||||
byte[] IV = new byte[blockSize];
|
||||
|
||||
for (int i = 0; i < keySize; ++i)
|
||||
{
|
||||
Key[i] = (byte)i;
|
||||
}
|
||||
for (int i = 0; i < blockSize; ++i)
|
||||
{
|
||||
IV[i] = (byte)i;
|
||||
}
|
||||
|
||||
if (keyAndIv.Length >= keySize)
|
||||
{
|
||||
Array.Copy(keyAndIv, Key, keySize);
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(keyAndIv, Key, keyAndIv.Length);
|
||||
}
|
||||
|
||||
if (keyAndIv.Length >= blockSize)
|
||||
{
|
||||
Array.Copy(keyAndIv, IV, blockSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(keyAndIv, IV, keyAndIv.Length);
|
||||
}
|
||||
|
||||
MemoryStream stream = new MemoryStream(content);
|
||||
CryptoStream cryptStream = new CryptoStream(stream
|
||||
, RMCrypto.CreateDecryptor(Key, IV)
|
||||
, CryptoStreamMode.Read);
|
||||
|
||||
StreamReader sReader = new StreamReader (cryptStream);
|
||||
string res = sReader.ReadToEnd();
|
||||
|
||||
sReader.Close();
|
||||
cryptStream.Close();
|
||||
stream.Close();
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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")]
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* (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);
|
||||
}
|
||||
}
|
||||
1070
ServerComponents/FileConverterUtils2/FileConverterUtils2/Storage.cs
Normal file
1070
ServerComponents/FileConverterUtils2/FileConverterUtils2/Storage.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,891 @@
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* (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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,684 @@
|
||||
/*
|
||||
* (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,513 @@
|
||||
/*
|
||||
* (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
|
||||
{
|
||||
#if !OPEN_SOURCE
|
||||
public interface ITrackingInfo
|
||||
{
|
||||
void setLicense (ILicenseReader lic);
|
||||
void track(string clientId, string docId, int isAlive);
|
||||
void getUserCount(out int active, out int inactive);
|
||||
ILicenseReader getLicense();
|
||||
bool isQuotaExceed(string userId, string docId);
|
||||
void Cleanup();
|
||||
bool isLicenseFileValid();
|
||||
bool isLicenseDateValid();
|
||||
bool isLicenseDateTresholdExpired();
|
||||
bool isLicenseEndDateGreater(DateTime time);
|
||||
}
|
||||
|
||||
public class TrackingInfo: ITrackingInfo
|
||||
{
|
||||
|
||||
public static double sdCleanupExpiredMinutes = 2.0;
|
||||
|
||||
private DateTime oLastCleanupTime = DateTime.Now;
|
||||
public class TrackingValue
|
||||
{
|
||||
public int inactiveTicks;
|
||||
public DateTime lastTrackingTime;
|
||||
}
|
||||
public class TrackingDictionary
|
||||
{
|
||||
Dictionary<string, TrackingValue> dict;
|
||||
Object sync;
|
||||
|
||||
public TrackingDictionary ()
|
||||
{
|
||||
dict = new Dictionary<string, TrackingValue> ();
|
||||
sync = new Object ();
|
||||
|
||||
try
|
||||
{
|
||||
int periods = int.Parse (ConfigurationManager.AppSettings["license.activeconnections.tracking.cleanupperiods"] ?? "2");
|
||||
int tracking_time = int.Parse(ConfigurationManager.AppSettings["license.activeconnections.tracking.interval"] ?? "300");
|
||||
sdCleanupExpiredMinutes = ((double) (periods * tracking_time)) / 60.0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
sdCleanupExpiredMinutes = 5.0;
|
||||
}
|
||||
}
|
||||
public void Add (string key, TrackingValue value)
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
dict.Add (key, value);
|
||||
}
|
||||
}
|
||||
public void Remove (string key)
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
dict.Remove (key);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveOldItems (DateTime lastTime)
|
||||
{
|
||||
Dictionary<string, TrackingValue> toSave = new Dictionary<string, TrackingValue>();
|
||||
|
||||
lock (sync)
|
||||
{
|
||||
for (int i = 0; i < dict.Count; ++i)
|
||||
{
|
||||
KeyValuePair<string, TrackingValue> element;
|
||||
|
||||
element = dict.ElementAt(i);
|
||||
if (element.Value.lastTrackingTime > lastTime)
|
||||
toSave.Add (element.Key, element.Value);
|
||||
|
||||
}
|
||||
if (toSave.Count != dict.Count)
|
||||
dict = toSave;
|
||||
}
|
||||
}
|
||||
public bool TryGetValue (string key, out TrackingValue value)
|
||||
{
|
||||
bool bRes = false;
|
||||
lock (sync)
|
||||
{
|
||||
bRes = dict.TryGetValue (key, out value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
return dict.Count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TrackingDictionary activeUsers;
|
||||
private TrackingDictionary inactiveUsers;
|
||||
|
||||
private ILicenseReader license;
|
||||
|
||||
public TrackingInfo()
|
||||
{
|
||||
activeUsers = new TrackingDictionary();
|
||||
inactiveUsers = new TrackingDictionary();
|
||||
}
|
||||
public void setLicense(ILicenseReader lic)
|
||||
{
|
||||
this.license = lic;
|
||||
}
|
||||
public ILicenseReader getLicense()
|
||||
{
|
||||
return license;
|
||||
}
|
||||
|
||||
public void getUserCount(out int active, out int inactive)
|
||||
{
|
||||
active = activeUsers.GetCount();
|
||||
inactive = inactiveUsers.GetCount();
|
||||
}
|
||||
public virtual void track(string clientId, string docId, int isAlive)
|
||||
{
|
||||
|
||||
if (null == clientId)
|
||||
clientId = "";
|
||||
|
||||
if (null == docId)
|
||||
docId = "";
|
||||
|
||||
TrackingValue value;
|
||||
string key = clientId + docId;
|
||||
if (key == "")
|
||||
key = "empty";
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
if (0 == isAlive)
|
||||
{
|
||||
|
||||
if (inactiveUsers.TryGetValue(key, out value))
|
||||
{
|
||||
|
||||
value.lastTrackingTime = now;
|
||||
value.inactiveTicks++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (activeUsers.TryGetValue(key, out value))
|
||||
{
|
||||
|
||||
activeUsers.Remove(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
value = new TrackingValue();
|
||||
}
|
||||
|
||||
value.inactiveTicks = 1;
|
||||
value.lastTrackingTime = now;
|
||||
inactiveUsers.Add(key, value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (activeUsers.TryGetValue(key, out value))
|
||||
{
|
||||
|
||||
value.lastTrackingTime = now;
|
||||
value.inactiveTicks = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (inactiveUsers.TryGetValue(key, out value))
|
||||
{
|
||||
|
||||
inactiveUsers.Remove(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
value = new TrackingValue();
|
||||
}
|
||||
value.inactiveTicks = 0;
|
||||
value.lastTrackingTime = now;
|
||||
|
||||
activeUsers.Add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (now.AddDays(1.0) > oLastCleanupTime)
|
||||
{
|
||||
Cleanup();
|
||||
oLastCleanupTime = now;
|
||||
}
|
||||
|
||||
}
|
||||
public bool isQuotaExceed (string userId, string docId)
|
||||
{
|
||||
if (null == userId)
|
||||
userId = "";
|
||||
|
||||
if (null == docId)
|
||||
docId = "";
|
||||
|
||||
if (null == license)
|
||||
return false;
|
||||
|
||||
int count = activeUsers.GetCount();
|
||||
|
||||
if (count < ((ActiveConnectionsLicenseReader)license).getUserQuota())
|
||||
return false;
|
||||
|
||||
string key = userId + docId;
|
||||
if (key == "")
|
||||
key = "empty";
|
||||
|
||||
TrackingValue value;
|
||||
|
||||
if (activeUsers.TryGetValue(key, out value))
|
||||
return false;
|
||||
|
||||
if (inactiveUsers.TryGetValue(key, out value))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
public bool isLicenseFileValid()
|
||||
{
|
||||
return (null != license
|
||||
&& license.isLicenseFound()
|
||||
&& license.isLicenseCorrect());
|
||||
}
|
||||
public bool isLicenseDateValid()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
DateTime start = license.getStartDate();
|
||||
DateTime end = license.getEndDate();
|
||||
if (start < now && end > now)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public bool isLicenseEndDateGreater (DateTime time)
|
||||
{
|
||||
DateTime end = license.getEndDate();
|
||||
return (end > time);
|
||||
}
|
||||
public bool isLicenseDateTresholdExpired()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
DateTime treshold = license.getEndDateThreshold();
|
||||
|
||||
return now > treshold;
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
int active_count = activeUsers.GetCount();
|
||||
int inactive_count = inactiveUsers.GetCount();
|
||||
int quota = (null == license) ? 2048 : ((ActiveConnectionsLicenseReader)license).getUserQuota();
|
||||
|
||||
if (active_count >= (quota - 1))
|
||||
{
|
||||
|
||||
CleanupTrackingDictionary(activeUsers, sdCleanupExpiredMinutes);
|
||||
}
|
||||
if (inactive_count >= quota)
|
||||
{
|
||||
|
||||
CleanupTrackingDictionary(inactiveUsers, sdCleanupExpiredMinutes);
|
||||
}
|
||||
}
|
||||
private void CleanupTrackingDictionary(TrackingDictionary dict, double minutes)
|
||||
{
|
||||
dict.RemoveOldItems (DateTime.Now.AddMinutes (-1.0 * minutes));
|
||||
}
|
||||
|
||||
}
|
||||
public class UserCount2TrackingInfo : ITrackingInfo
|
||||
{
|
||||
public class UserTrackingDictionary
|
||||
{
|
||||
Dictionary<string, DateTime> dict;
|
||||
Object sync;
|
||||
DateTime lastCleanupTime;
|
||||
|
||||
public UserTrackingDictionary()
|
||||
{
|
||||
dict = new Dictionary<string, DateTime>();
|
||||
sync = new Object();
|
||||
|
||||
lastCleanupTime = DateTime.Now.Date;
|
||||
|
||||
}
|
||||
public void Add(string key, DateTime value)
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
dict.Add(key, value);
|
||||
}
|
||||
}
|
||||
public void Remove(string key)
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
dict.Remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveItems ()
|
||||
{
|
||||
DateTime currentTime = DateTime.Now;
|
||||
TimeSpan timeDelta = currentTime - lastCleanupTime;
|
||||
double hoursDelta = timeDelta.TotalHours;
|
||||
|
||||
if (hoursDelta < 24.0)
|
||||
return;
|
||||
|
||||
lock (sync)
|
||||
{
|
||||
dict.Clear();
|
||||
}
|
||||
|
||||
lastCleanupTime = currentTime.Date;
|
||||
}
|
||||
public bool TryGetValue(string key, out DateTime value)
|
||||
{
|
||||
bool bRes = false;
|
||||
lock (sync)
|
||||
{
|
||||
bRes = dict.TryGetValue(key, out value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
return dict.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ILicenseReader license;
|
||||
private UserTrackingDictionary activeUsers;
|
||||
|
||||
public UserCount2TrackingInfo()
|
||||
{
|
||||
activeUsers = new UserTrackingDictionary();
|
||||
}
|
||||
|
||||
public void setLicense(ILicenseReader lic)
|
||||
{
|
||||
this.license = lic;
|
||||
}
|
||||
public void track(string clientId, string docId, int isAlive)
|
||||
{
|
||||
|
||||
if (null == clientId)
|
||||
clientId = "";
|
||||
|
||||
if (null == docId)
|
||||
docId = "";
|
||||
|
||||
DateTime value;
|
||||
string key = clientId + docId;
|
||||
if (key == "")
|
||||
key = "empty";
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
{
|
||||
|
||||
if (activeUsers.TryGetValue(key, out value))
|
||||
{
|
||||
value = now;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
activeUsers.Add(key, now);
|
||||
}
|
||||
}
|
||||
|
||||
Cleanup();
|
||||
}
|
||||
public void getUserCount(out int active, out int inactive)
|
||||
{
|
||||
active = activeUsers.GetCount();
|
||||
inactive = 0;
|
||||
}
|
||||
public ILicenseReader getLicense()
|
||||
{
|
||||
return license;
|
||||
}
|
||||
public bool isQuotaExceed(string userId, string docId)
|
||||
{
|
||||
if (null == userId)
|
||||
userId = "";
|
||||
|
||||
docId = "";
|
||||
|
||||
if (null == license)
|
||||
return false;
|
||||
|
||||
int count = activeUsers.GetCount();
|
||||
|
||||
if (count < ((ActiveConnectionsLicenseReader)license).getUserQuota())
|
||||
return false;
|
||||
|
||||
string key = userId + docId;
|
||||
if (key == "")
|
||||
key = "empty";
|
||||
|
||||
DateTime value;
|
||||
|
||||
if (activeUsers.TryGetValue(key, out value))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public void Cleanup()
|
||||
{
|
||||
activeUsers.RemoveItems();
|
||||
}
|
||||
public bool isLicenseFileValid()
|
||||
{
|
||||
return (null != license
|
||||
&& license.isLicenseFound()
|
||||
&& license.isLicenseCorrect());
|
||||
}
|
||||
public bool isLicenseDateValid()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
DateTime start = license.getStartDate();
|
||||
DateTime end = license.getEndDate();
|
||||
if (start < now && end > now)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public bool isLicenseDateTresholdExpired()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
DateTime treshold = license.getEndDateThreshold();
|
||||
|
||||
return now > treshold;
|
||||
}
|
||||
public bool isLicenseEndDateGreater(DateTime time)
|
||||
{
|
||||
DateTime end = license.getEndDate();
|
||||
return (end > time);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
87
ServerComponents/FileConverterUtils2/LicenseTest/Form1.Designer.cs
generated
Normal file
87
ServerComponents/FileConverterUtils2/LicenseTest/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
}
|
||||
|
||||
50
ServerComponents/FileConverterUtils2/LicenseTest/Form1.cs
Normal file
50
ServerComponents/FileConverterUtils2/LicenseTest/Form1.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
ServerComponents/FileConverterUtils2/LicenseTest/Form1.resx
Normal file
120
ServerComponents/FileConverterUtils2/LicenseTest/Form1.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=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>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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>
|
||||
50
ServerComponents/FileConverterUtils2/LicenseTest/Program.cs
Normal file
50
ServerComponents/FileConverterUtils2/LicenseTest/Program.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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")]
|
||||
78
ServerComponents/FileConverterUtils2/LicenseTest/Properties/Resources.Designer.cs
generated
Normal file
78
ServerComponents/FileConverterUtils2/LicenseTest/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
51
ServerComponents/FileConverterUtils2/LicenseTest/Properties/Settings.Designer.cs
generated
Normal file
51
ServerComponents/FileConverterUtils2/LicenseTest/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
20
ServerComponents/PdfWriter/PdfWriter.sln
Normal file
20
ServerComponents/PdfWriter/PdfWriter.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C# Express 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdfWriter", "PdfWriter\PdfWriter.csproj", "{D7628414-F181-49AB-9E23-76D741426641}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D7628414-F181-49AB-9E23-76D741426641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7628414-F181-49AB-9E23-76D741426641}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7628414-F181-49AB-9E23-76D741426641}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7628414-F181-49AB-9E23-76D741426641}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
952
ServerComponents/PdfWriter/PdfWriter/Main.cs
Normal file
952
ServerComponents/PdfWriter/PdfWriter/Main.cs
Normal file
@@ -0,0 +1,952 @@
|
||||
/*
|
||||
* (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.Xml;
|
||||
using System.IO;
|
||||
|
||||
namespace PdfWriter
|
||||
{
|
||||
enum CommandType
|
||||
{
|
||||
ctPenXML = 0,
|
||||
ctPenColor = 1,
|
||||
ctPenAlpha = 2,
|
||||
ctPenSize = 3,
|
||||
ctPenDashStyle = 4,
|
||||
ctPenLineStartCap = 5,
|
||||
ctPenLineEndCap = 6,
|
||||
ctPenLineJoin = 7,
|
||||
ctPenDashPatern = 8,
|
||||
ctPenDashPatternCount = 9,
|
||||
ctPenDashOffset = 10,
|
||||
ctPenAlign = 11,
|
||||
ctPenMiterLimit = 12,
|
||||
|
||||
ctBrushXML = 20,
|
||||
ctBrushType = 21,
|
||||
ctBrushColor1 = 22,
|
||||
ctBrushColor2 = 23,
|
||||
ctBrushAlpha1 = 24,
|
||||
ctBrushAlpha2 = 25,
|
||||
ctBrushTexturePath = 26,
|
||||
ctBrushTextureAlpha = 27,
|
||||
ctBrushTextureMode = 28,
|
||||
ctBrushRectable = 29,
|
||||
ctBrushRectableEnabled = 30,
|
||||
ctBrushGradient = 31,
|
||||
|
||||
ctFontXML = 40,
|
||||
ctFontName = 41,
|
||||
ctFontSize = 42,
|
||||
ctFontStyle = 43,
|
||||
ctFontPath = 44,
|
||||
ctFontGID = 45,
|
||||
ctFontCharSpace = 46,
|
||||
|
||||
ctShadowXML = 50,
|
||||
ctShadowVisible = 51,
|
||||
ctShadowDistanceX = 52,
|
||||
ctShadowDistanceY = 53,
|
||||
ctShadowBlurSize = 54,
|
||||
ctShadowColor = 55,
|
||||
ctShadowAlpha = 56,
|
||||
|
||||
ctEdgeXML = 70,
|
||||
ctEdgeVisible = 71,
|
||||
ctEdgeDistance = 72,
|
||||
ctEdgeColor = 73,
|
||||
ctEdgeAlpha = 74,
|
||||
|
||||
ctDrawText = 80,
|
||||
ctDrawTextEx = 81,
|
||||
|
||||
ctPathCommandMoveTo = 91,
|
||||
ctPathCommandLineTo = 92,
|
||||
ctPathCommandLinesTo = 93,
|
||||
ctPathCommandCurveTo = 94,
|
||||
ctPathCommandCurvesTo = 95,
|
||||
ctPathCommandArcTo = 96,
|
||||
ctPathCommandClose = 97,
|
||||
ctPathCommandEnd = 98,
|
||||
ctDrawPath = 99,
|
||||
ctPathCommandStart = 100,
|
||||
ctPathCommandGetCurrentPoint = 101,
|
||||
ctPathCommandText = 102,
|
||||
ctPathCommandTextEx = 103,
|
||||
|
||||
ctDrawImage = 110,
|
||||
ctDrawImageFromFile = 111,
|
||||
|
||||
ctSetParams = 120,
|
||||
|
||||
ctBeginCommand = 121,
|
||||
ctEndCommand = 122,
|
||||
|
||||
ctSetTransform = 130,
|
||||
ctResetTransform = 131,
|
||||
|
||||
ctClipMode = 140,
|
||||
|
||||
ctCommandLong1 = 150,
|
||||
ctCommandDouble1 = 151,
|
||||
ctCommandString1 = 152,
|
||||
ctCommandLong2 = 153,
|
||||
ctCommandDouble2 = 154,
|
||||
ctCommandString2 = 155,
|
||||
|
||||
ctPageWidth = 200,
|
||||
ctPageHeight = 201,
|
||||
|
||||
ctPageStart = 202,
|
||||
ctPageEnd = 203,
|
||||
|
||||
ctError = 255
|
||||
}
|
||||
|
||||
public class CPdfWriter
|
||||
{
|
||||
private string m_sHtmlPlace = "";
|
||||
private string m_sThemesPlace = "";
|
||||
private bool m_bIsUnregistredVersion = false;
|
||||
|
||||
List<string> m_arTmpTexturePrushPaths = new List<string>();
|
||||
|
||||
public void SetHtmlPlace(string sRoot)
|
||||
{
|
||||
m_sHtmlPlace = sRoot;
|
||||
}
|
||||
|
||||
public void SetThemesPlace(string sRoot)
|
||||
{
|
||||
m_sThemesPlace = sRoot;
|
||||
}
|
||||
|
||||
public void SetUnregistredVersion(bool bIsUnReg)
|
||||
{
|
||||
m_bIsUnregistredVersion = bIsUnReg;
|
||||
}
|
||||
|
||||
public bool SavePdf2(string sPathXml, string sDstFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
AVSOfficePDFWriter.CPDFWriterClass oWriter = new AVSOfficePDFWriter.CPDFWriterClass();
|
||||
oWriter.CreatePDF();
|
||||
|
||||
XmlDocument oDocument = new XmlDocument();
|
||||
oDocument.Load(sPathXml);
|
||||
|
||||
XmlNodeList list = oDocument.ChildNodes[0].ChildNodes;
|
||||
int nPagesCount = list.Count;
|
||||
for (int nPage = 0; nPage < nPagesCount; ++nPage)
|
||||
{
|
||||
oWriter.NewPage();
|
||||
oWriter.BeginCommand(1);
|
||||
|
||||
XmlNodeList nodes = list[nPage].ChildNodes;
|
||||
int nCommandsCount = nodes.Count;
|
||||
|
||||
bool bIsPathOpened = false;
|
||||
for (int nCommand = 0; nCommand < nCommandsCount; ++nCommand)
|
||||
{
|
||||
XmlNode oNode = nodes[nCommand];
|
||||
XmlAttributeCollection attr = oNode.Attributes;
|
||||
CommandType type = (CommandType)Convert.ToInt32(oNode.Attributes["t"].Value);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CommandType.ctPenColor:
|
||||
oWriter.PenColor = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctPenAlpha:
|
||||
oWriter.PenAlpha = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctPenSize:
|
||||
oWriter.PenSize = Convert.ToDouble(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctBrushColor1:
|
||||
oWriter.BrushColor1 = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctBrushAlpha1:
|
||||
oWriter.BrushAlpha1 = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctBrushColor2:
|
||||
oWriter.BrushColor2 = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctBrushAlpha2:
|
||||
oWriter.BrushAlpha2 = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctSetTransform:
|
||||
oWriter.SetTransform(Convert.ToDouble(attr["m1"].Value), Convert.ToDouble(attr["m2"].Value), Convert.ToDouble(attr["m3"].Value),
|
||||
Convert.ToDouble(attr["m4"].Value), Convert.ToDouble(attr["m5"].Value), Convert.ToDouble(attr["m6"].Value));
|
||||
break;
|
||||
case CommandType.ctPathCommandStart:
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
oWriter.PathCommandStart();
|
||||
oWriter.BeginCommand(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
oWriter.PathCommandStart();
|
||||
oWriter.BeginCommand(4);
|
||||
}
|
||||
bIsPathOpened = true;
|
||||
break;
|
||||
case CommandType.ctPathCommandMoveTo:
|
||||
oWriter.PathCommandMoveTo(Convert.ToDouble(attr["x"].Value), Convert.ToDouble(attr["y"].Value));
|
||||
break;
|
||||
case CommandType.ctPathCommandLineTo:
|
||||
oWriter.PathCommandLineTo(Convert.ToDouble(attr["x"].Value), Convert.ToDouble(attr["y"].Value));
|
||||
break;
|
||||
case CommandType.ctPathCommandCurveTo:
|
||||
oWriter.PathCommandCurveTo(Convert.ToDouble(attr["x1"].Value), Convert.ToDouble(attr["y1"].Value), Convert.ToDouble(attr["x2"].Value),
|
||||
Convert.ToDouble(attr["y2"].Value), Convert.ToDouble(attr["x3"].Value), Convert.ToDouble(attr["y3"].Value));
|
||||
break;
|
||||
case CommandType.ctPathCommandClose:
|
||||
oWriter.PathCommandClose();
|
||||
break;
|
||||
case CommandType.ctDrawPath:
|
||||
oWriter.DrawPath(Convert.ToInt32(attr["v"].Value));
|
||||
break;
|
||||
case CommandType.ctDrawImageFromFile:
|
||||
oWriter.DrawImageFromFile(attr["src"].Value, Convert.ToDouble(attr["x"].Value), Convert.ToDouble(attr["y"].Value),
|
||||
Convert.ToDouble(attr["w"]), Convert.ToDouble(attr["h"].Value));
|
||||
break;
|
||||
case CommandType.ctFontName:
|
||||
oWriter.FontName = attr["v"].Value;
|
||||
break;
|
||||
case CommandType.ctFontSize:
|
||||
oWriter.FontSize = Convert.ToDouble(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctFontStyle:
|
||||
oWriter.FontStyle = Convert.ToInt32(attr["v"].Value);
|
||||
break;
|
||||
case CommandType.ctDrawText:
|
||||
oWriter.CommandDrawText(attr["v"].Value, Convert.ToDouble(attr["x"].Value), Convert.ToDouble(attr["y"].Value), 0, 0, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
}
|
||||
|
||||
oWriter.EndCommand(1);
|
||||
}
|
||||
|
||||
oWriter.SaveToFile(sDstFile);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SavePdf(string sPathXml, string sDstFile)
|
||||
{
|
||||
m_arTmpTexturePrushPaths.Clear();
|
||||
|
||||
CommandType eCommand = CommandType.ctError;
|
||||
|
||||
int len = 0;
|
||||
int curindex = 0;
|
||||
|
||||
int nCountPages = 0;
|
||||
string sTempLogo = "";
|
||||
try
|
||||
{
|
||||
AVSGraphics.CAVSWinFonts winfonts = new AVSGraphics.CAVSWinFontsClass();
|
||||
AVSOfficePDFWriter.CPDFWriterClass oWriter = new AVSOfficePDFWriter.CPDFWriterClass();
|
||||
oWriter.CreatePDF();
|
||||
oWriter.SetPDFCompressionMode(15);
|
||||
|
||||
bool bIsPathOpened = false;
|
||||
|
||||
StringBuilder sHypers = new StringBuilder();
|
||||
sHypers.Append("<linker>");
|
||||
|
||||
unsafe
|
||||
{
|
||||
string[] array50 = File.ReadAllLines(sPathXml, Encoding.UTF8);
|
||||
|
||||
for (int index50 = 0; index50 < array50.Length; index50++)
|
||||
{
|
||||
byte[] dstArray = Convert.FromBase64String(array50[index50]);
|
||||
len = dstArray.Length;
|
||||
curindex = 0;
|
||||
|
||||
Int32* m = null;
|
||||
UInt16* ms = null;
|
||||
int _sLen = 0;
|
||||
string s = "";
|
||||
|
||||
double m1 = 0;
|
||||
double m2 = 0;
|
||||
double m3 = 0;
|
||||
double m4 = 0;
|
||||
double m5 = 0;
|
||||
double m6 = 0;
|
||||
|
||||
string imgPath = "";
|
||||
string base64Temp = "";
|
||||
|
||||
fixed (byte* p = dstArray)
|
||||
{
|
||||
byte* current = p;
|
||||
while (curindex < len)
|
||||
{
|
||||
eCommand = (CommandType)(*current);
|
||||
current++;
|
||||
curindex++;
|
||||
switch (eCommand)
|
||||
{
|
||||
case CommandType.ctPageWidth:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
oWriter.Width = ((*m) / 100000.0);
|
||||
break;
|
||||
case CommandType.ctPageHeight:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
oWriter.Height = ((*m) / 100000.0);
|
||||
break;
|
||||
case CommandType.ctPageStart:
|
||||
oWriter.NewPage();
|
||||
oWriter.BeginCommand(1);
|
||||
++nCountPages;
|
||||
break;
|
||||
case CommandType.ctPageEnd:
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
}
|
||||
|
||||
bIsPathOpened = false;
|
||||
|
||||
if (m_bIsUnregistredVersion)
|
||||
{
|
||||
double ww = oWriter.Width;
|
||||
double wh = oWriter.Height;
|
||||
|
||||
double dR = ww - 13;
|
||||
double dB = wh - 5;
|
||||
double k = 1.0;
|
||||
|
||||
if (ww <= wh)
|
||||
{
|
||||
|
||||
double k1 = ww / 210;
|
||||
double k2 = wh / 297;
|
||||
k = Math.Min(k1, k2);
|
||||
}
|
||||
else
|
||||
{
|
||||
double k1 = ww / 297;
|
||||
double k2 = wh / 210;
|
||||
k = Math.Min(k1, k2);
|
||||
}
|
||||
double dW = 15 * 5.9 * k;
|
||||
double dH = 15 * k;
|
||||
|
||||
double dKoef = 72 / 25.4;
|
||||
|
||||
sHypers.AppendFormat("<link><source x=\"{0}\" y=\"{1}\" width=\"{2}\" height=\"{3}\" page=\"{4}\"/>", (int)((dR - dW) * dKoef), (int)((dB - dH) * dKoef), (int)(dW * dKoef), (int)(dH * dKoef), nCountPages - 1);
|
||||
sHypers.Append("<target url=\"www.teamlab.com\"/></link>");
|
||||
|
||||
oWriter.ResetTransform();
|
||||
|
||||
if ("" == sTempLogo)
|
||||
{
|
||||
sTempLogo = Path.GetTempFileName();
|
||||
File.WriteAllBytes(sTempLogo, PdfWriter.Properties.Resources.logo);
|
||||
}
|
||||
oWriter.DrawImageFromFile(sTempLogo, dR - dW, dB - dH, dW, dH);
|
||||
}
|
||||
|
||||
oWriter.EndCommand(1);
|
||||
break;
|
||||
case CommandType.ctPenColor:
|
||||
m = (Int32*)current;
|
||||
oWriter.PenColor = *m;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
break;
|
||||
case CommandType.ctPenAlpha:
|
||||
oWriter.PenAlpha = *current;
|
||||
current++;
|
||||
curindex++;
|
||||
break;
|
||||
case CommandType.ctPenSize:
|
||||
m = (Int32*)current;
|
||||
oWriter.PenSize = *m / 100000.0;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
break;
|
||||
case CommandType.ctPenLineJoin:
|
||||
oWriter.PenLineJoin = *current;
|
||||
current++;
|
||||
curindex++;
|
||||
break;
|
||||
case CommandType.ctBrushType:
|
||||
m = (Int32*)current;
|
||||
oWriter.BrushType = *m;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
break;
|
||||
case CommandType.ctBrushColor1:
|
||||
m = (Int32*)current;
|
||||
oWriter.BrushColor1 = *m;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
break;
|
||||
case CommandType.ctBrushAlpha1:
|
||||
oWriter.BrushAlpha1 = *current;
|
||||
current++;
|
||||
curindex++;
|
||||
break;
|
||||
case CommandType.ctBrushColor2:
|
||||
m = (Int32*)current;
|
||||
oWriter.BrushColor1 = *m;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
break;
|
||||
case CommandType.ctBrushAlpha2:
|
||||
oWriter.BrushAlpha2 = *current;
|
||||
current++;
|
||||
curindex++;
|
||||
break;
|
||||
case CommandType.ctBrushRectable:
|
||||
m = (Int32*)current;
|
||||
current += 4 * 4;
|
||||
curindex += 4 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
m3 = (*m++) / 100000.0;
|
||||
m4 = (*m++) / 100000.0;
|
||||
|
||||
oWriter.BrushRect(0, m1, m2, m3, m4);
|
||||
break;
|
||||
case CommandType.ctBrushRectableEnabled:
|
||||
bool bEn = (1 == *current);
|
||||
oWriter.SetAdditionalParam("BrushFillBoundsEnable", bEn);
|
||||
|
||||
current += 1;
|
||||
curindex += 1;
|
||||
break;
|
||||
case CommandType.ctBrushTexturePath:
|
||||
ms = (UInt16*)current;
|
||||
current += 2;
|
||||
curindex += 2;
|
||||
|
||||
_sLen = (int)(*ms);
|
||||
s = new string((char*)current, 0, _sLen);
|
||||
imgPath = s;
|
||||
|
||||
if (0 != s.IndexOf("http:") &&
|
||||
0 != s.IndexOf("https:") &&
|
||||
0 != s.IndexOf("ftp:") &&
|
||||
0 != s.IndexOf("file:"))
|
||||
{
|
||||
if (0 == s.IndexOf("theme"))
|
||||
{
|
||||
imgPath = Path.Combine(m_sThemesPlace, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
imgPath = Path.Combine(m_sHtmlPlace, s);
|
||||
|
||||
int _len = imgPath.Length;
|
||||
int ind = imgPath.LastIndexOf(".svg");
|
||||
if (ind != -1)
|
||||
{
|
||||
if (ind == (_len - 4))
|
||||
{
|
||||
string sInterest = imgPath.Substring(0, ind);
|
||||
|
||||
if (File.Exists(sInterest + ".emf"))
|
||||
imgPath = sInterest + ".emf";
|
||||
else if (File.Exists(sInterest + ".wmf"))
|
||||
imgPath = sInterest + ".wmf";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base64Temp = "";
|
||||
if (0 == s.IndexOf("data:"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int nFind = s.IndexOf(",");
|
||||
s = s.Remove(0, nFind + 1);
|
||||
|
||||
base64Temp = Path.GetTempFileName();
|
||||
byte[] byteIm = Convert.FromBase64String(s);
|
||||
File.WriteAllBytes(base64Temp, byteIm);
|
||||
|
||||
imgPath = base64Temp;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
current += 2 * _sLen;
|
||||
curindex += 2 * _sLen;
|
||||
|
||||
oWriter.BrushTexturePath = imgPath;
|
||||
|
||||
if (base64Temp != "")
|
||||
{
|
||||
m_arTmpTexturePrushPaths.Add(base64Temp);
|
||||
}
|
||||
break;
|
||||
case CommandType.ctBrushGradient:
|
||||
current++;
|
||||
curindex++;
|
||||
|
||||
string strAttrMain = "";
|
||||
string strColors = "";
|
||||
bool bIsLinear = true;
|
||||
|
||||
while (true)
|
||||
{
|
||||
byte _command = *current;
|
||||
current++;
|
||||
curindex++;
|
||||
|
||||
if (251 == _command)
|
||||
break;
|
||||
|
||||
switch (_command)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
current += 5;
|
||||
curindex += 5;
|
||||
|
||||
m = (Int32*)current;
|
||||
current += 4 * 4;
|
||||
curindex += 4 * 4;
|
||||
|
||||
double d1 = (*m++) / 100000.0;
|
||||
double d2 = (*m++) / 100000.0;
|
||||
double d3 = (*m++) / 100000.0;
|
||||
double d4 = (*m++) / 100000.0;
|
||||
|
||||
strAttrMain = String.Format("x1=\"{0}\" y1=\"{1}\" x2=\"{2}\" y2=\"{3}\" gradientUnits=\"userSpaceOnUse\"", d1, d2, d3, d4);
|
||||
strAttrMain = strAttrMain.Replace(',', '.');
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
bIsLinear = false;
|
||||
|
||||
current++;
|
||||
curindex++;
|
||||
|
||||
m = (Int32*)current;
|
||||
current += 6 * 4;
|
||||
curindex += 6 * 4;
|
||||
|
||||
double d1 = (*m++) / 100000.0;
|
||||
double d2 = (*m++) / 100000.0;
|
||||
double d3 = (*m++) / 100000.0;
|
||||
double d4 = (*m++) / 100000.0;
|
||||
double d5 = (*m++) / 100000.0;
|
||||
double d6 = (*m++) / 100000.0;
|
||||
|
||||
strAttrMain = String.Format("cx=\"{0}\" cy=\"{1}\" r0=\"{2}\" r1=\"{3}\" rx=\"{4}\" ry=\"{5}\" gradientUnits=\"userSpaceOnUse\"", d1, d2, d5, d6, d1, d2);
|
||||
strAttrMain = strAttrMain.Replace(',', '.');
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
int nCountColors = *((Int32*)current);
|
||||
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
|
||||
for (int nI = 0; nI < nCountColors; ++nI)
|
||||
{
|
||||
int pos = *((Int32*)current);
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
|
||||
double dPos = pos / 100000.0;
|
||||
byte _r = *current++;
|
||||
byte _g = *current++;
|
||||
byte _b = *current++;
|
||||
byte _a = *current++;
|
||||
|
||||
curindex += 4;
|
||||
|
||||
int _color = ((_b << 16) & 0xFF0000) | ((_g << 8) & 0xFF00) | _r;
|
||||
string sColor = String.Format("<stop stop-color=\"{0}\" stop-opacity=\"{1}\" offset=\"{2}\" />", _color, _a / 255.0, dPos);
|
||||
|
||||
sColor = sColor.Replace(',', '.');
|
||||
strColors += sColor;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
string strXml = "";
|
||||
|
||||
if (bIsLinear)
|
||||
{
|
||||
strXml = "<linearGradient " + strAttrMain + ">" + strColors + "</linearGradient>";
|
||||
oWriter.SetAdditionalParam("Fill-LinearGradient", strXml);
|
||||
}
|
||||
else
|
||||
{
|
||||
strXml = "<radialGradient " + strAttrMain + ">" + strColors + "</radialGradient>";
|
||||
oWriter.SetAdditionalParam("Fill-RadialGradient", strXml);
|
||||
}
|
||||
|
||||
break;
|
||||
case CommandType.ctBrushTextureMode:
|
||||
int mode = (int)(*current);
|
||||
oWriter.BrushTextureMode = mode;
|
||||
|
||||
current += 1;
|
||||
curindex += 1;
|
||||
break;
|
||||
case CommandType.ctBrushTextureAlpha:
|
||||
int txalpha = (int)(*current);
|
||||
oWriter.BrushTextureAlpha = txalpha;
|
||||
|
||||
current += 1;
|
||||
curindex += 1;
|
||||
break;
|
||||
case CommandType.ctSetTransform:
|
||||
m = (Int32*)current;
|
||||
current += 6 * 4;
|
||||
curindex += 6 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
m3 = (*m++) / 100000.0;
|
||||
m4 = (*m++) / 100000.0;
|
||||
m5 = (*m++) / 100000.0;
|
||||
m6 = (*m++) / 100000.0;
|
||||
|
||||
oWriter.SetTransform(m1, m2, m3, m4, m5, m6);
|
||||
break;
|
||||
case CommandType.ctPathCommandStart:
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
oWriter.BeginCommand(4);
|
||||
oWriter.PathCommandStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
oWriter.BeginCommand(4);
|
||||
oWriter.PathCommandStart();
|
||||
}
|
||||
bIsPathOpened = true;
|
||||
break;
|
||||
case CommandType.ctPathCommandEnd:
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
break;
|
||||
case CommandType.ctPathCommandMoveTo:
|
||||
m = (Int32*)current;
|
||||
current += 2 * 4;
|
||||
curindex += 2 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
oWriter.PathCommandMoveTo(m1, m2);
|
||||
break;
|
||||
case CommandType.ctPathCommandLineTo:
|
||||
m = (Int32*)current;
|
||||
current += 2 * 4;
|
||||
curindex += 2 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
oWriter.PathCommandLineTo(m1, m2);
|
||||
break;
|
||||
case CommandType.ctPathCommandCurveTo:
|
||||
m = (Int32*)current;
|
||||
current += 6 * 4;
|
||||
curindex += 6 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
m3 = (*m++) / 100000.0;
|
||||
m4 = (*m++) / 100000.0;
|
||||
m5 = (*m++) / 100000.0;
|
||||
m6 = (*m++) / 100000.0;
|
||||
|
||||
oWriter.PathCommandCurveTo(m1, m2, m3, m4, m5, m6);
|
||||
break;
|
||||
case CommandType.ctPathCommandClose:
|
||||
oWriter.PathCommandClose();
|
||||
break;
|
||||
case CommandType.ctDrawPath:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
|
||||
oWriter.DrawPath(*m);
|
||||
break;
|
||||
case CommandType.ctDrawImageFromFile:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
|
||||
_sLen = (int)(*m);
|
||||
_sLen /= 2;
|
||||
s = new string((char*)current, 0, _sLen);
|
||||
|
||||
imgPath = s;
|
||||
|
||||
if (0 != s.IndexOf("http:") &&
|
||||
0 != s.IndexOf("https:") &&
|
||||
0 != s.IndexOf("ftp:") &&
|
||||
0 != s.IndexOf("file:"))
|
||||
{
|
||||
if (0 == s.IndexOf("theme"))
|
||||
{
|
||||
imgPath = Path.Combine(m_sThemesPlace, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
imgPath = Path.Combine(m_sHtmlPlace, s);
|
||||
|
||||
int _len = imgPath.Length;
|
||||
int ind = imgPath.LastIndexOf(".svg");
|
||||
if (ind != -1)
|
||||
{
|
||||
if (ind == (_len - 4))
|
||||
{
|
||||
string sInterest = imgPath.Substring(0, ind);
|
||||
|
||||
if (File.Exists(sInterest + ".emf"))
|
||||
imgPath = sInterest + ".emf";
|
||||
else if (File.Exists(sInterest + ".wmf"))
|
||||
imgPath = sInterest + ".wmf";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base64Temp = "";
|
||||
if (0 == s.IndexOf("data:"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int nFind = s.IndexOf(",");
|
||||
s = s.Remove(0, nFind + 1);
|
||||
|
||||
base64Temp = Path.GetTempFileName();
|
||||
byte[] byteIm = Convert.FromBase64String(s);
|
||||
File.WriteAllBytes(base64Temp, byteIm);
|
||||
|
||||
imgPath = base64Temp;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
current += 2 * _sLen;
|
||||
curindex += 2 * _sLen;
|
||||
|
||||
m = (Int32*)current;
|
||||
current += 4 * 4;
|
||||
curindex += 4 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
m3 = (*m++) / 100000.0;
|
||||
m4 = (*m++) / 100000.0;
|
||||
|
||||
try
|
||||
{
|
||||
oWriter.DrawImageFromFile(imgPath, m1, m2, m3, m4);
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (base64Temp != "")
|
||||
{
|
||||
File.Delete(base64Temp);
|
||||
}
|
||||
break;
|
||||
case CommandType.ctFontName:
|
||||
ms = (UInt16*)current;
|
||||
current += 2;
|
||||
curindex += 2;
|
||||
|
||||
_sLen = (int)(*ms);
|
||||
s = new string((char*)current, 0, _sLen);
|
||||
|
||||
current += 2 * _sLen;
|
||||
curindex += 2 * _sLen;
|
||||
oWriter.FontName = s;
|
||||
break;
|
||||
case CommandType.ctFontSize:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
|
||||
oWriter.FontSize = Math.Min(m1, 1000.0);
|
||||
break;
|
||||
case CommandType.ctFontStyle:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
|
||||
oWriter.FontStyle = *m;
|
||||
break;
|
||||
case CommandType.ctDrawText:
|
||||
ms = (UInt16*)current;
|
||||
current += 2;
|
||||
curindex += 2;
|
||||
|
||||
_sLen = (int)(*ms);
|
||||
s = new string((char*)current, 0, _sLen);
|
||||
|
||||
current += 2 * _sLen;
|
||||
curindex += 2 * _sLen;
|
||||
|
||||
m = (Int32*)current;
|
||||
current += 2 * 4;
|
||||
curindex += 2 * 4;
|
||||
|
||||
m1 = (*m++) / 100000.0;
|
||||
m2 = (*m++) / 100000.0;
|
||||
oWriter.CommandDrawText(s, m1, m2, 0, 0, 0);
|
||||
break;
|
||||
case CommandType.ctBeginCommand:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
oWriter.BeginCommand((uint)(*m));
|
||||
break;
|
||||
case CommandType.ctEndCommand:
|
||||
m = (Int32*)current;
|
||||
current += 4;
|
||||
curindex += 4;
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
oWriter.PathCommandEnd();
|
||||
oWriter.EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
oWriter.EndCommand((uint)(*m));
|
||||
oWriter.PathCommandEnd();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sHypers.Append("</linker>");
|
||||
|
||||
if (m_bIsUnregistredVersion)
|
||||
{
|
||||
oWriter.BeginCommand(8);
|
||||
string strHypers = sHypers.ToString();
|
||||
oWriter.CommandDrawText(strHypers, 0, 0, 0, 0, 0);
|
||||
oWriter.EndCommand(8);
|
||||
}
|
||||
|
||||
if (sTempLogo != "")
|
||||
File.Delete(sTempLogo);
|
||||
|
||||
DeleteTmpFiles();
|
||||
|
||||
oWriter.SaveToFile(sDstFile);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (sTempLogo != "")
|
||||
File.Delete(sTempLogo);
|
||||
|
||||
DeleteTmpFiles();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteTmpFiles()
|
||||
{
|
||||
int len = m_arTmpTexturePrushPaths.Count;
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
if (File.Exists(m_arTmpTexturePrushPaths[i]))
|
||||
File.Delete(m_arTmpTexturePrushPaths[i]);
|
||||
}
|
||||
m_arTmpTexturePrushPaths.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
101
ServerComponents/PdfWriter/PdfWriter/PdfWriter.csproj
Normal file
101
ServerComponents/PdfWriter/PdfWriter/PdfWriter.csproj
Normal file
@@ -0,0 +1,101 @@
|
||||
<?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>{D7628414-F181-49AB-9E23-76D741426641}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PdfWriter</RootNamespace>
|
||||
<AssemblyName>PdfWriter</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>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</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>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel.Web">
|
||||
<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="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Unreg.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="AVSGraphics">
|
||||
<Guid>{AB5F2678-2773-44C4-A637-33DFBC51233B}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="AVSOfficePDFWriter">
|
||||
<Guid>{E0DC00B5-13BE-451C-92B5-078A5B44BEEA}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\logo.wmf" />
|
||||
</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 $(ProjectDir)bin\Release\$(TargetFileName) $(SolutionDir)..\wwwroot\Bin\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (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("PdfWriter")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("PdfWriter")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA Copyright (c) 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("8af8f799-b208-44f3-ac7a-9b37a5918982")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.2")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.2")]
|
||||
77
ServerComponents/PdfWriter/PdfWriter/Properties/Resources.Designer.cs
generated
Normal file
77
ServerComponents/PdfWriter/PdfWriter/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* (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 PdfWriter.Properties {
|
||||
using System;
|
||||
|
||||
[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 (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PdfWriter.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;
|
||||
}
|
||||
}
|
||||
|
||||
internal static byte[] logo {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("logo", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
124
ServerComponents/PdfWriter/PdfWriter/Properties/Resources.resx
Normal file
124
ServerComponents/PdfWriter/PdfWriter/Properties/Resources.resx
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\logo.wmf;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
ServerComponents/PdfWriter/PdfWriter/Resources/logo.wmf
Normal file
BIN
ServerComponents/PdfWriter/PdfWriter/Resources/logo.wmf
Normal file
Binary file not shown.
188
ServerComponents/PdfWriter/PdfWriter/Unreg.cs
Normal file
188
ServerComponents/PdfWriter/PdfWriter/Unreg.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* (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.Xml;
|
||||
using System.IO;
|
||||
|
||||
namespace PdfWriter
|
||||
{
|
||||
class ResoursesLogo
|
||||
{
|
||||
public static string Logo1 = @"<?xml version='1.0' encoding='utf-8'?>
|
||||
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px'
|
||||
width='514px' height='166px' viewBox='0 0 514 166' enable-background='new 0 0 514 166' xml:space='preserve'>
|
||||
<polygon fill='#ADADAD' points='185.909,63.292 150.09,126.283 138.083,133.77 147.648,90.781 '/>
|
||||
<path fill='#E2E2E2' d='M30.81,97.145l23.264-2.098l-2.035,8.742L30.81,97.145z'/>
|
||||
<polygon fill='#CBCBCB' points='128.623,82.445 86.899,10.32 84.527,12.627 88.611,98.982 '/>
|
||||
<polygon fill='#E6E7E8' points='80.275,14.986 82.244,13.838 84.845,100.539 72.577,105.609 '/>
|
||||
<polygon fill='#BBBBBB' points='77.797,16.375 74.384,19.014 55.035,104.729 66.041,107.846 68.579,107.262 '/>
|
||||
<path fill='#DFDFDF' d='M69.945,141.207c-0.748,0.043-1.229,0.053-1.385,0.023c-1.771-0.322-16.562-4.101-22.613-5.91l4.778-5.078
|
||||
l0,0l15.179-16.127L69.945,141.207L69.945,141.207z'/>
|
||||
<path fill='#F0F0F0' d='M130.174,133.486l2.209,0.725l1.779,0.584c-12.788,1.369-49.015,5.215-61.423,6.211l-0.184-1.268
|
||||
l-3.614-24.908l-0.22-1.52l29.698,9.75l10.305,3.383L130.174,133.486L130.174,133.486z'/>
|
||||
<path fill='#D6D6D6' d='M52.964,108.27h0.004l11.655,3.726l-0.458,0.467l-20.814,21.302c-3.793-6.021-18.209-29.06-20.418-34.865
|
||||
l4.5,1.215L52.964,108.27L52.964,108.27z'/>
|
||||
<path fill='#F8F8F8' d='M185.28,64.085l-27.599,44.2l-18.449,23.926l-69.109-21.385l83.576-34.077
|
||||
C171.808,69.663,185.297,64.315,185.28,64.085L185.28,64.085z'/>
|
||||
<path fill='#AFAFAF' d='M46.08,134.242l17.944,4.713c135.917-18.133,206.353-10.34,206.312-9.541
|
||||
c-0.041,0.801-88.329,0.379-144.937,9.678s-69.276,12.629-80.254,14.891c-10.978,2.265-9.999-10.776-9.999-10.776l0.128-0.021
|
||||
C35.518,140.416,37.232,135.527,46.08,134.242L46.08,134.242z'/>
|
||||
<path fill='#AFAFAF' d='M193.304,44.696h8.928c0.667,0,1.18,0.16,1.539,0.481c0.206,0.184,0.411,0.481,0.616,0.894l6.08,13.886
|
||||
c0,0.092,0.128,0.275,0.385,0.55c0.205-0.184,0.333-0.344,0.385-0.48l6.926-13.817c0.308-0.55,0.629-0.939,0.962-1.169
|
||||
c0.334-0.229,0.706-0.344,1.116-0.344h9.005c1.18,0,1.77,0.39,1.77,1.169c0,0.275-0.051,0.504-0.154,0.688
|
||||
c-0.103,0.183-0.154,0.298-0.154,0.344L217.47,69.857c-0.205,0.367-0.436,0.791-0.693,1.272c-0.256,0.48-0.385,1.042-0.385,1.684
|
||||
V90.41c0,1.055-0.218,1.719-0.654,1.994c-0.437,0.275-1.116,0.412-2.04,0.412h-6.003c-0.923,0-1.539-0.092-1.847-0.275
|
||||
c-0.564-0.365-0.847-1.076-0.847-2.131V72.811c0-0.642-0.026-1.077-0.077-1.306c-0.052-0.229-0.308-0.779-0.77-1.65l-12.161-22.959
|
||||
c-0.257-0.551-0.385-0.963-0.385-1.237c0-0.413,0.167-0.676,0.5-0.791C192.444,44.753,192.842,44.696,193.304,44.696L193.304,44.696
|
||||
z M234.172,75.286V62.225c0-4.583,0.667-8.157,2.001-10.724c2.565-4.903,7.491-7.355,14.777-7.355c6.825,0,11.571,2.2,14.239,6.6
|
||||
c1.692,2.795,2.539,6.622,2.539,11.479v13.061c0,4.537-0.666,8.089-2,10.655c-2.566,4.949-7.492,7.424-14.778,7.424
|
||||
c-5.696,0-9.915-1.479-12.661-4.434C235.545,85.975,234.172,81.426,234.172,75.286z M256.338,74.118V63.394
|
||||
c0-3.575-0.23-6.004-0.693-7.287c-0.718-2.017-2.283-3.024-4.694-3.024c-2.411,0-3.977,0.985-4.694,2.956
|
||||
c-0.463,1.283-0.693,3.734-0.693,7.355v10.724c0,3.574,0.23,6.003,0.693,7.286c0.718,2.017,2.283,3.024,4.694,3.024
|
||||
c2.411,0,3.977-0.985,4.694-2.956C256.108,80.189,256.338,77.738,256.338,74.118L256.338,74.118z M274.271,77.554V47.102
|
||||
c0-0.825,0.102-1.375,0.307-1.649c0.412-0.505,1.207-0.757,2.387-0.757h6.004c1.18,0,1.924,0.195,2.23,0.584
|
||||
c0.309,0.39,0.463,0.997,0.463,1.822v30.384c0,1.741,0.205,3.048,0.615,3.918c0.82,1.741,2.412,2.612,4.771,2.612
|
||||
c1.897,0,3.271-0.502,4.119-1.512c0.847-1.008,1.271-2.681,1.271-5.018V47.102c0-0.825,0.102-1.375,0.307-1.649
|
||||
c0.41-0.505,1.207-0.757,2.387-0.757h6.004c1.18,0,1.924,0.195,2.23,0.584c0.309,0.39,0.463,0.997,0.463,1.822v30.452
|
||||
c0,4.079-0.873,7.379-2.617,9.899c-2.721,3.941-7.439,5.912-14.162,5.912c-6.721,0-11.441-1.947-14.16-5.844
|
||||
C275.143,85.002,274.271,81.679,274.271,77.554L274.271,77.554z M317.447,44.696h14.24c6.516,0,11.391,1.489,14.623,4.469
|
||||
c2.617,2.383,3.926,5.385,3.926,9.005c0,3.3-0.873,6.049-2.619,8.249c-1.385,1.787-3.104,3.002-5.154,3.643
|
||||
c-0.463,0.092-0.693,0.299-0.693,0.619c0,0.275,0.127,0.642,0.385,1.1l9.621,18.56c0.152,0.367,0.23,0.688,0.23,0.964
|
||||
c0,1.008-0.615,1.512-1.848,1.512h-8.004c-1.129,0-1.924-0.205-2.387-0.619c-0.154-0.137-0.332-0.412-0.539-0.824L330.07,73.5
|
||||
c-0.359-0.642-0.898-0.963-1.615-0.963h-1.463c-0.564,0-0.848,0.275-0.848,0.825v17.047c0,1.055-0.217,1.719-0.654,1.993
|
||||
c-0.436,0.275-1.115,0.412-2.039,0.412h-6.004c-0.922,0-1.539-0.092-1.846-0.274c-0.564-0.365-0.848-1.076-0.848-2.131V47.102
|
||||
c0-0.825,0.104-1.375,0.309-1.649C315.473,44.948,316.268,44.696,317.447,44.696L317.447,44.696z M326.145,54.664v8.387
|
||||
c0,0.688,0.359,1.03,1.078,1.03h3.617c2.154,0,3.875-0.48,5.156-1.443c1.283-0.962,1.924-2.245,1.924-3.85
|
||||
c0-1.466-0.486-2.657-1.461-3.574c-1.232-1.146-3.105-1.719-5.619-1.719h-3.387C326.582,53.495,326.145,53.884,326.145,54.664
|
||||
L326.145,54.664z'/>
|
||||
<path fill='#CECECE' d='M355.93,90.408V47.101c0-0.825,0.104-1.375,0.309-1.65c0.41-0.504,1.205-0.756,2.385-0.756h13.316
|
||||
c5.797,0,10.197,1.501,13.199,4.502c3.002,3.002,4.502,7.321,4.502,12.958V73.91c0,5.179-0.898,9.211-2.693,12.098
|
||||
c-2.82,4.537-7.852,6.807-15.086,6.807h-13.238c-0.922,0-1.537-0.092-1.846-0.274C356.213,92.172,355.93,91.461,355.93,90.408z
|
||||
M367.32,55.143v27.565c0,0.504,0.078,0.858,0.23,1.065c0.152,0.205,0.539,0.31,1.154,0.31h2.615c2.361,0,4.105-0.746,5.234-2.235
|
||||
c1.129-1.489,1.693-4.159,1.693-8.008V63.804c0-2.887-0.309-5.063-0.924-6.53c-1.025-2.521-2.977-3.78-5.85-3.78h-2.771
|
||||
c-0.615,0-1.002,0.16-1.154,0.48C367.398,54.295,367.32,54.685,367.32,55.143L367.32,55.143z M394.951,75.285V62.224
|
||||
c0-4.583,0.666-8.157,2.002-10.725c2.564-4.903,7.49-7.354,14.777-7.354c6.824,0,11.57,2.199,14.238,6.599
|
||||
c1.691,2.796,2.539,6.622,2.539,11.48v13.061c0,4.537-0.666,8.088-2.002,10.654c-2.564,4.949-7.49,7.424-14.775,7.424
|
||||
c-5.697,0-9.916-1.479-12.662-4.434C396.324,85.975,394.951,81.425,394.951,75.285z M417.117,74.116V63.392
|
||||
c0-3.574-0.23-6.003-0.693-7.286c-0.719-2.017-2.283-3.024-4.693-3.024c-2.412,0-3.979,0.985-4.695,2.955
|
||||
c-0.463,1.283-0.691,3.735-0.691,7.355v10.724c0,3.574,0.229,6.004,0.691,7.286c0.719,2.017,2.283,3.026,4.695,3.026
|
||||
c2.41,0,3.975-0.986,4.693-2.957C416.887,80.188,417.117,77.736,417.117,74.116L417.117,74.116z M462.295,46.276V52.6
|
||||
c0,0.366-0.051,0.652-0.154,0.859c-0.102,0.206-0.357,0.31-0.77,0.31c-1.18-0.229-2.398-0.447-3.654-0.653
|
||||
c-1.258-0.207-2.4-0.31-3.426-0.31c-3.488,0-5.773,0.985-6.85,2.956c-0.668,1.237-1,3.46-1,6.668v11.617
|
||||
c0,3.941,0.576,6.564,1.73,7.871c1.152,1.306,3.373,1.959,6.656,1.959c1.85,0,3.105-0.148,3.771-0.447s1.77-0.446,3.309-0.446
|
||||
c0.771,0,1.154,0.412,1.154,1.237v6.119c0,1.053-0.629,1.82-1.885,2.303c-1.258,0.48-4.143,0.721-8.658,0.721
|
||||
c-7.082,0-11.982-1.694-14.701-5.086c-1.848-2.338-2.77-5.888-2.77-10.655V58.099c0-4.078,1.076-7.218,3.23-9.418
|
||||
c2.926-3.024,7.877-4.536,14.855-4.536c3.848,0,6.465,0.229,7.85,0.687C461.859,45.107,462.295,45.588,462.295,46.276
|
||||
L462.295,46.276z M468.068,90.133v-6.188c0-0.549,0.18-0.927,0.539-1.133c0.371-0.207,0.73-0.31,1.09-0.31
|
||||
c0.41,0,0.896,0.068,1.436,0.206c0.541,0.138,0.938,0.229,1.207,0.275c0.871,0.229,2.193,0.458,3.949,0.688
|
||||
c1.758,0.229,3.156,0.343,4.195,0.343c2.271,0,4.066-0.424,5.387-1.271c1.322-0.848,1.977-2.005,1.977-3.471
|
||||
c0-2.154-1.488-4.171-4.465-6.05c-2.154-1.237-3.744-2.153-4.771-2.75c-3.797-2.245-6.387-4.147-7.771-5.705
|
||||
c-1.85-2.063-2.771-4.629-2.771-7.699c0-4.216,1.59-7.424,4.771-9.624c3.182-2.199,7.49-3.299,12.93-3.299
|
||||
c2.359,0,4.695,0.183,7.004,0.55c3.488,0.55,5.234,1.352,5.234,2.406v6.187c0,0.183,0,0.344,0,0.48
|
||||
c-0.154,0.551-0.592,0.825-1.309,0.825l-3.695-0.619c-2.104-0.366-3.424-0.584-3.963-0.652c-0.539-0.069-1.348-0.104-2.424-0.104
|
||||
c-2.105,0-3.631,0.298-4.58,0.894c-0.949,0.596-1.424,1.329-1.424,2.2c0,1.558,2.898,4.01,8.697,7.355
|
||||
c3.385,2.017,5.85,3.918,7.389,5.705c2.463,2.842,3.693,6.187,3.693,10.036c0,4.309-1.693,7.71-5.066,10.208
|
||||
s-8.004,3.746-13.879,3.746c-1.912,0-4.08-0.125-6.492-0.379c-2.424-0.252-4.207-0.584-5.336-0.996
|
||||
c-0.68-0.229-1.102-0.504-1.281-0.824S468.068,90.5,468.068,90.133z'/>
|
||||
<path fill='#AFAFAF' d='M204.477,118.375v-15.918h5.481c1.238,0,2.183,0.078,2.835,0.23c0.912,0.207,1.69,0.588,2.335,1.137
|
||||
c0.837,0.713,1.468,1.617,1.882,2.721c0.419,1.104,0.626,2.365,0.626,3.783c0,1.209-0.141,2.279-0.426,3.213
|
||||
c-0.281,0.936-0.641,1.709-1.086,2.32c-0.44,0.611-0.922,1.094-1.449,1.443c-0.522,0.352-1.156,0.616-1.897,0.799
|
||||
c-0.745,0.182-1.597,0.271-2.558,0.271L204.477,118.375L204.477,118.375z M206.582,116.496h3.398c1.049,0,1.875-0.098,2.472-0.293
|
||||
c0.597-0.197,1.071-0.471,1.427-0.826c0.5-0.496,0.889-1.172,1.167-2.014c0.278-0.844,0.418-1.863,0.418-3.068
|
||||
c0-1.664-0.274-2.941-0.819-3.836c-0.548-0.896-1.212-1.492-1.994-1.797c-0.563-0.219-1.475-0.326-2.724-0.326h-3.347v12.16H206.582
|
||||
z M220.58,118.375v-15.918h11.508v1.879h-9.402v4.873h8.806v1.869h-8.806v5.418h9.773v1.879H220.58L220.58,118.375z M234.652,113.26
|
||||
l1.986-0.174c0.093,0.797,0.312,1.449,0.656,1.961c0.344,0.512,0.878,0.922,1.601,1.238c0.723,0.314,1.538,0.471,2.442,0.471
|
||||
c0.804,0,1.513-0.119,2.128-0.357c0.615-0.239,1.074-0.565,1.375-0.979c0.3-0.42,0.451-0.871,0.451-1.364
|
||||
c0-0.5-0.145-0.935-0.438-1.308c-0.289-0.375-0.767-0.687-1.43-0.938c-0.43-0.168-1.371-0.428-2.836-0.779
|
||||
c-1.459-0.352-2.486-0.682-3.072-0.991c-0.76-0.397-1.327-0.896-1.701-1.483c-0.371-0.589-0.556-1.248-0.556-1.982
|
||||
c0-0.799,0.226-1.553,0.682-2.248c0.456-0.701,1.123-1.23,1.998-1.594c0.878-0.359,1.85-0.541,2.921-0.541
|
||||
c1.182,0,2.22,0.188,3.124,0.569c0.9,0.378,1.594,0.938,2.079,1.677c0.481,0.735,0.744,1.573,0.781,2.508l-2.021,0.152
|
||||
c-0.111-1.005-0.479-1.769-1.104-2.279c-0.627-0.517-1.55-0.771-2.773-0.771c-1.273,0-2.201,0.234-2.786,0.701
|
||||
c-0.582,0.467-0.875,1.029-0.875,1.686c0,0.574,0.208,1.045,0.619,1.412c0.407,0.371,1.464,0.748,3.177,1.135
|
||||
c1.711,0.39,2.887,0.728,3.523,1.017c0.927,0.43,1.613,0.971,2.053,1.623c0.441,0.655,0.66,1.411,0.66,2.264
|
||||
c0,0.851-0.24,1.646-0.727,2.396c-0.485,0.748-1.182,1.33-2.09,1.75c-0.908,0.414-1.931,0.621-3.064,0.621
|
||||
c-1.441,0-2.65-0.207-3.621-0.629c-0.975-0.42-1.738-1.049-2.294-1.896C234.97,115.279,234.678,114.324,234.652,113.26
|
||||
L234.652,113.26z M250.11,118.375v-15.918h2.109v7.895l7.904-7.895h2.854l-6.678,6.449l6.971,9.469h-2.779l-5.667-8.057
|
||||
l-2.604,2.541v5.516H250.11L250.11,118.375z M269.082,118.375v-14.039h-5.244v-1.879h12.615v1.879h-5.268v14.039H269.082z
|
||||
M277.572,110.621c0-2.643,0.707-4.709,2.127-6.203s3.25-2.242,5.496-2.242c1.467,0,2.795,0.352,3.973,1.053
|
||||
c1.18,0.703,2.08,1.683,2.699,2.939c0.617,1.252,0.926,2.678,0.926,4.268c0,1.617-0.322,3.063-0.975,4.334
|
||||
c-0.652,1.273-1.576,2.238-2.771,2.896c-1.196,0.653-2.481,0.979-3.864,0.979c-1.5,0-2.838-0.358-4.019-1.086
|
||||
c-1.183-0.723-2.074-1.711-2.683-2.965C277.875,113.346,277.572,112.02,277.572,110.621L277.572,110.621z M279.744,110.654
|
||||
c0,1.92,0.514,3.43,1.545,4.533c1.033,1.104,2.328,1.656,3.885,1.656c1.586,0,2.891-0.556,3.912-1.673
|
||||
c1.023-1.114,1.539-2.696,1.539-4.746c0-1.295-0.223-2.424-0.66-3.394c-0.438-0.967-1.078-1.715-1.92-2.247
|
||||
c-0.844-0.531-1.789-0.798-2.838-0.798c-1.494,0-2.777,0.513-3.852,1.537C280.281,106.549,279.744,108.262,279.744,110.654z
|
||||
M295.51,118.375v-15.918h6.004c1.057,0,1.863,0.053,2.42,0.152c0.781,0.129,1.438,0.377,1.967,0.744
|
||||
c0.527,0.362,0.953,0.879,1.275,1.535c0.322,0.659,0.482,1.383,0.482,2.172c0,1.352-0.43,2.502-1.291,3.438
|
||||
c-0.863,0.935-2.42,1.403-4.668,1.403h-4.086v6.472L295.51,118.375L295.51,118.375z M297.613,110.025h4.119
|
||||
c1.359,0,2.326-0.252,2.896-0.76c0.57-0.509,0.855-1.222,0.855-2.14c0-0.668-0.168-1.237-0.504-1.713
|
||||
c-0.338-0.476-0.779-0.785-1.332-0.938c-0.354-0.092-1.008-0.141-1.963-0.141h-4.074v5.691H297.613z M328.182,116.67
|
||||
c0.975,0.674,1.879,1.164,2.701,1.475l-0.617,1.469c-1.143-0.411-2.283-1.063-3.422-1.952c-1.178,0.655-2.479,0.983-3.906,0.983
|
||||
c-1.441,0-2.746-0.348-3.92-1.041c-1.172-0.697-2.076-1.672-2.709-2.932c-0.635-1.26-0.949-2.68-0.949-4.254
|
||||
c0-1.572,0.318-3.002,0.955-4.291c0.639-1.287,1.543-2.27,2.721-2.943c1.178-0.67,2.49-1.008,3.943-1.008
|
||||
c1.471,0,2.795,0.348,3.977,1.049c1.182,0.697,2.08,1.674,2.697,2.932c0.619,1.257,0.928,2.673,0.928,4.25
|
||||
c0,1.31-0.195,2.486-0.598,3.531C329.586,114.984,328.986,115.895,328.182,116.67L328.182,116.67z M323.545,113.975
|
||||
c1.217,0.342,2.217,0.851,3.006,1.523c1.238-1.129,1.857-2.826,1.857-5.092c0-1.289-0.219-2.416-0.656-3.379
|
||||
c-0.438-0.961-1.078-1.709-1.92-2.242c-0.844-0.531-1.789-0.797-2.842-0.797c-1.568,0-2.873,0.537-3.906,1.611
|
||||
c-1.037,1.073-1.553,2.68-1.553,4.817c0,2.067,0.512,3.658,1.533,4.767c1.027,1.104,2.336,1.66,3.926,1.66
|
||||
c0.756,0,1.463-0.142,2.131-0.423c-0.66-0.43-1.357-0.733-2.086-0.911L323.545,113.975L323.545,113.975z M343.859,102.457h2.107
|
||||
v9.199c0,1.598-0.184,2.867-0.545,3.809c-0.363,0.941-1.018,1.705-1.959,2.295c-0.945,0.592-2.186,0.885-3.721,0.885
|
||||
c-1.486,0-2.713-0.256-3.654-0.77c-0.949-0.512-1.631-1.258-2.031-2.232c-0.408-0.975-0.607-2.301-0.607-3.986v-9.198h2.104v9.188
|
||||
c0,1.383,0.131,2.399,0.387,3.053c0.256,0.656,0.699,1.16,1.322,1.518c0.627,0.355,1.393,0.533,2.297,0.533
|
||||
c1.551,0,2.654-0.354,3.314-1.057c0.656-0.701,0.986-2.049,0.986-4.047V102.457L343.859,102.457z M347.725,118.375l6.115-15.918
|
||||
h2.268l6.516,15.918h-2.4l-1.857-4.822h-6.656l-1.744,4.822H347.725z M352.316,111.838h5.398l-1.664-4.408
|
||||
c-0.504-1.338-0.881-2.438-1.127-3.301c-0.203,1.021-0.488,2.035-0.859,3.043L352.316,111.838L352.316,111.838z M364.217,118.375
|
||||
v-15.918h2.107v14.039h7.84v1.879H364.217z M377.031,118.375v-15.918h2.105v15.918H377.031z M386.9,118.375v-14.039h-5.244v-1.879
|
||||
h12.615v1.879h-5.266v14.039H386.9L386.9,118.375z M400.918,118.375v-6.742l-6.135-9.176h2.561l3.139,4.799
|
||||
c0.58,0.896,1.117,1.795,1.617,2.695c0.479-0.834,1.057-1.771,1.738-2.813l3.082-4.683h2.455l-6.354,9.176v6.742L400.918,118.375
|
||||
L400.918,118.375z M416.4,110.621c0-2.643,0.709-4.709,2.129-6.203c1.418-1.494,3.25-2.242,5.496-2.242
|
||||
c1.467,0,2.793,0.352,3.973,1.053c1.178,0.703,2.078,1.683,2.697,2.938c0.619,1.254,0.926,2.681,0.926,4.271
|
||||
c0,1.617-0.322,3.063-0.975,4.334c-0.652,1.272-1.574,2.238-2.768,2.895c-1.197,0.654-2.482,0.98-3.865,0.98
|
||||
c-1.502,0-2.84-0.359-4.02-1.086c-1.182-0.724-2.074-1.711-2.684-2.965C416.705,113.346,416.4,112.02,416.4,110.621L416.4,110.621z
|
||||
M418.572,110.654c0,1.92,0.516,3.428,1.547,4.533c1.033,1.104,2.326,1.656,3.883,1.656c1.586,0,2.891-0.558,3.914-1.673
|
||||
c1.023-1.114,1.537-2.696,1.537-4.746c0-1.295-0.223-2.424-0.658-3.394c-0.438-0.967-1.08-1.715-1.92-2.247
|
||||
c-0.846-0.531-1.791-0.798-2.84-0.798c-1.494,0-2.775,0.513-3.85,1.537C419.109,106.549,418.572,108.262,418.572,110.654z
|
||||
M434.316,118.375v-15.918h2.16l8.361,12.496v-12.496h2.02v15.918h-2.16l-8.361-12.508v12.508H434.316z M450.309,118.375v-15.918
|
||||
h2.107v14.039h7.84v1.879H450.309z M463.123,118.375v-15.918h2.105v15.918H463.123z M468.92,118.375v-15.918h2.16l8.361,12.496
|
||||
v-12.496h2.02v15.918h-2.16l-8.361-12.508v12.508H468.92z M485.045,118.375v-15.918h11.508v1.879h-9.402v4.873h8.805v1.869h-8.805
|
||||
v5.418h9.771v1.879H485.045L485.045,118.375z'/>
|
||||
<polygon fill='#B5B5B5' points='80.268,117.346 69.612,121.502 68.397,113.484 '/>
|
||||
<path fill='#A6A8AB' d='M58.024,118.588l-33.43-11.02c0.458-0.15-3.059-6.269-4.434-9.16l6.949,1.877l36.893,11.797L58.024,118.588z'/>
|
||||
<path fill='#B5B5B5' d='M60.703,119.469l0.238-0.232l5.237-5.416l0.899,7.623C65.023,120.861,62.443,119.998,60.703,119.469z'/>
|
||||
<path fill='#D0D2D3' d='M178.142,85.885l-93.671,29.594l-14.48-4.477l117.176-47.806C186.073,67.116,179.371,82.425,178.142,85.885z'/>
|
||||
</svg>";
|
||||
}
|
||||
}
|
||||
146
ServerComponents/PdfWriter/logo.svg
Normal file
146
ServerComponents/PdfWriter/logo.svg
Normal file
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="514px" height="166px" viewBox="0 0 514 166" enable-background="new 0 0 514 166" xml:space="preserve">
|
||||
<polygon fill="#ADADAD" points="185.909,63.292 150.09,126.283 138.083,133.77 147.648,90.781 "/>
|
||||
<path fill="#E2E2E2" d="M30.81,97.145l23.264-2.098l-2.035,8.742L30.81,97.145z"/>
|
||||
<polygon fill="#CBCBCB" points="128.623,82.445 86.899,10.32 84.527,12.627 88.611,98.982 "/>
|
||||
<polygon fill="#E6E7E8" points="80.275,14.986 82.244,13.838 84.845,100.539 72.577,105.609 "/>
|
||||
<polygon fill="#BBBBBB" points="77.797,16.375 74.384,19.014 55.035,104.729 66.041,107.846 68.579,107.262 "/>
|
||||
<path fill="#DFDFDF" d="M69.945,141.207c-0.748,0.043-1.229,0.053-1.385,0.023c-1.771-0.322-16.562-4.101-22.613-5.91l4.778-5.078
|
||||
l0,0l15.179-16.127L69.945,141.207L69.945,141.207z"/>
|
||||
<path fill="#F0F0F0" d="M130.174,133.486l2.209,0.725l1.779,0.584c-12.788,1.369-49.015,5.215-61.423,6.211l-0.184-1.268
|
||||
l-3.614-24.908l-0.22-1.52l29.698,9.75l10.305,3.383L130.174,133.486L130.174,133.486z"/>
|
||||
<path fill="#D6D6D6" d="M52.964,108.27h0.004l11.655,3.726l-0.458,0.467l-20.814,21.302c-3.793-6.021-18.209-29.06-20.418-34.865
|
||||
l4.5,1.215L52.964,108.27L52.964,108.27z"/>
|
||||
<path fill="#F8F8F8" d="M185.28,64.085l-27.599,44.2l-18.449,23.926l-69.109-21.385l83.576-34.077
|
||||
C171.808,69.663,185.297,64.315,185.28,64.085L185.28,64.085z"/>
|
||||
<path fill="#AFAFAF" d="M46.08,134.242l17.944,4.713c135.917-18.133,206.353-10.34,206.312-9.541
|
||||
c-0.041,0.801-88.329,0.379-144.937,9.678s-69.276,12.629-80.254,14.891c-10.978,2.265-9.999-10.776-9.999-10.776l0.128-0.021
|
||||
C35.518,140.416,37.232,135.527,46.08,134.242L46.08,134.242z"/>
|
||||
<path fill="#AFAFAF" d="M193.304,44.696h8.928c0.667,0,1.18,0.16,1.539,0.481c0.206,0.184,0.411,0.481,0.616,0.894l6.08,13.886
|
||||
c0,0.092,0.128,0.275,0.385,0.55c0.205-0.184,0.333-0.344,0.385-0.48l6.926-13.817c0.308-0.55,0.629-0.939,0.962-1.169
|
||||
c0.334-0.229,0.706-0.344,1.116-0.344h9.005c1.18,0,1.77,0.39,1.77,1.169c0,0.275-0.051,0.504-0.154,0.688
|
||||
c-0.103,0.183-0.154,0.298-0.154,0.344L217.47,69.857c-0.205,0.367-0.436,0.791-0.693,1.272c-0.256,0.48-0.385,1.042-0.385,1.684
|
||||
V90.41c0,1.055-0.218,1.719-0.654,1.994c-0.437,0.275-1.116,0.412-2.04,0.412h-6.003c-0.923,0-1.539-0.092-1.847-0.275
|
||||
c-0.564-0.365-0.847-1.076-0.847-2.131V72.811c0-0.642-0.026-1.077-0.077-1.306c-0.052-0.229-0.308-0.779-0.77-1.65l-12.161-22.959
|
||||
c-0.257-0.551-0.385-0.963-0.385-1.237c0-0.413,0.167-0.676,0.5-0.791C192.444,44.753,192.842,44.696,193.304,44.696L193.304,44.696
|
||||
z M234.172,75.286V62.225c0-4.583,0.667-8.157,2.001-10.724c2.565-4.903,7.491-7.355,14.777-7.355c6.825,0,11.571,2.2,14.239,6.6
|
||||
c1.692,2.795,2.539,6.622,2.539,11.479v13.061c0,4.537-0.666,8.089-2,10.655c-2.566,4.949-7.492,7.424-14.778,7.424
|
||||
c-5.696,0-9.915-1.479-12.661-4.434C235.545,85.975,234.172,81.426,234.172,75.286z M256.338,74.118V63.394
|
||||
c0-3.575-0.23-6.004-0.693-7.287c-0.718-2.017-2.283-3.024-4.694-3.024c-2.411,0-3.977,0.985-4.694,2.956
|
||||
c-0.463,1.283-0.693,3.734-0.693,7.355v10.724c0,3.574,0.23,6.003,0.693,7.286c0.718,2.017,2.283,3.024,4.694,3.024
|
||||
c2.411,0,3.977-0.985,4.694-2.956C256.108,80.189,256.338,77.738,256.338,74.118L256.338,74.118z M274.271,77.554V47.102
|
||||
c0-0.825,0.102-1.375,0.307-1.649c0.412-0.505,1.207-0.757,2.387-0.757h6.004c1.18,0,1.924,0.195,2.23,0.584
|
||||
c0.309,0.39,0.463,0.997,0.463,1.822v30.384c0,1.741,0.205,3.048,0.615,3.918c0.82,1.741,2.412,2.612,4.771,2.612
|
||||
c1.897,0,3.271-0.502,4.119-1.512c0.847-1.008,1.271-2.681,1.271-5.018V47.102c0-0.825,0.102-1.375,0.307-1.649
|
||||
c0.41-0.505,1.207-0.757,2.387-0.757h6.004c1.18,0,1.924,0.195,2.23,0.584c0.309,0.39,0.463,0.997,0.463,1.822v30.452
|
||||
c0,4.079-0.873,7.379-2.617,9.899c-2.721,3.941-7.439,5.912-14.162,5.912c-6.721,0-11.441-1.947-14.16-5.844
|
||||
C275.143,85.002,274.271,81.679,274.271,77.554L274.271,77.554z M317.447,44.696h14.24c6.516,0,11.391,1.489,14.623,4.469
|
||||
c2.617,2.383,3.926,5.385,3.926,9.005c0,3.3-0.873,6.049-2.619,8.249c-1.385,1.787-3.104,3.002-5.154,3.643
|
||||
c-0.463,0.092-0.693,0.299-0.693,0.619c0,0.275,0.127,0.642,0.385,1.1l9.621,18.56c0.152,0.367,0.23,0.688,0.23,0.964
|
||||
c0,1.008-0.615,1.512-1.848,1.512h-8.004c-1.129,0-1.924-0.205-2.387-0.619c-0.154-0.137-0.332-0.412-0.539-0.824L330.07,73.5
|
||||
c-0.359-0.642-0.898-0.963-1.615-0.963h-1.463c-0.564,0-0.848,0.275-0.848,0.825v17.047c0,1.055-0.217,1.719-0.654,1.993
|
||||
c-0.436,0.275-1.115,0.412-2.039,0.412h-6.004c-0.922,0-1.539-0.092-1.846-0.274c-0.564-0.365-0.848-1.076-0.848-2.131V47.102
|
||||
c0-0.825,0.104-1.375,0.309-1.649C315.473,44.948,316.268,44.696,317.447,44.696L317.447,44.696z M326.145,54.664v8.387
|
||||
c0,0.688,0.359,1.03,1.078,1.03h3.617c2.154,0,3.875-0.48,5.156-1.443c1.283-0.962,1.924-2.245,1.924-3.85
|
||||
c0-1.466-0.486-2.657-1.461-3.574c-1.232-1.146-3.105-1.719-5.619-1.719h-3.387C326.582,53.495,326.145,53.884,326.145,54.664
|
||||
L326.145,54.664z"/>
|
||||
<path fill="#CECECE" d="M355.93,90.408V47.101c0-0.825,0.104-1.375,0.309-1.65c0.41-0.504,1.205-0.756,2.385-0.756h13.316
|
||||
c5.797,0,10.197,1.501,13.199,4.502c3.002,3.002,4.502,7.321,4.502,12.958V73.91c0,5.179-0.898,9.211-2.693,12.098
|
||||
c-2.82,4.537-7.852,6.807-15.086,6.807h-13.238c-0.922,0-1.537-0.092-1.846-0.274C356.213,92.172,355.93,91.461,355.93,90.408z
|
||||
M367.32,55.143v27.565c0,0.504,0.078,0.858,0.23,1.065c0.152,0.205,0.539,0.31,1.154,0.31h2.615c2.361,0,4.105-0.746,5.234-2.235
|
||||
c1.129-1.489,1.693-4.159,1.693-8.008V63.804c0-2.887-0.309-5.063-0.924-6.53c-1.025-2.521-2.977-3.78-5.85-3.78h-2.771
|
||||
c-0.615,0-1.002,0.16-1.154,0.48C367.398,54.295,367.32,54.685,367.32,55.143L367.32,55.143z M394.951,75.285V62.224
|
||||
c0-4.583,0.666-8.157,2.002-10.725c2.564-4.903,7.49-7.354,14.777-7.354c6.824,0,11.57,2.199,14.238,6.599
|
||||
c1.691,2.796,2.539,6.622,2.539,11.48v13.061c0,4.537-0.666,8.088-2.002,10.654c-2.564,4.949-7.49,7.424-14.775,7.424
|
||||
c-5.697,0-9.916-1.479-12.662-4.434C396.324,85.975,394.951,81.425,394.951,75.285z M417.117,74.116V63.392
|
||||
c0-3.574-0.23-6.003-0.693-7.286c-0.719-2.017-2.283-3.024-4.693-3.024c-2.412,0-3.979,0.985-4.695,2.955
|
||||
c-0.463,1.283-0.691,3.735-0.691,7.355v10.724c0,3.574,0.229,6.004,0.691,7.286c0.719,2.017,2.283,3.026,4.695,3.026
|
||||
c2.41,0,3.975-0.986,4.693-2.957C416.887,80.188,417.117,77.736,417.117,74.116L417.117,74.116z M462.295,46.276V52.6
|
||||
c0,0.366-0.051,0.652-0.154,0.859c-0.102,0.206-0.357,0.31-0.77,0.31c-1.18-0.229-2.398-0.447-3.654-0.653
|
||||
c-1.258-0.207-2.4-0.31-3.426-0.31c-3.488,0-5.773,0.985-6.85,2.956c-0.668,1.237-1,3.46-1,6.668v11.617
|
||||
c0,3.941,0.576,6.564,1.73,7.871c1.152,1.306,3.373,1.959,6.656,1.959c1.85,0,3.105-0.148,3.771-0.447s1.77-0.446,3.309-0.446
|
||||
c0.771,0,1.154,0.412,1.154,1.237v6.119c0,1.053-0.629,1.82-1.885,2.303c-1.258,0.48-4.143,0.721-8.658,0.721
|
||||
c-7.082,0-11.982-1.694-14.701-5.086c-1.848-2.338-2.77-5.888-2.77-10.655V58.099c0-4.078,1.076-7.218,3.23-9.418
|
||||
c2.926-3.024,7.877-4.536,14.855-4.536c3.848,0,6.465,0.229,7.85,0.687C461.859,45.107,462.295,45.588,462.295,46.276
|
||||
L462.295,46.276z M468.068,90.133v-6.188c0-0.549,0.18-0.927,0.539-1.133c0.371-0.207,0.73-0.31,1.09-0.31
|
||||
c0.41,0,0.896,0.068,1.436,0.206c0.541,0.138,0.938,0.229,1.207,0.275c0.871,0.229,2.193,0.458,3.949,0.688
|
||||
c1.758,0.229,3.156,0.343,4.195,0.343c2.271,0,4.066-0.424,5.387-1.271c1.322-0.848,1.977-2.005,1.977-3.471
|
||||
c0-2.154-1.488-4.171-4.465-6.05c-2.154-1.237-3.744-2.153-4.771-2.75c-3.797-2.245-6.387-4.147-7.771-5.705
|
||||
c-1.85-2.063-2.771-4.629-2.771-7.699c0-4.216,1.59-7.424,4.771-9.624c3.182-2.199,7.49-3.299,12.93-3.299
|
||||
c2.359,0,4.695,0.183,7.004,0.55c3.488,0.55,5.234,1.352,5.234,2.406v6.187c0,0.183,0,0.344,0,0.48
|
||||
c-0.154,0.551-0.592,0.825-1.309,0.825l-3.695-0.619c-2.104-0.366-3.424-0.584-3.963-0.652c-0.539-0.069-1.348-0.104-2.424-0.104
|
||||
c-2.105,0-3.631,0.298-4.58,0.894c-0.949,0.596-1.424,1.329-1.424,2.2c0,1.558,2.898,4.01,8.697,7.355
|
||||
c3.385,2.017,5.85,3.918,7.389,5.705c2.463,2.842,3.693,6.187,3.693,10.036c0,4.309-1.693,7.71-5.066,10.208
|
||||
s-8.004,3.746-13.879,3.746c-1.912,0-4.08-0.125-6.492-0.379c-2.424-0.252-4.207-0.584-5.336-0.996
|
||||
c-0.68-0.229-1.102-0.504-1.281-0.824S468.068,90.5,468.068,90.133z"/>
|
||||
<path fill="#AFAFAF" d="M204.477,118.375v-15.918h5.481c1.238,0,2.183,0.078,2.835,0.23c0.912,0.207,1.69,0.588,2.335,1.137
|
||||
c0.837,0.713,1.468,1.617,1.882,2.721c0.419,1.104,0.626,2.365,0.626,3.783c0,1.209-0.141,2.279-0.426,3.213
|
||||
c-0.281,0.936-0.641,1.709-1.086,2.32c-0.44,0.611-0.922,1.094-1.449,1.443c-0.522,0.352-1.156,0.616-1.897,0.799
|
||||
c-0.745,0.182-1.597,0.271-2.558,0.271L204.477,118.375L204.477,118.375z M206.582,116.496h3.398c1.049,0,1.875-0.098,2.472-0.293
|
||||
c0.597-0.197,1.071-0.471,1.427-0.826c0.5-0.496,0.889-1.172,1.167-2.014c0.278-0.844,0.418-1.863,0.418-3.068
|
||||
c0-1.664-0.274-2.941-0.819-3.836c-0.548-0.896-1.212-1.492-1.994-1.797c-0.563-0.219-1.475-0.326-2.724-0.326h-3.347v12.16H206.582
|
||||
z M220.58,118.375v-15.918h11.508v1.879h-9.402v4.873h8.806v1.869h-8.806v5.418h9.773v1.879H220.58L220.58,118.375z M234.652,113.26
|
||||
l1.986-0.174c0.093,0.797,0.312,1.449,0.656,1.961c0.344,0.512,0.878,0.922,1.601,1.238c0.723,0.314,1.538,0.471,2.442,0.471
|
||||
c0.804,0,1.513-0.119,2.128-0.357c0.615-0.239,1.074-0.565,1.375-0.979c0.3-0.42,0.451-0.871,0.451-1.364
|
||||
c0-0.5-0.145-0.935-0.438-1.308c-0.289-0.375-0.767-0.687-1.43-0.938c-0.43-0.168-1.371-0.428-2.836-0.779
|
||||
c-1.459-0.352-2.486-0.682-3.072-0.991c-0.76-0.397-1.327-0.896-1.701-1.483c-0.371-0.589-0.556-1.248-0.556-1.982
|
||||
c0-0.799,0.226-1.553,0.682-2.248c0.456-0.701,1.123-1.23,1.998-1.594c0.878-0.359,1.85-0.541,2.921-0.541
|
||||
c1.182,0,2.22,0.188,3.124,0.569c0.9,0.378,1.594,0.938,2.079,1.677c0.481,0.735,0.744,1.573,0.781,2.508l-2.021,0.152
|
||||
c-0.111-1.005-0.479-1.769-1.104-2.279c-0.627-0.517-1.55-0.771-2.773-0.771c-1.273,0-2.201,0.234-2.786,0.701
|
||||
c-0.582,0.467-0.875,1.029-0.875,1.686c0,0.574,0.208,1.045,0.619,1.412c0.407,0.371,1.464,0.748,3.177,1.135
|
||||
c1.711,0.39,2.887,0.728,3.523,1.017c0.927,0.43,1.613,0.971,2.053,1.623c0.441,0.655,0.66,1.411,0.66,2.264
|
||||
c0,0.851-0.24,1.646-0.727,2.396c-0.485,0.748-1.182,1.33-2.09,1.75c-0.908,0.414-1.931,0.621-3.064,0.621
|
||||
c-1.441,0-2.65-0.207-3.621-0.629c-0.975-0.42-1.738-1.049-2.294-1.896C234.97,115.279,234.678,114.324,234.652,113.26
|
||||
L234.652,113.26z M250.11,118.375v-15.918h2.109v7.895l7.904-7.895h2.854l-6.678,6.449l6.971,9.469h-2.779l-5.667-8.057
|
||||
l-2.604,2.541v5.516H250.11L250.11,118.375z M269.082,118.375v-14.039h-5.244v-1.879h12.615v1.879h-5.268v14.039H269.082z
|
||||
M277.572,110.621c0-2.643,0.707-4.709,2.127-6.203s3.25-2.242,5.496-2.242c1.467,0,2.795,0.352,3.973,1.053
|
||||
c1.18,0.703,2.08,1.683,2.699,2.939c0.617,1.252,0.926,2.678,0.926,4.268c0,1.617-0.322,3.063-0.975,4.334
|
||||
c-0.652,1.273-1.576,2.238-2.771,2.896c-1.196,0.653-2.481,0.979-3.864,0.979c-1.5,0-2.838-0.358-4.019-1.086
|
||||
c-1.183-0.723-2.074-1.711-2.683-2.965C277.875,113.346,277.572,112.02,277.572,110.621L277.572,110.621z M279.744,110.654
|
||||
c0,1.92,0.514,3.43,1.545,4.533c1.033,1.104,2.328,1.656,3.885,1.656c1.586,0,2.891-0.556,3.912-1.673
|
||||
c1.023-1.114,1.539-2.696,1.539-4.746c0-1.295-0.223-2.424-0.66-3.394c-0.438-0.967-1.078-1.715-1.92-2.247
|
||||
c-0.844-0.531-1.789-0.798-2.838-0.798c-1.494,0-2.777,0.513-3.852,1.537C280.281,106.549,279.744,108.262,279.744,110.654z
|
||||
M295.51,118.375v-15.918h6.004c1.057,0,1.863,0.053,2.42,0.152c0.781,0.129,1.438,0.377,1.967,0.744
|
||||
c0.527,0.362,0.953,0.879,1.275,1.535c0.322,0.659,0.482,1.383,0.482,2.172c0,1.352-0.43,2.502-1.291,3.438
|
||||
c-0.863,0.935-2.42,1.403-4.668,1.403h-4.086v6.472L295.51,118.375L295.51,118.375z M297.613,110.025h4.119
|
||||
c1.359,0,2.326-0.252,2.896-0.76c0.57-0.509,0.855-1.222,0.855-2.14c0-0.668-0.168-1.237-0.504-1.713
|
||||
c-0.338-0.476-0.779-0.785-1.332-0.938c-0.354-0.092-1.008-0.141-1.963-0.141h-4.074v5.691H297.613z M328.182,116.67
|
||||
c0.975,0.674,1.879,1.164,2.701,1.475l-0.617,1.469c-1.143-0.411-2.283-1.063-3.422-1.952c-1.178,0.655-2.479,0.983-3.906,0.983
|
||||
c-1.441,0-2.746-0.348-3.92-1.041c-1.172-0.697-2.076-1.672-2.709-2.932c-0.635-1.26-0.949-2.68-0.949-4.254
|
||||
c0-1.572,0.318-3.002,0.955-4.291c0.639-1.287,1.543-2.27,2.721-2.943c1.178-0.67,2.49-1.008,3.943-1.008
|
||||
c1.471,0,2.795,0.348,3.977,1.049c1.182,0.697,2.08,1.674,2.697,2.932c0.619,1.257,0.928,2.673,0.928,4.25
|
||||
c0,1.31-0.195,2.486-0.598,3.531C329.586,114.984,328.986,115.895,328.182,116.67L328.182,116.67z M323.545,113.975
|
||||
c1.217,0.342,2.217,0.851,3.006,1.523c1.238-1.129,1.857-2.826,1.857-5.092c0-1.289-0.219-2.416-0.656-3.379
|
||||
c-0.438-0.961-1.078-1.709-1.92-2.242c-0.844-0.531-1.789-0.797-2.842-0.797c-1.568,0-2.873,0.537-3.906,1.611
|
||||
c-1.037,1.073-1.553,2.68-1.553,4.817c0,2.067,0.512,3.658,1.533,4.767c1.027,1.104,2.336,1.66,3.926,1.66
|
||||
c0.756,0,1.463-0.142,2.131-0.423c-0.66-0.43-1.357-0.733-2.086-0.911L323.545,113.975L323.545,113.975z M343.859,102.457h2.107
|
||||
v9.199c0,1.598-0.184,2.867-0.545,3.809c-0.363,0.941-1.018,1.705-1.959,2.295c-0.945,0.592-2.186,0.885-3.721,0.885
|
||||
c-1.486,0-2.713-0.256-3.654-0.77c-0.949-0.512-1.631-1.258-2.031-2.232c-0.408-0.975-0.607-2.301-0.607-3.986v-9.198h2.104v9.188
|
||||
c0,1.383,0.131,2.399,0.387,3.053c0.256,0.656,0.699,1.16,1.322,1.518c0.627,0.355,1.393,0.533,2.297,0.533
|
||||
c1.551,0,2.654-0.354,3.314-1.057c0.656-0.701,0.986-2.049,0.986-4.047V102.457L343.859,102.457z M347.725,118.375l6.115-15.918
|
||||
h2.268l6.516,15.918h-2.4l-1.857-4.822h-6.656l-1.744,4.822H347.725z M352.316,111.838h5.398l-1.664-4.408
|
||||
c-0.504-1.338-0.881-2.438-1.127-3.301c-0.203,1.021-0.488,2.035-0.859,3.043L352.316,111.838L352.316,111.838z M364.217,118.375
|
||||
v-15.918h2.107v14.039h7.84v1.879H364.217z M377.031,118.375v-15.918h2.105v15.918H377.031z M386.9,118.375v-14.039h-5.244v-1.879
|
||||
h12.615v1.879h-5.266v14.039H386.9L386.9,118.375z M400.918,118.375v-6.742l-6.135-9.176h2.561l3.139,4.799
|
||||
c0.58,0.896,1.117,1.795,1.617,2.695c0.479-0.834,1.057-1.771,1.738-2.813l3.082-4.683h2.455l-6.354,9.176v6.742L400.918,118.375
|
||||
L400.918,118.375z M416.4,110.621c0-2.643,0.709-4.709,2.129-6.203c1.418-1.494,3.25-2.242,5.496-2.242
|
||||
c1.467,0,2.793,0.352,3.973,1.053c1.178,0.703,2.078,1.683,2.697,2.938c0.619,1.254,0.926,2.681,0.926,4.271
|
||||
c0,1.617-0.322,3.063-0.975,4.334c-0.652,1.272-1.574,2.238-2.768,2.895c-1.197,0.654-2.482,0.98-3.865,0.98
|
||||
c-1.502,0-2.84-0.359-4.02-1.086c-1.182-0.724-2.074-1.711-2.684-2.965C416.705,113.346,416.4,112.02,416.4,110.621L416.4,110.621z
|
||||
M418.572,110.654c0,1.92,0.516,3.428,1.547,4.533c1.033,1.104,2.326,1.656,3.883,1.656c1.586,0,2.891-0.558,3.914-1.673
|
||||
c1.023-1.114,1.537-2.696,1.537-4.746c0-1.295-0.223-2.424-0.658-3.394c-0.438-0.967-1.08-1.715-1.92-2.247
|
||||
c-0.846-0.531-1.791-0.798-2.84-0.798c-1.494,0-2.775,0.513-3.85,1.537C419.109,106.549,418.572,108.262,418.572,110.654z
|
||||
M434.316,118.375v-15.918h2.16l8.361,12.496v-12.496h2.02v15.918h-2.16l-8.361-12.508v12.508H434.316z M450.309,118.375v-15.918
|
||||
h2.107v14.039h7.84v1.879H450.309z M463.123,118.375v-15.918h2.105v15.918H463.123z M468.92,118.375v-15.918h2.16l8.361,12.496
|
||||
v-12.496h2.02v15.918h-2.16l-8.361-12.508v12.508H468.92z M485.045,118.375v-15.918h11.508v1.879h-9.402v4.873h8.805v1.869h-8.805
|
||||
v5.418h9.771v1.879H485.045L485.045,118.375z"/>
|
||||
<polygon fill="#B5B5B5" points="80.268,117.346 69.612,121.502 68.397,113.484 "/>
|
||||
<path fill="#A6A8AB" d="M58.024,118.588l-33.43-11.02c0.458-0.15-3.059-6.269-4.434-9.16l6.949,1.877l36.893,11.797L58.024,118.588z
|
||||
"/>
|
||||
<path fill="#B5B5B5" d="M60.703,119.469l0.238-0.232l5.237-5.416l0.899,7.623C65.023,120.861,62.443,119.998,60.703,119.469z"/>
|
||||
<path fill="#D0D2D3" d="M178.142,85.885l-93.671,29.594l-14.48-4.477l117.176-47.806C186.073,67.116,179.371,82.425,178.142,85.885z
|
||||
"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 15 KiB |
BIN
ServerComponents/PdfWriter/logo.wmf
Normal file
BIN
ServerComponents/PdfWriter/logo.wmf
Normal file
Binary file not shown.
Reference in New Issue
Block a user