Skip to content

Commit

Permalink
Merge pull request #784 from skadefro/master
Browse files Browse the repository at this point in the history
push 1.4.57.3
  • Loading branch information
skadefro authored Apr 5, 2024
2 parents 8b4e8a5 + beba54a commit 4a13e75
Show file tree
Hide file tree
Showing 43 changed files with 1,170 additions and 514 deletions.
4 changes: 2 additions & 2 deletions OpenRPA.CodeEditor/CodeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async static Task Initialize()
{
Log.Error("CodeEditor.init-inner: " + ex.ToString());
}
});
}, 10000);
var completionService = CompletionService.GetService(ce.document);
var completionList = await Task.Run(async () =>
{
Expand Down Expand Up @@ -244,7 +244,7 @@ public Document Initialize()
document = document.WithText(SourceText.From(header + Text + footer));
}
}
});
}, 10000);
return document;
}
private async Task ShowCompletionAsync(char? triggerChar)
Expand Down
2 changes: 1 addition & 1 deletion OpenRPA.Interfaces/ExtendedObservableCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void OnBaseCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
break;
}
});
}, 500);
}
}
new public void Move(int oldIndex, int newIndex) { basecollection.Move(oldIndex, newIndex); }
Expand Down
1 change: 1 addition & 0 deletions OpenRPA.Interfaces/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public static void Sort<T>(this System.Collections.ObjectModel.ObservableCollect

for (int i = 0; i < sortableList.Count; i++)
{
if (collection.Count != sortableList.Count) return;
collection.Move(collection.IndexOf(sortableList[i]), i);
}
}
Expand Down
13 changes: 6 additions & 7 deletions OpenRPA.Interfaces/GenericTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void Minimize(System.Windows.Window window)
{
Log.Error(ex.ToString());
}
});
}, 1000);
}
public static void Minimize(IntPtr hWnd)
{
Expand Down Expand Up @@ -85,7 +85,7 @@ public static void Restore()
{
Log.Error(ex.ToString());
}
});
}, 1000);
}
public static void Restore(System.Windows.Window window)
{
Expand All @@ -108,7 +108,7 @@ public static void Restore(System.Windows.Window window)
{
Log.Error(ex.ToString());
}
});
}, 1000);
}
public static void Restore(IntPtr hWnd)
{
Expand Down Expand Up @@ -168,17 +168,16 @@ public static async Task<T> RunUIAsync<T>(System.Windows.Window window, Func<Tas
}
}
private static readonly object statelock = new object();
public static void RunUI(Action action)
public static void RunUI(Action action, int timeout_ms = 10000)
{
if (System.Windows.Application.Current.Dispatcher.CheckAccess())
if (System.Windows.Application.Current == null || System.Windows.Application.Current.Dispatcher.CheckAccess())
{
action();
} else
{
try
{
// if (System.Threading.Monitor.TryEnter(statelock, Config.local.thread_lock_timeout_seconds * 1000))
if (System.Threading.Monitor.TryEnter(statelock, 1000))
if (System.Threading.Monitor.TryEnter(statelock, timeout_ms))
{
try
{
Expand Down
4 changes: 2 additions & 2 deletions OpenRPA.Interfaces/IPCService/OpenRPAService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void StartWorkflowInstances()
{
if (instance != null) instance.Run();
}
});
}, 10000);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -342,7 +342,7 @@ public void IdleOrComplete(IWorkflowInstance instance, EventArgs e)
catch (Exception)
{
}
});
}, 60000);
}
}
public string Ping() { return "pong"; }
Expand Down
22 changes: 22 additions & 0 deletions OpenRPA.Interfaces/IStorage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using OpenRPA.Input;
using OpenRPA.Interfaces.entity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenRPA.Interfaces
{
public interface IStorage : IDisposable
{
string Name { get; set; }
Task Initialize();
Task<T[]> FindAll<T>() where T : apibase;
Task<T> FindById<T>(string id) where T : apibase;
Task<T> Insert<T>(T item) where T : apibase;
Task<T> Update<T>(T item) where T : apibase;
Task Delete<T>(string id) where T : apibase;
}
}
15 changes: 13 additions & 2 deletions OpenRPA.Interfaces/ObservableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected T GetProperty<T>([CallerMemberName] string propertyName = null)
}
return default(T);
}
private static string[] isDirtyIgnored = { "isDirty", "isLocalOnly", "IsExpanded", "IsExpanded", "IsSelected", "_type", "_id" };
private static string[] isDirtyIgnored = { "isDirty", "isLocalOnly", "IsExpanded", "IsSelected", "_type", "_id" };
/// <summary>
/// Saves a property value to the internal backing field
/// </summary>
Expand Down Expand Up @@ -105,12 +105,23 @@ protected bool SetProperty<T>(T newValue, [CallerMemberName] string propertyName
if (!_disabledirty)
{
var stack = (new System.Diagnostics.StackTrace());
var hasLiteDB = false;
for(var i = 0; i < stack.FrameCount; i++)
{
var frame = stack.GetFrame(i);
var mname = frame.GetMethod().Module.ScopeName;
if(mname == "LiteDB.dll")
{
hasLiteDB = true;
break;
}
}
modulename = stack.GetFrame(1).GetMethod().Module.ScopeName;
if (stack.FrameCount > 3) modulename2 = stack.GetFrame(3).GetMethod().Module.ScopeName;
if (modulename2 == "Newtonsoft.Json.dll")
{
}
else if (modulename2 == "LiteDB.dll")
else if (modulename2 == "LiteDB.dll" || hasLiteDB == true)
{
}
else if (modulename2 == "CommonLanguageRuntimeLibrary")
Expand Down
44 changes: 41 additions & 3 deletions OpenRPA.Interfaces/Plugins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Plugins
public static Dictionary<string, Type> detectorPluginTypes = new Dictionary<string, Type>();
public static ObservableCollection<IRunPlugin> runPlugins = new ObservableCollection<IRunPlugin>();
public static ObservableCollection<ISnippet> Snippets = new ObservableCollection<ISnippet>();
public static ObservableCollection<IStorage> Storages = new ObservableCollection<IStorage>();
public static ICollection<Type> WorkflowExtensionsTypes = new List<Type>();
public static IDetectorPlugin AddDetector(IOpenRPAClient client, IDetector entity)
{
Expand Down Expand Up @@ -75,6 +76,7 @@ public static void LoadPlugins(IOpenRPAClient client)
ICollection<Type> snippetTypes = new List<Type>();
ICollection<Type> runPluginTypes = new List<Type>();
ICollection<Type> IDetectorPluginTypes = new List<Type>();
ICollection<Type> StorageTypes = new List<Type>();
Log.Information("Begin loading plugins");
Log.Debug("LoadPlugins::Get types " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
foreach (var a in assemblies)
Expand Down Expand Up @@ -144,7 +146,17 @@ public static void LoadPlugins(IOpenRPAClient client)
}
catch (Exception) { }
}


Log.Debug("LoadPlugins::Get all IStorage " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
var IStoragetype = typeof(IStorage);
foreach (var p in alltypes)
{
try
{
if (IStoragetype.IsAssignableFrom(p) && p.IsInterface == false) StorageTypes.Add(p);
}
catch (Exception) { }
}

foreach (var type in IDetectorPluginTypes)
if (!detectorPluginTypes.ContainsKey(type.FullName)) detectorPluginTypes.Add(type.FullName, type);
Expand All @@ -167,7 +179,7 @@ public static void LoadPlugins(IOpenRPAClient client)
Log.Debug("LoadPlugins::Initialize plugin " + plugin.Name + " " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
// SetStatus("Initialize plugin " + plugin.Name);
plugin.Initialize(client);
GenericTools.RunUI(() => recordPlugins.Add(plugin));
GenericTools.RunUI(() => recordPlugins.Add(plugin), 10000);
}

}
Expand Down Expand Up @@ -201,6 +213,32 @@ public static void LoadPlugins(IOpenRPAClient client)
Log.Error(ex.ToString());
}
}
foreach (Type type in StorageTypes)
{
try
{
IStorage plugin = null;
foreach (var p in Storages)
{
if (p.GetType() == type)
{
plugin = p;
break;
}
}
if (plugin == null)
{
plugin = (IStorage)Activator.CreateInstance(type);
Log.Debug("LoadPlugins::Initialize storage " + plugin.Name + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
plugin.Initialize();
Storages.Add(plugin);
}
}
catch (Exception ex)
{
Log.Error(ex.ToString());
}
}
foreach (Type type in runPluginTypes)
{
try
Expand All @@ -220,7 +258,7 @@ public static void LoadPlugins(IOpenRPAClient client)
plugin = (IRunPlugin)Activator.CreateInstance(type);
Log.Debug("LoadPlugins::Initialize RunPlugin " + plugin.Name + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
plugin.Initialize(client);
GenericTools.RunUI(() => runPlugins.Add(plugin));
GenericTools.RunUI(() => runPlugins.Add(plugin), 10000);
}
}
catch (Exception ex)
Expand Down
2 changes: 1 addition & 1 deletion OpenRPA.Interfaces/Selector/SelectorModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public bool doHighlight()
HighlightImage = Extensions.GetImageSourceFromResource("searchfound.png");
NotifyPropertyChanged("HighlightImage");
}
});
}, 10000);
});
// return (results.Count() > 0);
return true;
Expand Down
2 changes: 1 addition & 1 deletion OpenRPA.Interfaces/Selector/SelectorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
Log.Debug("init selector model, with " + treeelements.Count() + " root elements");
vm.init(treeelements);
// vm.FocusElement(vm.Selector);
});
}, 10000);
});
}
private void Window_Closed(object sender, EventArgs e)
Expand Down
2 changes: 2 additions & 0 deletions OpenRPA.SetupProject/OpenRPA.SetupProject.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<Compile Include="compMSSpeech.wxs" />
<Compile Include="compPS.wxs" />
<Compile Include="compTerminalEmulator.wxs" />
<Compile Include="compStorageLiteDb.wxs" />
<Compile Include="compStorageFS.wxs" />
<Compile Include="FeatureTreeDlg.wxs" />
<Compile Include="mainfiles.wxs" />
<Compile Include="Product.wxs" />
Expand Down
6 changes: 6 additions & 0 deletions OpenRPA.SetupProject/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@
<Feature Id="RDServicePluginFeature" Title="High Density robots using Remote Desktop" Level="1" Absent='allow' AllowAdvertise='yes' ConfigurableDirectory='INSTALLDIR' TypicalDefault="advertise" >
<ComponentGroupRef Id="RDServicePluginComponents" />
</Feature>
<Feature Id="StorageLiteDbFeature" Title="Store/cache data in LiteDB on local filesystem" Level="1" Absent='allow' AllowAdvertise='yes' ConfigurableDirectory='INSTALLDIR' TypicalDefault="install" >
<ComponentGroupRef Id="StorageLiteDbComponents" />
</Feature>
<Feature Id="StorageFSFeature" Title="Store/cache data as JSon files on local filesystem" Level="1" Absent='allow' AllowAdvertise='yes' ConfigurableDirectory='INSTALLDIR' TypicalDefault="install" >
<ComponentGroupRef Id="StorageFSComponents" />
</Feature>
<!--<Feature Id="PDPluginFeature" Title="Process Discovery Harvesting Run Plugin" Level="1" Absent='allow' AllowAdvertise='yes' ConfigurableDirectory='INSTALLDIR' TypicalDefault="advertise" >
<ComponentGroupRef Id="PDPluginComponents" />
</Feature>-->
Expand Down
13 changes: 13 additions & 0 deletions OpenRPA.SetupProject/compStorageFS.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>

