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

Initial import

This commit is contained in:
Patrick Simpson
2016-12-21 12:53:16 +01:00
parent e14319e74c
commit 4542b465c0
320 changed files with 49937 additions and 23 deletions

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
</configuration>

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@@ -0,0 +1,180 @@
namespace PluginDebugger
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.Properties = new System.Windows.Forms.PropertyGrid();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.buttonEnableAll = new System.Windows.Forms.Button();
this.buttonDisableAll = new System.Windows.Forms.Button();
this.buttonClearLog = new System.Windows.Forms.Button();
this.buttonOpenLog = new System.Windows.Forms.Button();
this.buttonExport = new System.Windows.Forms.Button();
this.buttonImport = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// Properties
//
this.Properties.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.Properties.Location = new System.Drawing.Point(3, 3);
this.Properties.Name = "Properties";
this.Properties.Size = new System.Drawing.Size(356, 534);
this.Properties.TabIndex = 0;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.Properties, 0, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 540F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(449, 540);
this.tableLayoutPanel1.TabIndex = 1;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.Controls.Add(this.buttonEnableAll);
this.flowLayoutPanel1.Controls.Add(this.buttonDisableAll);
this.flowLayoutPanel1.Controls.Add(this.buttonClearLog);
this.flowLayoutPanel1.Controls.Add(this.buttonOpenLog);
this.flowLayoutPanel1.Controls.Add(this.buttonExport);
this.flowLayoutPanel1.Controls.Add(this.buttonImport);
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(365, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(81, 534);
this.flowLayoutPanel1.TabIndex = 1;
//
// buttonEnableAll
//
this.buttonEnableAll.Location = new System.Drawing.Point(3, 3);
this.buttonEnableAll.Name = "buttonEnableAll";
this.buttonEnableAll.Size = new System.Drawing.Size(75, 23);
this.buttonEnableAll.TabIndex = 0;
this.buttonEnableAll.Text = "Enable All";
this.buttonEnableAll.UseVisualStyleBackColor = true;
this.buttonEnableAll.Click += new System.EventHandler(this.buttonEnableAll_Click);
//
// buttonDisableAll
//
this.buttonDisableAll.Location = new System.Drawing.Point(3, 32);
this.buttonDisableAll.Name = "buttonDisableAll";
this.buttonDisableAll.Size = new System.Drawing.Size(75, 23);
this.buttonDisableAll.TabIndex = 1;
this.buttonDisableAll.Text = "Disable All";
this.buttonDisableAll.UseVisualStyleBackColor = true;
this.buttonDisableAll.Click += new System.EventHandler(this.buttonDisableAll_Click);
//
// buttonClearLog
//
this.buttonClearLog.Location = new System.Drawing.Point(3, 61);
this.buttonClearLog.Name = "buttonClearLog";
this.buttonClearLog.Size = new System.Drawing.Size(75, 23);
this.buttonClearLog.TabIndex = 2;
this.buttonClearLog.Text = "Delete Log";
this.buttonClearLog.UseVisualStyleBackColor = true;
this.buttonClearLog.Click += new System.EventHandler(this.buttonClearLog_Click);
//
// buttonOpenLog
//
this.buttonOpenLog.Location = new System.Drawing.Point(3, 90);
this.buttonOpenLog.Name = "buttonOpenLog";
this.buttonOpenLog.Size = new System.Drawing.Size(75, 23);
this.buttonOpenLog.TabIndex = 3;
this.buttonOpenLog.Text = "Open Log";
this.buttonOpenLog.UseVisualStyleBackColor = true;
this.buttonOpenLog.Click += new System.EventHandler(this.buttonOpenLog_Click);
//
// buttonExport
//
this.buttonExport.Location = new System.Drawing.Point(3, 119);
this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(75, 23);
this.buttonExport.TabIndex = 4;
this.buttonExport.Text = "Save Config";
this.buttonExport.UseVisualStyleBackColor = true;
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
//
// buttonImport
//
this.buttonImport.Location = new System.Drawing.Point(3, 148);
this.buttonImport.Name = "buttonImport";
this.buttonImport.Size = new System.Drawing.Size(75, 23);
this.buttonImport.TabIndex = 5;
this.buttonImport.Text = "Load Config";
this.buttonImport.UseVisualStyleBackColor = true;
this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(448, 537);
this.Controls.Add(this.tableLayoutPanel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainForm";
this.Text = "Plugin Debugger";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PropertyGrid Properties;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button buttonEnableAll;
private System.Windows.Forms.Button buttonDisableAll;
private System.Windows.Forms.Button buttonClearLog;
private System.Windows.Forms.Button buttonOpenLog;
private System.Windows.Forms.Button buttonExport;
private System.Windows.Forms.Button buttonImport;
}
}

