AdjustBuildRevision, FlexMsgBx, Formats, LBWordLib, VlnStatus, RoAccessToSql, TablePicker, VG
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
|
||||
+313
-883
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -79,6 +79,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="LBComObject.cs" />
|
||||
<Compile Include="LBObjectExtension.cs" />
|
||||
<Compile Include="OutlookLBComObject.cs" />
|
||||
|
||||
@@ -1,64 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LBOutlookLibrary
|
||||
{
|
||||
public abstract partial class LBComObject
|
||||
{
|
||||
private Object _Item;
|
||||
internal Object Item
|
||||
private object _Item;
|
||||
internal object Item
|
||||
{
|
||||
get { return _Item; }
|
||||
set
|
||||
{
|
||||
_Item = value;
|
||||
if (value != null) _MyType = _Item.GetType();
|
||||
if (value != null) MyType = _Item.GetType();
|
||||
}
|
||||
}
|
||||
private Type _MyType;
|
||||
public Type MyType
|
||||
{
|
||||
get { return _MyType; }
|
||||
set { _MyType = value; }
|
||||
}
|
||||
protected LBComObject() { }
|
||||
|
||||
public Type MyType { get; set; }
|
||||
protected LBComObject() { }
|
||||
protected LBComObject(string ProgID)
|
||||
{
|
||||
Type objClassType;
|
||||
objClassType = Type.GetTypeFromProgID(ProgID);
|
||||
Item = Activator.CreateInstance(objClassType);
|
||||
}
|
||||
protected LBComObject(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
private Object DoInvokeMember(string name, Object[] parameters, BindingFlags bf, Binder b)
|
||||
protected LBComObject(object item) => Item = item;
|
||||
private object DoInvokeMember(string name, object[] parameters, BindingFlags bf, Binder b)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _MyType.InvokeMember(name, bf, b, _Item, parameters);
|
||||
return MyType.InvokeMember(name, bf, b, _Item, parameters);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", _MyType.Name, name), ex);
|
||||
throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", MyType.Name, name), ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected void SetProperty(string propertyName, params Object[] parameters)
|
||||
{
|
||||
DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
|
||||
}
|
||||
protected Object GetProperty(string propertyName)
|
||||
{
|
||||
return DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
|
||||
}
|
||||
protected Object GetProperty(string propertyName, params Object[] parameters)
|
||||
{
|
||||
return DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
|
||||
}
|
||||
protected Object InvokeMethod(string methodName, params Object[] parameters)
|
||||
protected void SetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
|
||||
protected object GetProperty(string propertyName) => DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
|
||||
protected object GetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
|
||||
protected object InvokeMethod(string methodName, params object[] parameters)
|
||||
{
|
||||
if (parameters != null)
|
||||
FixParameters(parameters);
|
||||
@@ -71,45 +52,15 @@ namespace LBOutlookLibrary
|
||||
if (parameters[i] is LBComObject)
|
||||
parameters[i] = (parameters[i] as LBComObject).Item;
|
||||
}
|
||||
protected Object InvokeMethod(string methodName)
|
||||
{
|
||||
return InvokeMethod(methodName, null);
|
||||
}
|
||||
}
|
||||
public class LBComObjectList<TList, TItem> : LBComObject
|
||||
where TList : LBComObjectList<TList, TItem>
|
||||
where TItem : LBComObject, new()
|
||||
{
|
||||
//public new(Object item):base(item){}
|
||||
public TItem Add()
|
||||
{
|
||||
TItem tmp = new TItem();
|
||||
tmp.Item = InvokeMethod("Add");
|
||||
return tmp;
|
||||
}
|
||||
//public TItem this[int item]
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// TItem tmp = new TItem();
|
||||
// tmp.Item = GetProperty("Item", item);
|
||||
// return tmp;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
protected object InvokeMethod(string methodName) => InvokeMethod(methodName, null);
|
||||
}
|
||||
public partial class LBApplicationClass : LBComObject
|
||||
{
|
||||
public LBApplicationClass() : base("Outlook.Application") { }
|
||||
public LBApplicationClass(Object item) : base(item) { }
|
||||
public System.Object CreateItem(LBOlItemType ItemType)
|
||||
{
|
||||
return InvokeMethod("CreateItem", ItemType);
|
||||
}
|
||||
public void Quit()
|
||||
{
|
||||
InvokeMethod("Quit");
|
||||
}
|
||||
}
|
||||
public LBApplicationClass(object item) : base(item) { }
|
||||
public object CreateItem(LBOlItemType ItemType) => InvokeMethod("CreateItem", ItemType);
|
||||
public void Quit() => InvokeMethod("Quit");
|
||||
}
|
||||
public enum LBOlItemType
|
||||
{
|
||||
olMailItem = 0,
|
||||
@@ -124,13 +75,13 @@ namespace LBOutlookLibrary
|
||||
public partial class LBMailItem : LBComObject
|
||||
{
|
||||
public LBMailItem() { }
|
||||
public LBMailItem(Object item) : base(item) { }
|
||||
public LBMailItem(object item) : base(item) { }
|
||||
}
|
||||
public partial class LBMailItemClass : LBComObject
|
||||
{
|
||||
public LBMailItemClass() { }
|
||||
public LBMailItemClass(Object item) : base(item) { }
|
||||
public String Body
|
||||
public LBMailItemClass(object item) : base(item) { }
|
||||
public string Body
|
||||
{
|
||||
get { return (GetProperty("Body").ToString()); }
|
||||
set { SetProperty("Body", value); }
|
||||
@@ -140,29 +91,20 @@ namespace LBOutlookLibrary
|
||||
get { return (LBOlBodyFormat)GetProperty("BodyFormat"); }
|
||||
set { SetProperty("BodyFormat", value); }
|
||||
}
|
||||
public LBAttachments Attachments
|
||||
{
|
||||
get { return new LBAttachments(GetProperty("Attachments")); }
|
||||
}
|
||||
public String Subject
|
||||
public LBAttachments Attachments => new LBAttachments(GetProperty("Attachments"));
|
||||
public string Subject
|
||||
{
|
||||
get { return (GetProperty("Subject").ToString()); }
|
||||
set { SetProperty("Subject", value); }
|
||||
}
|
||||
public LBRecipients Recipients
|
||||
{
|
||||
get { return new LBRecipients(GetProperty("Recipients")); }
|
||||
}
|
||||
public String To
|
||||
public LBRecipients Recipients => new LBRecipients(GetProperty("Recipients"));
|
||||
public string To
|
||||
{
|
||||
get { return (GetProperty("To").ToString()); }
|
||||
set { SetProperty("To", value); }
|
||||
}
|
||||
public void Send()
|
||||
{
|
||||
InvokeMethod("Send");
|
||||
}
|
||||
}
|
||||
public void Send() => InvokeMethod("Send");
|
||||
}
|
||||
public enum LBOlBodyFormat
|
||||
{
|
||||
olFormatUnspecified = 0,
|
||||
@@ -173,79 +115,40 @@ namespace LBOutlookLibrary
|
||||
public partial class LBAttachments : LBComObject
|
||||
{
|
||||
public LBAttachments() { }
|
||||
public LBAttachments(Object item) : base(item) { }
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
public LBAttachment Item
|
||||
{
|
||||
get { return new LBAttachment(GetProperty("Item")); }
|
||||
}
|
||||
public LBAttachment Add(object Source)
|
||||
{
|
||||
return new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
|
||||
}
|
||||
public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
|
||||
public LBAttachments(object item) : base(item) { }
|
||||
public int Count => (GetProperty("Count") as int? ?? 0);
|
||||
public new LBAttachment Item => new LBAttachment(GetProperty("Item"));
|
||||
public LBAttachment Add(object Source) => new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
|
||||
public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
|
||||
{
|
||||
return new LBAttachment(InvokeMethod("Add", Source, Type, Position, DisplayName));
|
||||
}
|
||||
public void Remove(int Index)
|
||||
{
|
||||
InvokeMethod("Remove", Index);
|
||||
}
|
||||
}
|
||||
public void Remove(int Index) => InvokeMethod("Remove", Index);
|
||||
}
|
||||
public partial class LBRecipients : LBComObject
|
||||
{
|
||||
public LBRecipients() { }
|
||||
public LBRecipients(Object item) : base(item) { }
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
public LBRecipient Item
|
||||
{
|
||||
get { return new LBRecipient(GetProperty("Item")); }
|
||||
}
|
||||
public LBRecipient Add(string Name)
|
||||
{
|
||||
return new LBRecipient(InvokeMethod("Add", Name));
|
||||
}
|
||||
public void Remove(int Index)
|
||||
{
|
||||
InvokeMethod("Remove", Index);
|
||||
}
|
||||
public Boolean ResolveAll()
|
||||
{
|
||||
return InvokeMethod("ResolveAll") as Boolean? ?? false;
|
||||
}
|
||||
}
|
||||
public LBRecipients(object item) : base(item) { }
|
||||
public int Count => (GetProperty("Count") as int? ?? 0);
|
||||
public new LBRecipient Item => new LBRecipient(GetProperty("Item"));
|
||||
public LBRecipient Add(string Name) => new LBRecipient(InvokeMethod("Add", Name));
|
||||
public void Remove(int Index) => InvokeMethod("Remove", Index);
|
||||
public bool ResolveAll() => InvokeMethod("ResolveAll") as bool? ?? false;
|
||||
}
|
||||
public partial class LBAttachment : LBComObject
|
||||
{
|
||||
public LBAttachment() { }
|
||||
public LBAttachment(Object item) : base(item) { }
|
||||
public LBOlAttachmentType Type
|
||||
{
|
||||
get { return (LBOlAttachmentType)GetProperty("Type"); }
|
||||
}
|
||||
}
|
||||
public LBAttachment(object item) : base(item) { }
|
||||
public LBOlAttachmentType Type => (LBOlAttachmentType)GetProperty("Type");
|
||||
}
|
||||
public partial class LBRecipient : LBComObject
|
||||
{
|
||||
public LBRecipient() { }
|
||||
public LBRecipient(Object item) : base(item) { }
|
||||
public String Address
|
||||
{
|
||||
get { return (GetProperty("Address").ToString()); }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return (GetProperty("Name").ToString()); }
|
||||
}
|
||||
public Boolean Resolve()
|
||||
{
|
||||
return InvokeMethod("Resolve") as Boolean? ?? false;
|
||||
}
|
||||
}
|
||||
public LBRecipient(object item) : base(item) { }
|
||||
public string Address => (GetProperty("Address").ToString());
|
||||
public string Name => (GetProperty("Name").ToString());
|
||||
public bool Resolve() => InvokeMethod("Resolve") as bool? ?? false;
|
||||
}
|
||||
public enum LBOlAttachmentType
|
||||
{
|
||||
olByValue = 1,
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LBOutlookLibrary
|
||||
{
|
||||
public partial class LBApplicationClass
|
||||
{
|
||||
public LBMailItemClass CreateMailItem()
|
||||
{
|
||||
return new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
|
||||
}
|
||||
}
|
||||
public LBMailItemClass CreateMailItem() => new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
|
||||
}
|
||||
public partial class LBMailItemClass
|
||||
{
|
||||
public void AddAttachment(string filename)
|
||||
{
|
||||
Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
|
||||
}
|
||||
}
|
||||
public void AddAttachment(string filename) => Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,19 +49,13 @@ namespace Read64bitRegistryFrom32bitApp
|
||||
ref uint lpType,
|
||||
System.Text.StringBuilder lpData,
|
||||
ref uint lpcbData);
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, String inPropertyName)
|
||||
{
|
||||
return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
|
||||
}
|
||||
static public string GetRegKey32Value(UIntPtr inHive, String inKeyName, String inPropertyName)
|
||||
{
|
||||
return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_32Key, inPropertyName);
|
||||
}
|
||||
static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, RegSAM in32or64key, String inPropertyName)
|
||||
#region Functions
|
||||
static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, string inPropertyName) => GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
|
||||
static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, RegSAM in32or64key, string inPropertyName)
|
||||
{
|
||||
int hkey = 0;
|
||||
try
|
||||
@@ -80,15 +74,10 @@ namespace Read64bitRegistryFrom32bitApp
|
||||
if (0 != hkey) RegCloseKey(hkey);
|
||||
}
|
||||
}
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName)
|
||||
{
|
||||
return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
|
||||
}
|
||||
static public bool GetRegKey32Valid(UIntPtr inHive, String inKeyName)
|
||||
{
|
||||
return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
|
||||
}
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName, RegSAM in32or64key)
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
|
||||
static public bool GetRegKey32Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName, RegSAM in32or64key)
|
||||
{
|
||||
int hkey = 0;
|
||||
try
|
||||
@@ -103,8 +92,5 @@ namespace Read64bitRegistryFrom32bitApp
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Enums
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user