Пример #1
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.IO.Path.GetInvalidFileNameChars();
                scope.SetValue(OutPinReturn, returnValue);

                foreach (var item in returnValue)
                {
                    var childScope = scope.CreateChild();
                    childScope.SetValue(OutPinCurrent, item);

                    if (OutNodeEachItem != null)
                    {
                        runtime.EnqueueNode(OutNodeEachItem, childScope);
                    }
                }

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOPathGetInvalidFileNameChars: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.String.IsNullOrEmpty(
                    scope.GetValue <System.String>(InPinValue));
                scope.SetValue(OutPinReturn, returnValue);

                if (OutNodeTrue != null && returnValue)
                {
                    runtime.EnqueueNode(OutNodeTrue, scope);
                }
                else if (OutNodeFalse != null && !returnValue)
                {
                    runtime.EnqueueNode(OutNodeFalse, scope);
                }

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in SystemStringIsNullOrEmpty_String: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
Пример #3
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.IO.Directory.EnumerateFiles(
                    scope.GetValue <System.String>(InPinPath));
                scope.SetValue(OutPinReturn, returnValue);

                foreach (var item in returnValue)
                {
                    var childScope = scope.CreateChild();
                    childScope.SetValue(OutPinCurrent, item);

                    if (OutNodeEachItem != null)
                    {
                        runtime.EnqueueNode(OutNodeEachItem, childScope);
                    }
                }

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IODirectoryEnumerateFiles_String: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.Array.CreateInstance(
                    scope.GetValue <System.Type>(InPinElementType),
                    scope.GetValue <System.Int32>(InPinLength1),
                    scope.GetValue <System.Int32>(InPinLength2),
                    scope.GetValue <System.Int32>(InPinLength3));
                scope.SetValue(OutPinReturn, returnValue);

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in SystemArrayCreateInstance_Type_Int32_Int32_Int32: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
Пример #5
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            foreach (var node in OutNodes)
            {
                runtime.EnqueueNode(node, scope);
            }

            return(true);
        }
Пример #6
0
        /// <summary>
        /// Clear pin value
        /// </summary>
        /// <param name="runtime">Runtime instance</param>
        /// <param name="scope">Scope instance</param>
        /// <returns>True</returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            scope.SetValue(InPinPin, null);

            if (OutNode != null)
            {
                runtime.EnqueueNode(OutNode, scope);
            }

            return(true);
        }
Пример #7
0
        protected override bool Compare(IFlowRuntimeService runtime, DataPinScope scope)
        {
            var val1 = scope.GetValue <string>(InPinConditionA);
            var val2 = scope.GetValue <string>(InPinConditionB);

            if (string.IsNullOrWhiteSpace(val1) || string.IsNullOrWhiteSpace(val2))
            {
                return(false);
            }

            return(val1.EndsWith(val2));
        }
Пример #8
0
        /// <summary>
        /// Clear pin value
        /// </summary>
        /// <param name="runtime">Runtime instance</param>
        /// <param name="scope">Scope instance</param>
        /// <returns>True</returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var target = scope.GetValue <string>(InPinTarget);

                if (string.IsNullOrWhiteSpace(target))
                {
                    Console.WriteLine($"No target is set in {nameof(ExecuteFlowNode)}");
                    return(false);
                }

                var eventService = ServiceLocator.Current.GetInstance <IFlowEventService>();

                var data01 = scope.GetValue <string>(InPinData01);
                var data02 = scope.GetValue <string>(InPinData02);
                var data03 = scope.GetValue <string>(InPinData03);

                var id = $"{target ?? "OnExecuteFlowEvent"}EFE{data01 ?? ""}{data02 ?? ""}{data03 ?? ""}";

                if (id.Length > 255)
                {
                    id = id.Substring(0, 255);
                }

                eventService.InvokeEvent(new OnExecuteFlowEventArgs
                {
                    Id        = id,
                    Target    = target,
                    EventName = "OnExecuteFlowEvent",
                    Data01    = data01,
                    Data02    = data02,
                    Data03    = data03,
                    ObjectId  = target,
                    UserId    = 0
                });

                if (SuccessOutNode != null)
                {
                    runtime.EnqueueNode(SuccessOutNode, scope);
                }
            }
            catch
            {
                if (FailedOutNode != null)
                {
                    runtime.EnqueueNode(FailedOutNode, scope);
                }
            }

            return(true);
        }
