Skip to content

Commit

Permalink
Add support for DecodeMultiple and fix namespace redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
qbrandon committed Aug 6, 2021
1 parent 0983a78 commit b2bffe0
Show file tree
Hide file tree
Showing 10 changed files with 291 additions and 26 deletions.
Binary file added Barcode/.package/icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<mva:VisualBasic.Settings>
<x:Null />
</mva:VisualBasic.Settings>
<sap2010:Annotation.AnnotationText>UPTF00000134eyI8SGVscExpbms+a19fQmFja2luZ0ZpZWxkIjoiaHR0cHM6XC9cL2dpdGh1Yi5jb21cL3FicmFuZG9uXC9VaVBhdGhUZWFtLkJhcmNvZGUiLCI8SW5pdGlhbFRvb2x0aXA+a19fQmFja2luZ0ZpZWxkIjoiRGVjb2RlIEJhcmNvZGUgZnJvbSBhbiBpbnB1dCBVaVBhdGguQ29yZS5JbWFnZSB1c2luZyB0aGUgWlhpbmcuQmFyY29kZVJlYWRlciBjbGFzcyIsIjxWZXJzaW9uPmtfX0JhY2tpbmdGaWVsZCI6MX0=</sap2010:Annotation.AnnotationText>
<sap:VirtualizedContainerService.HintSize>1874,931.333333333333</sap:VirtualizedContainerService.HintSize>
<sap2010:WorkflowViewState.IdRef>ActivityBuilder_1</sap2010:WorkflowViewState.IdRef>
<TextExpression.NamespacesForImplementation>
Expand Down
175 changes: 175 additions & 0 deletions Barcode/DecodeMultiple Image.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<Activity mc:Ignorable="sap sap2010" x:Class="Main" this:Main.Charset="UTF-8" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Drawing;assembly=System.Drawing" xmlns:this="clr-namespace:" xmlns:ui="http://schemas.uipath.com/workflow/activities" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:z="clr-namespace:ZXing;assembly=zxing">
<x:Members>
<x:Property Name="Output" Type="OutArgument(s:String[])" />
<x:Property Name="Image" Type="InArgument(ui:Image)" />
<x:Property Name="Format" Type="OutArgument(z:BarcodeFormat[])" />
<x:Property sap2010:Annotation.AnnotationText="Charset to be used for decode (e.g. &quot;SJIS&quot;)" Name="Charset" Type="InArgument(x:String)" />
</x:Members>
<this:Main.Image>
<InArgument x:TypeArguments="ui:Image" />
</this:Main.Image>
<mva:VisualBasic.Settings>
<x:Null />
</mva:VisualBasic.Settings>
<sap2010:Annotation.AnnotationText>UPTF00000140eyI8SGVscExpbms+a19fQmFja2luZ0ZpZWxkIjoiaHR0cHM6XC9cL2dpdGh1Yi5jb21cL3FicmFuZG9uXC9VaVBhdGhUZWFtLkJhcmNvZGUiLCI8SW5pdGlhbFRvb2x0aXA+a19fQmFja2luZ0ZpZWxkIjoiRGVjb2RlIE11bHRpcGxlIEJhcmNvZGVzIGZyb20gYW4gaW5wdXQgVWlQYXRoLkNvcmUuSW1hZ2UgdXNpbmcgdGhlIFpYaW5nLkJhcmNvZGVSZWFkZXIgY2xhc3MiLCI8VmVyc2lvbj5rX19CYWNraW5nRmllbGQiOjF9</sap2010:Annotation.AnnotationText>
<sap:VirtualizedContainerService.HintSize>1721.33333333333,1496</sap:VirtualizedContainerService.HintSize>
<sap2010:WorkflowViewState.IdRef>ActivityBuilder_1</sap2010:WorkflowViewState.IdRef>
<TextExpression.NamespacesForImplementation>
<scg:List x:TypeArguments="x:String" Capacity="44">
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>Microsoft.VisualBasic</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Data</x:String>
<x:String>System.Diagnostics</x:String>
<x:String>System.Drawing</x:String>
<x:String>System.IO</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Net.Mail</x:String>
<x:String>System.Xml</x:String>
<x:String>System.Xml.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Core.Activities</x:String>
<x:String>System.Windows.Markup</x:String>
<x:String>ZXing</x:String>
<x:String>Microsoft.VisualBasic.CompilerServices</x:String>
<x:String>ZXing.Common</x:String>
<x:String>System.Reflection</x:String>
<x:String>System.Runtime.InteropServices</x:String>
<x:String>System.Collections.ObjectModel</x:String>
<x:String>System.Activities.DynamicUpdate</x:String>
</scg:List>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<scg:List x:TypeArguments="AssemblyReference" Capacity="34">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
<AssemblyReference>mscorlib</AssemblyReference>
<AssemblyReference>System.Data</AssemblyReference>
<AssemblyReference>System</AssemblyReference>
<AssemblyReference>System.Drawing</AssemblyReference>
<AssemblyReference>System.Core</AssemblyReference>
<AssemblyReference>System.Xml</AssemblyReference>
<AssemblyReference>System.Xml.Linq</AssemblyReference>
<AssemblyReference>PresentationFramework</AssemblyReference>
<AssemblyReference>WindowsBase</AssemblyReference>
<AssemblyReference>PresentationCore</AssemblyReference>
<AssemblyReference>System.Xaml</AssemblyReference>
<AssemblyReference>UiPath.System.Activities</AssemblyReference>
<AssemblyReference>UiPath.UiAutomation.Activities</AssemblyReference>
<AssemblyReference>zxing</AssemblyReference>
<AssemblyReference>zxing.presentation</AssemblyReference>
<AssemblyReference>System.ServiceModel</AssemblyReference>
<AssemblyReference>UiPath.Excel</AssemblyReference>
<AssemblyReference>UiPath.Mail</AssemblyReference>
<AssemblyReference>System.ComponentModel.Composition</AssemblyReference>
<AssemblyReference>System.Runtime.WindowsRuntime</AssemblyReference>
</scg:List>
</TextExpression.ReferencesForImplementation>
<Sequence sap2010:Annotation.AnnotationText="Decode Multiple Barcodes from an input UiPath.Core.Image using the ZXing.BarcodeReader class" DisplayName="Decode input Image" sap:VirtualizedContainerService.HintSize="604.666666666667,1431.33333333333" sap2010:WorkflowViewState.IdRef="Sequence_1">
<Sequence.Variables>
<Variable x:TypeArguments="z:BarcodeReader" Default="[new BarcodeReader]" Name="barcodeReader" />
<Variable x:TypeArguments="z:Result[]" Name="result" />
<Variable x:TypeArguments="sd:Bitmap" Name="bmp" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign DisplayName="Convert UiPath.Core.Image to Bitmap" sap:VirtualizedContainerService.HintSize="562.666666666667,62" sap2010:WorkflowViewState.IdRef="Assign_2">
<Assign.To>
<OutArgument x:TypeArguments="sd:Bitmap">[bmp]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="sd:Bitmap">[new Bitmap(Image)]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Configure Charset" sap:VirtualizedContainerService.HintSize="562.666666666667,62" sap2010:WorkflowViewState.IdRef="Assign_5">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[barcodeReader.Options.CharacterSet]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[Charset]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Decode the Barcode" sap:VirtualizedContainerService.HintSize="562.666666666667,62" sap2010:WorkflowViewState.IdRef="Assign_3">
<Assign.To>
<OutArgument x:TypeArguments="z:Result[]">[result]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="z:Result[]">[barcodeReader.DecodeMultiple(bmp)]</InArgument>
</Assign.Value>
</Assign>
<If Condition="[result isnot nothing AndAlso result.Length &gt; 0]" DisplayName="Check decode success" sap:VirtualizedContainerService.HintSize="562.666666666667,1002.66666666667" sap2010:WorkflowViewState.IdRef="If_1">
<If.Then>
<Sequence DisplayName="Extract results" sap:VirtualizedContainerService.HintSize="526,818" sap2010:WorkflowViewState.IdRef="Sequence_2">
<Sequence.Variables>
<Variable x:TypeArguments="x:Int32" Default="0" Name="index" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign DisplayName="Init Output Array" sap:VirtualizedContainerService.HintSize="484,62" sap2010:WorkflowViewState.IdRef="Assign_7">
<Assign.To>
<OutArgument x:TypeArguments="s:String[]">[Output]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="s:String[]">[new String(result.Length - 1) {}]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Init Format Array" sap:VirtualizedContainerService.HintSize="484,62" sap2010:WorkflowViewState.IdRef="Assign_8">
<Assign.To>
<OutArgument x:TypeArguments="z:BarcodeFormat[]">[Format]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="z:BarcodeFormat[]">[new BarcodeFormat(result.Length - 1) {}]</InArgument>
</Assign.Value>
</Assign>
<While DisplayName="Loop over results" sap:VirtualizedContainerService.HintSize="484,522" sap2010:WorkflowViewState.IdRef="While_1" Condition="[index &lt; result.Length]">
<Sequence DisplayName="Loop body" sap:VirtualizedContainerService.HintSize="304,358" sap2010:WorkflowViewState.IdRef="Sequence_3">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign DisplayName="Grab the result text" sap:VirtualizedContainerService.HintSize="262,62" sap2010:WorkflowViewState.IdRef="Assign_9">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[Output(index)]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[result(index).Text]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Extract the detected format" sap:VirtualizedContainerService.HintSize="262,62" sap2010:WorkflowViewState.IdRef="Assign_10">
<Assign.To>
<OutArgument x:TypeArguments="z:BarcodeFormat">[Format(index)]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="z:BarcodeFormat">[result(index).BarcodeFormat]</InArgument>
</Assign.Value>
</Assign>
<Assign sap:VirtualizedContainerService.HintSize="262,62" sap2010:WorkflowViewState.IdRef="Assign_11">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[index]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[index + 1]</InArgument>
</Assign.Value>
</Assign>
</Sequence>
</While>
</Sequence>
</If.Then>
</If>
</Sequence>
</Activity>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<mva:VisualBasic.Settings>
<x:Null />
</mva:VisualBasic.Settings>
<sap2010:Annotation.AnnotationText>UPTF000000F8eyI8SGVscExpbms+a19fQmFja2luZ0ZpZWxkIjoiaHR0cHM6XC9cL2dpdGh1Yi5jb21cL3FicmFuZG9uXC9VaVBhdGhUZWFtLkJhcmNvZGUiLCI8SW5pdGlhbFRvb2x0aXA+a19fQmFja2luZ0ZpZWxkIjoiRW5jb2RlIGEgU3RyaW5nIGludG8gYSBCYXJjb2RlIGltYWdlIiwiPFZlcnNpb24+a19fQmFja2luZ0ZpZWxkIjoxfQ==</sap2010:Annotation.AnnotationText>
<sap:VirtualizedContainerService.HintSize>1874,931.333333333333</sap:VirtualizedContainerService.HintSize>
<sap2010:WorkflowViewState.IdRef>Encode String_1</sap2010:WorkflowViewState.IdRef>
<TextExpression.NamespacesForImplementation>
Expand Down
22 changes: 18 additions & 4 deletions Barcode/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"ZXing.Net": "0.16.4"
},
"webServices": [],
"entitiesStores": [],
"schemaVersion": "4.0",
"studioVersion": "19.7.0.0",
"projectVersion": "1.0.5",
"projectVersion": "1.0.8",
"runtimeOptions": {
"autoDispose": false,
"isPausable": true,
Expand All @@ -19,7 +20,10 @@
"Private:*",
"*password*"
],
"executionType": "Workflow"
"executionType": "Workflow",
"readyForPiP": false,
"startsInPiP": false,
"mustRestoreAllDependencies": false
},
"designOptions": {
"projectProfile": "Developement",
Expand All @@ -28,7 +32,17 @@
"includeOriginalXaml": false,
"privateWorkflows": []
},
"fileInfoCollection": []
"processOptions": {
"ignoredFiles": []
},
"fileInfoCollection": [],
"modernBehavior": false
},
"expressionLanguage": "VisualBasic",
"isTemplate": false,
"templateProjectData": {},
"publishData": {
"iconUrl": ".package/icon.jpg"
},
"expressionLanguage": "VisualBasic"
"targetFramework": "Legacy"
}
Binary file added Barcode/res/icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

