1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-113] Removed old debug code from restarter, added logging. Also now including version numbers in OutlookRestarter and PluginDebugger.

This commit is contained in:
Patrick Simpson 2017-05-18 11:06:18 +02:00
parent 4a222d45ca
commit c0b990f52b
8 changed files with 78 additions and 35 deletions

View File

@ -11,7 +11,7 @@ using System.Security;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kopano OL Extension")]
[assembly: AssemblyCopyright("Copyright © Kopano b.v. 2016")]
[assembly: AssemblyCopyright("Copyright © Kopano b.v. 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -1,4 +1,6 @@
/// Copyright 2017 Kopano b.v.

using Acacia;
/// Copyright 2017 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
@ -13,7 +15,6 @@
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
///
/// Consult LICENSE file for details
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -25,7 +26,7 @@ using System.Threading.Tasks;
namespace OutlookRestarter
{
class Program
class OutlookRestarter
{
/// <summary>
@ -40,6 +41,8 @@ namespace OutlookRestarter
[STAThread]
static void Main(string[] args)
{
Logger.Instance.Debug(typeof(OutlookRestarter), "Restarting: {0}", string.Join(", ", args));
string procPath = args[1];
List<string> procArgs = args.Skip(2).ToList();
try
@ -47,10 +50,13 @@ namespace OutlookRestarter
// Attempt waiting for the process to finish
int procId = int.Parse(args[0]);
Process proc = Process.GetProcessById(procId);
proc.WaitForExit(15000);
Logger.Instance.Debug(typeof(OutlookRestarter), "Waiting for process to exit: {0}: {1}", procId, proc);
bool finished = proc.WaitForExit(15000);
Logger.Instance.Debug(typeof(OutlookRestarter), "Waited for process to exit: {0}: {1}", procId, finished);
}
finally
{
Logger.Instance.Debug(typeof(OutlookRestarter), "Parsing arguments");
List<string> useArgs = new List<string>();
for (int i = 0; i < procArgs.Count; ++i)
{
@ -58,14 +64,19 @@ namespace OutlookRestarter
{
++i;
string path = procArgs[i];
Logger.Instance.Debug(typeof(OutlookRestarter), "Request to remove store: {0}", path);
if (System.IO.Path.GetExtension(path) == ".ost")
{
Logger.Instance.Info(typeof(OutlookRestarter), "Removing store: {0}", path);
// Delete it
try
{
System.IO.File.Delete(path);
}
catch (Exception) { }
catch (Exception e)
{
Logger.Instance.Error(typeof(OutlookRestarter), "Exception removing store: {0}: {1}", path, e);
}
}
}
else
@ -73,12 +84,14 @@ namespace OutlookRestarter
useArgs.Add(procArgs[i]);
}
}
File.WriteAllLines("c:\\temp\\ol.txt", useArgs);
string argsString = string.Join(" ", useArgs);
Logger.Instance.Debug(typeof(OutlookRestarter), "Parsed arguments: {0}", argsString);
// Start the process
Process process = new Process();
process.StartInfo = new ProcessStartInfo(procPath, argsString);
Logger.Instance.Debug(typeof(OutlookRestarter), "Starting process: {0}", process);
process.Start();
Logger.Instance.Debug(typeof(OutlookRestarter), "Started process: {0}", process);
}
}
}

View File

@ -49,8 +49,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="OutlookRestarter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Version.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
@ -58,6 +59,12 @@
<ItemGroup>
<Content Include="Kopano.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AcaciaZPushPlugin\AcaciaZPushPlugin.csproj">
<Project>{1a7427a5-f814-4b07-98b2-c67d758b65d6}</Project>
<Name>AcaciaZPushPlugin</Name>
</ProjectReference>
</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.

View File

@ -37,16 +37,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("222c4da5-fa31-471a-b127-5e0c6ad2cb3c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,24 @@
/// Copyright 2016 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
/// as published by the Free Software Foundation.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
/// GNU Affero General Public License for more details.
///
/// You should have received a copy of the GNU Affero General Public License
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
///
/// Consult LICENSE file for details
using System.Reflection;
[assembly: AssemblyVersion("0.1")]
[assembly: AssemblyFileVersion("0.1")]
public static class BuildVersions
{
public const string VERSION = "0.1";
public const string REVISION = "abcdef0123456789abcdef0123456789abcdef01";
}

View File

@ -59,6 +59,7 @@
<Compile Include="Options.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Version.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PluginDebugger")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -21,16 +21,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9258ad17-0a25-4669-a95c-93ec70882551")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,24 @@
/// Copyright 2016 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
/// as published by the Free Software Foundation.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
/// GNU Affero General Public License for more details.
///
/// You should have received a copy of the GNU Affero General Public License
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
///
/// Consult LICENSE file for details
using System.Reflection;
[assembly: AssemblyVersion("0.1")]
[assembly: AssemblyFileVersion("0.1")]
public static class BuildVersions
{
public const string VERSION = "0.1";
public const string REVISION = "abcdef0123456789abcdef0123456789abcdef01";
}