Пример #9
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            var value = scope.GetValue <int>(InPinWaitTime);

            Thread.Sleep(value);

            if (OutNode != null)
            {
                runtime.EnqueueNode(OutNode, scope);
            }

            return(true);
        }
Пример #10
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var startInfo = new ProcessStartInfo
                {
                    CreateNoWindow = true,
                    FileName       = scope.GetValue <string>(InPinPath)
                };

                var arguments = scope.GetValue <string>(InPinArguments);
                if (!string.IsNullOrWhiteSpace(arguments))
                {
                    startInfo.Arguments = arguments;
                }

                var workingDirectory = scope.GetValue <string>(InPinWorkingDir);
                if (!string.IsNullOrWhiteSpace(workingDirectory))
                {
                    startInfo.WorkingDirectory = workingDirectory;
                }

                var process = new Process
                {
                    StartInfo = startInfo
                };

                process.Start();

                if (scope.GetValue <bool>(InPinWaitForExit))
                {
                    process.WaitForExit();
                }

                if (OutSuccessNode != null)
                {
                    runtime.EnqueueNode(OutSuccessNode, scope);
                }
            }
            catch
            {
                if (OutFailedNode != null)
                {
                    runtime.EnqueueNode(OutFailedNode, scope);
                }
            }

            return(true);
        }
Пример #11
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            var variableName = scope.GetValue <string>(InPinVariableName);
            var variable     = runtime.Instance.Variables.FirstOrDefault(x => x.Name == variableName);

            if (variable != null)
            {
                scope.SetValue(OutPinVariable, variable.Value);
                runtime.EnqueueNode(OutNode, scope);
            }
            else if (OutNode != null)
            {
                runtime.EnqueueNode(OutNode, scope);
            }

            return(true);
        }
Пример #12
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            System.Console.WriteLine($"Execute: {GetType().Name}");

            var values = scope.GetListValue <object>(InPinList);

            foreach (var value in values)
            {
                var newScope = scope.CreateChild();
                newScope.SetValue(OutPin, value);

                runtime.EnqueueNode(OutNodeEachItem, newScope);
            }

            runtime.EnqueueNode(OutNodeCompleted, scope);

            return(true);
        }
Пример #13
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            System.Console.WriteLine($"Execute: {GetType().Name}");

            var result = Compare(runtime, scope);

            if (result)
            {
                runtime.EnqueueNode(OutNodeTrue, scope);
            }
            else
            {
                runtime.EnqueueNode(OutNodeFalse, scope);
            }

            runtime.EnqueueNode(OutNodeAny, scope);

            return(true);
        }
Пример #14
0
        /// <summary>
        /// Clear pin value
        /// </summary>
        /// <param name="runtime">Runtime instance</param>
        /// <param name="scope">Scope instance</param>
        /// <returns>True</returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            var obj    = scope.GetValue <object>(InPinObject);
            var format = scope.GetValue <string>(InPinFormat);

            try
            {
                if (obj != null)
                {
                    if (string.IsNullOrWhiteSpace(format))
                    {
                        scope.SetValue(OutPinString, obj.ToString());
                    }
                    else
                    {
                        var method = obj.GetType().GetMethod("ToString", new[] { typeof(string) });
                        if (method == null)
                        {
                            throw new Exception("ToString with format parameter is not allowed in ToStringNode");
                        }

                        scope.SetValue(OutPinString, method.Invoke(obj, new[] { format }));
                    }
                }

                if (SuccessOutNode != null)
                {
                    runtime.EnqueueNode(SuccessOutNode, scope);
                }
            }
            catch (Exception ex)
            {
                if (FailedOutNode != null)
                {
                    runtime.EnqueueNode(FailedOutNode, scope);
                }

                throw ex;
            }

            return(true);
        }
Пример #15
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var value = scope.GetValue <object>(InPinToPrint);
                System.Console.WriteLine(value);
            }
            catch (Exception ex)
            {
                throw;
            }


            if (OutNode != null)
            {
                runtime.EnqueueNode(OutNode, scope);
            }

            return(true);
        }
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope) 
        { 
            try
            {
                var returnValue = System.Convert.ToChar(
                scope.GetValue<System.Boolean>(InPinValue));
                scope.SetValue(OutPinReturn, returnValue);

                if (OutNodeSuccess != null) 
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex) 
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in SystemConvertToChar_Boolean: ", ex);
                if (OutNodeFailed != null)
                    runtime.EnqueueNode(OutNodeFailed, scope);
            }
            return true; 
        }  
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.IO.Directory.Delete(
             scope.GetValue <System.String>(InPinPath));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IODirectoryDelete_String: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.Array.Sort(
             scope.GetValue <System.Array>(InPinArray));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in SystemArraySort_Array: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.IO.File.SetCreationTimeUtc(
             scope.GetValue <System.String>(InPinPath),
             scope.GetValue <System.DateTime>(InPinCreationTimeUtc));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOFileSetCreationTimeUtc_String_DateTime: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