### Links

Project on UiPath Connect! https://connect.uipath.com/community/project/uipathteam-barcode

Component on UiPath Go! https://go.uipath.com/preview/barcode-activities
Component on UiPath Marketplace https://marketplace.uipath.com/listings/470

### Description

This is an activity package exposing 2 activities:
This is an activity package exposing 3 activities:
* Decode Image: will decode a barcode embedded inside an image (`UiPath.Core.Image` instance) into a string
* DecodeMuultiple Image: will decode multiple barcodes embedded inside an image (`UiPath.Core.Image` instance) into an array of string
* Encode String: will encode an input string into the desired barcode format

The underlying library used to handle the barcode processing is ZXing (https://github.com/zxing/zxing)
Expand All @@ -24,6 +23,6 @@ Please note that this argument may not apply to some code types, such as `QR_COD
Please make sure that your Studio or Robot have access to the nuget.org feed (where the ZXing nupkg is hosted)
For the record here is the URL: https://api.nuget.org/v3/index.json

As for Go! itself, please refer to the following FAQ: https://go.uipath.com/help/frequently-asked-questions/go-public-feed
As for Marketplace itself, please refer to the following FAQ: https://docs.uipath.com/marketplace/docs/faq-integration-with-uipath-studio

Once the package intalled via the Package Manager in your specific project, you should see the activties be available in the Activity panel, under the UiPathTeam category.
Loading

0 comments on commit b2bffe0

Please sign in to comment.