View File

@@ -0,0 +1,245 @@
/// Project : Kopano OL Extension
///
/// 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 Acacia;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
namespace PluginDebugger
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
// Initialise the options
Properties.SelectedObject = new Options();
// Expand the first two levels
ExpandItems(RootItem, 2);
}
private GridItem RootItem
{
get
{
GridItem root = Properties.SelectedGridItem;
while (root?.Parent != null)
root = root.Parent;
return root;
}
}
private void ExpandItems(GridItem root, int depth)
{
if (root != null && depth > 0)
{
foreach (GridItem g in root.GridItems)
{
g.Expanded = true;
ExpandItems(g, depth - 1);
}
}
}
private void DoEnable(bool enable)
{
Properties.ExpandAllGridItems();
EnableItems(RootItem, enable);
Properties.Refresh();
}
private void EnableItems(GridItem item, bool enable)
{
if (item != null)
{
OptionsConverter.CanEnable desc = item.PropertyDescriptor as OptionsConverter.CanEnable;
desc?.Enable(enable);
foreach (GridItem g in item.GridItems)
{
EnableItems(g, enable);
}
}
}
private void buttonEnableAll_Click(object sender, EventArgs e)
{
DoEnable(true);
}
private void buttonDisableAll_Click(object sender, EventArgs e)
{
DoEnable(false);
}
private string LoggerPath
{
get { return LoggerHelpers.LoggerPath("Kopano OL Extension"); }
}
private void buttonClearLog_Click(object sender, EventArgs e)
{
try
{
File.Delete(LoggerPath);
}
catch (Exception) { }
}
private void buttonOpenLog_Click(object sender, EventArgs e)
{
try
{
Process.Start(LoggerPath);
}
catch (Exception) { }
}
private void SerializeItems(GridItem item, XmlNode parent)
{
if (item != null)
{
OptionsConverter.CanEnable desc = item.PropertyDescriptor as OptionsConverter.CanEnable;
if (desc != null)
{
string name = item.PropertyDescriptor.Name;
object value = item.PropertyDescriptor.GetValue(desc.Object);
if (value == null || (value is string && string.IsNullOrEmpty((string)value)))
{
// Skip
}
else if (desc.Object != value)
{
XmlAttribute attr = parent.OwnerDocument.CreateAttribute(name);
attr.Value = value.ToString();
parent.Attributes.Append(attr);
}
else
{
XmlNode newNode = parent.OwnerDocument.CreateElement(name);
parent.AppendChild(newNode);
parent = newNode;
}
}
foreach (GridItem g in item.GridItems)
{
SerializeItems(g, parent);
}
}
}
private void DeserializeItems(GridItem item, XmlNode parent)
{
if (item != null)
{
item.Expanded = true;
OptionsConverter.CanEnable desc = item.PropertyDescriptor as OptionsConverter.CanEnable;
if (desc != null && parent != null)
{
string name = item.PropertyDescriptor.Name;
//object value = item.PropertyDescriptor.GetValue(desc.Object);
if (desc.Object != item.PropertyDescriptor.GetValue(desc.Object))
{
// Attribute
XmlAttribute attr = parent.Attributes[name];
if (attr != null)
{
if (item.PropertyDescriptor.Converter.CanConvertFrom(typeof(string)))
{
object value = item.PropertyDescriptor.Converter.ConvertFromString(attr.Value);
item.PropertyDescriptor.SetValue(desc.Object, value);
}
}
}
else
{
parent = parent.SelectSingleNode(name);
}
}
foreach (GridItem g in item.GridItems)
{
DeserializeItems(g, parent);
}
}
}
private void buttonExport_Click(object sender, EventArgs e)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = "Config files (*.kpdcfg)|*.kpdcfg";
if (dlg.ShowDialog() == DialogResult.OK)
{
using (StreamWriter sw = new StreamWriter(dlg.FileName))
{
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateElement("Options"));
SerializeItems(RootItem, doc.DocumentElement);
doc.Save(sw);
}
}
}
private void buttonImport_Click(object sender, EventArgs args)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Config files (*.kpdcfg)|*.kpdcfg";
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
using (StreamReader sw = new StreamReader(dlg.FileName))
{
XmlDocument xml = new XmlDocument();
xml.Load(sw);
if (xml.DocumentElement.Name != "Options")
throw new Exception("Invalid Xml file");
DeserializeItems(RootItem, xml.DocumentElement);
Properties.Refresh();
}
}
catch(Exception e)
{
MessageBox.Show(e.Message + "\n" + e.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
/// Project : Kopano OL Extension
///
/// 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 Acacia;
using Acacia.Features;
using Acacia.Features.DebugSupport;
using Acacia.Features.SendAs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace PluginDebugger
{
[TypeConverter(typeof(OptionsConverter))]
public class Options
{
public GlobalOptions Global { get; set; }
public Feature[] Features { get; set; }
public Options()
{
Global = GlobalOptions.INSTANCE;
// Create an instance of each feature
Features = Acacia.Features.Features.FEATURES.Select(x => (Acacia.Features.Feature)Activator.CreateInstance(x)).ToArray();
}
}
}

View File

@@ -0,0 +1,384 @@
/// Project : Kopano OL Extension
///
/// 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 Acacia;
using Acacia.Utils;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Acacia.Features;
using System.Reflection;
using System.Globalization;
using System.Collections;
using System.Diagnostics;
using System.Drawing.Design;
using System.Drawing;
namespace PluginDebugger
{
public enum Category
{
Global,
Features,
}
public class CategoryAttribute : System.ComponentModel.CategoryAttribute
{
// Add tabs; these are not printed, but are used for the sorting
public CategoryAttribute(Category order)
:
base(order.ToString().PadLeft(typeof(Category).GetEnumNames().Length - (int)order + order.ToString().Length, '\t'))
{
}
}
public class OptionsConverter : ExpandableObjectConverter
{
private class NestedPropertyConverter : ExpandableObjectConverter
{
private AcaciaPropertyDescriptor _prop;
public NestedPropertyConverter(AcaciaPropertyDescriptor prop)
{
this._prop = prop;
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
return true;
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (value is string)
return bool.Parse((string)value);
return base.ConvertFrom(context, culture, value);
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
PropertyDescriptorCollection props = new PropertyDescriptorCollection(null);
foreach(AcaciaPropertyDescriptor prop in _prop.Children)
{
props.Add(prop);
}
return props;
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
List<bool> values = new List<bool>(new bool[] {false, true });
return new StandardValuesCollection(values);
}
}
public interface CanEnable
{
object Object { get; }
void Enable(bool enable);
}
public class AcaciaPropertyDescriptor : PropertyDescriptor, CanEnable
{
private readonly object _obj;
private readonly PropertyDescriptor _orig;
private readonly AcaciaOptionAttribute _acaciaAttr;
public readonly List<AcaciaPropertyDescriptor> Children = new List<AcaciaPropertyDescriptor>();
private AcaciaPropertyDescriptor Parent;
public string VisibleName;
public AcaciaPropertyDescriptor(object obj, AcaciaOptionAttribute acaciaAttr, PropertyDescriptor orig)
:
base(orig)
{
this._obj = obj;
this._acaciaAttr = acaciaAttr;
this._orig = orig;
}
/// <summary>
/// Creates a grouping attributes
/// </summary>
/// <param name="obj"></param>
public AcaciaPropertyDescriptor(object obj, string name)
:
base(name, new Attribute[0])
{
this._obj = obj;
this._acaciaAttr = null;
this._orig = null;
}
public void Enable(bool enable)
{
if (PropertyType == typeof(bool))
SetValue(_obj, enable);
}
public object Object { get { return _obj; } }
public void MakeChild(AcaciaPropertyDescriptor child, string childName)
{
Children.Add(child);
child.Parent = this;
child.VisibleName = childName;
}
public override string DisplayName
{
get
{
return VisibleName ?? base.DisplayName;
}
}
public override string Description
{
get
{
return _acaciaAttr?.Description ?? "";
}
}
public override TypeConverter Converter
{
get
{
if (Children.Count > 0)
return new NestedPropertyConverter(this);
return base.Converter;
}
}
public override Type ComponentType
{
get
{
return _orig?.ComponentType ?? typeof(string);
}
}
public override bool IsReadOnly { get { return _orig?.IsReadOnly ?? true; } }
public override Type PropertyType { get { return _orig?.PropertyType ?? typeof(string); } }
private object GetEffectiveComponent(object component)
{
if (Parent != null)
component = Parent._obj;
return component;
}
public override bool CanResetValue(object component)
{
return _orig.CanResetValue(GetEffectiveComponent(component));
}
public override object GetValue(object component)
{
return _orig?.GetValue(GetEffectiveComponent(component)) ?? "";
}
public override void ResetValue(object component)
{
if (_orig != null)
_orig.ResetValue(GetEffectiveComponent(component));
}
public override void SetValue(object component, object value)
{
if (_orig != null)
_orig.SetValue(GetEffectiveComponent(component), value);
}
public override bool ShouldSerializeValue(object component)
{
return _orig?.ShouldSerializeValue(GetEffectiveComponent(component)) ?? false;
}
public AttributeCollection GetAttributes()
{
return new AttributeCollection();
}
}
private class FeatureWrapperConverter : ExpandableObjectConverter
{
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
PropertyDescriptorCollection allProperties = TypeDescriptor.GetProperties(value);
Dictionary<string, AcaciaPropertyDescriptor> properties = new Dictionary<string, AcaciaPropertyDescriptor>();
// Select all properties with AcaciaOptionAttribute and wrap those
foreach (PropertyDescriptor pd in allProperties)
{
foreach(Attribute attr in pd.Attributes)
{
AcaciaOptionAttribute acaciaAttr = attr as AcaciaOptionAttribute;
if (acaciaAttr != null)
{
// Check if it's supported
if (acaciaAttr.Interface?.IsInstanceOfType(value) == false)
continue;
properties.Add(pd.Name, new AcaciaPropertyDescriptor(value, acaciaAttr, pd));
break;
}
}
}
// Group by name
PropertyDescriptorCollection root = new PropertyDescriptorCollection(null);
foreach(KeyValuePair<string, AcaciaPropertyDescriptor> entry in properties.ToArray())
{
string[] nameParts = entry.Key.Split(new char[] { '_' }, 2);
if (nameParts.Length == 2)
{
AcaciaPropertyDescriptor parent;
if (!properties.ContainsKey(nameParts[0]))
{
// Add a grouping attribute
parent = new AcaciaPropertyDescriptor(value, nameParts[0]);
properties[nameParts[0]] = parent;
root.Add(parent);
}
else parent = properties[nameParts[0]];
parent.MakeChild(entry.Value, nameParts[1]);
}
else
{
root.Add(entry.Value);
}
}
return root;
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(string))
return true;
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
{
// Show full registry string
Feature feature = value as Feature;
return DebugOptions.GetOptions(feature?.Name);
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
public class OptionsPropertyDescriptor : PropertyDescriptor, CanEnable
{
private readonly object _value;
public OptionsPropertyDescriptor(object value, string name, params Attribute[] attributes)
:
base(name, attributes)
{
this._value = value;
}
public void Enable(bool enable)
{
if (PropertyType == typeof(bool))
SetValue(_value, enable);
}
public object Object { get { return _value; } }
public override bool CanResetValue(object component) { return false; }
public override Type ComponentType { get { return typeof(Options); } }
public override object GetValue(object component) { return _value; }
public override bool IsReadOnly { get { return true; } }
public override Type PropertyType { get { return _value.GetType(); } }
public override void ResetValue(object component) { SetValue(component, null); }
public override void SetValue(object component, object value) { }
public override bool ShouldSerializeValue(object component) { return false; }
public override TypeConverter Converter
{
get
{
return new FeatureWrapperConverter();
}
}
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
PropertyDescriptorCollection properties = new PropertyDescriptorCollection(null);
Options options = value as Options;
if (options != null)
{
// Add Global options
properties.Add(new OptionsPropertyDescriptor(options.Global, "Global",
new CategoryAttribute(Category.Global),
new DescriptionAttribute("Global options for the Kopano Outlook Extension.")
));
// Add Features
foreach (Acacia.Features.Feature feature in options.Features)
{
string description = "Shows the registry setting for the feature.";
AcaciaOptionAttribute acacia = feature.GetType().GetCustomAttribute<AcaciaOptionAttribute>();
if (acacia != null)
description = acacia.Description;
properties.Add(new OptionsPropertyDescriptor(feature, feature.Name,
new CategoryAttribute(Category.Features),
new DescriptionAttribute(description)
));
}
}
return properties;
}
}
}

View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9258AD17-0A25-4669-A95C-93EC70882551}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PluginDebugger</RootNamespace>
<AssemblyName>PluginDebugger</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Build\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Build\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Kopano.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="OptionsInfra.cs" />
<Compile Include="Options.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</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>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,42 @@
/// Project : Kopano OL Extension
///
/// 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 Acacia.Features.DebugSupport;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PluginDebugger
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(true);
Application.Run(new MainForm());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PluginDebugger")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PluginDebugger")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// 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,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PluginDebugger.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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("PluginDebugger.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -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>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PluginDebugger.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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;
}
}
}
}

View File

@@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B