<ComponentGroup Id="StorageFSComponents">
<Component Id='StorageFSComponent' Guid='{079E3990-1D1F-4381-B023-B3DA6E64042B}' Win64='yes' Directory="INSTALLDIR">
<File Id="OpenRPA.Storage.Filesystem.dll" Source="!(wix.ScriptSource)\OpenRPA.Storage.Filesystem.dll" />
<File Id="OpenRPA.Storage.Filesystem.pdb" Source="!(wix.ScriptSource)\OpenRPA.Storage.Filesystem.pdb" />
</Component>
</ComponentGroup>

</Fragment>
</Wix>
13 changes: 13 additions & 0 deletions OpenRPA.SetupProject/compStorageLiteDb.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>

<ComponentGroup Id="StorageLiteDbComponents">
<Component Id='StorageLiteDbComponent' Guid='{D0AC728D-DFBC-4734-AA22-230ECB94449F}' Win64='yes' Directory="INSTALLDIR">
<File Id="OpenRPA.Storage.LiteDB.dll" Source="!(wix.ScriptSource)\OpenRPA.Storage.LiteDB.dll" />
<File Id="OpenRPA.Storage.LiteDB.pdb" Source="!(wix.ScriptSource)\OpenRPA.Storage.LiteDB.pdb" />
</Component>
</ComponentGroup>

</Fragment>
</Wix>
53 changes: 53 additions & 0 deletions OpenRPA.Storage.Filesystem/DoNotIgnoreResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace OpenRPA.Storage.Filesystem
{
public class DoNotIgnoreResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var property = base.CreateProperty(member, memberSerialization);
if (property.PropertyName == "isLocalOnly")
{
property.Ignored = false;
}
if (property.PropertyName == "isDirty")
{
property.Ignored = false;
}
if (property.PropertyName == "isDeleted")
{
property.Ignored = false;
}
if (property.PropertyName == "current_version")
{
property.Ignored = false;
}
if (property.PropertyName == "RelativeFilename")
{
property.Ignored = false;
}
if (property.PropertyName == "State")
{
property.Ignored = false;
}
if (property.PropertyName == "IsExpanded")
{
property.Ignored = false;
}
if (property.PropertyName == "IsSelected")
{
property.Ignored = false;
}
return property;
}
}

}
Loading

0 comments on commit 4a13e75

Please sign in to comment.