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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kopano OL Extension")] [assembly: AssemblyProduct("Kopano OL Extension")]
[assembly: AssemblyCopyright("Copyright © Kopano b.v. 2016")] [assembly: AssemblyCopyright("Copyright © Kopano b.v. 2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [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 /// 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, /// 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/>. /// along with this program.If not, see<http://www.gnu.org/licenses/>.
/// ///
/// Consult LICENSE file for details /// Consult LICENSE file for details
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -25,7 +26,7 @@ using System.Threading.Tasks;
namespace OutlookRestarter namespace OutlookRestarter
{ {
class Program class OutlookRestarter
{ {
/// <summary> /// <summary>
@ -40,6 +41,8 @@ namespace OutlookRestarter
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
{ {
Logger.Instance.Debug(typeof(OutlookRestarter), "Restarting: {0}", string.Join(", ", args));
string procPath = args[1]; string procPath = args[1];
List<string> procArgs = args.Skip(2).ToList(); List<string> procArgs = args.Skip(2).ToList();
try try
@ -47,10 +50,13 @@ namespace OutlookRestarter
// Attempt waiting for the process to finish // Attempt waiting for the process to finish
int procId = int.Parse(args[0]); int procId = int.Parse(args[0]);
Process proc = Process.GetProcessById(procId); 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 finally
{ {
Logger.Instance.Debug(typeof(OutlookRestarter), "Parsing arguments");
List<string> useArgs = new List<string>(); List<string> useArgs = new List<string>();
for (int i = 0; i < procArgs.Count; ++i) for (int i = 0; i < procArgs.Count; ++i)
{ {
@ -58,14 +64,19 @@ namespace OutlookRestarter
{ {
++i; ++i;
string path = procArgs[i]; string path = procArgs[i];
Logger.Instance.Debug(typeof(OutlookRestarter), "Request to remove store: {0}", path);
if (System.IO.Path.GetExtension(path) == ".ost") if (System.IO.Path.GetExtension(path) == ".ost")
{ {
Logger.Instance.Info(typeof(OutlookRestarter), "Removing store: {0}", path);
// Delete it // Delete it
try try
{ {
System.IO.File.Delete(path); System.IO.File.Delete(path);
} }
catch (Exception) { } catch (Exception e)
{
Logger.Instance.Error(typeof(OutlookRestarter), "Exception removing store: {0}: {1}", path, e);
}
} }
} }
else else
@ -73,12 +84,14 @@ namespace OutlookRestarter
useArgs.Add(procArgs[i]); useArgs.Add(procArgs[i]);
} }
} }
File.WriteAllLines("c:\\temp\\ol.txt", useArgs);
string argsString = string.Join(" ", useArgs); string argsString = string.Join(" ", useArgs);
Logger.Instance.Debug(typeof(OutlookRestarter), "Parsed arguments: {0}", argsString);
// Start the process // Start the process
Process process = new Process(); Process process = new Process();
process.StartInfo = new ProcessStartInfo(procPath, argsString); process.StartInfo = new ProcessStartInfo(procPath, argsString);
Logger.Instance.Debug(typeof(OutlookRestarter), "Starting process: {0}", process);
process.Start(); process.Start();
Logger.Instance.Debug(typeof(OutlookRestarter), "Started process: {0}", process);
} }
} }
} }

View File

@ -49,8 +49,9 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Program.cs" /> <Compile Include="OutlookRestarter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Version.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
@ -58,6 +59,12 @@
<ItemGroup> <ItemGroup>
<Content Include="Kopano.ico" /> <Content Include="Kopano.ico" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. 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 // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("222c4da5-fa31-471a-b127-5e0c6ad2cb3c")] [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="Options.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Version.cs" />
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PluginDebugger")] [assembly: AssemblyProduct("PluginDebugger")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [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 // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9258ad17-0a25-4669-a95c-93ec70882551")] [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";
}