Пример #20
0
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.IO.File.WriteAllBytes(
             scope.GetValue <System.String>(InPinPath),
             scope.GetValue <System.Byte[]>(InPinBytes));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOFileWriteAllBytes_String_Byte_: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
Пример #21
0
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.IO.File.SetAccessControl(
             scope.GetValue <System.String>(InPinPath),
             scope.GetValue <System.Security.AccessControl.FileSecurity>(InPinFileSecurity));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOFileSetAccessControl_String_FileSecurity: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
Пример #22
0
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.IO.File.Copy(
             scope.GetValue <System.String>(InPinSourceFileName),
             scope.GetValue <System.String>(InPinDestFileName));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOFileCopy_String_String: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.Text.RegularExpressions.Regex.CacheSize;
                scope.SetValue(OutPinStaticValue, returnValue);

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in System_Text_RegularExpressionsRegexCacheSize: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.IO.Path.GetRandomFileName();
                scope.SetValue(OutPinReturn, returnValue);

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOPathGetRandomFileName: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
Пример #25
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            var target = scope.GetValue <string>(InPinTarget);
            var args   = runtime.FlowEventArgs as OnExecuteFlowEventArgs;

            if (args == null)
            {
                Console.WriteLine($"Arguments not found in {nameof(OnExecuteFlowEventArgs)}");
                return(false);
            }

            scope.SetValue(OutPinData01, args.Data01);
            scope.SetValue(OutPinData02, args.Data02);
            scope.SetValue(OutPinData03, args.Data03);

            if (OutNode != null)
            {
                runtime.EnqueueNode(OutNode, scope);
            }

            return(true);
        }
Пример #26
0
        public override bool ShouldExecute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            var obj    = (runtime.FlowEventArgs as OnExecuteFlowEventArgs);
            var target = scope.GetValue <string>(InPinTarget);

            if (obj == null)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(obj.Target))
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(target))
            {
                return(false);
            }

            return(obj.Target.ToLower()?.Trim() == target.ToLower().Trim());
        }
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.IO.File.WriteAllLines(
             scope.GetValue <System.String>(InPinPath),
             scope.GetValue <System.Collections.Generic.IEnumerable <System.String> >(InPinContents));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_IOFileWriteAllLines_String_IEnumerable_1: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
Пример #28
0
 public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
 {
     try
     {
         System.Text.RegularExpressions.Regex.CompileToAssembly(
             scope.GetValue <System.Text.RegularExpressions.RegexCompilationInfo[]>(InPinRegexinfos),
             scope.GetValue <System.Reflection.AssemblyName>(InPinAssemblyname));
         if (OutNodeSuccess != null)
         {
             runtime.EnqueueNode(OutNodeSuccess, scope);
         }
     }
     catch (Exception ex)
     {
         Simplic.Log.LogManagerInstance.Instance.Error("Error in System_Text_RegularExpressionsRegexCompileToAssembly_RegexCompilationInfo__AssemblyName: ", ex);
         if (OutNodeFailed != null)
         {
             runtime.EnqueueNode(OutNodeFailed, scope);
         }
     }
     return(true);
 }
Пример #29
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.DateTime.Now;
                scope.SetValue(OutPinStaticValue, returnValue);

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in SystemDateTimeNow: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }
Пример #30
0
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            try
            {
                var returnValue = System.TimeSpan.FromTicks(
                    scope.GetValue <System.Int64>(InPinValue));
                scope.SetValue(OutPinReturn, returnValue);

                if (OutNodeSuccess != null)
                {
                    runtime.EnqueueNode(OutNodeSuccess, scope);
                }
            }
            catch (Exception ex)
            {
                Simplic.Log.LogManagerInstance.Instance.Error("Error in SystemTimeSpanFromTicks_Int64: ", ex);
                if (OutNodeFailed != null)
                {
                    runtime.EnqueueNode(OutNodeFailed, scope);
                }
            }
            return(true);
        }