init repo
This commit is contained in:
100
Tools/AllFontsGen/AllFontsGen.csproj
Normal file
100
Tools/AllFontsGen/AllFontsGen.csproj
Normal file
@@ -0,0 +1,100 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3A79F380-B991-4C7E-8603-D831EAEFA1A2}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AllFontsGen</RootNamespace>
|
||||
<AssemblyName>AllFontsGen</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</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>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</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>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference 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>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\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>
|
||||
20
Tools/AllFontsGen/AllFontsGen.sln
Normal file
20
Tools/AllFontsGen/AllFontsGen.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AllFontsGen", "AllFontsGen.csproj", "{3A79F380-B991-4C7E-8603-D831EAEFA1A2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3A79F380-B991-4C7E-8603-D831EAEFA1A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3A79F380-B991-4C7E-8603-D831EAEFA1A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3A79F380-B991-4C7E-8603-D831EAEFA1A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3A79F380-B991-4C7E-8603-D831EAEFA1A2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
77
Tools/AllFontsGen/Program.cs
Normal file
77
Tools/AllFontsGen/Program.cs
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
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AllFontsGen
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
string sDirectory = "";
|
||||
string sDstFile = "";
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
System.Console.Write("Error: Incorrect argument number!\n");
|
||||
System.Console.Write("Use:\n");
|
||||
System.Console.Write("AllFontsGen.exe [FontsFolder] <DestinationFile>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 1)
|
||||
sDstFile = args[0];
|
||||
else
|
||||
{
|
||||
sDirectory = args[0];
|
||||
sDstFile = args[1];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
System.Console.Write("Generating {0}, please wait...", Path.GetFileName(sDstFile));
|
||||
OfficeCore.CWinFontsClass oFonts = new OfficeCore.CWinFontsClass();
|
||||
oFonts.Init(sDirectory, false, false);
|
||||
oFonts.SetAdditionalParam("AllFonts.js", sDstFile);
|
||||
System.Console.Write("Done.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Console.Write("Failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Tools/AllFontsGen/Properties/AssemblyInfo.cs
Normal file
50
Tools/AllFontsGen/Properties/AssemblyInfo.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.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("AllFontsGen")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("avs")]
|
||||
[assembly: AssemblyProduct("AllFontsGen")]
|
||||
[assembly: AssemblyCopyright("Copyright © avs 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("03db9f7f-79ef-4e9e-ae9d-2e4242fc9d7d")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.3")]
|
||||
22
Tools/AllFontsGen/app.manifest
Normal file
22
Tools/AllFontsGen/app.manifest
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</asmv1:assembly>
|
||||
BIN
Tools/Bin/AllFontsGen.exe
Normal file
BIN
Tools/Bin/AllFontsGen.exe
Normal file
Binary file not shown.
3
Tools/Bin/GenerateAllFonts.bat
Normal file
3
Tools/Bin/GenerateAllFonts.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
cd /D %~dp0
|
||||
AllFontsGen.exe ..\DocService\OfficeWeb\sdk\Common\AllFonts.js
|
||||
pause
|
||||
BIN
Tools/Bin/ProcessRunnerService.exe
Normal file
BIN
Tools/Bin/ProcessRunnerService.exe
Normal file
Binary file not shown.
19
Tools/Bin/ProcessRunnerService.exe.config
Normal file
19
Tools/Bin/ProcessRunnerService.exe.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<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>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
20
Tools/ProcessRunnerService/ProcessRunnerService.sln
Normal file
20
Tools/ProcessRunnerService/ProcessRunnerService.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessRunnerService", "ProcessRunnerService\ProcessRunnerService.csproj", "{290A48D1-F7E2-4478-AFE6-AE5C744CD633}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|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}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{290A48D1-F7E2-4478-AFE6-AE5C744CD633}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
19
Tools/ProcessRunnerService/ProcessRunnerService/App.config
Normal file
19
Tools/ProcessRunnerService/ProcessRunnerService/App.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<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>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
131
Tools/ProcessRunnerService/ProcessRunnerService/ProcessRunner.cs
Normal file
131
Tools/ProcessRunnerService/ProcessRunnerService/ProcessRunner.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* (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.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
|
||||
namespace ProcessRunnerService
|
||||
{
|
||||
public class ProcessRunner
|
||||
{
|
||||
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(ProcessRunner));
|
||||
private readonly ManualResetEvent _stopEvt = new ManualResetEvent(false);
|
||||
|
||||
private Thread m_oStartAndWatchThread = null;
|
||||
|
||||
private string m_sBinPath = null;
|
||||
private string m_sOptions = "";
|
||||
|
||||
public ProcessRunner(string[] args)
|
||||
{
|
||||
if (args.Length > 1)
|
||||
m_sBinPath = EscapeCommandLineArgument(args[1]);
|
||||
|
||||
for( int i = 2; i < args.Length; i++)
|
||||
m_sOptions = m_sOptions + EscapeCommandLineArgument(args[i]) + " ";
|
||||
}
|
||||
|
||||
private string EscapeCommandLineArgument(string arg)
|
||||
{
|
||||
return "\"" + arg + "\"";
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Stop();
|
||||
_stopEvt.Reset();
|
||||
|
||||
if (!string.IsNullOrEmpty(m_sBinPath))
|
||||
{
|
||||
_log.Info("Start StartAndWatch thread.");
|
||||
|
||||
m_oStartAndWatchThread = new Thread(StartAndWatch);
|
||||
m_oStartAndWatchThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_stopEvt.Set();
|
||||
}
|
||||
|
||||
public void StartAndWatch()
|
||||
{
|
||||
while (!_stopEvt.WaitOne(0))
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process oProcess = new System.Diagnostics.Process();
|
||||
|
||||
oProcess.StartInfo.FileName = m_sBinPath;
|
||||
oProcess.StartInfo.Arguments = m_sOptions;
|
||||
|
||||
oProcess.StartInfo.CreateNoWindow = true;
|
||||
oProcess.StartInfo.UseShellExecute = false;
|
||||
|
||||
_log.DebugFormat("Start {0} {1}", oProcess.StartInfo.FileName, oProcess.StartInfo.Arguments);
|
||||
|
||||
oProcess.Start();
|
||||
|
||||
while (!_stopEvt.WaitOne(0) && !oProcess.HasExited)
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1.0));
|
||||
}
|
||||
|
||||
_log.Info("The process exited or stop event received.");
|
||||
|
||||
if (!oProcess.HasExited)
|
||||
oProcess.Kill();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error("Exception catched in StartAndWatch:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void processOutputHandler(object sender, System.Diagnostics.DataReceivedEventArgs e)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(e.Data))
|
||||
_log.Debug(e.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* (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 ProcessRunnerService
|
||||
{
|
||||
public sealed class ProcessRunnerService : ServiceBase
|
||||
{
|
||||
public const string c_sAscProcessRunnerService = "ASC Process Runner Service";
|
||||
private readonly ILog _log;
|
||||
private readonly ProcessRunner processRunner;
|
||||
|
||||
public ProcessRunnerService()
|
||||
{
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
_log = LogManager.GetLogger(typeof(ProcessRunnerService));
|
||||
|
||||
this.ServiceName = c_sAscProcessRunnerService;
|
||||
this.EventLog.Log = "Application";
|
||||
|
||||
string[] args = System.Environment.GetCommandLineArgs();
|
||||
processRunner = new ProcessRunner(args);
|
||||
|
||||
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");
|
||||
processRunner.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");
|
||||
processRunner.Stop();
|
||||
base.OnShutdown();
|
||||
}
|
||||
|
||||
protected override void OnCustomCommand(int command)
|
||||
{
|
||||
|
||||
base.OnCustomCommand(command);
|
||||
}
|
||||
|
||||
protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
|
||||
{
|
||||
if (powerStatus == PowerBroadcastStatus.Suspend)
|
||||
{
|
||||
processRunner.Stop();
|
||||
}
|
||||
return base.OnPowerEvent(powerStatus);
|
||||
}
|
||||
|
||||
protected override void OnSessionChange(
|
||||
SessionChangeDescription changeDescription)
|
||||
{
|
||||
base.OnSessionChange(changeDescription);
|
||||
}
|
||||
|
||||
public void StartDaemon()
|
||||
{
|
||||
processRunner.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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>ProcessRunnerService</RootNamespace>
|
||||
<AssemblyName>ProcessRunnerService</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>
|
||||
<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="ProcessRunner.cs" />
|
||||
<Compile Include="ProcessRunnerService.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ProcessRunnerServiceInstaller.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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="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" />
|
||||
</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 ProcessRunnerService
|
||||
{
|
||||
|
||||
[RunInstaller(true)]
|
||||
public class ProcessRunnerServiceInstaller : Installer
|
||||
{
|
||||
|
||||
public ProcessRunnerServiceInstaller()
|
||||
{
|
||||
ServiceProcessInstaller serviceProcessInstaller =
|
||||
new ServiceProcessInstaller();
|
||||
ServiceInstaller serviceInstaller = new ServiceInstaller();
|
||||
|
||||
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
|
||||
serviceProcessInstaller.Username = null;
|
||||
serviceProcessInstaller.Password = null;
|
||||
|
||||
serviceInstaller.DisplayName = ProcessRunnerService.c_sAscProcessRunnerService;
|
||||
serviceInstaller.StartType = ServiceStartMode.Automatic;
|
||||
|
||||
serviceInstaller.ServiceName = ProcessRunnerService.c_sAscProcessRunnerService;
|
||||
this.Installers.Add(serviceProcessInstaller);
|
||||
this.Installers.Add(serviceInstaller);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
52
Tools/ProcessRunnerService/ProcessRunnerService/Program.cs
Normal file
52
Tools/ProcessRunnerService/ProcessRunnerService/Program.cs
Normal file
@@ -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 ProcessRunnerService
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var service = new ProcessRunnerService();
|
||||
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("ProcessRunnerService")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ProcessRunnerService")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("2f0ef597-725c-4954-976e-9808c513f9a5")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
Reference in New Issue
Block a user