diff --git a/Include/ADO_CONSTANTS.au3.Backup.au3 b/Include/ADO_CONSTANTS.au3.Backup.au3 deleted file mode 100644 index 7a87948..0000000 --- a/Include/ADO_CONSTANTS.au3.Backup.au3 +++ /dev/null @@ -1,699 +0,0 @@ -#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 - -;~ ADO Enumerated Constants -;~ http://msdn.microsoft.com/en-us/library/windows/desktop/ms678353%28v=vs.85%29.aspx - -; ADCPROP_ASYNCTHREADPRIORITY_ENUM -Global Const $ADOENUM_adPriorityLowest = 1 -Global Const $ADOENUM_adPriorityBelowNormal = 2 -Global Const $ADOENUM_adPriorityNormal = 3 -Global Const $ADOENUM_adPriorityAboveNormal = 4 -Global Const $ADOENUM_adPriorityHighest = 5 - -; ADCPROP_AUTORECALC_ENUM -Global Const $ADOENUM_adRecalcUpFront = 0 -Global Const $ADOENUM_adRecalcAlways = 1 - -; ADCPROP_UPDATECRITERIA_ENUM -Global Const $ADOENUM_adCriteriaKey = 0 -Global Const $ADOENUM_adCriteriaAllCols = 1 -Global Const $ADOENUM_adCriteriaUpdCols = 2 -Global Const $ADOENUM_adCriteriaTimeStamp = 3 - -; ADCPROP_UPDATERESYNC_ENUM -Global Const $ADOENUM_adResyncNone = 0 -Global Const $ADOENUM_adResyncAutoIncrement = 1 -Global Const $ADOENUM_adResyncConflicts = 2 -Global Const $ADOENUM_adResyncUpdates = 4 -Global Const $ADOENUM_adResyncInserts = 8 -Global Const $ADOENUM_adResyncAll = 15 - -; AffectEnum -Global Const $ADOENUM_adAffectCurrent = 1 -Global Const $ADOENUM_adAffectGroup = 2 -Global Const $ADOENUM_adAffectAll = 3 -Global Const $ADOENUM_adAffectAllChapters = 4 - -; BookmarkEnum -Global Const $ADOENUM_adBookmarkCurrent = 0 -Global Const $ADOENUM_adBookmarkFirst = 1 -Global Const $ADOENUM_adBookmarkLast = 2 - -; CommandTypeEnum -Global Const $ADOENUM_adCmdUnspecified = -1 -Global Const $ADOENUM_adCmdText = 1 -Global Const $ADOENUM_adCmdTable = 2 -Global Const $ADOENUM_adCmdStoredProc = 4 -Global Const $ADOENUM_adCmdUnknown = 8 -Global Const $ADOENUM_adCmdFile = 256 -Global Const $ADOENUM_adCmdTableDirect = 512 - -; CompareEnum -Global Const $ADOENUM_adCompareLessThan = 0 -Global Const $ADOENUM_adCompareEqual = 1 -Global Const $ADOENUM_adCompareGreaterThan = 2 -Global Const $ADOENUM_adCompareNotEqual = 3 -Global Const $ADOENUM_adCompareNotComparable = 4 - -; ConnectModeEnum -Global Const $ADOENUM_adModeUnknown = 0 -Global Const $ADOENUM_adModeRead = 1 -Global Const $ADOENUM_adModeWrite = 2 -Global Const $ADOENUM_adModeReadWrite = 3 -Global Const $ADOENUM_adModeShareDenyRead = 4 -Global Const $ADOENUM_adModeShareDenyWrite = 8 -Global Const $ADOENUM_adModeShareExclusive = 12 -Global Const $ADOENUM_adModeShareDenyNone = 16 -Global Const $ADOENUM_adModeRecursive = 0x400000 - -; ConnectOptionEnum -Global Const $ADOENUM_adConnectUnspecified = -1 -Global Const $ADOENUM_adAsyncConnect = 16 - -; ConnectPromptEnum -Global Const $ADOENUM_adPromptAlways = 1 -Global Const $ADOENUM_adPromptComplete = 2 -Global Const $ADOENUM_adPromptCompleteRequired = 3 -Global Const $ADOENUM_adPromptNever = 4 - -; CopyRecordOptionsEnum -Global Const $ADOENUM_adCopyUnspecified = -1 -Global Const $ADOENUM_adCopyOverWrite = 1 -Global Const $ADOENUM_adCopyNonRecursive = 2 -Global Const $ADOENUM_adCopyAllowEmulation = 4 - -; CursorLocationEnum -Global Const $ADOENUM_adUseNone = 1 -Global Const $ADOENUM_adUseServer = 2 -Global Const $ADOENUM_adUseClient = 3 - -; CursorOptionEnum -Global Const $ADOENUM_adAddNew = 0x1000400 -Global Const $ADOENUM_adApproxPosition = 0x4000 -Global Const $ADOENUM_adBookmark = 0x2000 -Global Const $ADOENUM_adDelete = 0x1000800 -Global Const $ADOENUM_adFind = 0x80000 -Global Const $ADOENUM_adHoldRecords = 0x100 -Global Const $ADOENUM_adIndex = 0x100000 -Global Const $ADOENUM_adMovePrevious = 0x200 -Global Const $ADOENUM_adNotify = 0x40000 -Global Const $ADOENUM_adResync = 0x20000 -Global Const $ADOENUM_adSeek = 0x200000 -Global Const $ADOENUM_adUpdate = 0x1008000 -Global Const $ADOENUM_adUpdateBatch = 0x10000 - -;~ CursorTypeEnum -;~ https://msdn.microsoft.com/en-us/library/windows/desktop/ms681771(v=vs.85).aspx -Global Const $ADOENUM_adOpenUnspecified = -1 ; Does not specify the type of cursor. -Global Const $ADOENUM_adOpenForwardOnly = 0 ; Default. Uses a forward-only cursor. Identical to a static cursor, except that you can only scroll forward through records. This improves performance when you need to make only one pass through a Recordset. -Global Const $ADOENUM_adOpenKeyset = 1 ; Uses a keyset cursor. Like a dynamic cursor, except that you can't see records that other users add, although records that other users delete are inaccessible from your Recordset. Data changes by other users are still visible. -Global Const $ADOENUM_adOpenDynamic = 2 ; Uses a dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the Recordset are allowed, except for bookmarks, if the provider doesn't support them. -Global Const $ADOENUM_adOpenStatic = 3 ; Uses a static cursor, which is a static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible. - -; DataTypeEnum -Global Const $ADOENUM_adArray = 0x2000 -Global Const $ADOENUM_adBigInt = 20 -Global Const $ADOENUM_adBinary = 128 -Global Const $ADOENUM_adBoolean = 11 -Global Const $ADOENUM_adBSTR = 8 -Global Const $ADOENUM_adChapter = 136 -Global Const $ADOENUM_adChar = 129 -Global Const $ADOENUM_adCurrency = 6 -Global Const $ADOENUM_adDate = 7 -Global Const $ADOENUM_adDBDate = 133 -Global Const $ADOENUM_adDBTime = 134 -Global Const $ADOENUM_adDBTimeStamp = 135 -Global Const $ADOENUM_adDecimal = 14 -Global Const $ADOENUM_adDouble = 5 -Global Const $ADOENUM_adEmpty = 0 -Global Const $ADOENUM_adError = 10 -Global Const $ADOENUM_adFileTime = 64 -Global Const $ADOENUM_adGUID = 72 -Global Const $ADOENUM_adIDispatch = 9 -Global Const $ADOENUM_adInteger = 3 -Global Const $ADOENUM_adIUnknown = 13 -Global Const $ADOENUM_adLongVarBinary = 205 -Global Const $ADOENUM_adLongVarChar = 201 -Global Const $ADOENUM_adLongVarWChar = 203 -Global Const $ADOENUM_adNumeric = 131 -Global Const $ADOENUM_adPropVariant = 138 -Global Const $ADOENUM_adSingle = 4 -Global Const $ADOENUM_adSmallInt = 2 -Global Const $ADOENUM_adTinyInt = 16 -Global Const $ADOENUM_adUnsignedBigInt = 21 -Global Const $ADOENUM_adUnsignedInt = 19 -Global Const $ADOENUM_adUnsignedSmallInt = 18 -Global Const $ADOENUM_adUnsignedTinyInt = 17 -Global Const $ADOENUM_adUserDefined = 132 -Global Const $ADOENUM_adVarBinary = 204 -Global Const $ADOENUM_adVarChar = 200 -Global Const $ADOENUM_adVariant = 12 -Global Const $ADOENUM_adVarNumeric = 139 -Global Const $ADOENUM_adVarWChar = 202 -Global Const $ADOENUM_adWChar = 130 - -; EditModeEnum -Global Const $ADOENUM_adEditNone = 0 -Global Const $ADOENUM_adEditInProgress = 1 -Global Const $ADOENUM_adEditAdd = 2 -Global Const $ADOENUM_adEditDelete = 4 - -; ErrorValueEnum ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms681549(v=vs.85).aspx - -#CS - Global Const $ADOENUM_adErrBoundToCommand = 3707 - Global Const $ADOENUM_adErrCannotComplete = 3732 - Global Const $ADOENUM_adErrCantChangeConnection = 3748 - Global Const $ADOENUM_adErrCantChangeProvider = 3220 - Global Const $ADOENUM_adErrCantConvertvalue = 3724 - Global Const $ADOENUM_adErrCantCreate = 3725 - Global Const $ADOENUM_adErrCatalogNotSet = 3747 - Global Const $ADOENUM_adErrColumnNotOnThisRow = 3726 - Global Const $ADOENUM_adErrDataConversion = 3421 - Global Const $ADOENUM_adErrDataOverflow = 3721 - Global Const $ADOENUM_adErrDelResOutOfScope = 3738 - Global Const $ADOENUM_adErrDenyNotSupported = 3750 - Global Const $ADOENUM_adErrDenyTypeNotSupported = 3751 - Global Const $ADOENUM_adErrFeatureNotAvailable = 3251 - Global Const $ADOENUM_adErrFieldsUpdateFailed = 3749 - Global Const $ADOENUM_adErrIllegalOperation = 3219 - Global Const $ADOENUM_adErrIntegrityViolation = 3719 - Global Const $ADOENUM_adErrInTransaction = 3246 - Global Const $ADOENUM_adErrInvalidArgument = 3001 - Global Const $ADOENUM_adErrInvalidConnection = 3709 - Global Const $ADOENUM_adErrInvalidParamInfo = 3708 - Global Const $ADOENUM_adErrInvalidTransaction = 3714 - Global Const $ADOENUM_adErrInvalidURL = 3729 - Global Const $ADOENUM_adErrItemNotFound = 3265 - Global Const $ADOENUM_adErrNoCurrentRecord = 3021 - Global Const $ADOENUM_adErrNotExecuting = 3715 - Global Const $ADOENUM_adErrNotReentrant = 3710 - Global Const $ADOENUM_adErrObjectClosed = 3704 - Global Const $ADOENUM_adErrObjectInCollection = 3367 - Global Const $ADOENUM_adErrObjectNotSet = 3420 - Global Const $ADOENUM_adErrObjectOpen = 3705 - Global Const $ADOENUM_adErrOpeningFile = 3002 - Global Const $ADOENUM_adErrOperationCancelled = 3712 - Global Const $ADOENUM_adErrOutOfSpace = 3734 - Global Const $ADOENUM_adErrPermissionDenied = 3720 - Global Const $ADOENUM_adErrProviderFailed = 3000 - Global Const $ADOENUM_adErrProviderNotFound = 3706 - Global Const $ADOENUM_adErrReadFile = 3003 - Global Const $ADOENUM_adErrResourceExists = 3731 - Global Const $ADOENUM_adErrResourceLocked = 3730 - Global Const $ADOENUM_adErrResourceOutOfScope = 3735 - Global Const $ADOENUM_adErrSchemaViolation = 3722 - Global Const $ADOENUM_adErrSignMismatch = 3723 - Global Const $ADOENUM_adErrStillConnecting = 3713 - Global Const $ADOENUM_adErrStillExecuting = 3711 - Global Const $ADOENUM_adErrTreePermissionDenied = 3728 - Global Const $ADOENUM_adErrUnavailable = 3736 - Global Const $ADOENUM_adErrUnsafeOperation = 3716 - Global Const $ADOENUM_adErrURLDoesNotExist = 3727 - Global Const $ADOENUM_adErrURLNamedRowDoesNotExist = 3737 - Global Const $ADOENUM_adErrVolumeNotFound = 3733 - Global Const $ADOENUM_adErrWriteFile = 3004 - Global Const $ADOENUM_adWrnSecurityDialog = 3717 - Global Const $ADOENUM_adWrnSecurityDialogHeader = 3718 -#CE -Global Const $ADOENUM_adErrProviderFailed = 3000 -Global Const $ADOENUM_adErrInvalidArgument = 3001 -Global Const $ADOENUM_adErrOpeningFile = 3002 -Global Const $ADOENUM_adErrReadFile = 3003 -Global Const $ADOENUM_adErrWriteFile = 3004 -Global Const $ADOENUM_adErrNoCurrentRecord = 3021 -Global Const $ADOENUM_adErrCantChangeProvider = 3220 -Global Const $ADOENUM_adErrInTransaction = 3246 -Global Const $ADOENUM_adErrFeatureNotAvailable = 3251 -Global Const $ADOENUM_adErrItemNotFound = 3265 -Global Const $ADOENUM_adErrObjectInCollection = 3367 -Global Const $ADOENUM_adErrObjectNotSet = 3420 -Global Const $ADOENUM_adErrDataConversion = 3421 -Global Const $ADOENUM_adErrObjectClosed = 3704 -Global Const $ADOENUM_adErrObjectOpen = 3705 -Global Const $ADOENUM_adErrProviderNotFound = 3706 -Global Const $ADOENUM_adErrInvalidParamInfo = 3708 -Global Const $ADOENUM_adErrInvalidConnection = 3709 -Global Const $ADOENUM_adErrNotReentrant = 3710 -Global Const $ADOENUM_adErrStillExecuting = 3711 -Global Const $ADOENUM_adErrOperationCancelled = 3712 -Global Const $ADOENUM_adErrStillConnecting = 3713 -Global Const $ADOENUM_adErrInvalidTransaction = 3714 -Global Const $ADOENUM_adErrNotExecuting = 3715 -Global Const $ADOENUM_adErrUnsafeOperation = 3716 -Global Const $ADOENUM_adWrnSecurityDialog = 3717 -Global Const $ADOENUM_adWrnSecurityDialogHeader = 3718 -Global Const $ADOENUM_adErrIntegrityViolation = 3719 -Global Const $ADOENUM_adErrPermissionDenied = 3720 -Global Const $ADOENUM_adErrDataOverflow = 3721 -Global Const $ADOENUM_adErrSchemaViolation = 3722 -Global Const $ADOENUM_adErrSignMismatch = 3723 -Global Const $ADOENUM_adErrCantConvertvalue = 3724 -Global Const $ADOENUM_adErrCantCreate = 3725 -Global Const $ADOENUM_adErrColumnNotOnThisRow = 3726 -Global Const $ADOENUM_adErrURLDoesNotExist = 3727 -Global Const $ADOENUM_adErrTreePermissionDenied = 3728 -Global Const $ADOENUM_adErrInvalidURL = 3729 -Global Const $ADOENUM_adErrResourceLocked = 3730 -Global Const $ADOENUM_adErrResourceExists = 3731 -Global Const $ADOENUM_adErrCannotComplete = 3732 -Global Const $ADOENUM_adErrVolumeNotFound = 3733 -Global Const $ADOENUM_adErrOutOfSpace = 3734 -Global Const $ADOENUM_adErrResourceOutOfScope = 3735 -Global Const $ADOENUM_adErrUnavailable = 3736 -Global Const $ADOENUM_adErrURLNamedRowDoesNotExist = 3737 -Global Const $ADOENUM_adErrDelResOutOfScope = 3738 -Global Const $ADOENUM_adErrCatalogNotSet = 3747 -Global Const $ADOENUM_adErrCantChangeConnection = 3748 -Global Const $ADOENUM_adErrFieldsUpdateFailed = 3749 -Global Const $ADOENUM_adErrDenyTypeNotSupported = 3751 - -; EventReasonEnum -Global Const $ADOENUM_adRsnAddNew = 1 -Global Const $ADOENUM_adRsnDelete = 2 -Global Const $ADOENUM_adRsnUpdate = 3 -Global Const $ADOENUM_adRsnUndoUpdate = 4 -Global Const $ADOENUM_adRsnUndoAddNew = 5 -Global Const $ADOENUM_adRsnUndoDelete = 6 -Global Const $ADOENUM_adRsnRequery = 7 -Global Const $ADOENUM_adRsnResynch = 8 -Global Const $ADOENUM_adRsnClose = 9 -Global Const $ADOENUM_adRsnMove = 10 -Global Const $ADOENUM_adRsnFirstChange = 11 -Global Const $ADOENUM_adRsnMoveFirst = 12 -Global Const $ADOENUM_adRsnMoveNext = 13 -Global Const $ADOENUM_adRsnMovePrevious = 14 -Global Const $ADOENUM_adRsnMoveLast = 15 - -; EventStatusEnum -Global Const $ADOENUM_adStatusOK = 1 -Global Const $ADOENUM_adStatusErrorsOccurred = 2 -Global Const $ADOENUM_adStatusCantDeny = 3 -Global Const $ADOENUM_adStatusCancel = 4 -Global Const $ADOENUM_adStatusUnwantedEvent = 5 - -; ExecuteOptionEnum -Global Const $ADOENUM_adAsyncExecute = 0x10 -Global Const $ADOENUM_adAsyncFetch = 0x20 -Global Const $ADOENUM_adAsyncFetchNonBlocking = 0x40 -Global Const $ADOENUM_adExecuteNoRecords = 0x80 -Global Const $ADOENUM_adExecuteStream = 0x400 -Global Const $ADOENUM_adExecuteRecord = 2048 -Global Const $ADOENUM_adOptionUnspecified = -1 - -; FieldEnum -Global Const $ADOENUM_adDefaultStream = -1 -Global Const $ADOENUM_adRecordURL = -2 - -; FieldAttributeEnum -Global Const $ADOENUM_adFldCacheDeferred = 0x1000 -Global Const $ADOENUM_adFldFixed = 0x10 -Global Const $ADOENUM_adFldIsChapter = 0x2000 -Global Const $ADOENUM_adFldIsCollection = 0x40000 -Global Const $ADOENUM_adFldKeyColumn = 0x8000 -Global Const $ADOENUM_adFldIsDefaultStream = 0x20000 -Global Const $ADOENUM_adFldIsNullable = 0x20 -Global Const $ADOENUM_adFldIsRowURL = 0x10000 -Global Const $ADOENUM_adFldLong = 0x80 -Global Const $ADOENUM_adFldMayBeNull = 0x40 -Global Const $ADOENUM_adFldMayDefer = 0x2 -Global Const $ADOENUM_adFldNegativeScalem = 0x4000 -Global Const $ADOENUM_adFldRowID = 0x100 -Global Const $ADOENUM_adFldRowVersion = 0x200 -Global Const $ADOENUM_adFldUnknownUpdatable = 0x8 -Global Const $ADOENUM_adFldUnspecified = -1 -Global Const $ADOENUM_adFldUpdatable = 0x4 - -; FieldStatusEnum -Global Const $ADOENUM_adFieldOK = 0 -Global Const $ADOENUM_adFieldCantConvertValue = 2 -Global Const $ADOENUM_adFieldIsNull = 3 -Global Const $ADOENUM_adFieldTruncated = 4 -Global Const $ADOENUM_adFieldSignMismatch = 5 -Global Const $ADOENUM_adFieldDataOverflow = 6 -Global Const $ADOENUM_adFieldCantCreate = 7 -Global Const $ADOENUM_adFieldUnavailable = 8 -Global Const $ADOENUM_adFieldIntegrityViolation = 10 -Global Const $ADOENUM_adFieldSchemaViolation = 11 -Global Const $ADOENUM_adFieldBadStatus = 12 -Global Const $ADOENUM_adFieldDefault = 13 -Global Const $ADOENUM_adFieldIgnore = 15 -Global Const $ADOENUM_adFieldDoesNotExist = 16 -Global Const $ADOENUM_adFieldInvalidURL = 17 -Global Const $ADOENUM_adFieldResourceLocked = 18 -Global Const $ADOENUM_adFieldResourceExists = 19 -Global Const $ADOENUM_adFieldCannotComplete = 20 -Global Const $ADOENUM_adFieldVolumeNotFound = 21 -Global Const $ADOENUM_adFieldOutOfSpace = 22 -Global Const $ADOENUM_adFieldCannotDeleteSource = 23 -Global Const $ADOENUM_adFieldResourceOutOfScope = 25 -Global Const $ADOENUM_adFieldAlreadyExists = 26 -Global Const $ADOENUM_adFieldPendingChange = 0x40000 -Global Const $ADOENUM_adFieldPendingDelete = 0x20000 -Global Const $ADOENUM_adFieldPendingInsert = 0x10000 -Global Const $ADOENUM_adFieldPendingUnknown = 0x80000 -Global Const $ADOENUM_adFieldPendingUnknownDelete = 0x100000 -Global Const $ADOENUM_adFieldPermissionDenied = 0x9 -Global Const $ADOENUM_adFieldReadOnly = 0x24 - -; FilterGroupEnum -Global Const $ADOENUM_adFilterNone = 0 -Global Const $ADOENUM_adFilterPendingRecords = 1 -Global Const $ADOENUM_adFilterAffectedRecords = 2 -Global Const $ADOENUM_adFilterFetchedRecords = 3 -Global Const $ADOENUM_adFilterConflictingRecords = 5 - -; GetRowsOptionEnum -Global Const $ADOENUM_adGetRowsRest = -1 - -; IsolationLevelEnum -Global Const $ADOENUM_adXactUnspecified = -1 -Global Const $ADOENUM_adXactChaos = 16 -Global Const $ADOENUM_adXactBrowse = 256 -Global Const $ADOENUM_adXactReadUncommitted = 256 -Global Const $ADOENUM_adXactCursorStability = 4096 -Global Const $ADOENUM_adXactReadCommitted = 4096 -Global Const $ADOENUM_adXactRepeatableRead = 65536 -Global Const $ADOENUM_adXactIsolated = 1048576 -Global Const $ADOENUM_adXactSerializable = 1048576 - -; LineSeparatorsEnum -Global Const $ADOENUM_adCRLF = -1 -Global Const $ADOENUM_adLF = 10 -Global Const $ADOENUM_adCR = 13 - -; LockTypeEnum -Global Const $ADOENUM_adLockUnspecified = -1 -Global Const $ADOENUM_adLockReadOnly = 1 -Global Const $ADOENUM_adLockPessimistic = 2 -Global Const $ADOENUM_adLockOptimistic = 3 -Global Const $ADOENUM_adLockBatchOptimistic = 4 - -; MarshalOptionsEnum -Global Const $ADOENUM_adMarshalAll = 0 -Global Const $ADOENUM_adMarshalModifiedOnly = 1 - -; MoveRecordOptionsEnum -Global Const $ADOENUM_adMoveUnspecified = -1 -Global Const $ADOENUM_adMoveOverWrite = 1 -Global Const $ADOENUM_adMoveDontUpdateLinks = 2 -Global Const $ADOENUM_adMoveAllowEmulation = 4 - -;~ ObjectStateEnum -;~ https://msdn.microsoft.com/en-us/library/windows/desktop/ms675546(v=vs.85).aspx -Global Const $ADOENUM_adStateClosed = 0 ; The object is closed -Global Const $ADOENUM_adStateOpen = 1 ; The object is open -Global Const $ADOENUM_adStateConnecting = 2 ; The object is connecting -Global Const $ADOENUM_adStateExecuting = 4 ; The object is executing a command -Global Const $ADOENUM_adStateFetching = 8 ; The rows of the object are being retrieved - -; ParameterAttributesEnum -Global Const $ADOENUM_adParamSigned = 16 -Global Const $ADOENUM_adParamNullable = 64 -Global Const $ADOENUM_adParamLong = 128 - -; ParameterDirectionEnum -Global Const $ADOENUM_adParamUnknown = 0 -Global Const $ADOENUM_adParamInput = 1 -Global Const $ADOENUM_adParamOutput = 2 -Global Const $ADOENUM_adParamInputOutput = 3 -Global Const $ADOENUM_adParamReturnValue = 4 - -; PersistFormatEnum -Global Const $ADOENUM_adPersistADTG = 0 -;!!!! -Global Const $ADOENUM_adPersistADO = 1 -;!!!! -Global Const $ADOENUM_adPersistXML = 1 -Global Const $ADOENUM_adPersistProviderSpecific = 2 - -; PositionEnum -Global Const $ADOENUM_adPosEOF = -3 -Global Const $ADOENUM_adPosBOF = -2 -Global Const $ADOENUM_adPosUnknown = -1 - -; PropertyAttributesEnum -Global Const $ADOENUM_adPropNotSupported = 0 -Global Const $ADOENUM_adPropRequired = 1 -Global Const $ADOENUM_adPropOptional = 2 -Global Const $ADOENUM_adPropRead = 512 -Global Const $ADOENUM_adPropWrite = 1024 - -; RecordCreateOptionsEnum -Global Const $ADOENUM_adFailIfNotExists = -1 -Global Const $ADOENUM_adCreateNonCollection = 0 -Global Const $ADOENUM_adCreateCollection = 0x2000 -Global Const $ADOENUM_adCreateOverwrite = 0x4000000 -Global Const $ADOENUM_adCreateStructDoc = 0x80000000 -Global Const $ADOENUM_adOpenIfExists = 0x2000000 - -; RecordOpenOptionsEnum -Global Const $ADOENUM_adDelayFetchFields = 0x8000 -Global Const $ADOENUM_adDelayFetchStream = 0x4000 -Global Const $ADOENUM_adOpenAsync = 0x1000 -Global Const $ADOENUM_adOpenExecuteCommand = 0x10000 -Global Const $ADOENUM_adOpenRecordUnspecified = -1 -Global Const $ADOENUM_adOpenOutput = 0x800000 - -; RecordStatusEnum -Global Const $ADOENUM_adRecCanceled = 0x100 -Global Const $ADOENUM_adRecCantRelease = 0x400 -Global Const $ADOENUM_adRecConcurrencyViolation = 0x800 -Global Const $ADOENUM_adRecDBDeleted = 0x40000 -Global Const $ADOENUM_adRecDeleted = 0x4 -Global Const $ADOENUM_adRecIntegrityViolation = 0x1000 -Global Const $ADOENUM_adRecInvalid = 0x10 -Global Const $ADOENUM_adRecMaxChangesExceeded = 0x2000 -Global Const $ADOENUM_adRecModified = 0x2 -Global Const $ADOENUM_adRecMultipleChanges = 0x40 -Global Const $ADOENUM_adRecNew = 0x1 -Global Const $ADOENUM_adRecObjectOpen = 0x4000 -Global Const $ADOENUM_adRecOK = 0 -Global Const $ADOENUM_adRecOutOfMemory = 0x8000 -Global Const $ADOENUM_adRecPendingChanges = 0x80 -Global Const $ADOENUM_adRecPermissionDenied = 0x10000 -Global Const $ADOENUM_adRecSchemaViolation = 0x20000 -Global Const $ADOENUM_adRecUnmodified = 0x8 - -; RecordTypeEnum -Global Const $ADOENUM_adSimpleRecord = 0 -Global Const $ADOENUM_adCollectionRecord = 1 -Global Const $ADOENUM_adRecordUnknown = -1 -Global Const $ADOENUM_adStructDoc = 2 - -; ResyncEnum -Global Const $ADOENUM_adResyncUnderlyingValues = 1 -Global Const $ADOENUM_adResyncAllValues = 2 - -; SaveOptionsEnum -Global Const $ADOENUM_adSaveCreateNotExist = 1 -Global Const $ADOENUM_adSaveCreateOverWrite = 2 - -; SchemaEnum -; https://msdn.microsoft.com/en-us/library/ms675274(v=vs.85).aspx -Global Const $ADOENUM_adSchemaProviderSpecific = -1 -Global Const $ADOENUM_adSchemaAsserts = 0 -Global Const $ADOENUM_adSchemaCatalogs = 1 -Global Const $ADOENUM_adSchemaCharacterSets = 2 -Global Const $ADOENUM_adSchemaCollations = 3 -Global Const $ADOENUM_adSchemaCheckConstraints = 5 -Global Const $ADOENUM_adSchemaColumns = 4 -Global Const $ADOENUM_adSchemaConstraintColumnUsage = 6 -Global Const $ADOENUM_adSchemaConstraintTableUsage = 7 -Global Const $ADOENUM_adSchemaKeyColumnUsage = 8 -Global Const $ADOENUM_adSchemaReferentialConstraints = 9 -Global Const $ADOENUM_adSchemaTableConstraints = 10 -Global Const $ADOENUM_adSchemaColumnsDomainUsage = 11 -Global Const $ADOENUM_adSchemaIndexes = 12 -Global Const $ADOENUM_adSchemaColumnPrivileges = 13 -Global Const $ADOENUM_adSchemaTablePrivileges = 14 -Global Const $ADOENUM_adSchemaUsagePrivileges = 15 -Global Const $ADOENUM_adSchemaProcedures = 16 -Global Const $ADOENUM_adSchemaSchemata = 17 -Global Const $ADOENUM_adSchemaSQLLanguages = 18 -Global Const $ADOENUM_adSchemaStatistics = 19 -Global Const $ADOENUM_adSchemaTables = 20 -Global Const $ADOENUM_adSchemaTranslations = 21 -Global Const $ADOENUM_adSchemaProviderTypes = 22 -Global Const $ADOENUM_adSchemaViews = 23 -Global Const $ADOENUM_adSchemaViewColumnUsage = 24 -Global Const $ADOENUM_adSchemaViewTableUsage = 25 -Global Const $ADOENUM_adSchemaProcedureParameters = 26 -Global Const $ADOENUM_adSchemaForeignKeys = 27 -Global Const $ADOENUM_adSchemaPrimaryKeys = 28 -Global Const $ADOENUM_adSchemaProcedureColumns = 29 -Global Const $ADOENUM_adSchemaDBInfoKeywords = 30 -Global Const $ADOENUM_adSchemaDBInfoLiterals = 31 -Global Const $ADOENUM_adSchemaCubes = 32 -Global Const $ADOENUM_adSchemaDimensions = 33 -Global Const $ADOENUM_adSchemaHierarchies = 34 -Global Const $ADOENUM_adSchemaLevels = 35 -Global Const $ADOENUM_adSchemaMeasures = 36 -Global Const $ADOENUM_adSchemaProperties = 37 -Global Const $ADOENUM_adSchemaMembers = 38 -Global Const $ADOENUM_adSchemaTrustees = 39 - -; SearchDirectionEnum -; https://msdn.microsoft.com/en-us/library/ms676696(v=vs.85).aspx -Global Const $ADOENUM_adSearchBackward = -1 -Global Const $ADOENUM_adSearchForward = 1 - -; SeekEnum -; https://msdn.microsoft.com/en-us/library/ms681524(v=vs.85).aspx -Global Const $ADOENUM_adSeekFirstEQ = 1 -Global Const $ADOENUM_adSeekLastEQ = 2 -Global Const $ADOENUM_adSeekAfterEQ = 4 -Global Const $ADOENUM_adSeekAfter = 8 -Global Const $ADOENUM_adSeekBeforeEQ = 16 -Global Const $ADOENUM_adSeekBefore = 32 - -; StreamOpenOptionsEnum -; https://msdn.microsoft.com/en-us/library/ms676706(v=vs.85).aspx -Global Const $ADOENUM_adOpenStreamUnspecified = -1 -Global Const $ADOENUM_adOpenStreamAsync = 1 -Global Const $ADOENUM_adOpenStreamFromRecord = 4 - -; StreamReadEnum -; https://msdn.microsoft.com/en-us/library/ms679794(v=vs.85).aspx -Global Const $ADOENUM_adReadLine = -2 -Global Const $ADOENUM_adReadAll = -1 - -; StreamTypeEnum -; https://msdn.microsoft.com/en-us/library/ms675277(v=vs.85).aspx -Global Const $ADOENUM_adTypeBinary = 1 -Global Const $ADOENUM_adTypeText = 2 - -; StreamWriteEnum -; https://msdn.microsoft.com/en-us/library/ms678072(v=vs.85).aspx -Global Const $ADOENUM_adWriteChar = 0 -Global Const $ADOENUM_adWriteLine = 1 - -; StringFormatEnum -Global Const $ADOENUM_adClipString = 2 - -; XactAttributeEnum -Global Const $ADOENUM_adXactCommitRetaining = 131072 -Global Const $ADOENUM_adXactAbortRetaining = 262144 - - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _ADO_ERROR_GetErrorInfo -; Description ...: -; Syntax ........: _ADO_ERROR_Description($iError) -; Parameters ....: $iError - an integer value. -; Return values .: $sDescription -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681549(v=vs.85).aspx -; Example .......: No -; =============================================================================================================================== -Func _ADO_ERROR_GetErrorInfo($iError) - Local $sDescription = '' - Switch $iError - Case $ADOENUM_adErrProviderFailed - $sDescription = "Provider failed to perform the requested operation." - Case $ADOENUM_adErrInvalidArgument - $sDescription = "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. This error is often caused by a typographical error in an SQL SELECT statement. For example, a misspelled field name or table name can generate this error. This error can also occur when a field or table named in a SELECT statement does not exist in the data store." - Case $ADOENUM_adErrOpeningFile - $sDescription = "File could not be opened. A misspelled file name was specified, or a file has been moved, renamed, or deleted. Over a network, the drive might be temporarily unavailable or network traffic might be preventing a connection." - Case $ADOENUM_adErrReadFile - $sDescription = "File could not be read. The name of the file is specified incorrectly, the file might have been moved or deleted, or the file might have become corrupted." - Case $ADOENUM_adErrWriteFile - $sDescription = "Write to file failed. You might have closed a file and then tried to write to it, or the file might be corrupted. If the file is located on a network drive, transient network conditions might prevent writing to a network drive." - Case $ADOENUM_adErrNoCurrentRecord - $sDescription = "Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. 3219 adErrIllegalOperation Operation is not allowed in this context." - Case $ADOENUM_adErrCantChangeProvider - $sDescription = "Supplied provider is different from the one already in use." - Case $ADOENUM_adErrInTransaction - $sDescription = "Connection object cannot be explicitly closed while in a transaction. A Recordset or Connection object that is currently participating in a transaction cannot be closed. Call either RollbackTrans or CommitTrans before closing the object." - Case $ADOENUM_adErrFeatureNotAvailable - $sDescription = "The object or provider is not capable of performing the requested operation. Some operations depend on a particular provider version." - Case $ADOENUM_adErrItemNotFound - $sDescription = "Item cannot be found in the collection corresponding to the requested name or ordinal. An incorrect field or table name has been specified." - Case $ADOENUM_adErrObjectInCollection - $sDescription = "Object is already in collection. Cannot append. An object cannot be added to the same collection twice." - Case $ADOENUM_adErrObjectNotSet - $sDescription = "Object is no longer valid." - Case $ADOENUM_adErrDataConversion - $sDescription = "Application uses a value of the wrong type for the current operation. You might have supplied a string to an operation that expects a stream, for example." - Case $ADOENUM_adErrObjectClosed - $sDescription = "Operation is not allowed when the object is closed. TheConnection or Recordset has been closed. For example, some other routine might have closed a global object. You can prevent this error by checking the State property before you attempt an operation." - Case $ADOENUM_adErrObjectOpen - $sDescription = "Operation is not allowed when the object is open. An object that is open cannot be opened. Fields cannot be appended to an open Recordset." - Case $ADOENUM_adErrProviderNotFound - $sDescription = "Provider cannot be found. It may not be properly installed. 3707 adErrBoundToCommand The ActiveConnection property of a Recordset object, which has a Command object as its source, cannot be changed. The application attempted to assign a newConnection object to a Recordset that has a Commandobject as its source." - Case $ADOENUM_adErrInvalidParamInfo - $sDescription = "Parameter object is improperly defined. Inconsistent or incomplete information was provided." - Case $ADOENUM_adErrInvalidConnection - $sDescription = "The connection cannot be used to perform this operation. It is either closed or invalid in this context." - Case $ADOENUM_adErrNotReentrant - $sDescription = "Operation cannot be performed while processing event. An operation cannot be performed within an event handler that causes the event to fire again. For example, navigation methods should not be called from within aWillMove event handler." - Case $ADOENUM_adErrStillExecuting - $sDescription = "Operation cannot be performed while executing asynchronously." - Case $ADOENUM_adErrOperationCancelled - $sDescription = "Operation has been canceled by the user. The application has called the CancelUpdate or CancelBatch method and the current operation has been canceled." - Case $ADOENUM_adErrStillConnecting - $sDescription = "Operation cannot be performed while connecting asynchronously." - Case $ADOENUM_adErrInvalidTransaction - $sDescription = "Coordinating transaction is invalid or has not started." - Case $ADOENUM_adErrNotExecuting - $sDescription = "Operation cannot be performed while not executing." - Case $ADOENUM_adErrUnsafeOperation - $sDescription = "Safety settings on this computer prohibit accessing a data source on another domain." - Case $ADOENUM_adWrnSecurityDialog - $sDescription = "For internal use only. Don't use. (Entry was included for the sake of completeness. This error should not appear in your code.)" - Case $ADOENUM_adWrnSecurityDialogHeader - $sDescription = "For internal use only. Don't use. (Entry included for the sake of completeness. This error should not appear in your code.)" - Case $ADOENUM_adErrIntegrityViolation - $sDescription = "Data value conflicts with the integrity constraints of the field. A new value for a Field would cause a duplicate key. A value that forms one side of a relationship between two records might not be updatable." - Case $ADOENUM_adErrPermissionDenied - $sDescription = "Insufficient permission prevents writing to the field. The user named in the connection string does not have the proper permissions to write to a Field." - Case $ADOENUM_adErrDataOverflow - $sDescription = "Data value is too large to be represented by the field data type. A numeric value that is too large for the intended field was assigned. For example, a long integer value was assigned to a short integer field." - Case $ADOENUM_adErrSchemaViolation - $sDescription = "Data value conflicts with the data type or constraints of the field. The data store has validation constraints that differ from the Field value." - Case $ADOENUM_adErrSignMismatch - $sDescription = "Conversion failed because the data value was signed and the field data type used by the provider was unsigned." - Case $ADOENUM_adErrCantConvertvalue - $sDescription = "Data value cannot be converted for reasons other than sign mismatch or data overflow. For example, conversion would have truncated data." - Case $ADOENUM_adErrCantCreate - $sDescription = "Data value cannot be set or retrieved because the field data type was unknown, or the provider had insufficient resources to perform the operation." - Case $ADOENUM_adErrColumnNotOnThisRow - $sDescription = "Record does not contain this field. An incorrect field name was specified or a field not in the Fields collection of the current record was referenced." - Case $ADOENUM_adErrURLDoesNotExist - $sDescription = "Either the source URL or the parent of the destination URL does not exist. There is a typographical error in either the source or destination URL. You might havehttp://mysite/photo/myphoto.jpg when you should actually have http://mysite/photos/myphoto.jpginstead. The typographical error in the parent URL (in this case, photo instead of photos) has caused the error." - Case $ADOENUM_adErrTreePermissionDenied - $sDescription = "Permissions are insufficient to access tree or subtree. The user named in the connection string does not have the appropriate permissions." - Case $ADOENUM_adErrInvalidURL - $sDescription = "URL contains invalid characters. Make sure the URL is typed correctly. The URL follows the scheme registered to the current provider (for example, Internet Publishing Provider is registered for http)." - Case $ADOENUM_adErrResourceLocked - $sDescription = "Object represented by the specified URL is locked by one or more other processes. Wait until the process has finished and attempt the operation again. The object you are trying to access has been locked by another user or by another process in your application. This is most likely to arise in a multi-user environment." - Case $ADOENUM_adErrResourceExists - $sDescription = "Copy operation cannot be performed. Object named by destination URL already exists. Specify adCopyOverwriteto replace the object. If you do not specifyadCopyOverwrite when copying the files in a directory, the copy fails when you try to copy an item that already exists in the destination location." - Case $ADOENUM_adErrCannotComplete - $sDescription = "The server cannot complete the operation. This might be because the server is busy with other operations or it might be low on resources." - Case $ADOENUM_adErrVolumeNotFound - $sDescription = "Provider cannot locate the storage device indicated by the URL. Make sure the URL is typed correctly. The URL of the storage device might be incorrect, but this error can occur for other reasons. The device might be offline or a large volume of network traffic might prevent the connection from being made." - Case $ADOENUM_adErrOutOfSpace - $sDescription = "Operation cannot be performed. Provider cannot obtain enough storage space. There might not be enough RAM or hard-drive space for temporary files on the server." - Case $ADOENUM_adErrResourceOutOfScope - $sDescription = "Source or destination URL is outside the scope of the current record." - Case $ADOENUM_adErrUnavailable - $sDescription = "Operation failed to complete and the status is unavailable. The field may be unavailable or the operation was not attempted. Another user might have changed or deleted the field you are trying to access." - Case $ADOENUM_adErrURLNamedRowDoesNotExist - $sDescription = "Record named by this URL does not exist. While attempting to open a file using a Record object, either the file name or the path to the file was misspelled." - Case $ADOENUM_adErrDelResOutOfScope - $sDescription = "The URL of the object to be deleted is outside the scope of the current record." - Case $ADOENUM_adErrCatalogNotSet - $sDescription = "Operation requires a valid ParentCatalog." - Case $ADOENUM_adErrCantChangeConnection - $sDescription = "Connection was denied. The new connection you requested has different characteristics than the one already in use." - Case $ADOENUM_adErrFieldsUpdateFailed - $sDescription = "Fields update failed. For further information, examine theStatus property of individual field objects. This error can occur in two situations: when changing a Field object's value in the process of changing or adding a record to the database; and when changing the properties of the Fieldobject itself. 3750 adErrDenyNotSupported Provider does not support sharing restrictions. An attempt was made to restrict file sharing and your provider does not support the concept." - Case $ADOENUM_adErrDenyTypeNotSupported - $sDescription = "Provider does not support the requested kind of sharing restriction. An attempt was made to establish a particular type of file-sharing restriction that is not supported by your provider. See the provider's documentation to determine what file-sharing restrictions are supported." - EndSwitch - Return $sDescription -EndFunc ;==>_ADO_ERROR_GetErrorInfo diff --git a/Include/_MyFunction.au3 b/Include/_MyFunction.au3 index 619e750..5ee44c5 100644 --- a/Include/_MyFunction.au3 +++ b/Include/_MyFunction.au3 @@ -124,21 +124,72 @@ Func _LOG($iMessage = "", $iLOGType = 0, $iLOGPath = @ScriptDir & "\Log.txt") ConsoleWrite("+" & $iMessage & @CRLF) Case 2 If $iLOGType <= $iVerboseLVL Then - FileWrite($iLOGPath, $iTimestamp & "--------------------------------------------------------------------------------" & @CRLF) FileWrite($iLOGPath, $iTimestamp & "/!\ " & $iMessage & @CRLF) - FileWrite($iLOGPath, $iTimestamp & "--------------------------------------------------------------------------------" & @CRLF) EndIf ConsoleWrite("!" & $iMessage & @CRLF) Case 3 - If $iLOGType <= $iVerboseLVL Then - FileWrite($iLOGPath, $iTimestamp & "--------------------------------------------------------------------------------" & @CRLF) - FileWrite($iLOGPath, $iTimestamp & $iMessage & @CRLF) - FileWrite($iLOGPath, $iTimestamp & "--------------------------------------------------------------------------------" & @CRLF) - EndIf +;~ FileWrite($iLOGPath, $iTimestamp & $iMessage & @CRLF) ConsoleWrite(">----" & $iMessage & @CRLF) EndSwitch EndFunc ;==>_LOG +; #FUNCTION# ==================================================================================================================== +; Name ..........: _LOG_Array +; Description ...: Print an array to the console. +; Syntax ........: _LOG_Array(Const Byref $aArray[, $iBase = Default[, $iUBound = Default[, $sDelimeter = "|"]]]) +; Parameters ....: $aArray - [in/out and const] The array to be written to the file. +; $iBase - [optional] Start array index to read, normally set to 0 or 1. Default is 0. +; $iUBound - [optional] Set to the last record you want to write to the File. Default is whole array. +; $sDelimeter - [optional] Delimiter character(s) for 2-dimension arrays. Default is "|". +; Return values .: Success - 1 +; Failure - 0 and sets @error to non-zero +; |@error: +; |1 - Input is not an array. +; |2 - Array dimension is greater than 2. +; |3 - Start index is greater than the size of the array. +; Author ........: guinness +; Modified ......: +; Remarks .......: +; Related .......: _FileWriteFromArray +; Link ..........: +; Example .......: Yes +; =============================================================================================================================== +Func _LOG_Array($aArray, $iBase = Default, $iUBound = Default, $sDelimeter = "|", $iLOGPath = @ScriptDir & "\Log.txt") + ; Check if we have a valid array as input + If Not IsArray($aArray) Then Return SetError(1, 0, 0) + + ; Check the number of dimensions + Local $iDims = UBound($aArray, 0) + If $iDims > 2 Then Return SetError(2, 0, 0) + + ; Determine last entry of the array + Local $iLast = UBound($aArray) - 1 + If $iUBound = Default Or $iUBound > $iLast Then $iUBound = $iLast + If $iBase < 0 Or $iBase = Default Then $iBase = 0 + If $iBase > $iUBound Then Return SetError(3, 0, 0) + + If $sDelimeter = Default Then $sDelimeter = "|" + + ; Write array data to the console + Switch $iDims + Case 1 + For $I = $iBase To $iUBound + _LOG("[" & $I - $iBase & "] " & $aArray[$I], 1, $iLOGPath) + Next + Case 2 + Local $sTemp = "" + Local $iCols = UBound($aArray, 2) + For $I = $iBase To $iUBound + $sTemp = $aArray[$I][0] + For $j = 1 To $iCols - 1 + $sTemp &= $sDelimeter & $aArray[$I][$j] + Next + _LOG("[" & $I - $iBase & "] " & $sTemp, 1, $iLOGPath) + Next + EndSwitch + Return 1 +EndFunc ;==>_LOG_Array + ; #FUNCTION# =================================================================================================== ; Name...........: _Download ; Description ...: Download URL to a file with @Error and TimeOut @@ -155,15 +206,15 @@ EndFunc ;==>_LOG ; Related .......: ; Link ..........; ; Example .......; No -Func _Download($iURL, $iPath, $iTimeOut = "") +Func _Download($iURL, $iPath, $iTimeOut = 20) Local $inetgettime = 0, $aData, $hDownload - If $iTimeOut = "" Then $iTimeOut = 20 $hDownload = InetGet($iURL, $iPath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(250) $inetgettime = $inetgettime + 0.25 If $inetgettime > $iTimeOut Then InetClose($hDownload) + _LOG("File Downloading URL : " & $iURL, 3, $iLOGPath) _LOG("Timed out (" & $inetgettime & "s) for downloading file : " & $iPath, 1, $iLOGPath) Return -2 EndIf @@ -180,12 +231,12 @@ Func _Download($iURL, $iPath, $iTimeOut = "") InetClose($hDownload) If $aData[$INET_DOWNLOADSUCCESS] Then - _LOG("File Downloaded Path : " & $iPath, 1, $iLOGPath) -;~ _LOG("File Downloading URL : " & $iURL, 2, $iLOGPath) - Return $iPath + _LOG("File Downloaded Path : " & $iPath, 1, $iLOGPath) + _LOG("File Downloading URL : " & $iURL, 3, $iLOGPath) + Return $iPath Else _LOG("Error Downloading File : " & $iPath, 2, $iLOGPath) -;~ _LOG("Error Downloading URL : " & $iURL, 2, $iLOGPath) + _LOG("Error Downloading URL : " & $iURL, 3, $iLOGPath) _LOG("Bytes read: " & $aData[$INET_DOWNLOADREAD], 2, $iLOGPath) _LOG("Size: " & $aData[$INET_DOWNLOADSIZE], 2, $iLOGPath) _LOG("Complete: " & $aData[$INET_DOWNLOADCOMPLETE], 2, $iLOGPath) @@ -212,10 +263,8 @@ EndFunc ;==>_Download ; Related .......: ; Link ..........; ; Example .......; No -Func _DownloadWRetry($iURL, $iPath, $iRetry = "", $iTimeOut = "") +Func _DownloadWRetry($iURL, $iPath, $iRetry = 3, $iTimeOut = 20) Local $iCount = 0, $iResult = -1, $vTimer = TimerInit() - If $iRetry = "" Then $iRetry = 3 - If $iTimeOut = "" Then $iTimeOut = 20 While $iResult < 0 And $iCount < $iRetry $iCount = $iCount + 1 $iResult = _Download($iURL, $iPath, $iTimeOut) @@ -762,6 +811,85 @@ Func _GDIPlus_Transparency($iPath, $iTransLvl) Return $iPath EndFunc ;==>_GDIPlus_Transparency +; #FUNCTION# =================================================================================================== +; Name...........: _GDIPlus_Text +; Description ...: Draw Text on picture +; Syntax.........: _GDIPlus_Text($iPath, $iString = '', $iX = 0, $iY = 0, $iFont = 'Arial', $iFontSize = 10, $iFontColor = 0xFFFFFFFF) +; Parameters ....: $iPath - Path to the picture +; $iString - String to draw +; $iX - X position of the text +; $iY - Y position of the text +; $iFont - Font name +; $iFontSize - Font size +; $iFontStyle - Font Style +;~ 0 - Normal weight or thickness of the typeface +;~ 1 - Bold typeface +;~ 2 - Italic typeface +;~ 4 - Underline +;~ 8 - Strikethrough +; $iFontColor - Font Color +; Return values .: Success - Return the Path of the Picture +; Failure - -1 +; Author ........: Screech +; Modified.......: +;; Related .......: +; Link ..........; +; Example .......; No +Func _GDIPlus_Text($iPath, $iString = '', $iX = 0, $iY = 0, $iFont = 'Arial', $iFontSize = 10, $iFontStyle = 0, $iFontColor = 0xFFFFFFFF) +;~ MsgBox(0,"DEBUG","_GDIPlus_Text");Debug + Local $hImage, $ImageWidth, $ImageHeight, $hGui, $hGraphicGUI, $hBMPBuff, $hGraphic + Local $hFamily, $hFont, $tLayout, $hFormat, $hBrush, $hPen, $aInfo + Local $MergedImageBackgroundColor = 0x00000000 + Local $sDrive, $sDir, $sFileName, $iExtension, $iPath_Temp + _PathSplit($iPath, $sDrive, $sDir, $sFileName, $iExtension) + $iPath_Temp = $sDrive & $sDir & $sFileName & "-TEXT_Temp.PNG" + If _MakeTEMPFile($iPath, $iPath_Temp) = -1 Then Return -1 + $iPath = $sDrive & $sDir & $sFileName & ".png" + _GDIPlus_Startup() + $hImage = _GDIPlus_ImageLoadFromFile($iPath_Temp) + $ImageWidth = _GDIPlus_ImageGetWidth($hImage) + If $ImageWidth = 4294967295 Then $ImageWidth = 0 ;4294967295 en cas d'erreur. + $ImageHeight = _GDIPlus_ImageGetHeight($hImage) + $hGui = GUICreate("", $ImageWidth, $ImageHeight) + $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGui) ;Draw to this graphics, $hGraphicGUI, to display on GUI + $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($ImageWidth, $ImageHeight, $hGraphicGUI) ; $hBMPBuff is a bitmap in memory + $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) ; Draw to this graphics, $hGraphic, being the graphics of $hBMPBuff + _GDIPlus_GraphicsClear($hGraphic, $MergedImageBackgroundColor) ;Fill the Graphic Background (0x00000000 for transparent background in .png files) + _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) + +;~ _GDIPlus_SetSmoothingMode($hGraphic) + + $hFamily = _GDIPlus_FontFamilyCreate($iFont) + $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontStyle) + $tLayout = _GDIPlus_RectFCreate($iX, $iY, $ImageWidth - $iX, $ImageHeight - $iY) +;~ $tLayout = _GDIPlus_RectFCreate(140, 110, 0, 0) + $hFormat = _GDIPlus_StringFormatCreate() ; (2 - text are drawn vertically) + $hBrush = _GDIPlus_BrushCreateSolid($iFontColor) ;0xFFFFFFFF) ; (0x00FFFFFF - fully transparent. Alpha channel zero) +;~ $hPen = _GDIPlus_PenCreate($iFontColor) + $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $iString, $hFont, $tLayout, $hFormat) + _GDIPlus_GraphicsDrawStringEx($hGraphic, $iString, $hFont, $aInfo[0], $hFormat, $hBrush) + + _GDIPlus_ImageSaveToFile($hBMPBuff, $iPath) + +;~ _GDIPlus_PenDispose($hPen) + _GDIPlus_FontDispose($hFont) + _GDIPlus_FontFamilyDispose($hFamily) + _GDIPlus_StringFormatDispose($hFormat) + _GDIPlus_BrushDispose($hBrush) + _GDIPlus_GraphicsDispose($hGraphic) + _GDIPlus_BitmapDispose($hBMPBuff) + _WinAPI_DeleteObject($hBMPBuff) + _GDIPlus_GraphicsDispose($hGraphicGUI) + GUIDelete($hGui) + _GDIPlus_ImageDispose($hImage) + _GDIPlus_Shutdown() + If Not FileDelete($iPath_Temp) Then + _LOG("Error deleting " & $iPath_Temp, 2, $iLOGPath) + Return -1 + EndIf + Return $iPath +EndFunc ;==>_GDIPlus_Text + ; #FUNCTION# =================================================================================================== ; Name...........: _GDIPlus_TransparencyZone ; Description ...: Apply transparency on a picture @@ -1173,7 +1301,7 @@ Func _GDIPlus_Imaging($iPath, $aPicParameters, $vTarget_Width, $vTarget_Height) Case '' $Image_C3Y = $Image_C1Y + $iHeight EndSwitch - Switch $Image_C4X + Switch $Image_C4X Case 'CENTER' $Image_C4X = Int(($vTarget_Width / 2) + ($iWidth / 2)) Case 'LEFT' @@ -1238,109 +1366,109 @@ EndFunc ;==>_GDIPlus_Imaging ; Link ..........; ; Example .......; https://www.autoitscript.com/forum/topic/123623-gdi-image-question/#comment-860805 Func _GDIPlus_GraphicsDrawImage_4Points($hGraphics, $hImage, $X1, $Y1, $X2, $Y2, $X3, $Y3, $X4, $Y4, $fPrecision = 0.25) - ;by eukalyptus - Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0) - If @error Or Not IsArray($aResult) Then Return SetError(1, 1, False) - Local $hPath = $aResult[2] - - Local $iW = _GDIPlus_ImageGetWidth($hImage) - Local $iH = _GDIPlus_ImageGetHeight($hImage) - - If $fPrecision <= 0 Then $fPrecision = 0.01 - If $fPrecision > 1 Then $fPrecision = 1 - - Local $iTX = Ceiling($iW * $fPrecision) - Local $iTY = Ceiling($iH * $fPrecision) - Local $iCnt = ($iTX + 1) * ($iTY + 1) - Local $X, $Y - - Local $tPoints = DllStructCreate("float[" & $iCnt * 2 & "]") - Local $I - For $Y = 0 To $iTY - For $X = 0 To $iTX - $I = ($Y * ($iTX + 1) + $X) * 2 - DllStructSetData($tPoints, 1, $X * $iW / $iTX, $I + 1) - DllStructSetData($tPoints, 1, $Y * $iH / $iTY, $I + 2) - Next - Next - - $aResult = DllCall($__g_hGDIPDll, "uint", "GdipAddPathPolygon", "hwnd", $hPath, "ptr", DllStructGetPtr($tPoints), "int", $iCnt) - If @error Or Not IsArray($aResult) Then Return SetError(1, 2, False) - - Local $tWarp = DllStructCreate("float[8]") - DllStructSetData($tWarp, 1, $X1, 1) - DllStructSetData($tWarp, 1, $Y1, 2) - DllStructSetData($tWarp, 1, $X2, 3) - DllStructSetData($tWarp, 1, $Y2, 4) - DllStructSetData($tWarp, 1, $X3, 5) - DllStructSetData($tWarp, 1, $Y3, 6) - DllStructSetData($tWarp, 1, $X4, 7) - DllStructSetData($tWarp, 1, $Y4, 8) - - $aResult = DllCall($__g_hGDIPDll, "uint", "GdipWarpPath", "hwnd", $hPath, "hwnd", 0, "ptr", DllStructGetPtr($tWarp), "int", 4, "float", 0, "float", 0, "float", $iW, "float", $iH, "int", 0, "float", 0) - If @error Or Not IsArray($aResult) Then Return SetError(1, 3, False) - - $aResult = DllCall($__g_hGDIPDll, "uint", "GdipGetPathPoints", "hwnd", $hPath, "ptr", DllStructGetPtr($tPoints), "int", $iCnt) - If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) - - Local $tRectF = DllStructCreate("float X;float Y;float Width;float Height") - $aResult = DllCall($__g_hGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", DllStructGetPtr($tRectF), "hwnd", 0, "hwnd", 0) - If @error Or Not IsArray($aResult) Then Return SetError(1, 5, False) - - DllCall($__g_hGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath) - - Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics(DllStructGetData($tRectF, 1) + DllStructGetData($tRectF, 3), DllStructGetData($tRectF, 2) + DllStructGetData($tRectF, 4), $hGraphics) - Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) - - Local $tDraw = DllStructCreate("float[6]") - Local $pDraw = DllStructGetPtr($tDraw) - Local $W = $iW / $iTX - Local $H = $iH / $iTY - Local $iO = ($iTX + 1) * 2 - Local $fX1, $fY1, $fX2, $fY2, $fX3, $fY3, $fSX, $fSY - - For $Y = 0 To $iTY - 1 - For $X = 0 To $iTX - 1 - $I = ($Y * ($iTX + 1) + $X) * 2 - $fX1 = DllStructGetData($tPoints, 1, $I + 1) - $fY1 = DllStructGetData($tPoints, 1, $I + 2) - - Switch $X - Case $iTX - 1 - $fX2 = DllStructGetData($tPoints, 1, $I + 3) - $fY2 = DllStructGetData($tPoints, 1, $I + 4) - $fSX = 1 - Case Else - $fX2 = DllStructGetData($tPoints, 1, $I + 5) - $fY2 = DllStructGetData($tPoints, 1, $I + 6) - $fSX = 2 - EndSwitch - - Switch $Y - Case $iTY - 1 - $fX3 = DllStructGetData($tPoints, 1, $I + 1 + $iO) - $fY3 = DllStructGetData($tPoints, 1, $I + 2 + $iO) - $fSY = 1 - Case Else - $fX3 = DllStructGetData($tPoints, 1, $I + 1 + $iO * 2) - $fY3 = DllStructGetData($tPoints, 1, $I + 2 + $iO * 2) - $fSY = 2 - EndSwitch - - DllStructSetData($tDraw, 1, $fX1, 1) - DllStructSetData($tDraw, 1, $fY1, 2) - DllStructSetData($tDraw, 1, $fX2, 3) - DllStructSetData($tDraw, 1, $fY2, 4) - DllStructSetData($tDraw, 1, $fX3, 5) - DllStructSetData($tDraw, 1, $fY3, 6) - - DllCall($__g_hGDIPDll, "uint", "GdipDrawImagePointsRect", "hwnd", $hContext, "hwnd", $hImage, "ptr", $pDraw, "int", 3, "float", $X * $W, "float", $Y * $H, "float", $W * $fSX, "float", $H * $fSY, "int", 2, "hwnd", 0, "ptr", 0, "ptr", 0) - Next - Next - - _GDIPlus_GraphicsDispose($hContext) - _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) - _GDIPlus_BitmapDispose($hBitmap) + ;by eukalyptus + Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0) + If @error Or Not IsArray($aResult) Then Return SetError(1, 1, False) + Local $hPath = $aResult[2] + + Local $iW = _GDIPlus_ImageGetWidth($hImage) + Local $iH = _GDIPlus_ImageGetHeight($hImage) + + If $fPrecision <= 0 Then $fPrecision = 0.01 + If $fPrecision > 1 Then $fPrecision = 1 + + Local $iTX = Ceiling($iW * $fPrecision) + Local $iTY = Ceiling($iH * $fPrecision) + Local $iCnt = ($iTX + 1) * ($iTY + 1) + Local $x, $Y + + Local $tPoints = DllStructCreate("float[" & $iCnt * 2 & "]") + Local $I + For $Y = 0 To $iTY + For $x = 0 To $iTX + $I = ($Y * ($iTX + 1) + $x) * 2 + DllStructSetData($tPoints, 1, $x * $iW / $iTX, $I + 1) + DllStructSetData($tPoints, 1, $Y * $iH / $iTY, $I + 2) + Next + Next + + $aResult = DllCall($__g_hGDIPDll, "uint", "GdipAddPathPolygon", "hwnd", $hPath, "ptr", DllStructGetPtr($tPoints), "int", $iCnt) + If @error Or Not IsArray($aResult) Then Return SetError(1, 2, False) + + Local $tWarp = DllStructCreate("float[8]") + DllStructSetData($tWarp, 1, $X1, 1) + DllStructSetData($tWarp, 1, $Y1, 2) + DllStructSetData($tWarp, 1, $X2, 3) + DllStructSetData($tWarp, 1, $Y2, 4) + DllStructSetData($tWarp, 1, $X3, 5) + DllStructSetData($tWarp, 1, $Y3, 6) + DllStructSetData($tWarp, 1, $X4, 7) + DllStructSetData($tWarp, 1, $Y4, 8) + + $aResult = DllCall($__g_hGDIPDll, "uint", "GdipWarpPath", "hwnd", $hPath, "hwnd", 0, "ptr", DllStructGetPtr($tWarp), "int", 4, "float", 0, "float", 0, "float", $iW, "float", $iH, "int", 0, "float", 0) + If @error Or Not IsArray($aResult) Then Return SetError(1, 3, False) + + $aResult = DllCall($__g_hGDIPDll, "uint", "GdipGetPathPoints", "hwnd", $hPath, "ptr", DllStructGetPtr($tPoints), "int", $iCnt) + If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) + + Local $tRectF = DllStructCreate("float X;float Y;float Width;float Height") + $aResult = DllCall($__g_hGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", DllStructGetPtr($tRectF), "hwnd", 0, "hwnd", 0) + If @error Or Not IsArray($aResult) Then Return SetError(1, 5, False) + + DllCall($__g_hGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath) + + Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics(DllStructGetData($tRectF, 1) + DllStructGetData($tRectF, 3), DllStructGetData($tRectF, 2) + DllStructGetData($tRectF, 4), $hGraphics) + Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) + + Local $tDraw = DllStructCreate("float[6]") + Local $pDraw = DllStructGetPtr($tDraw) + Local $W = $iW / $iTX + Local $H = $iH / $iTY + Local $iO = ($iTX + 1) * 2 + Local $fX1, $fY1, $fX2, $fY2, $fX3, $fY3, $fSX, $fSY + + For $Y = 0 To $iTY - 1 + For $x = 0 To $iTX - 1 + $I = ($Y * ($iTX + 1) + $x) * 2 + $fX1 = DllStructGetData($tPoints, 1, $I + 1) + $fY1 = DllStructGetData($tPoints, 1, $I + 2) + + Switch $x + Case $iTX - 1 + $fX2 = DllStructGetData($tPoints, 1, $I + 3) + $fY2 = DllStructGetData($tPoints, 1, $I + 4) + $fSX = 1 + Case Else + $fX2 = DllStructGetData($tPoints, 1, $I + 5) + $fY2 = DllStructGetData($tPoints, 1, $I + 6) + $fSX = 2 + EndSwitch + + Switch $Y + Case $iTY - 1 + $fX3 = DllStructGetData($tPoints, 1, $I + 1 + $iO) + $fY3 = DllStructGetData($tPoints, 1, $I + 2 + $iO) + $fSY = 1 + Case Else + $fX3 = DllStructGetData($tPoints, 1, $I + 1 + $iO * 2) + $fY3 = DllStructGetData($tPoints, 1, $I + 2 + $iO * 2) + $fSY = 2 + EndSwitch + + DllStructSetData($tDraw, 1, $fX1, 1) + DllStructSetData($tDraw, 1, $fY1, 2) + DllStructSetData($tDraw, 1, $fX2, 3) + DllStructSetData($tDraw, 1, $fY2, 4) + DllStructSetData($tDraw, 1, $fX3, 5) + DllStructSetData($tDraw, 1, $fY3, 6) + + DllCall($__g_hGDIPDll, "uint", "GdipDrawImagePointsRect", "hwnd", $hContext, "hwnd", $hImage, "ptr", $pDraw, "int", 3, "float", $x * $W, "float", $Y * $H, "float", $W * $fSX, "float", $H * $fSY, "int", 2, "hwnd", 0, "ptr", 0, "ptr", 0) + Next + Next + + _GDIPlus_GraphicsDispose($hContext) + _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) + _GDIPlus_BitmapDispose($hBitmap) EndFunc ;==>_GDIPlus_GraphicsDrawImage_4Points #EndRegion GDI Function @@ -1404,6 +1532,10 @@ Func _XML_Read($iXpath, $iXMLType = 0, $iXMLPath = "", $oXMLDoc = "") Switch $iXMLType Case 0 + If _XML_NodeExists($oXMLDoc, $iXpath) <> $XML_RET_SUCCESS Then + _LOG('_XML_NodeExists ERROR (' & $iXpath & " doesn't exist)", 2, $iLOGPath) + Return "" + EndIf $iXMLValue = _XML_GetValue($oXMLDoc, $iXpath) If @error Then If @error = 21 Then Return "" @@ -1412,7 +1544,7 @@ Func _XML_Read($iXpath, $iXMLType = 0, $iXMLPath = "", $oXMLDoc = "") Return -1 EndIf If IsArray($iXMLValue) And UBound($iXMLValue) - 1 > 0 Then -;~ _LOG('_XML_GetValue (' & $iXpath & ') = ' &$iXMLValue[1], 1, $iLOGPath) + _LOG('...Value..._XML_GetValue (' & $iXpath & ') = ' & $iXMLValue[1], 1, $iLOGPath) Return $iXMLValue[1] Else _LOG('_XML_GetValue (' & $iXpath & ') is not an Array', 2, $iLOGPath) @@ -1434,6 +1566,7 @@ Func _XML_Read($iXpath, $iXMLType = 0, $iXMLPath = "", $oXMLDoc = "") _LOG('_XML_GetNodeAttributeValue @error:' & @CRLF & XML_My_ErrorParser(@error), 3, $iLOGPath) Return -1 EndIf + _LOG('...Attribut..._XML_GetValue (' & $iXpath & ') = ' & $iXMLValue, 1, $iLOGPath) Return $iXMLValue Case Else Return -2 diff --git a/Include/_XML.au3.old.au3 b/Include/_XML.au3.old.au3 deleted file mode 100644 index d44a5ef..0000000 --- a/Include/_XML.au3.old.au3 +++ /dev/null @@ -1,2989 +0,0 @@ -#include-once -;~ #include -#include -#include -#include -#include "ADO_CONSTANTS.au3" - -#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 -#Tidy_Parameters=/sort_funcs /reel - -#Region XML.au3 - UDF Header -; #INDEX# ======================================================================================================================= -; Title .........: XML.au3 -; AutoIt Version : 3.3.10.2++ -; Language ......: English -; Description ...: Functions to use for reading and writing XML using msxml. (UDF based on XMLWrapper.au3) -; Remarks .......: BETA Version -; Author(s) .....: mLipok, Eltorro, Weaponx, drlava, Lukasz Suleja, oblique, Mike Rerick, Tom Hohmann, guinness, GMK -; Version .......: "1.1.1.10" ; _XML_MiscProperty_UDFVersion() - -#CS - This UDF is created on the basis of: - https://www.autoitscript.com/forum/topic/19848-xml-dom-wrapper-com/ - For this reason, I attach also the last known (to me) previous version ($_XMLUDFVER = "1.0.3.98" _XMLDomWrapper_1.0.3.98_CN.au3 ) - For the same reason I continue to recognize the achievements of the work of my predecessors (they are still noted in each Function header). - . - . - . - . !!!!!!!!! This is BETA VERSION (all could be changed) !!!!!!!!! - . - . - . - WORK IN PROGRESS INFORMATION: - . For now 2015-09-01 the descripion (Function Header) can not entirely correctly describe the function. - . TODO: in many places I used "TODO" as a keyword to find what should be done in future - . TO REMOVE _XML_NodeExists(ByRef $oXmlDoc, $sXPath)as is duplicate for _XML_SelectSingleNode($oXmlDoc, $sXPath) - . - I want to: PREVENT THIS: - . The unfortunate nature of both the scripts is that the func return results are strings or arrays instead of objects. - . - I want to: USE THIS CONCEPT: - . All function should use Refernce to the object as first Function parameter - . All function should return in most cases objects. There should be separate functions to Change Object collection to array - . All function should use COM Error Handler in local scope. - . All function should return @error which are defined in Region XMLWrapperEx.au3 - ERROR Enums - . All function should have the same naming convention - . All variables should have the same naming convention - . There should not to be any Global Variable - exception is $__g_oXMLDOM_EventsHandler - . It should be possible easy to use XML DOM Events - . https://msdn.microsoft.com/en-us/library/ms764697(v=vs.85).aspx - . It should be possible easy to Debug - . Ultimately, you should be able to do anything with your XML without having to use your own Error Handler. - - . MAIN MOTTO: "Programs are meant to be read by humans, and only incidentally for computers to execute." - Donald Knuth - -#CE - -#CS - ; !!!!!!!!!!!!!!!! the previous version of UDF - ; Author ........: Stephen Podhajecki - Eltorro - ; Author ........: Weaponx - ; Modified ......: drlava, Lukasz Suleja, oblique, Mike Rerick, Tom Hohmann - ; Initial release Dec. 15, 2005 - - ;; There is also _MSXML.au3 at http://code.google.com/p/my-autoit/source/browse/#svn/trunk/Scripts/MSXML - ;; http://my-autoit.googlecode.com/files/_MSXML.au3 - ;; which return the xml object instead of using a global var. - ;; - ;; Therefore using the one above, more than one xml file can be opened at a time. - ;; The unfortunate nature of both the scripts is that the func return results are strings or arrays instead of objects. - - !!!!!!!!!!!! The following description is intended only to show the extent of the changes that have taken place in relation to the source version of the UDF - !!!!!!!!!!!! PLEASE TREAT THIS AS QUITE NEW UDF - 2015/09/02 - "1.1.1.01" - - . Global Variable renaming: $fXMLAUTOSAVE > $g__bXMLAUTOSAVE - mLipok - . Global Variable renaming: $fADDFORMATTING > $g__bADDFORMATTING - mLipok - . Global Variable renaming: $DOMVERSION > $g__iDOMVERSION - mLipok - . Global Variable renaming: $_XMLUDFVER > $g__sXML_UDF_VERSION - mLipok - - . Local Variable renaming: $fDebug > $bDebug - mLipok - . Local Variable renaming: $strNameSpc > $sNameSpace - mLipok - . Local Variable renaming: $strXPath > $sXPath - mLipok - - . added EventHandler for __XML_DOM_EVENT_onreadystatechange - mLipok - . added EventHandler for __XML_DOM_EVENT_ondataavailable - mLipok - . added EventHandler for __XML_DOM_EVENT_ontransformnode - mLipok - - . _XML_Misc* functions renamed and extended - mLipok - . #Region -- grouping functions - mLipok - . New Enums - Stream Object - ReadText Method - StreamReadEnum - mLipok - . New Enums - readyState Property (DOMDocument) - mLipok - . New Function: __XML_ComErrorHandler_UserFunction - mLipok - . added ADO_CONSTANTS.au3 - mLipok - - ?? - . __XML_ComErrorHandler_InternalFunction() CleanUp - mLipok - . __XML_ComErrorHandler_InternalFunction() new parameters - mLipok - - SCRIPT BREAKING CHANGES - . all function renamed from _XMLSomeName to _XML_SomeName ; TODO not yet all, but that is the plan - mLipok - . Function _DebugWrite renamed to __XML_Misc_ConsoleNotifier - mLipok - . Function _XSL_GetDefaultStyleSheet renamed to __XSL_GetDefaultStyleSheet - mLipok - . Function _XMLGetDomVersion renamed to _XML_Misc_GetDomVersion - mLipok - . Func _SetDebug renamed to _XML_MiscProperty_NotifyToConsole - mLipok - . Removed $fDEBUGGING as is now used inside _XML_MiscProperty_NotifyToConsole - mLipok - . Removed $bXMLAUTOSAVE as is now used inside _XML_MiscProperty_AutoSave - mLipok - . Removed $bADDFORMATTING as is now used inside _XML_MiscProperty_AutoFormat - mLipok - . Removed $g__iDOMVERSION as is now used inside __XML_MiscProperty_DomVersion - mLipok - . standardarization for using Return Value for failure: return 0 and set @error to none 0 - mLipok - . _XML_Load on success return $oXmlDoc instead 1 - mLipok - . _XML_LoadXML on success return $oXmlDoc instead 1 - mLipok - . $oXmlDoc is no longer global variable (must be passed to function as ByRef) - mLipok - . removed many variable declaration used even for variable iteration "For $i to 10" - mLipok - - 2015/09/04 - "1.1.1.02" - . event handler renamed to $__g_oXMLDOM_EventsHandler - mLipok - . added $XMLWRAPPER_ERROR_SAVEFILERO and checking in - mLipok - . if variable is ObjectsCollection then variable name ends with sufix "Coll" - mLipok - . variable used in loops are named with sufix "_idx" like this For $iAttribute_idx = 0 To $oAttributesColl.length - 1 - mLipok - . variable used in loops are named with sufix "Enum" like this For $oNode_enum in $oNodesColl - mLipok - . Local Variable renaming: $strQuery > $sQuery - mLipok - thanks to guinness - . Local Variable renaming: $sComment > $sComment - mLipok - thanks to guinness - . Function renamed fixed typo in function name _XML_CreateAttributeute => _XML_CreateAttribute - mLipok - thanks to guinness - . Function renamed _XML_Misc_NodesList_GetNames >> _XML_Array_GetNodesNamesFromCollection - mLipok - . Global Enum renamed from $g__eXML_ ..... to $__g_eXML_ ..... - mLipok - . Function renamed _XML_ArrayAdd >> _XML_Array_AddName - mLipok - . Function renamed _XML_Misc_NodesColl_GetNamesToArray >> _XML_Array_GetNodesNamesFromCollection - mLipok - . Function renamed _XML_DeleteNode_XML_DeleteNode >> _XML_removeAll - mLipok - . Function renamed _XML_FileOpen >> _XML_Load - mLipok - . new Function _XML_Array_GetNodeList() - mLipok - . UDF FileName: _XMLWrapperEx.au3 >> XMLWrapperEx.au3 - mLipok - . !!! EXAMPLES FILE: XMLWrapperEx__Examples.au3 - mLipok - - 2015/09/06 - "1.1.1.03" - . Renamed Function: _XMLCreateChildWAttr >> _XML_CreateChildWAttr - mLipok - . Renamed ENUMs: $__g_eXML_ERROR ... >> $XMLWRAPPER_ERROR ... - mLipok - Thanks to guinness - . Renamed ENUMs: $__g_eXML_RESULT ... >> $XMLWRAPPER_RESULT ... - mLipok - Thanks to guinness - . Renamed CONST: $XMLDOM_DOCUMENT_READYSTATE_ ... >> $XMLWRAPPER_DOCUMENT_READYSTATE_ ... - mLipok - Thanks to guinness - . Renamed Variable : $oXML_Document >> $oXmlDoc - for shortness, and compliance with examples of MSDN - mLipok - . New Example: _Example_2__XML_CreateChildWAttr - mLipok - . New Example: _Example_3__XML_Misc_ErrorDecription - mLipok - . New Example: _Example_MSDN_1__setAttributeNode - mLipok - . New Function: _XML_Misc_Viewer - mLipok - . New: Function: _XML_Misc_ErrorParser() -- added as a replacment for using: _XML_Misc_ErrorDecription() - mLipok - . NEW: @ERROR result: $XMLWRAPPER_ERROR_ARRAY - mLipok - . NEW: @ERROR result: $XMLWRAPPER_ERROR_NODECREATEAPPEND - mLipok - . Removed: all old _XML_Misc_ErrorDecription() - mLipok - . Removed: _XML_Misc_ErrorDecription_Reset()- mLipok - . Removed: all $sXML_error - mLipok - . Removed: _XML_Error_Reason - mLipok - . COMPLETED: @error checking for .selectNodes methods: @error is set to: $XMLWRAPPER_ERROR_XPATH - mLipok - . COMPLETED: _XML_CreateChildWAttr - mLipok - . COMPLETED: Standardarization for using Return Value @error codes returned from function --> ENUMERATED CONSTATNS - mLipok - . Now all functions Return like the following examples: - . Return SetError($XMLWRAPPER_ERROR_ ......... - . or in this way: - . If @error Then Return SetError(@error, @extended, $XMLWRAPPER_RESULT_FAILURE) - - 2015/09/07 - "1.1.1.04" - . Renamed: $iXMLWrapper_Error_number >> $iXMLWrapper_Error - mLipok - . Removed: almost all MsgBox() - leaves only in __XML_Misc_MsgBoxNotifier() - mLipok - . Changed: in Examples : Global $oErrorHandler >> Local $oErrorHandler - mLipok - . Renamed _XML_Array_GetNodeList >> _XML_Array_GetNodesProperties - mLipok - . Removed: _XML_Array_GetNodesFromCollection as this was duplicate for _XML_Array_GetNodesProperties - mLipok - . NEW: $__g_eARRAY_NODE_ATTRIBUTES in function _XML_Array_GetNodesProperties - now also display all atributes - mLipok - . Renamed: _XML_MiscProperty_DomVersion >> __XML_MiscProperty_DomVersion - as this should be internal - as you can use _XML_Misc_GetDomVersion() - mLipok - . Renamed: _XML_ComErrorHandler_MainFunction >> __XML_ComErrorHandler_UserFunction - as this should be internal - mLipok - . Renamed: _XML_ErrorParser >> _XML_ErrorParser_GetDescription - mLipok - . Removed: _XML_Misc_ErrorParser - will be in Examples - mLipok - . Changed: Return value behavior - mLipok - . From: - . SetError($XMLWRAPPER_ERROR_PARSE, $oXmlDoc.parseError.errorCode, $oXmlDoc.parseError.reason) - . SetError($XMLWRAPPER_ERROR_PARSE, $oXmlDoc.parseError.errorCode, $XMLWRAPPER_RESULT_FAILURE) - . Changed: _XML_Load and _XML_LoadXML require $oXmlDoc as first parameter, you must use _XML_CreateDOMDocument() as only in this way it is possible to use _XML_ErrorParser_GetDescription() - mLipok - . All examples changed to show how to use "new" _XML_Load and _XML_LoadXML - . NEW: ENUMs: $XMLWRAPPER_ERROR_EMPTYCOLLECTION - mLipok - . NEW: ENUMs: $XMLWRAPPER_ERROR_NONODESMATCH - mLipok - . Changed: MAGIC NUMBERS: for StringStripWS in _XML_DeleteNode() - mLipok - . COMPLETED: _XML_NodeExists - mLipok - . COMPLETED: Refactroing all functions with "selectNodes" Method now have checking: If (Not IsObj($oNodesColl)) Or $oNodesColl.length = 0 Then ... SetError($XMLWRAPPER_ERROR_EMPTYCOLLECTION ..... - mLipok - . COMPLETED: Refactroing all functions with "selectSingleNode" Method now have checking: If $oNode_Selected = Null Then .. SetError($XMLWRAPPER_ERROR_NONODESMATCH ..... - mLipok - - 2015/09/09 - "1.1.1.05" - . NEW: ENUMs: $XMLWRAPPER_ERROR_PARSE_XSL - mLipok - . NEW: ENUMs: $XMLWRAPPER_ERROR_NOATTRMATCH - mLipok - . COMPLETED: Function: _XML_RemoveAttribute() - mLipok - . NEW EXAMPLE: _Example_4__XML_RemoveAttribute() - mLipok - . Renamed: _XMLReplaceChild >> _XML_ReplaceChild - mLipok - . COMPLETED: _XML_ReplaceChild - mLipok - . NEW EXAMPLE: _Example_5__XML_ReplaceChild() - mLipok - . NEW: ENUMs: $XMLWRAPPER_ERROR_NOCHILDMATCH - mLipok - . NEW EXAMPLE: _Example_6__XML_GetChildNodes() - mLipok - . COMPLETED: _XML_GetChildNodes() - mLipok - . COMPLETED: _XML_GetAllAttribIndex() - mLipok - . NEW Function: _XML_Array_GetAttributesProperties() - mLipok - . NEW EXAMPLE: _Example_7__XML_GetAllAttribIndex() - mLipok - . ADDED: many IsObj() >> https://www.autoitscript.com/forum/topic/177176-why-isobj-0-and-vargettype-object/ - - 2015/09/11 - "1.1.1.06" - . Removed: Function: __XML_Misc_ConsoleNotifier() - mLipok - . Removed: Function: __XML_Misc_MsgBoxNotifier() - mLipok - . Removed: Function: _XML_MiscProperty_Notify() - mLipok - . Removed: Function: _XML_MiscProperty_NotifyToConsole() - mLipok - . Removed: Function: _XML_MiscProperty_NotifyToMsgBox() - mLipok - . Removed: Function: _XML_MiscProperty_NotifyAll() - mLipok - . Removed: Function: __XML_ComErrorHandler_MainFunction() - mLipok - . Removed: Function: __XML_DOM_EVENT_ondataavailable() >> is in example - mLipok - . Removed: Function: __XML_DOM_EVENT_onreadystatechange() >> is in example - mLipok - . Removed: Function: __XML_DOM_EVENT_ontransformnode() >> is in example - mLipok - . Removed: Function: _XML_UseEventHandler() - as event handler should be defined by user in main script - look in examlpes - mLipok - . Removed: Function: _XML_ComErrorHandler_UseInternalAsUser() - mLipok - . Renamed: Function: _XML_ComErrorHandler_UserFunction >> __XML_ComErrorHandler_UserFunction - is now internal - mLipok - . User Function are now passed as parameter to _XML_CreateDOMDocument() - . Changed: Examples: XML_Misc_ErrorParser() >> XML_My_ErrorParser() - mLipok - . Changed: Examples to fit to the changed UDF - mLipok - . Modified: Examples: CleanUp +++ Comments - mLipok - . Removed: Function: __AddFormat - as now is _XML_TIDY() function - mLipok - . Removed: Function: _XML_MiscProperty_StaticCOMErrorHandler() - as was not used - mLipok - . - . - . !!!!!! REMARKS: - mLipok - . It is user choice to set ERROR HANDLER or not. - . If user do not set it and something goes wrong with COM then this is USER PROBLEM and NOT UDF ISSUE/ERROR - . in such case UDF will call empty function for avoid AutoIt Error - . FOR ERROR CHECKING - . 1. check @error - . 2. _XML_ErrorParser_GetDescription() - . 3. setup your COM ERROR HANDLER and pass it as parameter to _XML_CreateDOMDocument() - . 4. you can make in your main script function like XML_My_ErrorParser() and use it if you want - - 2015/09/15 - "1.1.1.07" - . Renamed: ENUMs: $eAttributeList_ ..... >> $__g_eARRAY_ATTR_ .... - as now are Global Enums - mLipok - . Renamed: ENUMs: $eNodeList_ ..... >> $__g_eARRAY_NODE_ .... - as now are Global Enums - mLipok - . Removed: Function: _XML_MiscProperty_AutoFormat() - as is not used - mLipok - . Removed: Function: _XML_MiscProperty_EventHandling() - as is not used - mLipok - . Removed: Function: _XML_MiscProperty_AutoSave() - as is not used - mLipok - . ADDED NEW: Function: __XML_IsValidObject_Attributes() - mLipok - . ADDED NEW: Function: __XML_IsValidObject_NodesColl() - mLipok - . ADDED NEW: $XMLWRAPPER_EXT_ ... for proper handling @extended information - mLipok - . Changed: Examples: XML_My_ErrorParser() - added support for $XMLWRAPPER_EXT_ ... - mLipok - . Removed: $sQuery - DOM compliant query string (not really necessary as it becomes part of the path) - mLipok - . Changed: All @extended are returned as $XMLWRAPPER_EXT_ .... or @extended - never as 0 or directly as number - mLipok - . REFACTORED: _XML_Tidy() - proper @errors and @extended support - mLipok - . REFACTORED: _XML_Array_GetAttributesProperties() - proper @errors and @extended support - mLipok - . REFACTORED: _XML_Array_GetNodesProperties() - proper @errors and @extended support - mLipok - . REFACTORED: all this following function uses _XML_SelectNodes() - mLipok - . _XMLCreateChildNode() _XML_DeleteNode() _XML_GetAllAttribIndex() - . _XML_GetParentNodeName() _XMLSetAttrib() _XML_UpdateField2() - . _XMLGetValue() _XML_GetNodesCount() _XML_ReplaceChild() - . _XML_GetNodesPath() _XMLGetAllAttrib() - . REFACTORED: all this following function uses _XML_SelectSingleNode() - mLipok - . _XML_CreateAttribute() _XML_CreateComment() _XML_GetAttrib() - . _XML_GetChildNodes() _XML_GetChildren() _XML_NodeExist() - . _XML_RemoveAttribute() _XML_GetChildText() _XML_UpdateField() - . _XMLGetField() - . Renamed: Function: __XML_IsValidObject >> __XML_IsValidObject_DOMDocument - mLipok - . COMPLETED: Function: _XML_SaveToFile - mLipok - . Removed: $XMLWRAPPER_ERROR_NODECREATEAPPEND - mLipok - . ADDED: $XMLWRAPPER_ERROR_NODECREATE - mLipok - . ADDED: $XMLWRAPPER_ERROR_NODEAPPEND - mLipok - . Changed: Functions to proper use $XMLWRAPPER_ERROR_NODECREATE and $XMLWRAPPER_ERROR_NODEAPPEND - mLipok - . Renamed: Function: __XML_IsValidObject_Nodes >> __XML_IsValidObject_NodesColl - mLipok - . Renamed: ENUMs: $XMLWRAPPER_EXT_OK >> $XMLWRAPPER_EXT_DEFAULT - mLipok - . Renamed: Function: _XML_GetNodeCount >> _XML_GetNodesCount - mLipok - . Renamed: Function: _XML_GetAttrib >> _XML_GetNodeAttributeValue - mLipok - . Changed: Function: _XML_GetNodeAttributeValue - parameters chagned - must pass $oNode instead $oXmlDoc - mLipok - . COMPLETED: Function: _XML_LoadXML - mLipok - . COMPLETED: Function: _XML_CreateDOMDocument - mLipok - . COMPLETED: Function: _XML_Tidy - mLipok - . Renamed: Function: _XML_CreateObject >> _XML_CreateDOMDocument - mLipok - . NEW: Region: XMLWrapperEx.au3 - Functions - Not yet reviewed - mLipok - . NEW: Region: XMLWrapperEx.au3 - Functions - COMPLETED - mLipok - . COMPLETED: Function: _XML_GetNodeAttributeValue - mLipok - . other CleanUp - mLipok - - 2015/10/22 - "1.1.1.08" - . ADDED: Description for _XML_ErrorParser_GetDescription() - mLipok - . ADDED: Description for _XML_Array_GetNodesProperties() - mLipok - . Fixed: Function: _XMLCreateFile () - mLipok - . Issue with usage of Tenary Operator in $oXmlDoc.createProcessingInstruction("xml", 'version="1.0"' & (($bUTF8) ? ' encoding="UTF-8"' : '')) - . Renamed: Function: _XMLCreateFile >> _XML_CreateFile - mLipok - . Completed: Function: _XML_CreateFile - mLipok - . !!! EXAMPLES FILE: New Example: Example_9__XML_CreateFile() - mLipok - . !!! EXAMPLES FILE: Changed to Keep the changed Script Breaking Changes - mLipok - . Renamed: Function: __XML_ComErrorHandler_UserFunction >> _XML_ComErrorHandler_UserFunction : is now normal function - not internal - mLipok - . NEW: methode of transfer UDF internal COM Error Handler to the user function - mLipok - . just use _XML_ComErrorHandler_UserFunction() like in example - . - SCRIPT BREAKING CHANGES - . Renamed: Enums: $XMLWRAPPER_RESULT_ >> $XML_RET_ - mLipok - . Renamed: Enums: $XMLWRAPPER_EXT_ >> $XML_EXT_ - mLipok - . Renamed: Enums: $XMLWRAPPER_ERROR_ >> $XML_ERR_ - mLipok - . Renamed: Enums: $NODE_ >> $XML_NODE_ - mLipok - . Removed: Parameter: _XML_CreateDOMDocument > $vComErrFunc - mLipok - - - 2016/05/18 - "1.1.1.09" - . !!!! UDF RENAMED XMLWrapperEx.au3 >> XML.au3 - mLipok - . Changed: Error Handling: all SetError($XML_ERR_NODEAPPEND, - returns @error as extended - as this is COM ERROR - mLipok - . Changed: Error Handling: all SetError($XML_ERR_NODECREATE, - returns @error as extended - as this is COM ERROR - mLipok - . Removed: Function: _XMLCreateChildNode - as it was duplicate feature with _XML_CreateChildWAttr - mLipok - . Thanks to: @scila1996 - . https://www.autoitscript.com/forum/topic/176895-xmlwrapperexau3-beta/?do=findComment&comment=1278825 - . Removed: Function: _XMLCreateChildNodeWAttr - as it was only duplicate/wrapper for _XML_CreateChildWAttr - mLipok - . Thanks to: @scila1996 - . https://www.autoitscript.com/forum/topic/176895-xmlwrapperexau3-beta/?do=findComment&comment=1278825 - . ! EXAMPLES FILE: Modified: XML_My_ErrorParser - mLipok - . ! EXAMPLES FILE: New: Example_2a__XML_CreateChildWAttr() - mLipok - . Removed: Enums: $XML_ERR_SAVEFILERO - New Requirment for saving - File Can Not Exist - user should manage it by their own - mLipok - . Renamed: Enums: $XML_ERR_ISNOTVALIDNODESE >> $XML_ERR_ISNOTVALIDNODETYPE - mLipok - . Renamed: Enums: $XML_ERR_ISNOTVALIDNODETYPE >> $XML_ERR_INVALIDNODETYPE - mLipok - . Renamed: Enums: $XML_ERR_ISNOTVALIDATTRIB >> $XML_ERR_INVALIDATTRIB - mLipok - . Renamed: Enums: $XML_ERR_ISNOTVALIDDOMDOC >> $XML_ERR_INVALIDDOMDOC - mLipok - . Removed: $XML_EXT_GENERAL >> $XML_EXT_DEFAULT - mLipok - . Changed: $XML_EXT_.. are reordered - mLipok - . Removed: Function: _XSL_GetDefaultStyleSheet - mLipok - . This was example from: - . http://www.xml.com/lpt/a/1681 - . But it is: Copyright © 1998-2006 O'Reilly Media, Inc. - . Renamed: Function: _XMLGetField >> _XML_GetField - mLipok - . Renamed: Function: _XMLGetValue >> _XML_GetValue - mLipok - . Renamed: Function: _XMLGetAllAttrib >> _XML_GetAllAttrib - mLipok - . Renamed: Function: _XMLSetAttrib >> _XML_SetAttrib - mLipok - . New: Function: _XML_InsertChildNode - GMK - . New: Function: _XML_InsertChildWAttr - GMK - . Changed: Function: _XML_CreateAttribute - numbers of parameters - mLipok - . now you must pass an Array with AttributeName and AttributeValue - . Fixed: Function: _XMLCreateRootNode - GMK - . $oXmlDoc.documentElement.appendChild($oChild) >> $oXmlDoc.appendChild($oChild) - . Fixed: Function: _XMLCreateRootNodeWAttr - GMK - . $oXmlDoc.documentElement.appendChild($oChild_Node) >> $oXmlDoc.appendChild($oChild_Node) - . Renamed: Function: _XMLCreateRootChild >> _XML_CreateRootNode - GMK - . !!!!!!!! @TODO need to be revisited - . - . Renamed: Function: _XMLCreateRootNodeWAttr >> _XML_CreateRootNodeWAttr - GMK - . ADDED: #CURRENT# - GMK - . ADDED: #IN_PROGESS# - GMK - . ADDED: #INTERNAL_USE_ONLY# - GMK - . !!! Additional Thanks for GMK for testing and many changes in many Description - . CleanUp: Function: _XML_GetNodesPath - removed $sNodePathTag - mLipok - thanks to GMK - . CleanUp: Function: _XML_GetParentNodeName - removed $sNodePathTag - mLipok - thanks to GMK - . CleanUp: Function: removed #include - mLipok - thanks to GMK - . CleanUp: Function: _XML_GetField - removed $oChild - mLipok - thanks to GMK - . CleanUp: Function: _XML_GetNodesPath - MagicNumber 0 replaced with $STR_NOCASESENSE - mLipok - thanks to GMK - . CleanUp: Function: _XML_GetNodesPathInternal - MagicNumber 0 replaced with $STR_NOCASESENSE - mLipok - thanks to GMK - . CleanUp: Function: _XML_GetParentNodeName - MagicNumber 0 replaced with $STR_NOCASESENSE - mLipok - thanks to GMK - . Renamed: Function: _XMLCreateCDATA >> _XML_CreateCDATA - mLipok - thanks to GMK - . Rewrite: Function: _XML_GetAllAttrib - Parameters : removed ByRef $aName, ByRef $aValue - mLipok - . Fixed Typo: Descripton: Chceck >> Check - mLipok - thanks to GMK - . Added: Descripton: _XML_GetNodesCount - mLipok - thanks to GMK - . Changed: Descripton: _XML_TransformNode - mLipok - thanks to GMK - . Changed: Descripton: _XML_CreateDOMDocument - mLipok - thanks to GMK - . Added: Descripton: _XML_GetNodeAttributeValue - mLipok - thanks to GMK - . Changed: Descripton: _XML_Misc_Viewer - mLipok - thanks to GMK - . - . Changed: Function: _XML_SelectNodes in case of success @extended = $oNodesColl.length - . - . - 2016/05/18 - "1.1.1.10" - . NEW: Feature: _XML_Tidy: if Parameter $sEncoding = -1 then .omitXMLDeclaration = true - mLipok - . Feature asked by @GMK here: - . https://www.autoitscript.com/forum/topic/176895-xmlau3-v-11109-formerly-xmlwrapperexau3-beta-support-topic/?do=findComment&comment=1294688 - . Changed: _XML_Tidy(ByRef $oXmlDoc, $sEncoding = -1) - Default value is set to -1 - mLipok - . New: XML__Example_TIDY.au3 - mLipok - . - . - 2016/06/16 - "1.1.1.11" - . NEW: Function: __XML_IsValidObject_DOMDocumentOrElement - mLipok - . Changed: Function: _XML_SelectNodes - parameter validation __XML_IsValidObject_DOMDocumentOrElement - mLipok - . Currently _XML_SelectNodes can use relative XPath - . Changed: Function: _XML_SelectSingleNode - parameter validation __XML_IsValidObject_DOMDocumentOrElement - mLipok - . Currently _XML_SelectSingleNode can use relative XPath - . Refactored: Function: _XML_CreateComment - mLipok - . Changed: Function: @error > $XML_ERR_COMERROR - mLipok - . Fixed: Function: _XML_Array_GetNodesProperties - properly gets all attributes - mLipok - . - . EXAMPLES: New, and checked/refactored/fixed - . XML__Examples_TIDY.au3 - . XML__Examples_User__asdf1nit.au3 - . XML__Examples_User_coma.au3 - . XML__Examples_User_Realm.au3 - . XML__Examples_User_scila1996.au3 - . XML__Examples_User_DarkAqua__Tasks.au3 - . - . - - - - @LAST - this keyword is usefull for quick jumping here - - TODO LIST: - . TODO CHECK: _XML_GetField, _XML_GetValue - . @WIP TODO: COUNT = 54 - . TODO: Description, Function Header CleanUp (are still old) - . TODO: browse entire UDF for TODO "Keyword" - . TODO: Return SetError($XML_ERR_GENERAL ... should be used only once per function - . TODO: Return SetError($XML_ERR_GENERAL ... should be always ONLY as the last Error returned from function - . TODO: $XML_ERR_ .... should be reordered it will be SCRIPT BREAKING CHANGES: only if used MAGIC NUMBERS for @error checking - . TODO: GMK: What's a better way to insert a node before a specified node object or XPath for _XML_InsertChildNode and _XML_InsertChildWAttr?  Replace $iItem with $oInsertBeforeNode? - . TODO: GMK: Rename _XML_Transform ==> _XML_TransformNodeToObj (?) - . TODO: GMK: Why not combine _XML_UpdateField and _XML_UpdateField2? Would inputting parameters for a single node XPath not work the same for _XML_UpdateField2 as it would for _XML_UpdateField? - -#CE - -; #CURRENT# ===================================================================================================================== -; _XML_CreateAttribute -; _XML_CreateComment -; _XML_DeleteNote -; _XML_GetChildren -; _XML_GetChildText -; _XML_GetNodesPath -; _XML_GetNodesPathInternal -; _XML_GetParentNodeName -; _XML_RemoveAttributeNode -; _XML_ReplaceChild -; _XML_Transform -; _XML_UpdateField -; _XML_UpdateField2 -; _XML_ValidateFile -; _XML_CreateCDATA -; _XML_CreateChildNode -; _XML_CreateRootNode -; _XML_CreateRootNodeWAttr -; _XML_GetAllAttrib -; _XML_GetAllAttribIndex -; _XML_GetField -; _XML_GetValue -; _XML_SetAttrib -; _XML_CreateChildWAttr -; _XML_CreateDOMDocument -; _XML_CreateFile -; _XML_GetChildNodes -; _XML_GetNodeAttributeValue -; _XML_Load -; _XML_LoadXML -; _XML_NodeExists -; _XML_SaveToFile -; _XML_SelectNodes -; _XML_SelectSingleNode -; _XML_Tidy -; _XML_Misc_GetDomVersion -; _XML_Misc_Viewer -; _XML_MiscProperty_UDFVersion -; _XML_Array_AddName -; _XML_Array_GetAttributesProperties -; _XML_Array_GetNodesProperties -; _XML_ErrorParser_GetDescription - -; #IN_PROGESS# ================================================================================================================== -; _XML_InsertChildNode -; _XML_InsertChildWAttr -; _XML_GetNodesCount -; _XML_RemoveAttribute -; _XML_TransformNode -; _XML_MiscProperty_Encoding - -; #INTERNAL_USE_ONLY# =========================================================================================================== -; __XML_IsValidObject_Attributes -; __XML_IsValidObject_DOMDocument -; __XML_IsValidObject_DOMDocumentOrElement -; __XML_IsValidObject_Node -; __XML_IsValidObject_NodesColl -; __XML_MiscProperty_DomVersion -; __XML_ComErrorHandler_InternalFunction -; __XML_ComErrorHandler_UserFunction - -#EndRegion XML.au3 - UDF Header - -; #VARIABLES# =================================================================================================================== -#Region XML.au3 - Enumeration - ERROR EXTENDED RETURN -Global Enum _ - $XML_ERR_OK, _ ; All is ok - $XML_ERR_GENERAL, _ ; The error which is not specifically defined. - $XML_ERR_COMERROR, _ ; COM Error occured - Check @extended for COMERROR Number or check you COM Error Handler Function - $XML_ERR_DOMVERSION, _ ; Check @extended for required DOM Version - $XML_ERR_ISNOTOBJECT, _ ; No object passed to function. - $XML_ERR_INVALIDDOMDOC, _ ; Invalid object passed to function - expected Document. - $XML_ERR_INVALIDATTRIB, _ ; Invalid object passed to function - expected Attrib Element. - $XML_ERR_INVALIDNODETYPE, _ ; Invalid object passed to function - expected Node Element. - $XML_ERR_OBJCREATE, _ ; Object can not be created. - $XML_ERR_NODECREATE, _ ; Can not create Node - check also extended for node type - $XML_ERR_NODEAPPEND, _ ; Can not append Node - check also extended for node type - $XML_ERR_PARSE, _ ; Error with Parsing objects use _XML_ErrorParser_GetDescription() for Get details - $XML_ERR_PARSE_XSL, _ ; Error with Parsing XSL objects use _XML_ErrorParser_GetDescription() for Get details - $XML_ERR_LOAD, _ ; Error opening specified file. - $XML_ERR_SAVE, _ ; Error saving file. - $XML_ERR_PARAMETER, _ ; Wrong parameter passed to function. - $XML_ERR_ARRAY, _ ; Wrong array parameter passed to function. Check array dimension and conent. - $XML_ERR_XPATH, _ ; XPath syntax error - you should check also COM Error Handler. - $XML_ERR_NONODESMATCH, _ ; No nodes match the XPath expression - $XML_ERR_NOCHILDMATCH, _ ; There is no Child in nodes matched by XPath expression. - $XML_ERR_NOATTRMATCH, _ ; There is no such attribute in selected node. - $XML_ERR_EMPTYCOLLECTION, _ ; Collections of objects was empty - $XML_ERR_EMPTYOBJECT, _ ; Object is empty - $XML_ERR_ENUMCOUNTER ; not used in UDF - just for other/future testing -Global Enum _ - $XML_EXT_DEFAULT, _ ; Default - Do not return any additional information, The extended which is not specifically defined. - $XML_EXT_PARAM1, _ ; Error Occurs in 1-Parameter - $XML_EXT_PARAM2, _ ; Error Occurs in 2-Parameter - $XML_EXT_PARAM3, _ ; Error Occurs in 3-Parameter - $XML_EXT_PARAM4, _ ; Error Occurs in 4-Parameter - $XML_EXT_PARAM5, _ ; Error Occurs in 5-Parameter - $XML_EXT_PARAM6, _ ; Error Occurs in 6-Parameter - $XML_EXT_XMLDOM, _ ; "Microsoft.XMLDOM" related Error - $XML_EXT_DOMDOCUMENT, _ ; "Msxml2.DOMDocument" related Error - $XML_EXT_XSLTEMPLATE, _ ; "Msxml2.XSLTemplate" related Error - $XML_EXT_SAXXMLREADER, _ ; "MSXML2.SAXXMLReader" related Error - $XML_EXT_MXXMLWRITER, _ ; "MSXML2.MXXMLWriter" related Error - $XML_EXT_FREETHREADEDDOMDOCUMENT, _ ; "Msxml2.FreeThreadedDOMDocument" related Error - $XML_EXT_XMLSCHEMACACHE, _ ; "Msxml2.XMLSchemaCache." related Error - $XML_EXT_STREAM, _ ; "ADODB.STREAM" related Error - $XML_EXT_ENCODING, _ ; Encoding related Error - $XML_EXT_ENUMCOUNTER ; not used in UDF - just for other/future testing -Global Enum _ - $XML_RET_FAILURE, _ ; UDF Default Failure Return Value - $XML_RET_SUCCESS, _ ; UDF Default Success Return Value - $XML_RET_ENUMCOUNTER ; not used in UDF - just for other/future testing -#EndRegion XML.au3 - Enumeration - ERROR EXTENDED RETURN - -#Region XML.au3 - ARRAY Enums -; Enums for _XML_Array_GetAttributesProperties() function -Global Enum _ - $__g_eARRAY_ATTR_NAME, _ - $__g_eARRAY_ATTR_TYPESTRING, _ - $__g_eARRAY_ATTR_VALUE, _ - $__g_eARRAY_ATTR_TEXT, _ - $__g_eARRAY_ATTR_DATATYPE, _ - $__g_eARRAY_ATTR_XML, _ - $__g_eARRAY_ATTR_ARRAYCOLCOUNT -; Enums for _XML_Array_GetNodesProperties() function -Global Enum _ - $__g_eARRAY_NODE_NAME, _ - $__g_eARRAY_NODE_TYPESTRING, _ - $__g_eARRAY_NODE_VALUE, _ - $__g_eARRAY_NODE_TEXT, _ - $__g_eARRAY_NODE_DATATYPE, _ - $__g_eARRAY_NODE_XML, _ - $__g_eARRAY_NODE_ATTRIBUTES, _ - $__g_eARRAY_NODE_ARRAYCOLCOUNT -#EndRegion XML.au3 - ARRAY Enums - -#Region XML.au3 - XML DOM Enumerated Constants -;~ https://msdn.microsoft.com/en-us/library/ms766473(v=vs.85).aspx -Global Const $XML_NODE_ELEMENT = 1 -Global Const $XML_NODE_ATTRIBUTE = 2 -Global Const $XML_NODE_TEXT = 3 -Global Const $XML_NODE_CDATA_SECTION = 4 -Global Const $XML_NODE_ENTITY_REFERENCE = 5 -Global Const $XML_NODE_ENTITY = 6 -Global Const $XML_NODE_PROCESSING_INSTRUCTION = 7 -Global Const $XML_NODE_COMMENT = 8 -Global Const $XML_NODE_DOCUMENT = 9 -Global Const $XML_NODE_DOCUMENT_TYPE = 10 -Global Const $XML_NODE_DOCUMENT_FRAGMENT = 11 -Global Const $XML_NODE_NOTATION = 12 -#EndRegion XML.au3 - XML DOM Enumerated Constants - -#Region XML.au3 - readyState Property (DOMDocument) -;~ https://msdn.microsoft.com/en-us/library/ms753702(v=vs.85).aspx -Global Const $XML_DOCUMENT_READYSTATE_LOADING = 1 -Global Const $XML_DOCUMENT_READYSTATE_LOADED = 2 -Global Const $XML_DOCUMENT_READYSTATE_INTERACTIVE = 3 -Global Const $XML_DOCUMENT_READYSTATE_COMPLETED = 4 -#EndRegion XML.au3 - readyState Property (DOMDocument) - -#Region XML.au3 - Functions - Not yet reviewed -; =============================================================================================================================== -; XMLWrapper functions - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateAttribute -; Description ...: Adds an XML Attribute to specified node. -; Syntax ........: _XML_CreateAttribute(Byref $oXmlDoc, $sXPath, $asAttributeList) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $asAttributeList - an array of strings. Column0=AtributeName, Column1=AtributeValue -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok, GMK -; Remarks .......: -; Related .......: https://msdn.microsoft.com/en-us/library/ms754616(v=vs.85).aspx -; Link ..........: https://msdn.microsoft.com/en-us/library/ms764615(v=vs.85).aspx -; Example .......: Yes -; =============================================================================================================================== -Func _XML_CreateAttribute(ByRef $oXmlDoc, $sXPath, $asAttributeList) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If Not UBound($asAttributeList) Or UBound($asAttributeList, $UBOUND_COLUMNS) <> 2 Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_PARAM3, $XML_RET_FAILURE) - EndIf - - Local Enum $eAttribute_Name, $eAttribute_Value - Local $oAttribute = Null - #forceref $oAttribute - For $iAttribute_idx = 0 To UBound($asAttributeList) - 1 - $oAttribute = $oXmlDoc.createAttribute($asAttributeList[$iAttribute_idx][$eAttribute_Name]) ;, $sNameSpace) ; TODO Check why $sNameSpace - If @error Then Return SetError($XML_ERR_COMERROR, @error, $XML_RET_FAILURE) - - $oNode_Selected.SetAttribute($asAttributeList[$iAttribute_idx][$eAttribute_Name], $asAttributeList[$iAttribute_idx][$eAttribute_Value]) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - Next - - ; CleanUp - $oAttribute = Null - $oNode_Selected = Null - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_CreateAttribute - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateCDATA -; Description ...: Create a CDATA SECTION node directly under root. -; Syntax ........: _XML_CreateCDATA(ByRef $oXmlDoc, $sNode, $sCDATA[, $sNameSpace = ""]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sNode - a string value. name of node to create -; $sCDATA - a string value. CDATA value -; $sNameSpace - a string value. the namespace to specifiy if the xml uses one. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: fixme, won't append to exisiting node. must create new node. -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_CreateCDATA(ByRef $oXmlDoc, $sNode, $sCDATA, $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oNode = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNode, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - If IsObj($oNode) Then - Local $oChild = $oXmlDoc.createCDATASection($sCDATA) - $oNode.appendChild($oChild) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - $oXmlDoc.documentElement.appendChild($oNode) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - $oChild = Null - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_CreateCDATA - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateComment -; Description ...: Create a COMMENT node at specified path. -; Syntax ........: _XML_CreateComment(ByRef $oXmlDoc, $sXPath, $sComment) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sComment - a string value. The comment to add the to the xml file. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_CreateComment(ByRef $oXmlDoc, $sXPath, $sComment) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oChild = $oXmlDoc.createComment($sComment) - $oNode_Selected.insertBefore($oChild, $oNode_Selected.childNodes(0)) - If @error Then - Return SetError($XML_ERR_COMERROR, @error, $XML_RET_SUCCESS) - ElseIf $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) ; TODO Check for what we need to return on success - -EndFunc ;==>_XML_CreateComment - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateRootNode -; Description ...: Create node directly under root. -; Syntax ........: _XML_CreateRootNode(ByRef $oXmlDoc, $sNode[, $sData = ""[, $sNameSpace = ""]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sNode - a string value. The name of node to create. -; $sData - a string value. The optional value to create -; $sNameSpace - a string value. the namespace to specifiy if the file uses one. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok, GMK -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_CreateRootNode(ByRef $oXmlDoc, $sNode, $sData = "", $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oChild = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNode, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - If IsObj($oChild) Then - If $sData <> "" Then $oChild.text = $sData - $oXmlDoc.appendChild($oChild) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - $oChild = 0 - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_CreateRootNode - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateRootNodeWAttr -; Description ...: Create a child node under root node with attributes. -; Syntax.........: _XML_CreateRootNodeWAttr($sNode, $aAttribute_Names, $aAttribute_Values[, $sData = ""[, $sNameSpace = ""]]) -; Parameters ....: $sNode - The node to add with attibute(s) -; $aAttribute_Names - The attribute name(s) -- can be array -; $aAttribute_Values - The attribute value(s) -- can be array -; $sData - The optional value to give the node. -; Return values .: Success $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: This function requires that each attribute name has a corresponding value. -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_CreateRootNodeWAttr(ByRef $oXmlDoc, $sNode, $aAttribute_Names, $aAttribute_Values, $sData = "", $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oChild_Node = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNode, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - If IsObj($oChild_Node) Then - If $sData <> "" Then $oChild_Node.text = $sData - - Local $oAttribute = Null - #forceref $oAttribute - If IsArray($aAttribute_Names) And IsArray($aAttribute_Values) Then - If UBound($aAttribute_Names) <> UBound($aAttribute_Values) Then - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - For $iAttribute_idx = 0 To UBound($aAttribute_Names) - 1 - If $aAttribute_Names[$iAttribute_idx] = "" Then - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - $oAttribute = $oXmlDoc.createAttribute($aAttribute_Names[$iAttribute_idx]) ;, $sNameSpace) ; TODO Check why $sNameSpace - $oChild_Node.SetAttribute($aAttribute_Names[$iAttribute_idx], $aAttribute_Values[$iAttribute_idx]) - Next - Else - $oAttribute = $oXmlDoc.createAttribute($aAttribute_Names) - $oChild_Node.SetAttribute($aAttribute_Names, $aAttribute_Values) - EndIf - $oXmlDoc.appendChild($oChild_Node) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - $oChild_Node = Null - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_CreateRootNodeWAttr - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_DeleteNode -; Description ...: Deletes XML Node based on XPath input from root node. -; Syntax ........: _XML_DeleteNode(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; |0 - No error -; |1 - Deletion error -; |2 - No object passed -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_DeleteNode(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - For $oNode_enum In $oNodesColl - If $oNode_enum.hasChildNodes Then - For $oNode_enum_Child In $oNode_enum.childNodes - If $oNode_enum_Child.nodeType = $XML_NODE_TEXT Then - If StringStripWS($oNode_enum_Child.text, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) = "" Then - $oNode_enum.removeChild($oNode_enum_Child) - EndIf - EndIf - Next - EndIf - $oNode_enum.parentNode.removeChild($oNode_enum) - Next - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_DeleteNode - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetAllAttrib -; Description ...: Get all XML Field(s) attributes based on XPath input from root node. -; Syntax ........: _XML_GetAllAttrib(ByRef $oXmlDoc, $sXPath, ByRef $aName, ByRef $aValue) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - Returns array of fields text values (number of items is in [0][0]) -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetAllAttrib(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oAttributesColl = Null - Local $aResponse[2][1] - For $oNode_enum In $oNodesColl - $oAttributesColl = $oNode_enum.attributes - If ($oAttributesColl.length) = 0 Then - ContinueLoop - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - ReDim $aResponse[2][$oAttributesColl.length + 2] - For $iAttribute_idx = 0 To $oAttributesColl.length - 1 - $aResponse[0][$iAttribute_idx + 1] = $oAttributesColl.item($iAttribute_idx).nodeName - $aResponse[1][$iAttribute_idx + 1] = $oAttributesColl.item($iAttribute_idx).Value - Next - Next - $aResponse[0][0] = $oAttributesColl.length - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $aResponse) - -EndFunc ;==>_XML_GetAllAttrib - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetChildren -; Description ...: Selects XML child Node(s) of an element based on XPath input from root node and returns there text values. -; Syntax ........: _XML_GetChildren(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - Returns an array where: -; |$array[0][0] = Size of array -; |$array[1][0] = Name -; |$array[1][1] = Text -; |$array[1][2] = NameSpaceURI -; |... -; |$array[n][0] = Name -; |$array[n][1] = Text -; |$array[n][2] = NamespaceURI -; On Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetChildren(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then - Return SetError(@error, @extended, $XML_RET_FAILURE) - ElseIf $oNode_Selected.hasChildNodes() Then - Local $iResponseDimSize = 0 - Local $aResponse[1][3] = [[$iResponseDimSize, '', '']] - For $oNode_enum_Child In $oNode_Selected.childNodes() - If $oNode_enum_Child.nodeType() = $XML_NODE_ELEMENT And $oNode_enum_Child.hasChildNodes() Then - For $oNode_enum_Descendant In $oNode_enum_Child.childNodes() - If $oNode_enum_Descendant.nodeType() = $XML_NODE_TEXT Then - $iResponseDimSize = UBound($aResponse, 1) - ReDim $aResponse[$iResponseDimSize + 1][3] - $aResponse[$iResponseDimSize][0] = $oNode_enum_Descendant.parentNode.baseName - $aResponse[$iResponseDimSize][1] = $oNode_enum_Descendant.text - $aResponse[$iResponseDimSize][2] = $oNode_enum_Descendant.NamespaceURI - ; TODO Check - ; _XML_Array_AddName($aResponse, $oNode_enum_Child.baseName) - EndIf - Next - EndIf - Next - $aResponse[0][0] = $iResponseDimSize - ; TODO Description for @extended - Return SetError($XML_ERR_OK, $iResponseDimSize, $aResponse) - - EndIf - Return SetError($XML_ERR_NOCHILDMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetChildren - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetChildText -; Description ...: Selects XML child Node(s) of an element based on XPath input from root node. -; Syntax ........: _XML_GetChildText(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - Returns an array of Node's names and text. -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetChildText(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then - Return SetError(@error, @extended, $XML_RET_FAILURE) - ElseIf $oNode_Selected.hasChildNodes() Then - Local $aResponse[1] = [0] - For $oNode_enum_Child In $oNode_Selected.childNodes() - If $oNode_enum_Child.nodeType = $XML_NODE_ELEMENT Then - _XML_Array_AddName($aResponse, $oNode_enum_Child.baseName) - ElseIf $oNode_enum_Child.nodeType = $XML_NODE_TEXT Then - _XML_Array_AddName($aResponse, $oNode_enum_Child.text) - EndIf - Next - - $aResponse[0] = UBound($aResponse) - 1 - Return SetError($XML_ERR_OK, $aResponse[0], $aResponse) ; TODO Description for @extended - EndIf - Return SetError($XML_ERR_NOCHILDMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetChildText - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetField -; Description ...: Get XML Field(s) based on XPath input from root node. -; Syntax ........: _XML_GetField(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - Returns an array of fields text values (count is in first element) -; On Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok, GMK -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetField(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then - Return SetError(@error, @extended, $XML_RET_FAILURE) - ElseIf $oNode_Selected.hasChildNodes() Then - Local $aResponse[1] = [0], $sNodePath = "" - Local $iNodeMaxCount = $oNode_Selected.childNodes.length - Local $aRet - For $iNode_idx = 1 To $iNodeMaxCount - If $oNode_Selected.parentNode.nodeType = $XML_NODE_DOCUMENT Then - $sNodePath = "/" & $oNode_Selected.baseName & "/*[" & $iNode_idx & "]" - Else - $sNodePath = $oNode_Selected.baseName & "/*[" & $iNode_idx & "]" - EndIf - - $aRet = _XML_GetValue($oXmlDoc, $sNodePath) - If UBound($aRet) > 1 Then - _XML_Array_AddName($aResponse, $aRet[1]) - Else - _XML_Array_AddName($aResponse, "") - EndIf - - Next - $aResponse[0] = UBound($aResponse) - 1 - Return SetError($XML_ERR_OK, $aResponse[0], $aResponse) ; TODO Description for @extended - - EndIf - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetField - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetNodesPath -; Description ...: Return a nodes full path based on XPath input from root node. -; Syntax ........: _XML_GetNodesPath(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - An array of node names from root, count in [0] element. -; On Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetNodesPath(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - If _XML_Misc_GetDomVersion() < 4 Then - Return SetError($XML_ERR_DOMVERSION, 4, $XML_RET_FAILURE) ; TODO @extended Description - EndIf - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $aResponse[1], $sNodePath, $sNameSpace - - Local $oParent, $oNode_enum_Temp - For $oNode_enum In $oNodesColl - $oNode_enum_Temp = $oNode_enum - $sNodePath = "" - If $oNode_enum.nodeType <> $XML_NODE_DOCUMENT Then - $sNameSpace = $oNode_enum.namespaceURI() - If $sNameSpace <> "" Then - $sNameSpace = StringRight($sNameSpace, StringLen($sNameSpace) - StringInStr($sNameSpace, "/", $STR_NOCASESENSE, -1)) & ":" - EndIf - If $sNameSpace = 0 Then $sNameSpace = "" - $sNodePath = "/" & $sNameSpace & $oNode_enum.nodeName() & $sNodePath - EndIf - - Do - $oParent = $oNode_enum_Temp.parentNode() - If $oParent.nodeType <> $XML_NODE_DOCUMENT Then - $sNameSpace = $oParent.namespaceURI() - If $sNameSpace <> "" Then - ; $sNameSpace = StringRight($sNameSpace, StringLen($sNameSpace) - StringInStr($sNameSpace, "/", $STR_NOCASESENSE, -1)) & ":" - $sNameSpace &= ":" - EndIf - If $sNameSpace = 0 Then $sNameSpace = "" - $sNodePath = "/" & $sNameSpace & $oParent.nodeName() & $sNodePath - $oNode_enum_Temp = $oParent - Else - $oNode_enum_Temp = Null - EndIf - $oParent = Null - Until (Not (IsObj($oNode_enum_Temp))) - - _XML_Array_AddName($aResponse, $sNodePath) - Next - - $aResponse[0] = UBound($aResponse) - 1 - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $aResponse) - -EndFunc ;==>_XML_GetNodesPath - -; #FUNCTION# =================================================================== -; Name ..........: _XML_GetNodesPathInternal -; Description ...: Returns the path of a valid node object. -; Syntax ........: _XML_GetNodesPathInternal(ByRef $oXML_Node) -; Parameters ....: $oXML_Node - A valid node object -; Return values .: On Success - Path from root as string. -; On Failure - @TODO -; On Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; On Failure - An empty string and @error set to 1. -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetNodesPathInternal(ByRef $oXML_Node) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXML_Node) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $sNodePath = "/" & $oXML_Node.baseName - Local $oParentNode = Null, $sNameSpace = '' - - Do - $oParentNode = $oXML_Node.parentNode() - - If $oParentNode.nodeType <> $XML_NODE_DOCUMENT Then - $sNameSpace = $oParentNode.namespaceURI() - If $sNameSpace = 0 Then $sNameSpace = "" - If $sNameSpace <> "" Then - $sNameSpace = StringRight($sNameSpace, StringLen($sNameSpace) - StringInStr($sNameSpace, "/", $STR_NOCASESENSE, -1)) & ":" - EndIf - $sNodePath = "/" & $sNameSpace & $oParentNode.nodeName() & $sNodePath - $oXML_Node = $oParentNode - Else - $oXML_Node = Null - EndIf - - $oParentNode = Null - Until (Not (IsObj($oXML_Node))) - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sNodePath) - -EndFunc ;==>_XML_GetNodesPathInternal - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetParentNodeName -; Description ...: Gets the parent node name of the node pointed to by the XPath -; Syntax ........: _XML_GetParentNodeName(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - @TODO -; On Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Mike Rerick -; Modified.......: -; Remarks .......: Returns empty string if the XPath is not valid -; Related .......: -; Link ..........: -; Example .......: [yes/no] -; =============================================================================================================================== -Func _XML_GetParentNodeName(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - If _XML_Misc_GetDomVersion() < 4 Then - Return SetError($XML_ERR_DOMVERSION, 4, $XML_RET_FAILURE) ; TODO @extended Description - EndIf - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $aResponse[1], $sNodePath, $sNameSpace = '' - Local $sParentNodeName = "", $oParent_Node = Null - - For $oNode_enum In $oNodesColl - Local $oNode_enum1 = $oNode_enum - $sNodePath = "" - If $oNode_enum.nodeType <> $XML_NODE_DOCUMENT Then - $sNameSpace = $oNode_enum.namespaceURI() - If $sNameSpace = 0 Then - $sNameSpace = "" - ElseIf $sNameSpace <> "" Then - $sNameSpace = StringRight($sNameSpace, StringLen($sNameSpace) - StringInStr($sNameSpace, "/", $STR_NOCASESENSE, -1)) & ":" - EndIf - - $sNodePath = "/" & $sNameSpace & $oNode_enum.nodeName() & $sNodePath - EndIf - - $oParent_Node = $oNode_enum1.parentNode() - If $oParent_Node.nodeType <> $XML_NODE_DOCUMENT Then - $sNameSpace = $oParent_Node.namespaceURI() - If $sNameSpace = 0 Then - $sNameSpace = "" - ElseIf $sNameSpace <> "" Then - $sNameSpace &= ":" - EndIf - - $sNodePath = "/" & $sNameSpace & $oParent_Node.nodeName() & $sNodePath - $oNode_enum1 = $oParent_Node - $sParentNodeName = $oParent_Node.nodeName() - Else - $oNode_enum1 = 0 - EndIf - - $oParent_Node = Null - _XML_Array_AddName($aResponse, $sNodePath) - Next - - $aResponse[0] = UBound($aResponse) - 1 - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sParentNodeName) - -EndFunc ;==>_XML_GetParentNodeName - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetValue -; Description ...: Get XML values based on XPath input from root node. -; Syntax ........: _XML_GetValue(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: On Success - Returns an array of fields text values (count is in first element) -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; |0 - No matching node. ; TODO -; |1 - No object passed. ; TODO -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetValue(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $aResponse[1] - For $oNode_enum In $oNodesColl - If $oNode_enum.hasChildNodes() Then - For $oNode_enum_Child In $oNode_enum.childNodes() - If $oNode_enum_Child.nodeType = $XML_NODE_CDATA_SECTION Then - _XML_Array_AddName($aResponse, $oNode_enum_Child.data) - ElseIf $oNode_enum_Child.nodeType = $XML_NODE_TEXT Then - _XML_Array_AddName($aResponse, $oNode_enum_Child.Text) - EndIf - Next - Else - _XML_Array_AddName($aResponse, $oNode_enum.nodeValue) - EndIf - Next - - Local $i - For $i = UBound($aResponse) - 1 To 1 Step -1 - $aResponse[$i] = $aResponse[$i - 1] - Next - - $aResponse[0] = UBound($aResponse) - 1 - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $aResponse) - -EndFunc ;==>_XML_GetValue - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_InsertChildNode -; Description ...: Insert a child node under the specified XPath Node. -; Syntax ........: _XML_InsertChildNode(ByRef $oXmlDoc, $sXPath, $sNode[, $sData = ""[, $sNameSpace = ""]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sNode - Node name to add. -; $iItem - [optional] 0-based child item before which to insert. (Default = 0 -; $sData - [optional] Value to give the node -; $sNameSpace - [optional] Name Space -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: GMK -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; -; =============================================================================================================================== -Func _XML_InsertChildNode(ByRef $oXmlDoc, $sXPath, $sNode, $iItem = 0, $sData = "", $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oChild - For $oNode_enum In $oNodesColl - If $sNameSpace = "" Then - If Not ($oNode_enum.namespaceURI = 0 Or $oNode_enum.namespaceURI = "") Then $sNameSpace = $oNode_enum.namespaceURI - EndIf - - $oChild = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNode, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - If $sData <> "" Then $oChild.text = $sData - $oNode_enum.insertBefore($oChild, $oNode_enum.childNodes.item($iItem)) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - Next - - $oNodesColl = Null - $oChild = Null - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_InsertChildNode - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_RemoveAttributeNode -; Description ...: Delete XML Attribute node based on XPath input from root node. -; Syntax ........: _XML_RemoveAttributeNode(ByRef $oXmlDoc, $sXPath, $sAttribute) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sAttribute - a string value. The name of attribute node to delete -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_RemoveAttributeNode(ByRef $oXmlDoc, $sXPath, $sAttribute) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oAttribute = $oNode_Selected.removeAttributeNode($oNode_Selected.getAttributeNode($sAttribute)) - If @error Then - Return SetError($XML_ERR_COMERROR, @error, $XML_RET_FAILURE) - ElseIf Not IsObj($oAttribute) Then - Return SetError($XML_ERR_NOATTRMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_RemoveAttributeNode - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_ReplaceChild -; Description ...: Replaces selected nodes with another -; Syntax ........: _XML_ReplaceChild(ByRef $oXmlDoc, $sXPath, $sNodeNew_Name[, $sNameSpace = ""]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sNodeNew_Name - a string value. The replacement node name. -; $sNameSpace - [optional] a string value. Default is "". -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro adapted from http://www.perfectxml.com/msxmlAnswers.asp?Row_ID=65 -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: http://www.perfectxml.com/msxmlAnswers.asp?Row_ID=65 -; Example .......; yes -; =============================================================================================================================== -Func _XML_ReplaceChild(ByRef $oXmlDoc, $sXPath, $sNodeNew_Name, $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oNodeNew = Null - For $oNode_enum_old In $oNodesColl - ; Create a New Node element - $oNodeNew = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNodeNew_Name, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - ; Copy all attributes - For $oAttributeEnum In $oNode_enum_old.Attributes - $oNodeNew.Attributes.setNamedItem($oAttributeEnum.cloneNode(True)) - Next - - ; Copy all Child Nodes - For $oNode_enum_old_Child In $oNode_enum_old.childNodes - $oNodeNew.appendChild($oNode_enum_old_Child) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - Next - - ; Replace the specified $oNode_enum_old with the supplied $oNodeNew - $oNode_enum_old.parentNode.replaceChild($oNodeNew, $oNode_enum_old) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - Next - $oNodesColl = Null - $oNodeNew = Null - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_ReplaceChild - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_SetAttrib -; Description ...: Set XML Field(s) based on XPath input from root node. -; Syntax ........: _XML_SetAttrib(ByRef $oXmlDoc, $sXPath, $sAttribute[, $sValue = ""[, $iIndex = Default]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sAttribute - The attribute to set. -; $sValue - The value to give the attribute defaults to "" -; $iIndex - Used to specify a specific index for "same named" nodes. -; Return values .: Success - An array of fields text values -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_SetAttrib(ByRef $oXmlDoc, $sXPath, $sAttribute, $sValue = "", $iIndex = Default) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $aResponse[1] - - If IsNumber($iIndex) And $iIndex > 0 Then - $aResponse[0] = $oNodesColl.item($iIndex).SetAttribute($sAttribute, $sValue) - If @error Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - ElseIf $iIndex = Default Then - ReDim $aResponse[$oNodesColl.length] - For $iNode_idx = 0 To $oNodesColl.length - 1 - $aResponse[$iNode_idx] = $oNodesColl.item($iNode_idx).SetAttribute($sAttribute, $sValue) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - Next - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $aResponse) - EndIf - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_SetAttrib - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Transform -; Description ...: Transform XML data -; Syntax ........: _XML_Transform(ByRef $oXmlDoc, $sXSL_FileFullPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sXSL_FileFullPath - a string value. The stylesheet to use -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro , Modified by WeaponX -; Modified ......: mLipok -; Remarks .......: Ref XML Object will be overwriten - will contain Transformed Data -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_Transform(ByRef $oXmlDoc, $sXSL_FileFullPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - If Not (FileExists($sXSL_FileFullPath)) Then - Return SetError($XML_ERR_LOAD, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oXSLT_Template = ObjCreate("Msxml2.XSLTemplate." & _XML_Misc_GetDomVersion() & ".0") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_XSLTEMPLATE, $XML_RET_FAILURE) - - Local $oXSL_Document = ObjCreate("Msxml2.FreeThreadedDOMDocument." & _XML_Misc_GetDomVersion() & ".0") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_FREETHREADEDDOMDOCUMENT, $XML_RET_FAILURE) - - Local $oXmlDoc_Temp = ObjCreate("Msxml2.DOMDocument." & _XML_Misc_GetDomVersion() & ".0") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_DOMDOCUMENT, $XML_RET_FAILURE) - - $oXSL_Document.async = False - $oXSL_Document.load($sXSL_FileFullPath) - If $oXSL_Document.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - $oXSLT_Template.stylesheet = $oXSL_Document - Local $oXSL_Processor = $oXSLT_Template.createProcessor() - $oXSL_Processor.input = $oXmlDoc - - $oXmlDoc_Temp.transformNodeToObject($oXSL_Document, $oXmlDoc) - If $oXSL_Document.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc_Temp.parseError.errorCode, $oXmlDoc_Temp.parseError.reason) - EndIf - - ; Replace oryginal document obecject - $oXmlDoc = $oXmlDoc_Temp - - ; CleanUp - $oXSL_Processor = Null - $oXSLT_Template = Null - $oXSL_Document = Null - $oXmlDoc_Temp = Null - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_Transform - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_UpdateField -; Description ...: Update existing single node based on XPath specs. -; Syntax ........: _XML_UpdateField(ByRef $oXmlDoc, $sXPath, $sData) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sData - The data to update the node with. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: Weaponx, mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_UpdateField(ByRef $oXmlDoc, $sXPath, $sData) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then - Return SetError(@error, @extended, $XML_RET_FAILURE) - ElseIf $oNode_Selected.hasChildNodes Then - Local $bUpdateStatus = False - For $oNode_enum_Child In $oNode_Selected.childNodes() - If $oNode_enum_Child.nodetype = $XML_NODE_TEXT Then - $oNode_enum_Child.Text = $sData - $bUpdateStatus = True - ExitLoop - EndIf - Next - - If Not $bUpdateStatus Then - Local $oNode_Created = $oXmlDoc.createTextNode($sData) - $oNode_Selected.appendChild($oNode_Created) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - EndIf - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_UpdateField - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_UpdateField2 -; Description ...: Update existing node(s) based on XPath specs. -; Syntax ........: _XML_UpdateField2(ByRef $oXmlDoc, $sXPath, $sData) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sData - The data to update the node with. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified.......: Weaponx, mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: [yes/no] -; =============================================================================================================================== -Func _XML_UpdateField2(ByRef $oXmlDoc, $sXPath, $sData) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - For $oNode_enum In $oNodesColl - If $oNode_enum.hasChildNodes() Then - For $oNode_enum_Child In $oNode_enum.childNodes() - If $oNode_enum_Child.nodetype = $XML_NODE_TEXT Then - $oNode_enum_Child.Text = $sData - ExitLoop - EndIf - Next - Else - ; TODO What here ??? - EndIf - Next - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_UpdateField2 - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Validate_File -; Description ...: Validates a document against a dtd. -; Syntax ........: _XML_Validate_File($sXMLFile, $sNameSpace, $sXSD_FileFullPath) -; Parameters ....: $sXMLFile - The file to validate -; $sNameSpace - xml namespace -; $sXSD_FileFullPath - DTD file to validate against. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: ; TODO: Add such function but to work with object instead files ( I mean in memory validation ) -; Related .......: -; Link ..........; https://msdn.microsoft.com/en-us/library/ms760267(v=vs.85).aspx -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_Validate_File($sXMLFile, $sNameSpace, $sXSD_FileFullPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oXmlDoc = _XML_CreateDOMDocument() - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oXML_SchemaCache = ObjCreate("Msxml2.XMLSchemaCache." & _XML_Misc_GetDomVersion() & ".0") - If Not IsObj($oXML_SchemaCache) Then - Return SetError($XML_ERR_GENERAL, $XML_EXT_XMLSCHEMACACHE, $XML_RET_FAILURE) - EndIf - - $oXML_SchemaCache.add($sNameSpace, $sXSD_FileFullPath) - $oXmlDoc.schemas = $oXML_SchemaCache - $oXmlDoc.async = False - $oXmlDoc.ValidateOnParse = False - - $oXmlDoc.load($sXMLFile) - $oXmlDoc.validate() - - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_Validate_File -#EndRegion XML.au3 - Functions - Not yet reviewed - -#Region XML.au3 - Functions - Work in progress - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetNodesCount -; Description ...: Get node count based on $sXPath and selected $iNodeType -; Syntax ........: _XML_GetNodesCount(ByRef $oXmlDoc, $sXPath[, $iNodeType = Default]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $iNodeType - [optional] an integer value. Default value is Default which mean any type. -; Return values .: Success - Number of nodes found (can be 0) -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro & DickB -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_GetNodesCount(ByRef $oXmlDoc, $sXPath, $iNodeType = Default) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If $iNodeType = Default Then - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oNodesColl.length) - ElseIf $iNodeType >= $XML_NODE_ELEMENT And $iNodeType <= $XML_NODE_NOTATION Then - Local $iNodeCount = 0 - For $oNode_enum In $oNodesColl - If $oNode_enum.nodeType = $iNodeType Then $iNodeCount += 1 - Next - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $iNodeCount) - EndIf - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetNodesCount - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_InsertChildWAttr -; Description ...: Inserts a child node(s) under the specified XPath NodeCollection with attributes. -; Syntax ........: _XML_InsertChildWAttr(ByRef $oXmlDoc, $sXPath, $sNodeName[, $aAttributeList = Default[, $sNodeText = ""[, $sNameSpace = ""]]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sNodeName - a string value. The nodeName -; $iItem - [optional] Item before which to insert the child. (Default = 0) -; $vAttributeNameOrList - [optional] Attribute name or an array of XML Attributes and Values. (Name|Value) -; $sAttribute_Value - [optional] Attribute value if $vAttributeNameOrList is a string -; $sNodeText - [optional] a string value. Default is "". -; $sNameSpace - [optional] a string value. Default is "". -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: GMK -; Modified ......: -; Remarks .......: This function requires that each attribute name has a corresponding value. -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_InsertChildWAttr(ByRef $oXmlDoc, $sXPath, $sNodeName, $iItem = 0, $vAttributeNameOrList = Default, $sAttribute_Value = "", $sNodeText = "", $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local Enum _ - $eATTRIBUTES_NAME, _ - $eATTRIBUTES_VALUE, _ - $eATTRIBUTES_ARRAYCOLCOUNT - - If (UBound($vAttributeNameOrList) > 0 And UBound($vAttributeNameOrList, 2) <> $eATTRIBUTES_ARRAYCOLCOUNT) Then Return SetError($XML_ERR_ARRAY, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - - Local $iLastAttribute = UBound($vAttributeNameOrList) - 1 - For $iAttribute_idx = 0 To $iLastAttribute - If _ - $vAttributeNameOrList[$iAttribute_idx][$eATTRIBUTES_NAME] = '' _ - Or (Not IsString($vAttributeNameOrList[$iAttribute_idx][$eATTRIBUTES_NAME])) _ - Or (Not IsString($vAttributeNameOrList[$iAttribute_idx][$eATTRIBUTES_VALUE])) _ - Then - Return SetError($XML_ERR_ARRAY, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Next - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oChild_Temp = Null, $oAttribute_Temp = Null - For $oNode_enum In $oNodesColl - If $sNameSpace = "" Then - If Not ($oNode_enum.namespaceURI = 0 Or $oNode_enum.namespaceURI = "") Then $sNameSpace = $oNode_enum.namespaceURI - EndIf - - $oChild_Temp = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNodeName, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - If $sNodeText <> "" Then $oChild_Temp.text = $sNodeText - - If IsArray($vAttributeNameOrList) And UBound($vAttributeNameOrList) > 0 Then - For $iAttribute_idx = 0 To UBound($vAttributeNameOrList) - 1 - $oAttribute_Temp = $oXmlDoc.createAttribute($vAttributeNameOrList[$iAttribute_idx][$eATTRIBUTES_NAME]) ;, $sNameSpace) ; TODO Check this comment - If @error Then ExitLoop ; TODO Description ? - $oAttribute_Temp.value = $vAttributeNameOrList[$iAttribute_idx][$eATTRIBUTES_VALUE] - $oChild_Temp.setAttributeNode($oAttribute_Temp) - Next - Else - $oAttribute_Temp = $oXmlDoc.createAttribute($vAttributeNameOrList) ;, $sNameSpace) ; TODO Check this comment - $oAttribute_Temp.value = $sAttribute_Value - $oChild_Temp.setAttributeNode($oAttribute_Temp) - EndIf - - ; Inserts a new child node before the given item of the parent node - $oNode_enum.insertBefore($oChild_Temp, $oNode_enum.childNodes.item($iItem)) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - Next - - $oChild_Temp = Null - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_InsertChildWAttr - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_RemoveAttribute -; Description ...: Delete XML Attribute based on XPath input from root node. -; Syntax ........: _XML_RemoveAttribute(ByRef $oXmlDoc, $sXPath, $sAttribute_name) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sAttribute_name - a string value. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: [yes/no] -; =============================================================================================================================== -Func _XML_RemoveAttribute(ByRef $oXmlDoc, $sXPath, $sAttribute_Name) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oAttribute = $oNode_Selected.getAttributeNode($sAttribute_Name) - If Not (IsObj($oAttribute)) Then - Return SetError($XML_ERR_NOATTRMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - ; https://msdn.microsoft.com/en-us/library/ms757848(v=vs.85).aspx - Local $iAttributesLength = $oNode_Selected.attributes.length - Local $oAttribute_Removed = $oNode_Selected.removeAttributeNode($oAttribute) - - If Not IsObj($oAttribute_Removed) Or ($iAttributesLength = 1 + $oNode_Selected.attributes.length) Then - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_RemoveAttribute - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_TransformNode -; Description ...: Process given XML file with a given XSL stylesheet, in order to transform it to given HTML file -; Syntax ........: _XML_TransformNode($sXML_FileFullPath, $sXSL_FileFullPath, $sHTML_FileFullPath[, $iEncoding = $FO_UTF8_NOBOM]) -; Parameters ....: $sXML_FileFullPath - a string value. -; $sXSL_FileFullPath - a string value. -; $sHTML_FileFullPath - a string value. -; $iEncoding - [optional] an integer value. Default is $FO_UTF8_NOBOM. -; Return values .: Success - 1 and set @error = 0 -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func _XML_TransformNode($sXML_FileFullPath, $sXSL_FileFullPath, $sHTML_FileFullPath, $iEncoding = $FO_UTF8_NOBOM) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oXSL_Document = ObjCreate("Microsoft.XMLDOM") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_XMLDOM, $XML_RET_FAILURE) - - Local $oXmlDoc = ObjCreate("Microsoft.XMLDOM") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_XMLDOM, $XML_RET_FAILURE) - - $oXSL_Document.Async = False - $oXSL_Document.Load($sXSL_FileFullPath) - If $oXSL_Document.parseError.errorCode Then - Return SetError($XML_ERR_PARSE_XSL, $oXSL_Document.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - $oXmlDoc.Async = False - $oXmlDoc.Load($sXML_FileFullPath) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - Local $sHTML = $oXmlDoc.transformNode($oXSL_Document) - - Local $hFile = FileOpen($sHTML_FileFullPath, $FO_OVERWRITE + $iEncoding) - FileWrite($hFile, $sHTML) - FileClose($hFile) - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_TransformNode -#EndRegion XML.au3 - Functions - Work in progress - -#Region XML.au3 - Functions - COMPLETED - -; #INTERNAL_USE_ONLY# =========================================================================================================== -; Name ..........: __XML_IsValidObject_Attributes -; Description ...: Check if Object is valid IXMLDOMNamedNodeMap Object -; Syntax ........: __XML_IsValidObject_Attributes(ByRef $oAttributes) -; Parameters ....: $oAttributes - [in/out] an object. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func __XML_IsValidObject_Attributes(ByRef $oAttributes) - If Not IsObj($oAttributes) Then - Return SetError($XML_ERR_ISNOTOBJECT, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf ObjName($oAttributes, $OBJ_NAME) <> 'IXMLDOMNamedNodeMap' Then - Return SetError($XML_ERR_INVALIDATTRIB, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) -EndFunc ;==>__XML_IsValidObject_Attributes - -; #INTERNAL_USE_ONLY# =========================================================================================================== -; Name ..........: __XML_IsValidObject_DOMDocument -; Description ...: Check if Object is valid Msxml2.DOMDocument.xxxx Object -; Syntax ........: __XML_IsValidObject_DOMDocument(ByRef $oXML) -; Parameters ....: $oXML - [in/out] an object. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func __XML_IsValidObject_DOMDocument(ByRef $oXML) - If Not IsObj($oXML) Then - Return SetError($XML_ERR_ISNOTOBJECT, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf StringInStr(ObjName($oXML, $OBJ_NAME), 'DOMDocument') = 0 Then - Return SetError($XML_ERR_INVALIDDOMDOC, $XML_EXT_DOMDOCUMENT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) -EndFunc ;==>__XML_IsValidObject_DOMDocument - -; #INTERNAL_USE_ONLY# =========================================================================================================== -; Name ..........: __XML_IsValidObject_DOMDocumentOrElement -; Description ...: Check if Object is valid Msxml2.DOMDocument.xxxx Object or IXMLDOMElement -; Syntax ........: __XML_IsValidObject_DOMDocumentOrElement(Byref $oXML) -; Parameters ....: $oXML - [in/out] an object. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Return values .: None -; Author ........: Your Name -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func __XML_IsValidObject_DOMDocumentOrElement(ByRef $oXML) - If Not IsObj($oXML) Then - Return SetError($XML_ERR_ISNOTOBJECT, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf StringInStr(ObjName($oXML, $OBJ_NAME), 'DOMDocument') = 0 And StringInStr(ObjName($oXML, $OBJ_NAME), 'IXMLDOMElement') = 0 Then - Return SetError($XML_ERR_INVALIDDOMDOC, $XML_EXT_DOMDOCUMENT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) -EndFunc ;==>__XML_IsValidObject_DOMDocumentOrElement - -; #INTERNAL_USE_ONLY# =========================================================================================================== -; Name ..........: __XML_IsValidObject_Node -; Description ...: Check if Object is valid IXMLDOMSelection Object -; Syntax ........: __XML_IsValidObject_Node(ByRef $oNode[, $iNodeType = Default]) -; Parameters ....: $oNode - [in/out] an object. -; $iNodeType - [optional] an integer value. Default value is Default this mean any type. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func __XML_IsValidObject_Node(ByRef $oNode, $iNodeType = Default) - If Not IsObj($oNode) Then - Return SetError($XML_ERR_ISNOTOBJECT, $XML_EXT_PARAM1, $XML_RET_FAILURE) - ElseIf ObjName($oNode, $OBJ_NAME) <> 'IXMLDOMNode' And ObjName($oNode, $OBJ_NAME) <> 'IXMLDOMElement' Then - Return SetError($XML_ERR_INVALIDNODETYPE, $XML_EXT_DEFAULT, ObjName($oNode, $OBJ_NAME)) - ElseIf $iNodeType = Default Then - ; do not check type - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - ElseIf $iNodeType >= $XML_NODE_ELEMENT And $iNodeType <= $XML_NODE_NOTATION Then - If $iNodeType = $oNode.type Then - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - Return SetError($XML_ERR_INVALIDNODETYPE, $oNode.type, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_PARAMETER, $XML_EXT_PARAM2, $XML_RET_FAILURE) -EndFunc ;==>__XML_IsValidObject_Node - -; #INTERNAL_USE_ONLY# =========================================================================================================== -; Name ..........: __XML_IsValidObject_NodesColl -; Description ...: Check if Object is valid IXMLDOMSelection Object -; Syntax ........: __XML_IsValidObject_NodesColl(ByRef $oNodesColl) -; Parameters ....: $oNodesColl - [in/out] an object. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func __XML_IsValidObject_NodesColl(ByRef $oNodesColl) - If Not IsObj($oNodesColl) Then - Return SetError($XML_ERR_ISNOTOBJECT, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf ObjName($oNodesColl, $OBJ_NAME) <> 'IXMLDOMSelection' Then - Return SetError($XML_ERR_INVALIDNODETYPE, $XML_EXT_DEFAULT, ObjName($oNodesColl, $OBJ_NAME)) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) -EndFunc ;==>__XML_IsValidObject_NodesColl - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateChildWAttr -; Description ...: Create a child node(s) under the specified XPath NodeCollection with attributes. -; Syntax ........: _XML_CreateChildWAttr(ByRef $oXmlDoc, $sXPath, $sNodeName[, $aAttributeList = Default[, $sNodeText = ""[, -; $sNameSpace = ""]]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $sNodeName - a string value. The nodeName -; $aAttributeList - [optional] an array of XML Attributes. Column0=Name, Column1=Value -; $sNodeText - [optional] a string value. Default is "". -; $sNameSpace - [optional] a string value. Default is "". -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: This function requires that each attribute name has a corresponding value. -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_CreateChildWAttr(ByRef $oXmlDoc, $sXPath, $sNodeName, $aAttributeList = Default, $sNodeText = "", $sNameSpace = "") - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local Enum _ - $eATTRIBUTES_NAME, _ - $eATTRIBUTES_VALUE, _ - $eATTRIBUTES_ARRAYCOLCOUNT - - If IsArray($aAttributeList) Then - If Not (UBound($aAttributeList) > 0 And UBound($aAttributeList, 2) = $eATTRIBUTES_ARRAYCOLCOUNT) Then - Return SetError($XML_ERR_ARRAY, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - For $iAttribute_idx = 0 To UBound($aAttributeList) - 1 - If _ - $aAttributeList[$iAttribute_idx][$eATTRIBUTES_NAME] = '' _ - Or (Not IsString($aAttributeList[$iAttribute_idx][$eATTRIBUTES_NAME])) _ - Or $aAttributeList[$iAttribute_idx][$eATTRIBUTES_VALUE] = '' _ ; TODO: QUESTION: is Value must be not empty string ? - Or (Not IsString($aAttributeList[$iAttribute_idx][$eATTRIBUTES_VALUE])) _ - Then - Return SetError($XML_ERR_ARRAY, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Next - ElseIf Not $aAttributeList = Default Then - Return SetError($XML_ERR_ARRAY, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oChild_Temp = Null, $oAttribute_Temp = Null - For $oNode_enum In $oNodesColl - If $sNameSpace = "" Then - If Not ($oNode_enum.namespaceURI = 0 Or $oNode_enum.namespaceURI = "") Then $sNameSpace = $oNode_enum.namespaceURI - EndIf - - $oChild_Temp = $oXmlDoc.createNode($XML_NODE_ELEMENT, $sNodeName, $sNameSpace) - If @error Then Return SetError($XML_ERR_NODECREATE, @error, $XML_RET_FAILURE) - - If $sNodeText <> "" Then $oChild_Temp.text = $sNodeText - - If UBound($aAttributeList) Then - For $iAttribute_idx = 0 To UBound($aAttributeList) - 1 - $oAttribute_Temp = $oXmlDoc.createAttribute($aAttributeList[$iAttribute_idx][$eATTRIBUTES_NAME]) ;, $sNameSpace) ; TODO Check this comment - If @error Then ExitLoop ; TODO Description ? - - $oAttribute_Temp.value = $aAttributeList[$iAttribute_idx][$eATTRIBUTES_VALUE] - $oChild_Temp.setAttributeNode($oAttribute_Temp) - Next - EndIf - - ; Appends a new child node as the last child of the node. - $oNode_enum.appendChild($oChild_Temp) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - Next - - $oChild_Temp = Null - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) -EndFunc ;==>_XML_CreateChildWAttr - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_CreateDOMDocument -; Description ...: Create DOMDocument Object -; Syntax ........: _XML_CreateDOMDocument([$iDOM_Version = Default]) -; Parameters ....: $iDOM_Version - [optional] an integer value. Default value is Default. -; Return values .: Success - DOMDocument Object -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Modified ......: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: yes -; =============================================================================================================================== -Func _XML_CreateDOMDocument($iDOM_Version = Default) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - If $iDOM_Version = Default Then - For $iDOM_Version_idx = 8 To 0 Step -1 - If FileExists(@SystemDir & "\msxml" & $iDOM_Version_idx & ".dll") Then - $iDOM_Version = $iDOM_Version_idx - ExitLoop - EndIf - Next - ; if not found $iDOM_Version (still is Default) - If $iDOM_Version = Default Then - Return SetError($XML_ERR_OBJCREATE, $XML_EXT_DOMDOCUMENT, $XML_RET_FAILURE) - EndIf - Else - If Not ($iDOM_Version > 0 And $iDOM_Version < 7) Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - EndIf - - Local $oXmlDoc = ObjCreate("Msxml2.DOMDocument." & $iDOM_Version & ".0") - If @error Then - Return SetError($XML_ERR_OBJCREATE, $XML_EXT_DOMDOCUMENT, $XML_RET_FAILURE) - Else - __XML_MiscProperty_DomVersion($iDOM_Version) - EndIf - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oXmlDoc) -EndFunc ;==>_XML_CreateDOMDocument - -; #FUNCTION# =================================================================== -; Name ..........: _XML_CreateFile -; Description ...: Create a new blank metafile with header. -; Syntax.........: _XML_CreateFile($sXML_FileFullPath, $sRoot[, $bUTF8 = False[, $iDOM_Version = Default]]) -; Parameters ....: $sXML_FileFullPath - The xml filename with full path to create -; $sRoot - The root of the xml file to create -; $bUTF8 - boolean flag to specify UTF-8 encoding in header. -; $iDOM_Version - specifically try to use the version supplied here. -; Return values .: On Success - Returns $oXmlDoc -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; ============================================================================== -Func _XML_CreateFile($sXML_FileFullPath, $sRoot, $bUTF8 = False, $iDOM_Version = Default) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - ; TODO $bUTF8 = False -- change to $iEncoding = $FO_UTF8_NOBOM - If Not (IsString($sXML_FileFullPath) And $sXML_FileFullPath <> "") Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_PARAM1, $XML_RET_FAILURE) - ElseIf FileExists($sXML_FileFullPath) Then - Return SetError($XML_ERR_SAVE, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf Not IsString($sRoot) Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_PARAM2, $XML_RET_FAILURE) - EndIf - - Local $oXmlDoc = _XML_CreateDOMDocument($iDOM_Version) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oProcessingInstruction = $oXmlDoc.createProcessingInstruction("xml", 'version="1.0"' & (($bUTF8) ? ' encoding="UTF-8"' : '')) - If @error Then SetError($XML_ERR_COMERROR, @error, $XML_RET_FAILURE) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - $oXmlDoc.appendChild($oProcessingInstruction) - If @error Then Return SetError($XML_ERR_NODEAPPEND, @error, $XML_RET_FAILURE) - - If $sRoot <> '' Then - Local $oXML_RootElement = $oXmlDoc.createElement($sRoot) - $oXmlDoc.documentElement = $oXML_RootElement - EndIf - - _XML_SaveToFile($oXmlDoc, $sXML_FileFullPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oXmlDoc) - -EndFunc ;==>_XML_CreateFile - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetAllAttribIndex -; Description ...: Get XML attributes collection from node element based on Xpath and specific index. -; Syntax ........: _XML_GetAllAttribIndex(ByRef $oXmlDoc, $sXPath[, $iNodeIndex = 0]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; $iNodeIndex - [optional] an integer value. Default is 0. Specify which node in collection should be used. -; Return values .: Success - Attributes collection of object, -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: yes -; =============================================================================================================================== -Func _XML_GetAllAttribIndex(ByRef $oXmlDoc, $sXPath, $iNodeIndex = 0) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNodesColl = _XML_SelectNodes($oXmlDoc, $sXPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oAttributesColl = $oNodesColl.item($iNodeIndex).attributes - If @error Then - Return SetError($XML_ERR_COMERROR, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf IsObj($oAttributesColl) Then - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oAttributesColl) - ElseIf $oAttributesColl = Null Then - Return SetError($XML_ERR_NOATTRMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf $oAttributesColl.length = 0 Then - Return SetError($XML_ERR_EMPTYCOLLECTION, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetAllAttribIndex - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetChildNodes -; Description ...: Get XML child Node collection of node element based on XPath input from root node. -; Syntax ........: _XML_GetChildNodes(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: Success - Child Nodes collection, and @extended contains collection length (count) -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: yes -; =============================================================================================================================== -Func _XML_GetChildNodes(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then - Return SetError(@error, @extended, $XML_RET_FAILURE) - ElseIf $oNode_Selected.hasChildNodes() Then - Return SetError($XML_ERR_OK, $oNode_Selected.childNodes().length, $oNode_Selected.childNodes()) - Else - Return SetError($XML_ERR_NOCHILDMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - ; TODO Is it used ? - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetChildNodes - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_GetNodeAttributeValue -; Description ...: Get attribute value of selected node -; Syntax ........: _XML_GetNodeAttributeValue(ByRef $oNode_Selected, $sAttribute_Name) -; Parameters ....: $oNode_Selected - [in/out] A valid node object. -; $sAttribute_Name - A string value. Attribute name. -; Return values .: On Success - Returns string value of selected node -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func _XML_GetNodeAttributeValue(ByRef $oNode_Selected, $sAttribute_Name) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_Node($oNode_Selected) ; TODO: , $XML_NODE_ELEMENT) ?? - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If Not IsString($sAttribute_Name) Or $sAttribute_Name = '' Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - Local $sAttribute_Value = $oNode_Selected.getAttribute($sAttribute_Name) - If IsString($sAttribute_Value) Then - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sAttribute_Value) - ElseIf $sAttribute_Value = Null Then - Return SetError($XML_ERR_NOATTRMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>_XML_GetNodeAttributeValue - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Load -; Description ...: Load XML file to the existing object or declared empty variable. -; Syntax ........: _XML_Load(ByRef $oXmlDoc, $sXML_FileFullPath[, $sNameSpace = ""[, $bValidateOnParse = True]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sXML_FileFullPath - a string value. The XML file to open -; $sNameSpace - [optional] a string value. Default is "". The namespace to specifiy if the file uses one. -; $bValidateOnParse - [optional] a boolean value. Default is True. Validate the document as it is being parsed -; Return values .: Success - $oXmlDoc -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: Tom Hohmann, mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_Load(ByRef $oXmlDoc, $sXML_FileFullPath, $sNameSpace = "", $bValidateOnParse = True) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If Not FileExists($sXML_FileFullPath) Then Return SetError($XML_ERR_LOAD, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - - If _XML_Misc_GetDomVersion() > 4 Then $oXmlDoc.setProperty("ProhibitDTD", False) - $oXmlDoc.async = False - $oXmlDoc.preserveWhiteSpace = True - $oXmlDoc.validateOnParse = $bValidateOnParse - $oXmlDoc.Load($sXML_FileFullPath) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - ; SelectionLanguage do not use this as this cause a problem - ; $oXmlDoc.setProperty("SelectionLanguage", "XPath") - - $oXmlDoc.setProperty("SelectionNamespaces", $sNameSpace) - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oXmlDoc) - -EndFunc ;==>_XML_Load - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_LoadXML -; Description ...: Load XML String to the DOMDocument object. -; Syntax ........: _XML_LoadXML(ByRef $oXmlDoc, $sXML_Content[, $sNameSpace = ""[, $bValidateOnParse = True]]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sXML_Content - a string value. The XML string to load into the document -; $sNameSpace - [optional] a string value. Default is "". The namespace to specifiy if the file uses one. -; $bValidateOnParse - [optional] a boolean value. Default is True. Set the MSXML ValidateOnParse property -; Return values .: Success - $oXmlDoc -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro, Lukasz Suleja, Tom Hohmann -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_LoadXML(ByRef $oXmlDoc, $sXML_Content, $sNameSpace = "", $bValidateOnParse = True) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If _XML_Misc_GetDomVersion() > 4 Then $oXmlDoc.setProperty("ProhibitDTD", False) - $oXmlDoc.async = False - $oXmlDoc.preserveWhiteSpace = True - $oXmlDoc.validateOnParse = $bValidateOnParse - $oXmlDoc.LoadXml($sXML_Content) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - - ; SelectionLanguage do not use this as this cause a problem - ; $oXmlDoc.setProperty("SelectionLanguage", "XPath") - - $oXmlDoc.setProperty("SelectionNamespaces", $sNameSpace) - ; TODO this following line was here, actualy I (mLipok) wondering why. - ; "xmlns:ms='urn:schemas-microsoft-com:xslt'" - ; here I put some reference to look in - ; https://msdn.microsoft.com/en-us/library/ms256186(v=vs.110).aspx - - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oXmlDoc) - -EndFunc ;==>_XML_LoadXML - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_NodeExists -; Description ...: Checks for the existence of a node matching the specified path -; Syntax ........: _XML_NodeExists(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_NodeExists(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - Local $oNode_Selected = _XML_SelectSingleNode($oXmlDoc, $sXPath) - If @error Then - Return SetError(@error, @extended, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - - #forceref $oNode_Selected - -EndFunc ;==>_XML_NodeExists - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_SaveToFile -; Description ...: Save the current $oXmlDoc content to XML file -; Syntax ........: _XML_SaveToFile(ByRef $oXmlDoc, $sXML_FileFullPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sXML_FileFullPath - a string value. The filename to save the $oXmlDoc content. -; Return values .: Success - $XML_RET_SUCCESS -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_SaveToFile(ByRef $oXmlDoc, $sXML_FileFullPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If Not (IsString($sXML_FileFullPath) And $sXML_FileFullPath <> '') Then - Return SetError($XML_ERR_PARAMETER, $XML_EXT_PARAM2, $XML_RET_FAILURE) - ElseIf FileExists($sXML_FileFullPath) Then - Return SetError($XML_ERR_SAVE, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - - $oXmlDoc.save($sXML_FileFullPath) - If $oXmlDoc.parseError.errorCode Then - Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_SaveToFile - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_SelectNodes -; Description ...: Selects XML Node(s) based on XPath input from root node. -; Syntax ........: _XML_SelectNodes(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: Success - $oNodesColl - Nodes collection, and set @extended = $oNodesColl.length -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_SelectNodes(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocumentOrElement($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oNodesColl = $oXmlDoc.selectNodes($sXPath) - If @error Then - Return SetError($XML_ERR_XPATH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf (Not IsObj($oNodesColl)) Or $oNodesColl.length = 0 Then - Return SetError($XML_ERR_EMPTYCOLLECTION, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $oNodesColl.length, $oNodesColl) - -EndFunc ;==>_XML_SelectNodes - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_SelectSingleNode -; Description ...: Select single XML Node based on XPath input from root node. -; Syntax ........: _XML_SelectSingleNode(ByRef $oXmlDoc, $sXPath) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. -; $sXPath - a string value. The XML tree path from root node (root/child/child..) -; Return values .: Success - $oNode_Selected - single node -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......; [yes/no] -; =============================================================================================================================== -Func _XML_SelectSingleNode(ByRef $oXmlDoc, $sXPath) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocumentOrElement($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oNode_Selected = $oXmlDoc.selectSingleNode($sXPath) - If @error Then - Return SetError($XML_ERR_XPATH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf $oNode_Selected = Null Then - Return SetError($XML_ERR_NONODESMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - ElseIf Not IsObj($oNode_Selected) Then ; https://www.autoitscript.com/forum/topic/177176-why-isobj-0-and-vargettype-object/ - ; $XML_ERR_EMPTYOBJECT - Return SetError($XML_ERR_NONODESMATCH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oNode_Selected) -EndFunc ;==>_XML_SelectSingleNode - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Tidy -; Description ...: Tidy XML structure -; Syntax ........: _XML_Tidy(ByRef $oXmlDoc[, $sEncoding = Default]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sEncoding - [optional] a string value. Default value is -1 (omitXMLDeclaration) . -; Return values .: Success - XML with indent -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: mLipok -; Modified ......: -; Remarks .......: set $sEncoding = Default if you want to use default UDF encoding -; Related .......: _XML_MiscProperty_Encoding -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func _XML_Tidy(ByRef $oXmlDoc, $sEncoding = -1) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_DOMDocument($oXmlDoc) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - If $sEncoding = Default Then $sEncoding = _XML_MiscProperty_Encoding() - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $oReader = ObjCreate("MSXML2.SAXXMLReader") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_SAXXMLREADER, $XML_RET_FAILURE) - - Local $oWriter = ObjCreate("MSXML2.MXXMLWriter") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_MXXMLWRITER, $XML_RET_FAILURE) - - Local $oStream = ObjCreate("ADODB.STREAM") - If @error Then Return SetError($XML_ERR_OBJCREATE, $XML_EXT_STREAM, $XML_RET_FAILURE) - - Local $sXML_Return = '' - - With $oStream - .Open - If $sEncoding <> -1 Then .Charset = $sEncoding - If @error Then Return SetError($XML_ERR_PARAMETER, $XML_EXT_ENCODING, $XML_RET_FAILURE) - - With $oWriter - .indent = True - If $sEncoding = -1 Then - .omitXMLDeclaration = True - Else - .encoding = $sEncoding - EndIf - If @error Then Return SetError($XML_ERR_PARAMETER, $XML_EXT_ENCODING, $XML_RET_FAILURE) - .output = $oStream - EndWith - - With $oReader - .contentHandler = $oWriter - .errorHandler = $oWriter - .Parse($oXmlDoc) - If @error Then - ; TODO $XML_ERR_GENERAL replacement ?? - Return SetError($XML_ERR_GENERAL, $XML_EXT_SAXXMLREADER, $XML_RET_FAILURE) - EndIf - EndWith - - .Position = 0 - $sXML_Return = .ReadText($ADOENUM_adReadAll) - If $sXML_Return = Null Then $sXML_Return = '' - - EndWith - - Local $iSizeInBytes = $oStream.size - - ; CleanUp - $oStream = Null - $oReader = Null - $oWriter = Null - - Return SetError($XML_ERR_OK, $iSizeInBytes, $sXML_Return) ; TODO Description for @error and @extended - -EndFunc ;==>_XML_Tidy -#EndRegion XML.au3 - Functions - COMPLETED - -#Region XML.au3 - Functions - Misc -; #INTERNAL_USE_ONLY# =========================================================================================================== -; Name ..........: __XML_MiscProperty_DomVersion -; Description ...: TODO -; Syntax ........: __XML_MiscProperty_DomVersion([$sDomVersion = Default]) -; Parameters ....: $sDomVersion - [optional] a string value. Default value is Default. -; Return values .: DOM Version -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func __XML_MiscProperty_DomVersion($sDomVersion = Default) - Local Static $sDomVersion_Static = -1 - - If $sDomVersion = Default Then - ; just return stored static variable - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sDomVersion_Static) - ElseIf IsNumber($sDomVersion) Then - ; set and return static variable - $sDomVersion_Static = $sDomVersion - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sDomVersion_Static) - EndIf - - ; reset static variable - $sDomVersion_Static = -1 - ; return error as incorrect parameter was passed to this function - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $XML_RET_FAILURE) - -EndFunc ;==>__XML_MiscProperty_DomVersion - -; #FUNCTION# =================================================================== -; Name ..........: _XML_Misc_GetDomVersion -; Description ...: Returns the version of msxml that is in use for the document. -; Syntax.........: _XML_Misc_GetDomVersion() -; Parameters ....: none -; Return values .: Success - msxml version -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: Eltorro -; Modified ......: mLipok -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; ============================================================================== -Func _XML_Misc_GetDomVersion() - Return __XML_MiscProperty_DomVersion() -EndFunc ;==>_XML_Misc_GetDomVersion - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Misc_Viewer -; Description ...: Display XML Document in default system viewer -; Syntax ........: _XML_Misc_Viewer(ByRef $oXmlDoc[, $sXML_FileFullPath = Default]) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; $sXML_FileFullPath - [optional] a string value. Default is Default. -; Return values .: On Success - Returns $XML_RET_SUCCESS -; On Failure - Returns $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; TODO: @extended description -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func _XML_Misc_Viewer(ByRef $oXmlDoc, $sXML_FileFullPath = Default) - If $sXML_FileFullPath = Default Then - $sXML_FileFullPath = @ScriptDir & '\XMLDOM_Display_TestingFile.xml' - FileDelete($sXML_FileFullPath) - EndIf - - _XML_SaveToFile($oXmlDoc, $sXML_FileFullPath) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - ShellExecute($sXML_FileFullPath) - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - -EndFunc ;==>_XML_Misc_Viewer - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_MiscProperty_Encoding -; Description ...: Set/Get Encoding property -; Syntax ........: _XML_MiscProperty_Encoding([$sEncoding = Default]) -; Parameters ....: $sEncoding - [optional] a string value. Default value is Default. -; Return values .: Encoding as string -; Author ........: mLipok -; Modified ......: -; Remarks .......: For a list of the character set names that are known by a system, see the subkeys of HKEY_CLASSES_ROOT\MIME\Database\Charset in the Windows Registry. -; Related .......: -; Link ..........: https://msdn.microsoft.com/en-us/library/ms681424(v=vs.85).aspx -; Example .......: No -; =============================================================================================================================== -Func _XML_MiscProperty_Encoding($sEncoding = Default) - Local Static $sEncoding_Static = Default - - If $sEncoding = Default Then ; get current value from static variable - If $sEncoding_Static = Default Then ; if not set yet, try to set default encoding - Switch @OSLang - Case 0415 ; 'pl-PL' - $sEncoding_Static = 'ISO-8859-2' - Case Else - $sEncoding_Static = 'ISO-8859-1' - EndSwitch - EndIf - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sEncoding_Static) - - ElseIf IsString($sEncoding) Then ; set and return current value - $sEncoding_Static = $sEncoding - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $sEncoding_Static) - EndIf - Return SetError($XML_ERR_PARAMETER, $XML_EXT_PARAM1, $sEncoding_Static) - -EndFunc ;==>_XML_MiscProperty_Encoding - -; #FUNCTION# =================================================================== -; Name ..........: _XML_MiscProperty_UDFVersion -; Description ...: Returns UDF version number -; Syntax.........: _XML_MiscProperty_UDFVersion() -; Parameters ....: None -; Return values .: The UDF version number -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; ============================================================================== -Func _XML_MiscProperty_UDFVersion() - Return "1.1.1.10" -EndFunc ;==>_XML_MiscProperty_UDFVersion -#EndRegion XML.au3 - Functions - Misc - -#Region XML.au3 - Functions - Arrays - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Array_AddName -; Description ...: Adds an item to an array. -; Syntax.........: _XML_Array_AddName(ByRef $avArray, $sValue) -; Parameters ....: $avArray - The array to modify. -; $sValue - The value to add to the array. -; Return values .: Success $XML_RET_SUCCESS and value added to array. -; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) -; Author ........: -; Modified ......: mLipok, guinness -; Remarks .......: Local version of _ArrayAdd to remove dependency on Array.au3 -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; ============================================================================== -Func _XML_Array_AddName(ByRef $avArray, $sValue) - Local $iUBound = UBound($avArray) - If $iUBound Then ; IsArray() only tells you if it's an array data structure and not if elements are in the array. - ; Cache function call results, as function calls are expensive compared to variable lookups. - ReDim $avArray[$iUBound + 1] - $avArray[$iUBound - 1] = $sValue - Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $XML_RET_SUCCESS) - EndIf - - ; Else is not required, as this was always happen as a last resort. - Return SetError($XML_ERR_GENERAL, $XML_EXT_DEFAULT, $XML_RET_FAILURE) -EndFunc ;==>_XML_Array_AddName - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Array_GetAttributesProperties -; Description ...: Get IXMLDOMAttribute Members - properties, and put the result to array -; Syntax ........: _XML_Array_GetAttributesProperties(ByRef $oAttributesColl) -; Parameters ....: $oAttributesColl - [in/out] an object. -; Return values .: TODO -; Author ........: mLipok -; Modified ......: -; Remarks .......: TODO @error and description -; Related .......: -; Link ..........: https://msdn.microsoft.com/en-us/library/ms767677(v=vs.85).aspx -; Example .......: Yes -; =============================================================================================================================== -Func _XML_Array_GetAttributesProperties(ByRef $oAttributesColl) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_Attributes($oAttributesColl) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $avArray[1][$__g_eARRAY_ATTR_ARRAYCOLCOUNT] - $avArray[0][$__g_eARRAY_ATTR_NAME] = 'name' - $avArray[0][$__g_eARRAY_ATTR_TYPESTRING] = 'nodeTypeString' - $avArray[0][$__g_eARRAY_ATTR_VALUE] = 'value' - $avArray[0][$__g_eARRAY_ATTR_TEXT] = 'text' - $avArray[0][$__g_eARRAY_ATTR_DATATYPE] = 'dataType' - $avArray[0][$__g_eARRAY_ATTR_XML] = 'xml' - Local $iUBound = 0 - - For $oAttributeEnum In $oAttributesColl - $iUBound = UBound($avArray) - ReDim $avArray[$iUBound + 1][$__g_eARRAY_ATTR_ARRAYCOLCOUNT] - $avArray[$iUBound][$__g_eARRAY_ATTR_NAME] = $oAttributeEnum.name - $avArray[$iUBound][$__g_eARRAY_ATTR_TYPESTRING] = $oAttributeEnum.nodeTypeString - $avArray[$iUBound][$__g_eARRAY_ATTR_VALUE] = $oAttributeEnum.value - $avArray[$iUBound][$__g_eARRAY_ATTR_TEXT] = $oAttributeEnum.text - $avArray[$iUBound][$__g_eARRAY_ATTR_DATATYPE] = $oAttributeEnum.dataType - $avArray[$iUBound][$__g_eARRAY_ATTR_XML] = $oAttributeEnum.xml - Next - Return SetError($XML_ERR_OK, UBound($avArray), $avArray) - -EndFunc ;==>_XML_Array_GetAttributesProperties - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_Array_GetNodesProperties -; Description ...: Get IXMLDOMNode Members - properties, and put the result to array -; Syntax ........: _XML_Array_GetNodesProperties(ByRef $oNodeColl) -; Parameters ....: $oNodeColl - [in/out] an object. -; Return values .: Array with attributes description -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: https://msdn.microsoft.com/en-us/library/ms761386(v=vs.85).aspx -; Example .......: yes -; =============================================================================================================================== -Func _XML_Array_GetNodesProperties(ByRef $oNodesColl) - ; Local Error handler declaration, it will be automatic CleanUp when returning from function - Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) - #forceref $oXML_COM_ErrorHandler - - __XML_IsValidObject_NodesColl($oNodesColl) - If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) - - Local $avArray[1][$__g_eARRAY_NODE_ARRAYCOLCOUNT] - $avArray[0][$__g_eARRAY_NODE_NAME] = 'nodeName' - $avArray[0][$__g_eARRAY_NODE_TYPESTRING] = 'nodeTypeString' - $avArray[0][$__g_eARRAY_NODE_VALUE] = 'nodeValue' - $avArray[0][$__g_eARRAY_NODE_TEXT] = 'text' - $avArray[0][$__g_eARRAY_NODE_DATATYPE] = 'dataType' - $avArray[0][$__g_eARRAY_NODE_XML] = 'xml' - $avArray[0][$__g_eARRAY_NODE_ATTRIBUTES] = 'attributes' - Local $iUBound = 0 - - For $oNode_enum In $oNodesColl - $iUBound = UBound($avArray) - ReDim $avArray[$iUBound + 1][$__g_eARRAY_NODE_ARRAYCOLCOUNT] - $avArray[$iUBound][$__g_eARRAY_NODE_NAME] = $oNode_enum.nodeName - $avArray[$iUBound][$__g_eARRAY_NODE_TYPESTRING] = $oNode_enum.nodeTypeString - $avArray[$iUBound][$__g_eARRAY_NODE_VALUE] = $oNode_enum.nodeValue - $avArray[$iUBound][$__g_eARRAY_NODE_TEXT] = $oNode_enum.text - $avArray[$iUBound][$__g_eARRAY_NODE_DATATYPE] = $oNode_enum.dataType - $avArray[$iUBound][$__g_eARRAY_NODE_XML] = $oNode_enum.xml - - ; check if node have any attributes - If IsObj($oNode_enum.attributes) And $oNode_enum.attributes.length = 0 Then - $avArray[$iUBound][$__g_eARRAY_NODE_ATTRIBUTES] = '' - Else - Local $sAttributes = '' - For $oAttribute In $oNode_enum.attributes - $sAttributes &= $oAttribute.name & '="' & $oAttribute.text & '" ' - Next - $avArray[$iUBound][$__g_eARRAY_NODE_ATTRIBUTES] = StringTrimRight($sAttributes, 1) - EndIf - Next - Return SetError($XML_ERR_OK, UBound($avArray), $avArray) - -EndFunc ;==>_XML_Array_GetNodesProperties -#EndRegion XML.au3 - Functions - Arrays - -#Region XML.au3 - Functions - Error Handling - -; #INTERNAL_USE_ONLY#========================================================== -; Name ..........: __XML_ComErrorHandler_InternalFunction -; Description ...: A COM error handling routine. -; Syntax.........: __XML_ComErrorHandler_InternalFunction() -; Parameters ....: None -; Return values .: None -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........; -; Example .......; [yes/no] -; ============================================================================== -Func __XML_ComErrorHandler_InternalFunction($oCOMError) - ; If not defined ComErrorHandler_UserFunction then this function do nothing special - ; In that case you only can check @error / @extended after suspect functions - - Local $sUserFunction = _XML_ComErrorHandler_UserFunction() - If IsFunc($sUserFunction) Then $sUserFunction($oCOMError) -EndFunc ;==>__XML_ComErrorHandler_InternalFunction - -; #FUNCTION# ==================================================================================================================== -; Name ..........: __XML_ComErrorHandler_UserFunction -; Description ...: Set a UserFunctionWrapper to move the Fired COM Error Error outside UDF -; Syntax ........: _XML_ComErrorHandler_UserFunction([$fnUserFunction = Default]) -; Parameters ....: $fnUserFunction- [optional] a Function. Default value is Default. -; Return values .: ErrorHandler Function -; Author ........: mLipok -; Modified ......: -; Remarks .......: Description TODO -; Related .......: -; Link ..........: -; Example .......: No -; =============================================================================================================================== -Func _XML_ComErrorHandler_UserFunction($fnUserFunction = Default) - ; in case when user do not set his own function UDF must use internal function to avoid AutoItError - Local Static $fnUserFunction_Static = '' - - If $fnUserFunction = Default Then - Return $fnUserFunction_Static ; just return stored static variable - ElseIf IsFunc($fnUserFunction) Then - $fnUserFunction_Static = $fnUserFunction ; set and return static variable - Return $fnUserFunction_Static - EndIf - $fnUserFunction_Static = '' ; reset static variable - ; return error as incorrect parameter was passed to this function - Return SetError($XML_ERR_PARAMETER, $XML_EXT_DEFAULT, $fnUserFunction_Static) - -EndFunc ;==>_XML_ComErrorHandler_UserFunction - -; #FUNCTION# ==================================================================================================================== -; Name ..........: _XML_ErrorParser_GetDescription -; Description ...: Parse Error to Console -; Syntax ........: _XML_ErrorParser_GetDescription(ByRef $oXmlDoc) -; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. -; Return values .: Descripition for paresed error -; Author ........: mLipok -; Modified ......: -; Remarks .......: -; Related .......: -; Link ..........: https://msdn.microsoft.com/en-us/library/ms767720(v=vs.85).aspx , https://msdn.microsoft.com/en-us/library/ms757019(v=vs.85).aspx -; Example .......: No -; =============================================================================================================================== -Func _XML_ErrorParser_GetDescription(ByRef $oXmlDoc) - Local $sParseError_FullDescription = '' - If IsObj($oXmlDoc) And $oXmlDoc.parseError.errorCode <> 0 Then - $sParseError_FullDescription &= 'IXMLDOMParseError errorCode = ' & $oXmlDoc.parseError.errorCode & @CRLF ; Contains the error code of the last parse error. - $sParseError_FullDescription &= 'IXMLDOMParseError filepos = ' & $oXmlDoc.parseError.filepos & @CRLF ; Contains the absolute file position where the error occurred. - $sParseError_FullDescription &= 'IXMLDOMParseError line = ' & $oXmlDoc.parseError.line & @CRLF ; Specifies the line number that contains the error. - $sParseError_FullDescription &= 'IXMLDOMParseError linepos = ' & $oXmlDoc.parseError.linepos & @CRLF ; Contains the character position within the line where the error occurred. - $sParseError_FullDescription &= 'IXMLDOMParseError reason = ' & $oXmlDoc.parseError.reason & @CRLF ; Describes the reason for the error. - $sParseError_FullDescription &= 'IXMLDOMParseError srcText = ' & $oXmlDoc.parseError.srcText & @CRLF ; Returns the full text of the line containing the error. - $sParseError_FullDescription &= 'IXMLDOMParseError url = ' & $oXmlDoc.parseError.url & @CRLF ; Contains the URL of the XML document containing the last error. - EndIf - Return $sParseError_FullDescription -EndFunc ;==>_XML_ErrorParser_GetDescription -#EndRegion XML.au3 - Functions - Error Handling - -#Region XML.au3 - NEW TODO - -#CS - DOM Reference - https://msdn.microsoft.com/en-us/library/ms764730(v=vs.85).aspx - - XPath Examples - https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx - -#CE - -Func _EncodeXML($sFileToEncode) -;~ http://www.vb-helper.com/howto_encode_base64_hex.html -;~ https://www.autoitscript.com/forum/topic/138443-image-to-base64-code/?do=findComment&comment=970372 -;~ http://stackoverflow.com/questions/496751/base64-encode-string-in-vbscript -;~ https://support.microsoft.com/en-us/kb/254388 -;~ https://gist.github.com/wangye/1990522 - ;Xroot 2011 - - Local $hFile = FileOpen($sFileToEncode, $FO_BINARY) - Local $dat = FileRead($hFile) - FileClose($hFile) - Local $oXML = ObjCreate("MSXML2.DOMDocument") - Local $oNode = $oXML.createElement("b64") - $oNode.dataType = "bin.base64" - $oNode.nodeTypedValue = $dat - Return $oNode.Text -EndFunc ;==>_EncodeXML -#EndRegion XML.au3 - NEW TODO - diff --git a/LanguageFiles/UXS-DUTCH.XML b/LanguageFiles/UXS-DUTCH.XML index 13e98f6..b7c0386 100644 --- a/LanguageFiles/UXS-DUTCH.XML +++ b/LanguageFiles/UXS-DUTCH.XML @@ -1,6 +1,6 @@ en - %COUNTRY%|nl|eu|us|jp|wor|ss + %COUNTRY%|nl|eu|wor|ss|us|jp|cus diff --git a/LanguageFiles/UXS-ENGLISH.XML b/LanguageFiles/UXS-ENGLISH.XML index f103029..6a5912a 100644 --- a/LanguageFiles/UXS-ENGLISH.XML +++ b/LanguageFiles/UXS-ENGLISH.XML @@ -1,6 +1,6 @@ en - %COUNTRY%|us|uk|eu|jp|wor|ss + %COUNTRY%|us|uk|eu|wor|ss|jp|cus diff --git a/LanguageFiles/UXS-FRENCH.XML b/LanguageFiles/UXS-FRENCH.XML index 9618d68..a158afd 100644 --- a/LanguageFiles/UXS-FRENCH.XML +++ b/LanguageFiles/UXS-FRENCH.XML @@ -1,6 +1,6 @@ fr|en - %COUNTRY%|fr|eu|us|jp|wor|ss + %COUNTRY%|fr|eu|wor|ss|us|jp|cus diff --git a/LanguageFiles/UXS-GERMAN.XML b/LanguageFiles/UXS-GERMAN.XML index 942a06c..fe15430 100644 --- a/LanguageFiles/UXS-GERMAN.XML +++ b/LanguageFiles/UXS-GERMAN.XML @@ -1,8 +1,6 @@ - - de|en - %COUNTRY%|de|eu|us|jp|wor|ss + %COUNTRY%|de|eu|wor|ss|us|jp|cus diff --git a/LanguageFiles/UXS-ITALIAN.XML b/LanguageFiles/UXS-ITALIAN.XML index 14c74b6..2ccfad0 100644 --- a/LanguageFiles/UXS-ITALIAN.XML +++ b/LanguageFiles/UXS-ITALIAN.XML @@ -1,6 +1,6 @@ it|en - %COUNTRY%|it|eu|us|jp|wor|ss + %COUNTRY%|it|eu|wor|ss|us|jp|cus Errore diff --git a/LanguageFiles/UXS-JAPANESE.XML b/LanguageFiles/UXS-JAPANESE.XML index 0828766..d1692c7 100644 --- a/LanguageFiles/UXS-JAPANESE.XML +++ b/LanguageFiles/UXS-JAPANESE.XML @@ -1,6 +1,6 @@ en - %COUNTRY%|jp|us|eu|wor|ss + %COUNTRY%|jp|wor|ss|eu|us|cus diff --git a/LanguageFiles/UXS-PORTUGUESE.XML b/LanguageFiles/UXS-PORTUGUESE.XML index 57ef61f..66bd8c0 100644 --- a/LanguageFiles/UXS-PORTUGUESE.XML +++ b/LanguageFiles/UXS-PORTUGUESE.XML @@ -1,204 +1,202 @@ - - pt|en - %COUNTRY%|br|eu|us|jp|wor|ss + %COUNTRY%|pt|eu|wor|ss|us|jp|cus - Error - Roms path can't be reached - No file found - Roms Path for autoconfiguration can't be reached - Universal XML Scraper fatal error ! - (Problem connecting to the database) - (Time Out) + Erro + Não é possível aceder ao caminho(Path) das roms + Nenhum ficheiro encontrado + Não é possível aceder ao caminho(Path) das roms para configuração automática + Erro fatal Universal XML Scraper ! + (Problema ao ligar a base de dados) + (Expirou) (err_SystemList) - (Scrape Engine launch Failed. Thank you to check your Antivirus) - SSH Command had a problem - (Connexion can't be established) - Sorry, your account can't be found (Check your login and password) + (Falha ao arrancar o motor de Scrape. Por favor verifica o Antivirús) + Comando SSH teve um problema + (Não foi possível estabelecer conexão) + A tua conta não foi encontrada (Por favor verifica o nome de utilizador e a password) - Autoconfiguration preparation in progress - Autoconfiguration - Do you want to use autoconfiguration ? - Are you sure you want to kill EmulationStation ? - Are you sure you want to start EmulationStation ? - Are you sure you want to reboot distant peripheral ? - Are you sure you want to halt distant peripheral ? - Update needed - Update - Account logged - Your account give you maximum - You are : a god, an half god (or at least a 2/3 god) or Chuck Norris. Be carreful !!! + Configuração automática em preparação + Configuração automática + Queres usar a Configuração automática ? + Tens a certeza que queres parar o EmulationStation ? + Tens a certeza que queres iniciar o EmulationStation ? + Tens a certeza que queres reiniciar a máquina remota ? + Tens a certeza que queres desligar a máquina remota ? + Atualização necessária + Atualizar + Conta registada + A tua conta dá-te um máximo de + És : um Deus, meio Deus (ou pelo menos 2/3 Deus) ou Chuck Norris. Tem cuidado !!! Universal XML Scraper V2 - File - Exit + Ficheiro + Sair - Configuration - Launch wizard - Path configuration - General configuration - Options configuration - Pictures configuration - Autoconfiguration Path configuration - Change your profil - Change your Mix Images profil - Change your language + Configuração + Iniciar assistente + Configuração da Path + Configuração geral + Configuração de opções + Configuração de imagens + Configuração da Path de configuração automática + Alterar perfil + Alterar perfil de imagens MIX + Alterar idioma Scrape - Select your system (Autoconf) + Seleciona o teu sistema (Autoconf) Scrape - Scrape all your system + Scrape de todos os sistemas - SSH Command - SSH Parameter - Stop Emulationstation - Start Emulationstation - Reboot Distant - Halt Distant + Comando SSH + Parâmetro SSH + Parar Emulationstation + Iniciar Emulationstation + Reiniciar máquina remota + Desligar máquina remota - Help - Help (wiki) - Help us - Links - About + Ajuda + Ajuda (wiki) + Ajuda-nos + Ligações + Sobre Scrape - Cancel + Cancelar - Select your language - Select your language - Select + Seleção de idioma + Seleciona o teu idioma + Selecionar - Select your profil - Select your profil - Select + Seleção de perfil + Escolhe o teu perfil + Selecionar - Select your system - Select your system - Select + Seleção de sistema + Escolhe o teu sistema + Selecionar - Path configuration + Configuração da Path Scraper - Roms directory to scrape - Roms directory to scrape - XML file path - Path to the roms in your XML file - Pictures - Directory where pictures will be downloaded - Path to the picture in your XML file + Pasta de Roms para fazer scrape + Pasta de Roms para fazer scrape + Path do ficheiro XML + Path das roms no ficheiro XML + Imagens + Pasta para onde as imagens vão ser descarregadas + Path das imagens no ficheiro XML - Pictures configuration - Picture parameters - Picture Size - Picture extension + Configuração de imagens + Parâmetros das imagens + Tamanho das imagens + Extenção das imagens - Options configuration - Item to change - Item Choice - Parameter to change + Configuração de opções + Elemento a alterar + Escolha de elemento + Parâmetro a alterar - General configuration + Configuração geral Misc - Country preferences - Language preferences - Scrape Mode - 0 - New XML File|1 - Update XML (Add New Rom)|2 - Create Picture only - Research Mode - 0 - CRC+FileName|1 - CRC|2 - FileName - Picture Mode - 0 - Language Pic|1 - Rom Pic|2 - Language Pic Strict|3 - Rom Pic Strict - Log level - 0 - Standard|1 - Advanced|2 - Full - Add missing roms in XML - Auto select your system - Use DigiMirror + Preferências regionais + Preferencias de idioma + Modo de Scrape + 0 - Novo ficheiro XML|1 - Atualizar XML (Adicionar nova Rom)|2 - Criar apenas imagem + Modo de pesquisa + 0 - CRC+Nome do ficheiro|1 - CRC|2 - Nome do ficheiro + Modo de imagem + 0 - Imagem idioma|1 - Imagem Rom|2 - Imagem idioma rigoroso|3 - Imagem Rom rigoroso + Nível de Log + 0 - Padrão|1 - Avançado|2 - Completo + Adicionar roms em falta ao XML + Selecionar sistema automaticamente + Usar DigiMirror Screenscraper - Screenscraper Login - Screenscraper Password - Thread number - Check - Screenscraper Register - Scraped files - Included files - Excluded files - Excluded folders + Utilizador Screenscraper + Password Screenscraper + Número de Threads + Verificar + Registro Screenscraper + Ficheiros Scraped + Ficheiros incluidos + Ficheiros excluidos + Pastas excluidas - Autoconfiguration path configuration - Use autoconfiguration + Configuração da Path da Configuração automática + Usar Configuração automática Scraper - Root System directory - XML file name - Path to the roms in your XML file - Picture - Folder Name where pictures will be downloaded - Path to the picture in your XML file + Pasta raiz do sistema + Nome do ficheiro XML + Path das roms no ficheiro XML + Imagem + Pasta para onde as imagens vão ser descarregadas + Path das imagens no ficheiro XML - Save - Cancel - Avanced + Gravar + Cancelar + Avançado - Mix Image configuration - Empty Exemple - Exemple - Save - Cancel + Configuração Imagens Mix + Exemplo vazio + Exemplo + Gravar + Cancelar - Download Mix Template - Empty Exemple - Exemple - Download - Exit + Descarregar template Mix + Exemplo vazio + Exemplo + Descarregar + Sair - About + Sobre Autor : Screech - Thanks to : + Obrigado a : - Scrape Results - Scrape finished - Files found : - Roms found : - Roms found percent : - Average time by Roms : - Total Time : - Thread(s) used : + Resultados do Scrape + Scrape concluido + Ficheiros encontrados : + Roms encontradas : + Percentagem de roms encontradas : + Tempo médio por rom : + Tempo total : + Thread(s) usadas : - Next - Back + Próximo + Anterior OK - Cancel + Cancelar - Profil Selection - Here You can select the profil corresponding to your OS.|!||!|MIX Version make picture with several other like screenshot, 3D box and Game logo.|!||!|You can change the MIX Profil in the menu : |!|"Change your Mix Images profil"|!|or later in this wizard. + Seleção de perfil + Aqui podes escolher um perfil que corresponde ao teu SO.|!||!|As versões MIX Version criam uma imagem composta por outras, como screenshots, caixa 3D e logotipo do jogo.|!||!|Podes alterar o perfil MIX no menu : |!|"Alterar perfil de imagens MIX"|!|ou mais a frente neste assistente. - Autoconfiguration Path - The Autoconfiguration let you scrape your system without spending time in path configuration.|!||!|The default path (selected from your selected profil) is just under this text.|!|You can change it with your system root directory.|!||!|Exemple :|!|Your SNES roms are in|!|E:\Emulation\Rom\SNES,|!|so the root path will be|!|E:\Emulation\Rom + Configuração automática da Path + A configuracão automática permite fazer scrap ao teu sistema sem perder tempo a configurar a Path.|!||!|A path padrão (baseada no perfil selecionado) encontra-se mesmo em baixo deste texto.|!|Podes alterar para a pasta de origem das roms.|!||!|Exemplo :|!|AS tuas roms de SNES estão em|!|E:\Emulation\Rom\SNES,|!|a path de origem deverá ser|!|E:\Emulation\Rom - MIX Image Profil Selection - You choose a Profil with MIX Image|!||!|You can choose the picture generated by UXS template in the next window.|!||!|Warning, some MIX Image profil need a specifique theme in your FrontEnd.|!|(Exemple, The "Full Back" Profil need a specifique theme)|!|Thank you to visit the wiki if needed. + Seleção de perfil imagens MIX + Escolheste um perfil com imagens MIX|!||!|A imagem gerada pelo UXS depende de um perfil que podes selecionar na proxima janela.|!||!|Atenção, alguns perfis de imagens MIX depende do tema da tua interface|!|(Exemplo, o perfil "Full Back" precisa de um tema específico.)|!|Consulta a wiki para mais informação. - Wizard End - The basic UXS configuration is now done.|!||!|You can now select your system in|!|"Scrape"|!|->"Select your system (Autoconf)"|!|and launch your first Scrape.|!||!|Thank you for using Universal XML Scraper. - + Fim do assistente + A configuração base do UXS está feita.|!||!|Podes agora selecionar o teu sistem em|!|"Scrape"|!|->"Seleciona o teu sistema (Autoconf)"|!|e faz scrap pela primeira vez.|!||!|Obrigado por utilizares o Universal XML Scraper. + diff --git a/LanguageFiles/UXS-SPANISH.XML b/LanguageFiles/UXS-SPANISH.XML index 88d376e..0869b0b 100644 --- a/LanguageFiles/UXS-SPANISH.XML +++ b/LanguageFiles/UXS-SPANISH.XML @@ -1,6 +1,6 @@ es|en - %COUNTRY%|sp|eu|us|jp|wor|ss + %COUNTRY%|sp|eu|wor|ss|us|jp|cus diff --git a/REQUETES.txt b/REQUETES.txt new file mode 100644 index 0000000..e432380 --- /dev/null +++ b/REQUETES.txt @@ -0,0 +1,34 @@ +REQUETE dedoublonnage langue + + +Verif doublon : + +SELECT COUNT(*) AS nbr_doublon, `source`, `langue` +FROM `translate` +GROUP BY `source`, `langue` +HAVING COUNT(*) > 1 + +Suppression doublon + +DELETE t1 +FROM `translate` AS t1, `translate` AS t2 +WHERE t1.id > t2.id +AND t1.`source` = t2.`source` +AND t1.`langue` = t2.`langue` +AND t1.`dest` = '' + + + +REQUETE dedoublonnage Romsgroups + +CREATE TABLE RomsGroups2 ( + id int(11) unsigned NOT NULL AUTO_INCREMENT, + rom_id int(11) unsigned NOT NULL, + group_id int(11) unsigned NOT NULL, + datesupression datetime NOT NULL, + usersupression int(11) unsigned NOT NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO RomsGroups2 (rom_id,group_id) SELECT distinct rom_id , group_id FROM `RomsGroups`; +DROP TABLE RomsGroups; +RENAME TABLE RomsGroups2 TO RomsGroups \ No newline at end of file diff --git a/Ressources/Countrylist.xml b/Ressources/Countrylist.xml index 60848fa..829e3fc 100644 --- a/Ressources/Countrylist.xml +++ b/Ressources/Countrylist.xml @@ -45,7 +45,7 @@ Brésil Brasilien Brazil - Basil + Brasil Brasil 3257 @@ -162,7 +162,7 @@ Monde World World - World + Mundo Mundo 0 @@ -184,6 +184,16 @@ Polonia 48 + + 3780 + pt + Portugal + Portugal + Portugal + Portugal + Portugal + 48 + 3289 uk @@ -228,7 +238,7 @@ USA USA USA - USA + EUA EUA 3257 diff --git a/Ressources/Genresliste.xml b/Ressources/Genresliste.xml new file mode 100644 index 0000000..2d70d4a --- /dev/null +++ b/Ressources/Genresliste.xml @@ -0,0 +1,1346 @@ + + + + + + 3583 + Action Shoot'em Up + 0 + + + 10 + Action + Action + Action + Acción + Ação + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=10&media=logo-monochrome&mediaformat=png + + + + 2917 + Action / Casse briques + Action / Breakout Spiele + Action / Breakout games + Acción / Juegos de Breakout + Ação / Jogos de Breakout + 10 + + + 2909 + Action / Escalade + Action / Klettern + Action / Climbing + Acción / Escalada + Ação / Escalada + 10 + + + 2937 + Action / Labyrinthe + Action / Labyrinth + Action / Labyrinth + Acción / Laberinto + Ação / Labirinto + 10 + + + 3566 + Action-Adventure + 0 + + + 413 + Adulte + Erwachsene + Adult + Adulto + Adulto + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=413&media=logo-monochrome&mediaformat=png + + + + 13 + Aventure + Abenteuer + Adventure + Aventura + Aventura + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=13&media=logo-monochrome&mediaformat=png + + + + 1 + Beat'em All + Beat'em Up + Beat'em Up + Beat'em Up + Briga de rua + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=1&media=logo-monochrome&mediaformat=png + + + + 320 + Casino + Casino + Casino + Casino + Cassino + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=320&media=logo-monochrome&mediaformat=png + + + + 2872 + Casino / Cartes + Casino / Karten + Casino / Cards + Casino / Cartas + Cassino / Cartas + 320 + + + 2950 + Casino / Course + Casino / Rennen + Casino / Race + Casino / Carreras + Cassino / Corrida + 320 + + + 2932 + Casino / Loterie + Casino / Lotterie + Casino / Lottery + Casino / Lotería + Cassino / Loteria + 320 + + + 2860 + Casino / Machine a sous + Casino / Slot Machine + Casino / Slot machine + Casino / Máquina tragamonedas + Cassino / Caça-níqueis + 320 + + + 2944 + Casino / Roulette + Casino / Roulette + Casino / Roulette + Casino / Ruleta + Cassino / Roleta + 320 + + + 171 + Casual Game + Gelegenheitsspiel + Casual Game + Juego casual + Jogo casual + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=171&media=logo-monochrome&mediaformat=png + + + + 3192 + Chasse + Jagen + Hunting + Caza + Caça + 2648 + + + 2648 + Chasse et Peche + Jagen und Angeln + Hunting and Fishing + Caza y Pesca + Caça e Pesca + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=2648&media=logo-monochrome&mediaformat=png + + + + 14 + Combat + Kampf + Fight + Combate + Luta + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=14&media=logo-monochrome&mediaformat=png + + + + 2874 + Combat / 2.5D + Kampf / 2.5D + Fight / 2.5D + Combate / 2.5D + Luta / 2.5D + 14 + + + 2914 + Combat / 2D + Kampf / 2D + Fight / 2D + Combate / 2D + Luta / 2D + 14 + + + 2920 + Combat / 3D + Kampf / 3D + Fight / 3D + Combate / 3D + Luta / 3D + 14 + + + 2885 + Combat / Versus + Kampf / Versus + Fight / Versus + Combate / Versus + Luta / Versus + 14 + + + 2957 + Combat / Versus Co-op + Kampf / Versus Ko-Op + Fight / Co-op + Combate / Versus Co-op + Luta / Versus Co-op + 14 + + + 2922 + Combat / Vertical + Kampf / Vertikal + Fight / Vertical + Combate / Vertical + Luta / Vertical + 14 + + + 34 + Compilation + Sammlung + Compilation + Copilación + Compilação + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=34&media=logo-monochrome&mediaformat=png + + + + 3301 + Course + 0 + + + 3737 + Course Automobile + 0 + + + 2918 + Course de chevaux + Pferderennen + Horses race + Carreras de caballos + Corrida com Cavalos + 2650 + + + 2973 + Course de Moto vue 1er pers. + Motorradrennen, 1st Pers. + Motorcycle Race, 1st Pers. + Carreras de moto, 1ª persona + Corrida de moto em 1ª pessoa + 28 + + + 2871 + Course de Moto vue 3eme pers. + Motorradrennen, 3rd Pers. + Motorcycle Race, 3rd Pers. + Carreras de moto, 3ª persona + Corrida de moto em 3ª pessoa + 28 + + + 2884 + Course vue 1ere pers. + Rennen 1st Pers. + Race 1st Pers. view + Carreras 1ª persona + Corrida em 1ª pessoa + 28 + + + 2888 + Course vue 3eme pers. + Rennen 3rd Pers. + Race 3rd Pers. view + Carreras 3ª persona + Corrida em 3ª pessoa + 28 + + + 28 + Course, Conduite + Rennen, Fahren + Race, Driving + Carreras, Conducción + Corrida, Pilotagem + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=28&media=logo-monochrome&mediaformat=png + + + + 2893 + Course, Conduite / Avion + Rennen, Fahren / Flugzeug + Race, Driving / Plane + Carreras, Conducción / Avión + Corrida, Pilotagem / Avião + 28 + + + 2911 + Course, Conduite / Bateau + Rennen, Fahren / Boot + Race, Driving / Boat + Carreras, Conducción / Bote + Corrida, Pilotagem / Bote + 28 + + + 2924 + Course, Conduite / Course + Rennen, Fahren / Rennen + Race, Driving / Race + Carreras, Conducción / Carreras + Corrida, Pilotagem / Corrida + 28 + + + 2953 + Course, Conduite / Deltaplane + Rennen, Fahren / Hang Glider + Race, Driving / Hang-glider + Carreras, Conducción / Ala delta + Corrida, Pilotagem / Asa-Delta + 28 + + + 2943 + Course, Conduite / Moto + Rennen, Fahren / Motorrad + Race, Driving / Motorcycle + Carreras, Conducción / Motocicleta + Corrida, Pilotagem / Moto + 28 + + + 2974 + Demo + Demo + Demo + Demo + Demo + 0 + + + 39 + Divers + Verschiedene + Various + Varios + Variados + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=39&media=logo-monochrome&mediaformat=png + + + + 2890 + Divers / Electro-mecanique + Verschiedene / Elektromechanisch + Various / Electro- Mechanical + Varios / Electromecánico + Variados / Eletromecânico + 39 + + + 2879 + Divers / Print Club + Verschiedene / Print Club + Various / Print Club + Varios / Print Club + Variados / Print Club + 39 + + + 2855 + Divers / Système + Verschiedene / System + Various / System + Varios / Sistema + Variados / Sistema + 39 + + + 2904 + Divers / Utilitaires + Verschiedene / Dienstprogramme + Various / Utilities + Varios / Utilidades + Variados / Utilitários + 39 + + + 31 + Flipper + Flipper + Pinball + Pinball + Pinball + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=31&media=logo-monochrome&mediaformat=png + + + + 2958 + Go + Go + Go + Go + Go + 2647 + + + 2882 + Hanafuda + Hanafuda + Hanafuda + Hanafuda + Hanafuda + 2647 + + + 42 + Jeu de cartes + Kartenspiele + Playing cards + Juegos de cartas + Jogo de cartas + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=42&media=logo-monochrome&mediaformat=png + + + + 8 + Jeu de rôles + Rollenspiele + Role playing games + Juegos de rol + Jogos de RPG + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=8&media=logo-monochrome&mediaformat=png + + + + 33 + Jeu de societe / plateau + Brettspiele + Board game + Juegos de mesa + Jogo de tabuleiro + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=33&media=logo-monochrome&mediaformat=png + + + + 2647 + Jeu de societe asiatique + Asiatische Brettspiele + Asiatic board game + Juegos de mesa asiático + Jogo de tabuleiro Asiático + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=2647&media=logo-monochrome&mediaformat=png + + + + 30 + Ludo-Educatif + Lernspiel + Educational + Educacional + Educacional + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=30&media=logo-monochrome&mediaformat=png + + + + 3516 + Machines à sous + 0 + + + 3512 + Mah-jong + 0 + + + 2869 + Mahjong + Mahjong + Mahjong + Mahjong + Mahjong + 2647 + + + 3738 + Mature + 0 + + + 425 + Musique et Dance + Musik und Tanz + Music and Dance + Música y Baile + Música e dança + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=425&media=logo-monochrome&mediaformat=png + + + + 323 + N/A + N/A + N/A + N/A + N/A + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=323&media=logo-monochrome&mediaformat=png + + + + 2949 + Othello + Othello + Othello + Reversi + Othello + 2647 + + + 2907 + Outline + 2843 + + + 2965 + Pachinko + 2857 + + + 2895 + Peche + Angeln + Fishing + Pesca + Pesca + 2648 + + + 2857 + Pinball + 2848 + + + 7 + Plateforme + Plattform + Platform + Plataforma + Plataforma + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=7&media=logo-monochrome&mediaformat=png + + + + 2896 + Plateforme / Fighter Scrolling + Plattform / Kampf Scrolling + Plateform / Fighter Scrolling + Plataforma / Combate con desplazamiento + Plataforma / Combate com rolagem + 7 + + + 2915 + Plateforme / Run Jump + Plattform / Jump'n'Run + Plateform / Run Jump + Plataforma / Corre y Salta + Plataforma / Corre e Pula + 7 + + + 2897 + Plateforme / Run Jump Scrolling + Plattform / Jump'n'Run Scrolling + Plateform / Run Jump Scrolling + Plataforma / Corre y Salta con deslizamiento + Plataforma / Corre e Pula com rolagem + 7 + + + 2887 + Plateforme / Shooter Scrolling + Plattform / Shooter Scrolling + Plateform / Shooter Scrolling + Plataforma / Tirador con deslizamiento + Plataforma / Tiro com rolagem + 7 + + + 3237 + Point and Click + Point und Klick + Point and Click + 13 + + + 3514 + Puzzle + 0 + + + 26 + Puzzle-Game + Puzzle + Puzzle-Game + Rompecabezas + Quebra-cabeças + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=26&media=logo-monochrome&mediaformat=png + + + + 2864 + Puzzle-Game / Egaler + Puzzle / Partie + Puzzle-Game / Equalize + Rompecabezas / Igualar + Quebra-cabeças / Igualar + 26 + + + 2891 + Puzzle-Game / Glisser + Puzzle / Gleiten + Puzzle-Game / Glide + Rompecabezas / Deslizar + Quebra-cabeças / Rolar + 26 + + + 2923 + Puzzle-Game / Lancer + Puzzle / Werfen + Puzzle-Game / Throw + Rompecabezas / Lanzar + Quebra-cabeças / Lançar + 26 + + + 2912 + Puzzle-Game / Tomber + Puzzle / Fallen + Puzzle-Game / Fall + Rompecabezas / Caída + Quebra-cabeças / Queda + 26 + + + 2649 + Quiz + Quiz + Quiz + Quiz + Quiz + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=2649&media=logo-monochrome&mediaformat=png + + + + 2954 + Quiz / Allemand + Quiz / Deutsch + Quiz / German + Quiz / Alemán + Quiz / Alemão + 2649 + + + 2931 + Quiz / Anglais + Quiz / Englisch + Quiz / English + Quiz / Inglés + Quiz / Inglês + 2649 + + + 2951 + Quiz / Coréen + Quiz / Koreanisch + Quiz / Korean + Quiz / Coreano + Quiz / Coreano + 2649 + + + 2962 + Quiz / Espagnol + Quiz / Spanisch + Quiz / Spanish + Quiz / Español + Quiz / Espanhol + 2649 + + + 2969 + Quiz / Français + Quiz / Französisches + Quiz / French + Quiz / Francés + Quiz / Francês + 2649 + + + 2952 + Quiz / Italien + Quiz / Italienisch + Quiz / Italian + Quiz / Italiano + Quiz / Italiano + 2649 + + + 2894 + Quiz / Japonnais + Quiz / Japanisch + Quiz / Japanese + Quiz / Japonés + Quiz / Japonês + 2649 + + + 2964 + Quiz / Musical Anglais + Quiz / Englische Musik + Quiz / Music English + Quiz / Música Inglés + Quiz / Musical Inglês + 2649 + + + 2967 + Quiz / Musical Japonnais + Quiz / Japanische Musik + Quiz / Music Japanese + Quiz / Música Japonés + Quiz / Musical Japonês + 2649 + + + 3511 + Réflexion + 0 + + + 2956 + Renju + Renju + Renju + Renju + Renju + 2647 + + + 2925 + Rhythme + Rythmus + Rhythm + Rítmico + Rítmico + 425 + + + 79 + Shoot'em Up + Shoot'em Up + Shoot'em Up + Shoot'em Up + Shoot'em Up + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=79&media=logo-monochrome&mediaformat=png + + + + 2955 + Shoot'em up / Diagonal + Shoot'em Up / Diagonal + Shoot'em up / Diagonal + Shoot'em Up / Diagonal + Shoot'em Up / Diagonal + 79 + + + 2870 + Shoot'em up / Horizontal + Shoot'em Up / Horizontal + Shoot'em up / Horizontal + Shoot'em Up / Horizontal + Shoot'em Up / Horizontal + 79 + + + 2851 + Shoot'em up / Vertical + Shoot'em Up / Vertikal + Shoot'em up / Vertical + Shoot'em Up / Vertical + Shoot'em Up / Vertical + 79 + + + 2898 + Shooter Large + 2843 + + + 2844 + Shooter Small + 2843 + + + 2961 + Shougi + Shougi + Shougi + Shougi + Shougi + 2647 + + + 40 + Simulation + Simulation + Simulation + Simulación + Simulação + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=40&media=logo-monochrome&mediaformat=png + + + + 685 + Sport + Sport + Sports + Deportes + Esporte + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=685&media=logo-monochrome&mediaformat=png + + + + 2853 + Sport / Baseball + Sport / Baseball + Sports / Baseball + Deportes / Béisbol + Esporte / Baseball + 685 + + + 2852 + Sport / Basketball + Sport / Basketball + Sports / Basketball + Deportes / Baloncesto + Esporte / Basquete + 685 + + + 3028 + Sport / Billard + Sport / Billard + Sports / Pool + Deportes / Billar + Esporte / Sinuca + 685 + + + 2901 + Sport / Bowling + Sport / Bowling + Sports / Bowling + Deportes / Bowling + Esporte / Boliche + 685 + + + 2929 + Sport / Boxe + Sport / Boxen + Sports / Boxing + Deportes / Boxeo + Esporte / Boxe + 685 + + + 2919 + Sport / Bras de fer + Sport / Armdrücken + Sports / Arm wrestling + Deportes / Pulseta + Esporte / Queda de Braço + 685 + + + 3034 + Sport / Combat + Sport / Kampfsport + Sports / Fighting + Deportes / Combate + Esporte / Combate + 685 + + + 2877 + Sport / Course a pied + Sport / Traillauf + Sports / Running trails + Deportes / Carrera en pista + Esporte / Pista de Corrida + 685 + + + 2970 + Sport / Dodgeball + Sport / Völkerball + Sports / Dodgeball + Deportes / Quemadas + Esporte / Queimada + 685 + + + 2906 + Sport / Flechette + Sport / Darts + Sports / Dart + Deportes / Dardos + Esporte / Dardos + 685 + + + 2847 + Sport / Football + Sport / Fußball + Sports / Soccer + Deportes / Fútbol + Esporte / Futebol + 685 + + + 2846 + Sport / Football Américain + Sport / American Football + Sports / Football + Deportes / Fútbol americano + Esporte / Futebol americano + 685 + + + 2913 + Sport / Golf + Sport / Golf + Sports / Golf + Deportes / Golf + Esporte / Golfe + 685 + + + 2960 + Sport / Handball + Sport / Handball + Sports / Handball + Deportes / Balonmano + Esporte / Handball + 685 + + + 2933 + Sport / Hockey + Sport / Eishockey + Sports / Hockey + Deportes / Hockey + Esporte / Hóquei + 685 + + + 2971 + Sport / Jeu de palet + Sport / Shuffleboard + Sports / Shuffleboard + Deportes / Shuffleboard + Esporte / Futebol de botão + 685 + + + 2861 + Sport / Lutte + Sport / Wrestling + Sports / Wrestling + Deportes / Lucha libre + Esporte / Luta Livre + 685 + + + 2878 + Sport / Natation + Sport / Schwimmen + Sports / Swimming + Deportes / Natación + Esporte / Natação + 685 + + + 2968 + Sport / Parachutisme + Sport / Fallschirmspringen + Sports / Skydiving + Deportes / Paracaidismo + Esporte / Paraquedismo + 685 + + + 2966 + Sport / Ping pong + Sport / Tischtennis + Sports / Table tennis + Deportes / Ping-pong + Esporte / Ping-pong + 685 + + + 2948 + Sport / Rugby + Sport / Rugby + Sports / Rugby + Deportes / Rugby + Esporte / Rugby + 685 + + + 2875 + Sport / Skateboard + Sport / Skateboard + Sports / Skateboard + Deportes / Patineta + Esporte / Skate + 685 + + + 2902 + Sport / Ski + Sport / Ski + Sports / Skiing + Deportes / Esquí + Esporte / Esqui + 685 + + + 2947 + Sport / Sumo + Sport / Sumo + Sports / Sumo + Deportes / Sumo + Esporte / Sumô + 685 + + + 2867 + Sport / Tennis + Sport / Tennis + Sports / Tennis + Deportes / Tenis + Esporte / Tênis + 685 + + + 2883 + Sport / Volleyball + Sport / Volleyball + Sports / Volleyball + Deportes / Voleibol + Esporte / Voleibol + 685 + + + 2650 + Sport avec animaux + Sport mit Tieren + Sports with Animals + Deportes con animales + Esporte com animais + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=2650&media=logo-monochrome&mediaformat=png + + + + 27 + Stratégie + Strategie + Strategy + Estrategia + Estratégia + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=27&media=logo-monochrome&mediaformat=png + + + + 2927 + Surround + 2843 + + + 2646 + Tir + Shooter + Shooter + Tiro + Tiro + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=2646&media=logo-monochrome&mediaformat=png + + + + 3303 + Tir (avec accessoire) + 0 + + + 3024 + Tir / 1ere Personne + Shooter / 1st Pers. + Shooter / 1st person + Tiro / Tiro 1ª persona + Tiro / Tiro em 1ª pessoa + 2646 + + + 2899 + Tir / 3eme Personne + Shooter / 3rd Pers. + Shooter / 3rd person + Tiro / Tiro 3ª persona + Tiro / Tiro em 3ª pessoa + 2646 + + + 2903 + Tir / A pied + Shooter / Run and Shoot + Shooter / Run and Shoot + Tiro / Corre y Dispara + Tiro / Corra e Atire + 2646 + + + 2928 + Tir / Avion + Shooter / Flugzeug + Shooter / Plane + Tiro / Avión + Tiro / Avião + 2646 + + + 2892 + Tir / Avion, 1ere personne + Shooter / Flugzeug, 1st Pers. + Shooter / Plane, 1st person + Tiro / Avión, 1ª persona + Tiro / Avião em 1ª pessoa + 2646 + + + 2881 + Tir / Avion, 3eme personne + Shooter / Flugzeug, 3rd Pers. + Shooter / Plane, 3rd person + Tiro / Avión, 3ª persona + Tiro / Avião em 3ª pessoa + 2646 + + + 2876 + Tir / Horizontal + Shooter / Horizontal + Shooter / Horizontal + Tiro / Horizontal + Tiro / Horizontal + 2646 + + + 2945 + Tir / Missile Command Like + Shooter / Wie Missile Command + Shooter / Missile Command Like + Tiro / Como Missile Command + Tiro / Estilo Missile Command + 2646 + + + 3026 + Tir / Run and Gun + Shooter / Run and Gun + Shooter / Run and Gun + Tiro / Run and Gun + Tiro / Run and Gun + 2646 + + + 2900 + Tir / Space Invaders Like + Shooter / Wie Space Invaders + Shooter / Space Invaders Like + Tiro / Estilo Space Invader + Tiro / Estilo Space Invader + 2646 + + + 2940 + Tir / Véhicule, 1ere personne + Shooter / Fahrzeug, 1st Pers. + Shooter / Vehicle, 1st person + Tiro / Vehículo 1ª persona + Tiro / Carro 1ª Pessoa + 2646 + + + 2910 + Tir / Vehicule, 3eme personne + Shooter / Fahrzeug, 3rd. Pers. + Shooter / Vehicle, 3rd person + Tiro / Vehículo 3ª persona + Tiro / Carro 3ª Pessoa + 2646 + + + 2934 + Tir / Véhicule, Diagonal + Shooter / Fahrzeug, Diagonal + Shooter / Vehicle, Diagonal + Tiro / Vehículo, Diagonal + Tiro / Carro, Diagonal + 2646 + + + 2938 + Tir / Véhicule, Horizontal + Shooter / Fahrzeug, Horizontal + Shooter / Vehicle, Horizontal + Tiro / Vehículo, Horizontal + Tiro / Carro, Horizontal + 2646 + + + 2921 + Tir / Véhicule, Vertical + Shooter / Fahrzeug, Vertikal + Shooter / Vehicle, Vertical + Tiro / Vehículo, Vertical + Tiro / Carro, Vertical + 2646 + + + 2889 + Tir / Vertical + Shooter / Vertikal + Shooter / Vertical + Tiro / Vertical + Tiro / Vertical + 2646 + + + 32 + Tir avec accessoire + Lightgun Shooter + Lightgun Shooter + Tiro con accesorios + Tiro com acessórios + 0 + + http://www.screenscraper.fr/api/mediaGroup.php?devid=Screech&devpassword=Screech201601281533y&softname=UniversalXMLScraper(TestDev)&crc=&md5=&sha1=&groupid=32&media=logo-monochrome&mediaformat=png + + + + 3591 + TirPlateforme Beat'em All + 0 + + + diff --git a/Scraper.au3 b/Scraper.au3 index f5dfb87..03142f4 100644 --- a/Scraper.au3 +++ b/Scraper.au3 @@ -5,7 +5,7 @@ #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Description=Scraper -#AutoIt3Wrapper_Res_Fileversion=1.1.0.2 +#AutoIt3Wrapper_Res_Fileversion=1.2.0.1 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p #AutoIt3Wrapper_Res_LegalCopyright=LEGRAS David #AutoIt3Wrapper_Res_Language=1036 @@ -67,7 +67,7 @@ Global $iLangPath = $iScriptPath & "\LanguageFiles" ; Where we are storing the l Global $iProfilsPath = $iScriptPath & "\ProfilsFiles" ; Where we are storing the profils files. Global $vNodeType = "Element" -Local $iSize, $aRomList, $vBoucle, $aConfig, $vProfilsPath, $oXMLProfil, $oXMLSystem, $aMatchingCountry +Local $iSize, $aRomList, $vBoucle, $aConfig, $vProfilsPath, $oXMLProfil, $oXMLSystem, $aMatchingCountry, $oXMLGenre Local $sMailSlotMother = "\\.\mailslot\Mother" Local $sMailSlotName = "\\.\mailslot\Son" & $vThreadNumber Local $sMailSlotCancel = "\\.\mailslot\Cancel" & $vThreadNumber @@ -79,6 +79,9 @@ Local $iNumberOfMessagesOverall = 1 $oXMLSystem = _XMLSystem_Create() If $oXMLSystem = -1 Then Exit +$oXMLGenre = _XMLGenre_Create() +If $oXMLGenre = -1 Then Exit + _SendMail($sMailSlotCheckEngine, $vThreadNumber) While $iNumberOfMessagesOverall < 5 @@ -238,13 +241,17 @@ Func _Game_Make($aRomList, $vBoucle, $aConfig, $oXMLProfil) EndFunc ;==>_Game_Make Func _XML_Read_Source($aRomList, $vBoucle, $aConfig, $oXMLProfil, $vWhile) - Local $vXpath, $vValue, $vXpathTemp, $aXpathCountry - Switch _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Type", 0, "", $oXMLProfil) + Local $vXpath, $vValue, $vXpathTemp, $aXpathCountry, $aPathSplit, $sDrive, $sDir, $sFileName, $sExtension + $vSource_Type = _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Type", 0, "", $oXMLProfil) + _LOG("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Type = " & $vSource_Type, 1, $iLOGPath) + Switch $vSource_Type Case "XML_Value" + _LOG("->XML_Value", 1, $iLOGPath) If $aRomList[9] = 0 Or $aConfig[5] = 2 Then Return "" $vXpath = _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Value", 0, "", $oXMLProfil) - + _LOG("$vXpath : " & $vXpath, 2, $iLOGPath) If StringInStr($vXpath, '%LANG%') Then + _LOG('%LANG%', 3, $iLOGPath) Local $aLangPref = $aConfig[9] For $vBoucle2 = 1 To UBound($aLangPref) - 1 $vXpathTemp = StringReplace($vXpath, '%LANG%', $aLangPref[$vBoucle2]) @@ -253,37 +260,67 @@ Func _XML_Read_Source($aRomList, $vBoucle, $aConfig, $oXMLProfil, $vWhile) Next EndIf - $aXpathCountry = _CountryArray_Make($aConfig, $vXpath, $aRomList[8], $oXMLProfil) - For $vBoucle2 = 1 To UBound($aXpathCountry) - 1 - $vValue = _XML_Read($aXpathCountry[$vBoucle2], 0, $aRomList[8]) - _LOG("COUNTRY " & $aXpathCountry[$vBoucle2] & "=" & $vValue, 1, $iLOGPath) - If $vValue <> -1 And $vValue <> "" Then Return $vValue - Next - + If StringInStr($vXpath, '%COUNTRY%') Then + _LOG('%COUNTRY%', 3, $iLOGPath) + $aXpathCountry = _Fallback($aConfig, $vXpath, $aRomList[8]) + For $vBoucle2 = 1 To UBound($aXpathCountry) - 1 + $vValue = _XML_Read($aXpathCountry[$vBoucle2], 0, $aRomList[8]) + _LOG("COUNTRY " & $aXpathCountry[$vBoucle2] & "=" & $vValue, 1, $iLOGPath) + If $vValue <> -1 And $vValue <> "" Then Return $vValue + Next + EndIf + _LOG('NO TAG', 3, $iLOGPath) + $vValue = _XML_Read($vXpath, 0, $aRomList[8]) + _LOG($vXpath & "=" & $vValue, 1, $iLOGPath) + If $vValue <> -1 Then Return $vValue Return "" Case "XML_Attribute" + _LOG("->XML_Attribute", 1, $iLOGPath) If $aRomList[9] = 0 Or $aConfig[5] = 2 Then Return "" Return _XML_Read(_XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Value", 1, "", $oXMLProfil), 0, $aRomList[8]) Case "XML_Download" + _LOG("->XML_Download", 1, $iLOGPath) If $aRomList[9] = 0 Then Return "" $vXpath = _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Value", 0, "", $oXMLProfil) - $aXpathCountry = _CountryArray_Make($aConfig, $vXpath, $aRomList[8], $oXMLProfil) + $aXpathCountry = _Fallback($aConfig, $vXpath, $aRomList[8]) For $vBoucle2 = 1 To UBound($aXpathCountry) - 1 - $vValue = _Picture_Download($aXpathCountry[$vBoucle2], $aRomList, $vBoucle, $vWhile, $oXMLProfil, $aConfig) - Select - Case Number($vValue) = -2 - Return -1 - Case _Coalesce($vValue, -1) <> -1 - Return $vValue - Case Else - Return -1 - EndSelect + $vDownloadURL = _Coalesce(_XML_Read($aXpathCountry[$vBoucle2], 0, $aRomList[8]), -1) + If $vDownloadURL < 0 Then + _LOG($aXpathCountry[$vBoucle2] & " problem : " & $vDownloadURL, 2, $iLOGPath) + Else + $vDownloadMaxWidth = _Coalesce(_XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Target_Image_Width", 0, "", $oXMLProfil), 0) + $vDownloadMaxHeight = _Coalesce(_XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Target_Image_Height", 0, "", $oXMLProfil), 0) + + $vDownloadTag = _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Download_Tag", 0, "", $oXMLProfil) + If $vNodeType = "Folder" Then $vDownloadTag = $vDownloadTag & "-folder" + $vDownloadExt = _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Ext", ""), _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Download_Ext", 0, "", $oXMLProfil)) + $aPathSplit = _PathSplit(StringReplace($aRomList[0], "\", "_"), $sDrive, $sDir, $sFileName, $sExtension) + $vSource_ImagePath = $aConfig[3] & "\" & $sFileName & $vDownloadTag & "." & $vDownloadExt + $vSource_ImagePath = _Picture_Download($vDownloadURL, $vSource_ImagePath, $oXMLProfil, $vDownloadMaxWidth, $vDownloadMaxHeight) + + If $vSource_ImagePath < 0 Then Return -1 + + $vTarget_ImagePath = $aConfig[4] & $sFileName & $vDownloadTag & "." & $vDownloadExt + If $vNodeType = "Folder" Then + $vCheckExist = _XML_NodeExists($aConfig[8], _XML_Read('/Profil/Folder/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTarget_ImagePath & '"]') + Else + $vCheckExist = _XML_NodeExists($aConfig[8], _XML_Read('/Profil/Game/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTarget_ImagePath & '"]') + EndIf + If $vCheckExist = $XML_RET_SUCCESS Then + _LOG(_XML_Read('/Profil/Game/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTarget_ImagePath & '"]' & " Already exist in XML ( " & $vCheckExist & ")", 1, $iLOGPath) + Return -2 + EndIf + + Return $vTarget_ImagePath + EndIf Next Return "" Case "Fixe_Value" + _LOG("->Fixe_Value", 1, $iLOGPath) Return _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Value", 0, "", $oXMLProfil) Case "Variable_Value" + _LOG("->Variable_Value", 1, $iLOGPath) Switch _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Value", 0, "", $oXMLProfil) Case '%XML_Rom_Path%' $vSystem = StringSplit(IniRead($iINIPath, "LAST_USE", "$vSource_RomPath", ""), "\") @@ -298,6 +335,7 @@ Func _XML_Read_Source($aRomList, $vBoucle, $aConfig, $oXMLProfil, $vWhile) Return "" EndSwitch Case "MIX_Template" + _LOG("->MIX_Template", 1, $iLOGPath) If $aRomList[9] = 0 And $aConfig[6] = 0 Then Return "" Local $vDownloadTag, $vDownloadExt, $vTargetPicturePath, $aPathSplit, $sDrive, $sDir, $sFileName, $sExtension $vDownloadTag = _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Download_Tag", 0, "", $oXMLProfil) @@ -320,91 +358,66 @@ Func _XML_Read_Source($aRomList, $vBoucle, $aConfig, $oXMLProfil, $vWhile) _LOG("MIX Template finished (" & $vTargetPicturePath & ")", 1, $iLOGPath) Return $vTargetPicturePath Case Else - _LOG("SOURCE Unknown", 1, $iLOGPath) + _LOG("->SOURCE Unknown", 1, $iLOGPath) Return "" EndSwitch EndFunc ;==>_XML_Read_Source -Func _CountryArray_Make($aConfig, $vXpath, $vSource_RomXMLPath, $oXMLProfil) - Local $vCountryPref, $vXpathCountry, $iCountryPref +Func _Fallback($aConfig, $vXpath, $vSource_RomXMLPath) +;~ _LOG("FallBack $vXpath : " & $vXpath, 2, $iLOGPath) +;~ _LOG("FallBack $vSource_RomXMLPath : " & $vSource_RomXMLPath, 2, $iLOGPath) + Local $vCountryPref = '', $vIdGenre = '' If StringInStr($vXpath, '%COUNTRY%') Then Local $aCountryPref = $aConfig[10] Else Local $aCountryPref[2] = ["", $vXpath] EndIf - -;~ _ArrayDisplay($aCountryPref, "$aCountryPref") - - Local $aMatchingCountry = $aConfig[11] Local $aXpathCountry[UBound($aCountryPref)] - $aCountryPrefSize = UBound($aCountryPref) - 1 - For $vBoucle = 1 To $aCountryPrefSize + For $vBoucle = 1 To UBound($aCountryPref) - 1 $vCountryPref = $aCountryPref[$vBoucle] - If $vCountryPref = '%COUNTRY%' Then - $vXpathCountry = _XML_Read("/Profil/Country/Source_Value", 0, "", $oXMLProfil) - $vCountryPref = _XML_Read($vXpathCountry, 0, $vSource_RomXMLPath) -;~ $vCountryPrefParentId = _XML_Read('/Data/regions/region[nomcourt="' & $vCountryPref & '"]/parent', 0, $iRessourcesPath & "\Countrylist.xml") -;~ IF $vCountryPrefParentId <> '0' Then -;~ $vCountryPrefParent = _XML_Read('/Data/regions/region[id="'&$vCountryPrefParentId&'"]/nomcourt',0,$iRessourcesPath&"\Countrylist.xml") -;~ ENDIF - EndIf +;~ _LOG("---$vCountryPref = " & $vCountryPref, 1, $iLOGPath) + If $vCountryPref = '%COUNTRY%' Then $vCountryPref = _XML_Read("Data/jeu/regionshortnames/regionshortname", 0, $vSource_RomXMLPath) +;~ _LOG("----->$vCountryPref = " & $vCountryPref, 1, $iLOGPath) + If StringInStr($aXpathCountry[$vBoucle], '%IDGENRE%') Then $vIdGenre = _XML_Read("Data/jeu/genres/genres_id/genre_id", 0, $vSource_RomXMLPath) $aXpathCountry[$vBoucle] = StringReplace($vXpath, '%COUNTRY%', $vCountryPref) +;~ _LOG("---$aXpathCountry[" & $vBoucle & "] = " & $aXpathCountry[$vBoucle], 1, $iLOGPath) + $aXpathCountry[$vBoucle] = StringReplace($aXpathCountry[$vBoucle], '%IDGENRE%', $vIdGenre) Next -;~ _ArrayDisplay($aXpathCountry, "$aXpathCountry") - Return $aXpathCountry -EndFunc ;==>_CountryArray_Make - -Func _Picture_Download($vCountryPref, $aRomList, $vBoucle, $vWhile, $oXMLProfil, $aConfig) - Local $vDownloadURL, $vDownloadTag, $vDownloadExt, $vTargetPicturePath, $aPathSplit, $sDrive, $sDir, $sFileName, $sExtension, $vSystem - - $vTarget_ImagePath = $aConfig[4] - $vSource_ImagePath = $aConfig[3] - $vDownloadURL = _XML_Read($vCountryPref, 0, $aRomList[8]) - $vDownloadTag = _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Download_Tag", 0, "", $oXMLProfil) - If $vNodeType = "Folder" Then $vDownloadTag = $vDownloadTag & "-folder" - $vDownloadExt = _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Ext", ""), _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Download_Ext", 0, "", $oXMLProfil)) - $vDownloadMaxWidth = "&maxwidth=" & _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Width", ""), _XML_Read("Profil/General/Target_Image_Width", 0, "", $oXMLProfil)) - $vDownloadMaxHeight = "&maxheight=" & _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Height", ""), _XML_Read("Profil/General/Target_Image_Height", 0, "", $oXMLProfil)) - $vDownloadOutputFormat = "&outputformat=" & $vDownloadExt - $aPathSplit = _PathSplit(StringReplace($aRomList[0], "\", "_"), $sDrive, $sDir, $sFileName, $sExtension) -;~ $vSystem = StringSplit(IniRead($iINIPath, "LAST_USE", "$vSource_RomPath", ""), "\") -;~ $vSystem = $vSystem[UBound($vSystem) - 1] -;~ $vTarget_ImagePath = StringReplace($vTarget_ImagePath, '%system%', $vSystem) - $vTargetPicturePath = $vTarget_ImagePath & $sFileName & $vDownloadTag & "." & $vDownloadExt - If $vDownloadExt = "%Source%" Then $vDownloadExt = StringRight($vDownloadURL, 3) - $vDownloadURL = $vDownloadURL & $vDownloadMaxWidth & $vDownloadMaxHeight & $vDownloadOutputFormat - Switch _XML_Read("/Profil/" & $vNodeType & "[" & $vWhile & "]/Source_Download_Path", 0, "", $oXMLProfil) - Case '%Local_Path_File%' - $vDownloadPath = $vSource_ImagePath & "\" & $sFileName & $vDownloadTag & "." & $vDownloadExt - Case Else - $vDownloadPath = $vSource_ImagePath & "\" & $sFileName & $vDownloadTag & "." & $vDownloadExt - EndSwitch -;~ $vCheckExist = _XML_Read(_XML_Read('/Profil/Game/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTargetPicturePath & '"]', 0, "", $aConfig[8]) +;~ _LOG("START OF $aXpathCountry ARRAY", 1, $iLOGPath) +;~ For $vBoucle = 1 To UBound($aCountryPref) - 1 +;~ _LOG($vBoucle & " - " & $aXpathCountry[$vBoucle], 1, $iLOGPath) +;~ Next +;~ _LOG("END OF $aXpathCountry ARRAY", 1, $iLOGPath) + Return $aXpathCountry +EndFunc ;==>_Fallback - If $vNodeType = "Folder" Then - $vCheckExist = _XML_NodeExists($aConfig[8], _XML_Read('/Profil/Folder/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTargetPicturePath & '"]') +Func _Picture_Download($vDownloadURL, $vSource_ImagePath, $oXMLProfil, $vDownloadMaxWidth = 0, $vDownloadMaxHeight = 0) + Local $vDownloadOutputFormat, $aPathSplit, $sDrive, $sDir, $sFileName, $sExtension + $aPathSplit = _PathSplit($vSource_ImagePath, $sDrive, $sDir, $sFileName, $sExtension) + If $vDownloadMaxWidth > 0 Then + $vDownloadMaxWidth = "&maxwidth=" & $vDownloadMaxWidth Else - $vCheckExist = _XML_NodeExists($aConfig[8], _XML_Read('/Profil/Game/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTargetPicturePath & '"]') + $vDownloadMaxWidth = "&maxwidth=" & _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Width", ""), _XML_Read("Profil/General/Target_Image_Width", 0, "", $oXMLProfil)) EndIf - - If $vCheckExist = $XML_RET_SUCCESS Then -;~ If _Coalesce($vCheckExist, -1) = -1 Then - _LOG(_XML_Read('/Profil/Game/Target_Value', 0, "", $oXMLProfil) & '[* = "' & $vTargetPicturePath & '"]' & " Already exist in XML ( " & $vCheckExist & ")", 1, $iLOGPath) - Return -2 + If $vDownloadMaxHeight > 0 Then + $vDownloadMaxHeight = "&maxheight=" & $vDownloadMaxHeight + Else + $vDownloadMaxHeight = "&maxheight=" & _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Height", ""), _XML_Read("Profil/General/Target_Image_Height", 0, "", $oXMLProfil)) EndIf + $vDownloadOutputFormat = "&outputformat=" & StringMid($sExtension, 2) - If FileExists($vDownloadPath) And $aConfig[5] <> 2 Then - _LOG($vDownloadPath & " File already exist", 1, $iLOGPath) - Return $vTargetPicturePath + If FileExists($vSource_ImagePath) And $aConfig[5] <> 2 Then + _LOG($vSource_ImagePath & " File already exist", 1, $iLOGPath) + Return $vSource_ImagePath EndIf - $vValue = _DownloadWRetry($vDownloadURL, $vDownloadPath) - _LOG($vValue & " $vValue returned by _DownloadWRetry", 1, $iLOGPath) - If $vValue <> -1 And $vValue <> "" And FileExists($vDownloadPath) Then - Return $vTargetPicturePath - Else + $vDownloadURL = $vDownloadURL & $vDownloadMaxWidth & $vDownloadMaxHeight & $vDownloadOutputFormat + $vValue = _DownloadWRetry($vDownloadURL, $vSource_ImagePath) + If $vValue < 0 Or Not FileExists($vSource_ImagePath) Then Return -1 + Else + Return $vSource_ImagePath EndIf EndFunc ;==>_Picture_Download @@ -415,13 +428,13 @@ Func _MIX_Engine($aRomList, $vBoucle, $aConfig, $oXMLProfil) Local $vTarget_Height = _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Height", ""), _XML_Read("/Profil/General/Target_Height", 0, "", $oMixConfig)) Local $vRoot_Game = _XML_Read("/Profil/Root/Root_Game", 0, "", $oMixConfig) & "/" Local $vRoot_System = _XML_Read("/Profil/Root/Root_System", 0, "", $oMixConfig) & "[id=" & $aConfig[12] & "]/" - Local $vPicTarget = -1, $vWhile = 1 + Local $vPicTarget = -1, $vWhile = 1, $vFinalValue = "" Dim $aMiXPicTemp[1] FileDelete($iTEMPPath & "\MIX") DirCreate($iTEMPPath & "\MIX") FileSetAttrib($iTEMPPath, "+H") While 1 -;~ If Not _Check_Cancel() Then Return "" + $vFinalValue = "" Switch StringLower(_XML_Read("/Profil/Element[" & $vWhile & "]/Source_Type", 0, "", $oMixConfig)) Case "fixe_value" $vPicTarget = $iTEMPPath & "\MIX\" & _XML_Read("/Profil/Element[" & $vWhile & "]/Name", 0, "", $oMixConfig) & ".png" @@ -436,41 +449,74 @@ Func _MIX_Engine($aRomList, $vBoucle, $aConfig, $oXMLProfil) $vOrigin = StringLower(_XML_Read("/Profil/Element[" & $vWhile & "]/source_Origin", 0, "", $oMixConfig)) If $vOrigin = -1 Then $vOrigin = 'game' $aPicParameters = _MIX_Engine_Dim($vWhile, $oMixConfig) - $aXpathCountry = _CountryArray_Make($aConfig, $vXpath, $aRomList[8], $oMixConfig) + $aXpathCountry = _Fallback($aConfig, $vXpath, $aRomList[8]) For $vBoucle2 = 1 To UBound($aXpathCountry) - 1 Switch $vOrigin Case 'game' $vDownloadURL = StringTrimRight(_XML_Read($vRoot_Game & $aXpathCountry[$vBoucle2], 0, $aRomList[8]), 3) & "png" - If $vDownloadURL <> "png" And Not FileExists($vPicTarget) Then - $vDownloadMaxWidth = "&maxwidth=" & _GDIPlus_RelativePos($aPicParameters[0], $vTarget_Width) - $vDownloadMaxHeight = "&maxheight=" & _GDIPlus_RelativePos($aPicParameters[1], $vTarget_Width) - $vDownloadOutputFormat = "&outputformat=png" - $vValue = _DownloadWRetry($vDownloadURL & $vDownloadMaxWidth & $vDownloadMaxHeight & $vDownloadOutputFormat, $vPicTarget) - If $vValue < 0 Then - _LOG("xml_value (game) : " & $vPicTarget & " Not Added", 2, $iLOGPath) - Else - _GDIPlus_Imaging($vPicTarget, $aPicParameters, $vTarget_Width, $vTarget_Height) - _ArrayAdd($aMiXPicTemp, $vPicTarget) - _LOG("xml_value (game) : " & $vPicTarget & " Created", 1, $iLOGPath) - EndIf - EndIf Case 'system' $vDownloadURL = StringTrimRight(_XML_Read($vRoot_System & $aXpathCountry[$vBoucle2], 0, "", $oXMLSystem), 3) & "png" - If $vDownloadURL <> "png" And Not FileExists($vPicTarget) Then - $vDownloadMaxWidth = "&maxwidth=" & _GDIPlus_RelativePos($aPicParameters[0], $vTarget_Width) - $vDownloadMaxHeight = "&maxheight=" & _GDIPlus_RelativePos($aPicParameters[1], $vTarget_Width) - $vDownloadOutputFormat = "&outputformat=png" - $vValue = _DownloadWRetry($vDownloadURL & $vDownloadMaxWidth & $vDownloadMaxHeight & $vDownloadOutputFormat, $vPicTarget) - If $vValue < 0 Then - _LOG("xml_value (system) : " & $vPicTarget & " Not Added", 2, $iLOGPath) - Else - _GDIPlus_Imaging($vPicTarget, $aPicParameters, $vTarget_Width, $vTarget_Height) - _ArrayAdd($aMiXPicTemp, $vPicTarget) - _LOG("xml_value (system) : " & $vPicTarget & " Created", 1, $iLOGPath) - EndIf - EndIf + Case 'genre' + $vDownloadURL = StringTrimRight(_XML_Read($aXpathCountry[$vBoucle2], 0, "", $oXMLGenre), 3) & "png" EndSwitch + If $vDownloadURL <> "png" And Not FileExists($vPicTarget) Then + $vDownloadMaxWidth = "&maxwidth=" & _GDIPlus_RelativePos($aPicParameters[0], $vTarget_Width) + $vDownloadMaxHeight = "&maxheight=" & _GDIPlus_RelativePos($aPicParameters[1], $vTarget_Width) + $vDownloadOutputFormat = "&outputformat=png" + $vValue = _DownloadWRetry($vDownloadURL & $vDownloadMaxWidth & $vDownloadMaxHeight & $vDownloadOutputFormat, $vPicTarget) + If $vValue < 0 Then + _LOG("xml_value : " & $vPicTarget & " Not Added", 2, $iLOGPath) + Else + $vRotationLvl = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_Rotation", 0, "", $oMixConfig) + If $vRotationLvl >= 0 Then + If _GDIPlus_Rotation($vPicTarget, $vRotationLvl) = -1 Then _LOG("Rotation Failed", 2, $iLOGPath) + EndIf + _GDIPlus_Imaging($vPicTarget, $aPicParameters, $vTarget_Width, $vTarget_Height) + _ArrayAdd($aMiXPicTemp, $vPicTarget) + _LOG("xml_value : " & $vPicTarget & " Created", 1, $iLOGPath) + EndIf + EndIf Next + Case "text" + Switch StringLower(_XML_Read("/Profil/Element[" & $vWhile & "]/Source_TextType", 0, "", $oMixConfig)) + Case "xml_value" + $vXpath = (_XML_Read("/Profil/Element[" & $vWhile & "]/Source_Value", 0, "", $oMixConfig)) + If StringInStr($vXpath, '%LANG%') Then + Local $aLangPref = $aConfig[9] + For $vBoucle2 = 1 To UBound($aLangPref) - 1 + $vXpathTemp = StringReplace($vXpath, '%LANG%', $aLangPref[$vBoucle2]) + $vValue = _XML_Read($vXpathTemp, 0, $aRomList[8]) + If $vValue <> -1 And $vValue <> "" Then + $vBoucle2 = UBound($aLangPref) - 1 + $vFinalValue = $vValue + EndIf + Next + EndIf + + $aXpathCountry = _Fallback($aConfig, $vXpath, $aRomList[8]) + For $vBoucle2 = 1 To UBound($aXpathCountry) - 1 + $vValue = _XML_Read($aXpathCountry[$vBoucle2], 0, $aRomList[8]) + _LOG("COUNTRY " & $aXpathCountry[$vBoucle2] & "=" & $vValue, 1, $iLOGPath) + If $vValue <> -1 And $vValue <> "" And $vFinalValue = "" Then + $vBoucle2 = UBound($aXpathCountry) - 1 + $vFinalValue = $vValue + EndIf + Next + _LOG("Text = " & $vFinalValue, 1, $iLOGPath) + + $iString = $vFinalValue + $iX = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_TopLeftX", 0, "", $oMixConfig) + $iY = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_TopLeftY", 0, "", $oMixConfig) + $iFont = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_Font", 0, "", $oMixConfig) + $iFontSize = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_FontSize", 0, "", $oMixConfig) + $iFontStyle = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_FontStyle", 0, "", $oMixConfig) + $iFontColor = _XML_Read("/Profil/Element[" & $vWhile & "]/Target_FontColor", 0, "", $oMixConfig) + $vPath = $aMiXPicTemp[UBound($aMiXPicTemp) - 1] + + _GDIPlus_Text($vPath, $iString, $iX, $iY, $iFont, $iFontSize, $iFontStyle, $iFontColor) + + EndSwitch + Case 'gdi_function' Switch StringLower(_XML_Read("/Profil/Element[" & $vWhile & "]/Source_Function", 0, "", $oMixConfig)) Case 'transparency' @@ -544,3 +590,15 @@ Func _XMLSystem_Create() EndIf EndFunc ;==>_XMLSystem_Create +Func _XMLGenre_Create() + Local $oXMLGenre, $vXMLGenrePath = $iScriptPath & "\Ressources\Genresliste.xml" + $oXMLGenre = _XML_Open($vXMLGenrePath) + If $oXMLGenre = -1 Then + MsgBox(0, 'ERREUR', '') + Exit + Else + _LOG("Genrelist.xml Opened", 1, $iLOGPath) + Return $oXMLGenre + EndIf +EndFunc ;==>_XMLGenre_Create + diff --git a/Scraper.exe b/Scraper.exe index 0697fcb..43ba1c5 100644 Binary files a/Scraper.exe and b/Scraper.exe differ diff --git a/Scraper64.exe b/Scraper64.exe index a8882dd..49d12d5 100644 Binary files a/Scraper64.exe and b/Scraper64.exe differ diff --git a/UXS-config.ini b/UXS-config.ini index b2e65cc..d2a1186 100644 --- a/UXS-config.ini +++ b/UXS-config.ini @@ -1,4 +1,4 @@ [GENERAL] -$verINI='2.1.0.3' +$verINI='2.1.0.4' $vVerbose=2 [LAST_USE] diff --git a/Universal XML Scraper.au3 b/Universal XML Scraper.au3 index 06e854f..2f8e01e 100644 --- a/Universal XML Scraper.au3 +++ b/Universal XML Scraper.au3 @@ -5,7 +5,7 @@ #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Description=Scraper XML Universel -#AutoIt3Wrapper_Res_Fileversion=2.1.0.4 +#AutoIt3Wrapper_Res_Fileversion=2.1.0.5 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p #AutoIt3Wrapper_Res_LegalCopyright=LEGRAS David #AutoIt3Wrapper_Res_Language=1036 @@ -188,7 +188,9 @@ Global $iMIXPath = $iScriptPath & "\Mix" ; Where we are storing the MIX files. Global $iPathMixTmp = $iMIXPath & "\TEMP" ; Where we are storing the current MIX files. Global $iURLMirror = "http://uxs-screenscraper.recalbox.com/" Global $iURLSS = "http://www.screenscraper.fr/" -Global $iURLScraper = $iURLSS +Global $iURLSSMirror = "http://mirror.screenscraper.fr/" +;~ Global $iURLScraper = _TestServer($iURLSS, $iURLSSMirror) +Global $iURLScraper = _TestServer($iURLSSMirror, $iURLSS) _LOG("Verbose LVL : " & $iVerboseLVL, 1, $iLOGPath) _LOG("Path to ini : " & $iINIPath, 1, $iLOGPath) @@ -202,7 +204,7 @@ Global $MP_, $aPlink_Command, $vScrapeCancelled Global $vProfilsPath = IniRead($iINIPath, "LAST_USE", "$vProfilsPath", -1) Local $vXpath2RomPath, $vFullTimer, $vRomTimer, $vSelectedProfil = -1 Local $L_SCRAPE_Parts[3] = [300, 480, -1] -Local $oXMLProfil, $oXMLSystem, $oXMLCountry +Local $oXMLProfil, $oXMLSystem, $oXMLCountry, $oXMLGenre Local $aConfig, $aRomList, $aXMLRomList Local $nMsg Local $sMailSlotMother = "\\.\mailslot\Mother" @@ -244,14 +246,19 @@ Switch $Result EndIf EndSwitch +$aConfig = _LoadConfig() + ;Catching SystemList.xml -$oXMLSystem = _XMLSystem_Create() +$oXMLSystem = _XMLSystem_Create($aConfig[13], $aConfig[14]) If $oXMLSystem = -1 Then Exit ;Catching CountryList.xml -$oXMLCountry = _XMLCountry_Create() +$oXMLCountry = _XMLCountry_Create($aConfig[13], $aConfig[14]) If $oXMLCountry = -1 Then Exit +;Catching GenreList.xml +$oXMLGenre = _XMLGenre_Create($aConfig[13], $aConfig[14]) + ;Delete Splascreen GUIDelete($F_Splashcreen) @@ -343,10 +350,10 @@ Else EndSwitch EndIf - If IniRead($iINIPath, "LAST_USE", "$vMirror", 1) = 0 Then $iURLScraper = $iURLSS +;~ If IniRead($iINIPath, "LAST_USE", "$vMirror", 1) = 0 Then $iURLScraper = $iURLSS $aDIRList = _Check_autoconf($oXMLProfil) - _LoadConfig($oXMLProfil) + _LoadConfig() _GUI_Refresh($oXMLProfil) EndIf _LOG("GUI Constructed", 1, $iLOGPath) @@ -397,7 +404,7 @@ While 1 IniWrite($iINIPath, "LAST_USE", "$vTarget_XMLName", $aDIRList[1][3]) IniWrite($iINIPath, "LAST_USE", "$vSource_ImagePath", $aDIRList[1][4]) IniWrite($iINIPath, "LAST_USE", "$vTarget_ImagePath", $aDIRList[1][5]) - _LoadConfig($oXMLProfil) + _LoadConfig() _GUI_Refresh($oXMLProfil) If IniRead($iINIPath, "LAST_USE", "$vAutoconf_Use", 0) <> 0 Then $vBoucle = $vBoucle + 1 EndIf @@ -445,7 +452,7 @@ While 1 _LOG("Impossible to load language", 2, $iLOGPath) Exit EndIf - _LoadConfig($oXMLProfil) + _LoadConfig() _GUI_Refresh($oXMLProfil) Case $MC_Config_LU ;Manual Path Configuration _GUI_Config_LU() @@ -608,7 +615,7 @@ WEnd ;Fonctions; ;---------; -Func _LoadConfig($oXMLProfil) +Func _LoadConfig() Local $aMatchingCountry Dim $aConfig[15] $aConfig[0] = IniRead($iINIPath, "LAST_USE", "$vTarget_XMLName", " ") @@ -1071,7 +1078,7 @@ Func _GUI_Config_MISC() GUICtrlSetData($C_Verbose, _MultiLang_GetText("win_config_MISC_GroupMISC_VerboseChoice"), $aVerbose[IniRead($iINIPath, "GENERAL", "$vVerbose", 0)]) $CB_MissingRom_Mode = GUICtrlCreateCheckbox(_MultiLang_GetText("win_config_MISC_GroupMISC_MissingMode"), 16, 252) $CB_RechSys = GUICtrlCreateCheckbox(_MultiLang_GetText("win_config_MISC_GroupMISC_RechSys"), 16, 274) - $CB_Mirror = GUICtrlCreateCheckbox(_MultiLang_GetText("win_config_MISC_GroupMISC_Mirror"), 16, 296) +;~ $CB_Mirror = GUICtrlCreateCheckbox(_MultiLang_GetText("win_config_MISC_GroupMISC_Mirror"), 16, 296) GUICtrlCreateGroup("", -99, -99, 1, 1) $G_ScreenScraper = GUICtrlCreateGroup(_MultiLang_GetText("win_config_MISC_GroupScreenScraper"), 240, 0, 225, 153) $L_SSLogin = GUICtrlCreateLabel(_MultiLang_GetText("win_config_MISC_GroupScreenScraper_Login"), 248, 15) @@ -1106,8 +1113,8 @@ Func _GUI_Config_MISC() If IniRead($iINIPath, "LAST_USE", "$vMissingRom_Mode", "0") = "1" Then GUICtrlSetState($CB_MissingRom_Mode, $GUI_CHECKED) GUICtrlSetState($CB_RechSys, $GUI_UNCHECKED) If IniRead($iINIPath, "LAST_USE", "$vRechSYS", "1") = "1" Then GUICtrlSetState($CB_RechSys, $GUI_CHECKED) - GUICtrlSetState($CB_Mirror, $GUI_UNCHECKED) - If IniRead($iINIPath, "LAST_USE", "$vMirror", "0") = "1" Then GUICtrlSetState($CB_Mirror, $GUI_CHECKED) +;~ GUICtrlSetState($CB_Mirror, $GUI_UNCHECKED) +;~ If IniRead($iINIPath, "LAST_USE", "$vMirror", "0") = "1" Then GUICtrlSetState($CB_Mirror, $GUI_CHECKED) GUICtrlSetState($CB_SSHHash, $GUI_UNCHECKED) GUICtrlSetState($B_Local_RomPath, $GUI_DISABLE) If IniRead($iINIPath, "LAST_USE", "$vHashOnPI", "0") = "1" Then @@ -1120,7 +1127,7 @@ Func _GUI_Config_MISC() $vSSLogin = GUICtrlRead($I_SSLogin) ;$vSSLogin $vSSPassword = GUICtrlRead($I_SSPassword) ;$vSSPassword - $vTEMPPathSSCheck = _DownloadWRetry($iURLScraper & "api/ssuserInfos.php?devid=xxx&devpassword=yyy&softname=zzz&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vTEMPPathSSCheck) + $vTEMPPathSSCheck = _DownloadWRetry($iURLSS & "api/ssuserInfos.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vTEMPPathSSCheck) $vSSParticipation = Number(_XML_Read("/Data/ssuser/uploadsysteme", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/uploadinfos", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/romasso", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/uploadmedia", 0, $vTEMPPathSSCheck)) $vSSContrib = Number(_XML_Read("/Data/ssuser/contribution", 0, $vTEMPPathSSCheck)) _LOG("SS Check ssid=" & $vSSLogin & " participation = " & $vSSParticipation & " contribution = " & $vSSContrib, 1, $iLOGPath) @@ -1189,13 +1196,13 @@ Func _GUI_Config_MISC() IniWrite($iINIPath, "LAST_USE", "$vRechSYS", 0) If _IsChecked($CB_RechSys) Then IniWrite($iINIPath, "LAST_USE", "$vRechSYS", 1) - If _IsChecked($CB_Mirror) Then - IniWrite($iINIPath, "LAST_USE", "$vMirror", 1) - $iURLScraper = $iURLMirror - Else - IniWrite($iINIPath, "LAST_USE", "$vMirror", 0) - $iURLScraper = $iURLSS - EndIf +;~ If _IsChecked($CB_Mirror) Then +;~ IniWrite($iINIPath, "LAST_USE", "$vMirror", 1) +;~ $iURLScraper = $iURLMirror +;~ Else +;~ IniWrite($iINIPath, "LAST_USE", "$vMirror", 0) +;~ $iURLScraper = $iURLSS +;~ EndIf If _IsChecked($CB_SSHHash) Then IniWrite($iINIPath, "LAST_USE", "$vHashOnPI", 1) @@ -1219,14 +1226,14 @@ Func _GUI_Config_MISC() Return GUICtrlRead($C_Thread) Case $B_SSRegister _LOG("Launch Internet Browser to Register", 0, $iLOGPath) - ShellExecute($iURLSS & "membreinscription.php") + ShellExecute("http://www.screenscraper.fr/membreinscription.php") Case $B_SSCheck GUICtrlSetData($C_Thread, "", "") $vTEMPPathSSCheck = $iScriptPath & "\Ressources\SSCheck.xml" $vSSLogin = GUICtrlRead($I_SSLogin) ;$vSSLogin $vSSPassword = GUICtrlRead($I_SSPassword) ;$vSSPassword _LOG("SS Check ssid=" & $vSSLogin, 3, $iLOGPath) - $vTEMPPathSSCheck = _DownloadWRetry($iURLScraper & "api/ssuserInfos.php?devid=xxx&devpassword=yyy&softname=zzz&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vTEMPPathSSCheck) + $vTEMPPathSSCheck = _DownloadWRetry($iURLSS & "api/ssuserInfos.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vTEMPPathSSCheck) $vSSParticipation = Number(_XML_Read("/Data/ssuser/uploadsysteme", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/uploadinfos", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/romasso", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/uploadmedia", 0, $vTEMPPathSSCheck)) $vSSContrib = Number(_XML_Read("/Data/ssuser/contribution", 0, $vTEMPPathSSCheck)) $vSSLevel = Number(_XML_Read("/Data/ssuser/niveau", 0, $vTEMPPathSSCheck)) @@ -1261,13 +1268,16 @@ Func _GUI_Config_MISC() Switch $vSSLevel Case 0 $vNbThreadMax = 1 + $iURLScraper = _TestServer($iURLSSMirror, $iURLSS) _LOG("Not Registered", 0, $iLOGPath) MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_NotRegistered"), 10, $F_CONFIG) Case 499 To 9999999 $vNbThreadMax = 99 + $iURLScraper = _TestServer($iURLSS, $iURLSSMirror) _LOG("God Mode", 0, $iLOGPath) MsgBox($MB_ICONWARNING, _MultiLang_GetText("mess_ssregister_title"), _MultiLang_GetText("mess_ssregister_GodMode"), 10, $F_CONFIG) Case Else + $iURLScraper = _TestServer($iURLSS, $iURLSSMirror) _LOG("Nb Thread Available : " & $vNbThreadMax, 0, $iLOGPath) MsgBox($MB_ICONINFORMATION, _MultiLang_GetText("mess_ssregister_title"), _MultiLang_GetText("mess_ssregister_OK") & " " & $vNbThreadMax & " Threads", 10, $F_CONFIG) EndSwitch @@ -1919,14 +1929,9 @@ Func _CalcHash($aRomList, $vNoRom, $oXMLProfil) Return $aRomList EndFunc ;==>_CalcHash -Func _XMLSystem_Create($vSSLogin = "", $vSSPassword = "") +Func _XMLSystem_Create($vSSLogin = "test", $vSSPassword = "test") Local $oXMLSystem, $vXMLSystemPath = $iScriptPath & "\Ressources\systemlist.xml" $vXMLSystemPath = _DownloadWRetry($iURLScraper & "api/systemesListe.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vXMLSystemPath) - If FileGetSize($vXMLSystemPath) < 100 Then - $iURLScraper = $iURLSS - IniWrite($iINIPath, "LAST_USE", "$vMirror", 0) - $vXMLSystemPath = _DownloadWRetry($iURLScraper & "api/systemesListe.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vXMLSystemPath) - EndIf Switch $vXMLSystemPath Case -1 MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_UXSGlobal") & @CRLF & _MultiLang_GetText("err_Connection")) @@ -1946,14 +1951,9 @@ Func _XMLSystem_Create($vSSLogin = "", $vSSPassword = "") EndSwitch EndFunc ;==>_XMLSystem_Create -Func _XMLCountry_Create($vSSLogin = "", $vSSPassword = "") +Func _XMLCountry_Create($vSSLogin = "test", $vSSPassword = "test") Local $oXMLCountry, $vXMLCountryPath = $iScriptPath & "\Ressources\Countrylist.xml" $vXMLCountryPath = _DownloadWRetry($iURLScraper & "api/regionsListe.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vXMLCountryPath) - If FileGetSize($vXMLCountryPath) < 100 Then - $iURLScraper = $iURLSS - IniWrite($iINIPath, "LAST_USE", "$vMirror", 0) - $vXMLCountryPath = _DownloadWRetry($iURLScraper & "api/regionsListe.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vXMLCountryPath) - EndIf Switch $vXMLCountryPath Case -1 MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_UXSGlobal") & @CRLF & _MultiLang_GetText("err_Connection")) @@ -1973,6 +1973,28 @@ Func _XMLCountry_Create($vSSLogin = "", $vSSPassword = "") EndSwitch EndFunc ;==>_XMLCountry_Create +Func _XMLGenre_Create($vSSLogin = "test", $vSSPassword = "test") + Local $oXMLGenre, $vXMLGenrePath = $iScriptPath & "\Ressources\Genresliste.xml" + $vXMLGenrePath = _DownloadWRetry($iURLScraper & "api/genresListe.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "&output=XML&ssid=" & $vSSLogin & "&sspassword=" & $vSSPassword, $vXMLGenrePath) + Switch $vXMLGenrePath + Case -1 + MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_UXSGlobal") & @CRLF & _MultiLang_GetText("err_Connection")) + Return -1 + Case -2 + MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_UXSGlobal") & @CRLF & _MultiLang_GetText("err_TimeOut")) + Return -1 + Case Else + $oXMLGenre = _XML_Open($vXMLGenrePath) + If $oXMLGenre = -1 Then + MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_UXSGlobal") & @CRLF & _MultiLang_GetText("err_SystemList")) + Return -1 + Else + _LOG("Genrelist.xml Opened", 1, $iLOGPath) + Return $oXMLGenre + EndIf + EndSwitch +EndFunc ;==>_XMLGenre_Create + Func _DownloadROMXML($aRomList, $vBoucle, $vSystemID, $vSSLogin = "", $vSSPassword = "", $vScrapeSearchMode = 0) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $aPathSplit FileDelete($aRomList[$vBoucle][8]) @@ -2223,7 +2245,7 @@ Func _SCRAPE($oXMLProfil, $vNbThread = 1, $vFullScrape = 0) _GUI_Refresh($oXMLProfil, 1) Local $vScrapeCancelled = 0 - Local $aConfig = _LoadConfig($oXMLProfil) + Local $aConfig = _LoadConfig() Local $aExtToHide = StringSplit(_XML_Read('/Profil/Element[Source_Value="%AutoHide%"]/AutoHideEXT', 0, "", $oXMLProfil), "|") Local $aValueToHide = StringSplit(_XML_Read('/Profil/Element[Source_Value="%AutoHide%"]/AutoHideValue', 0, "", $oXMLProfil), "|") Local $vSendTimerLeft = 0, $vCreateTimerLeft = 0, $vSendTimerMoy = 0, $vCreateTimerMoy = 0, $vSendTimerTotal = 0, $vSendTimerTotalbyRom = 0, $vCreateTimerTotal = 0, $PercentProgression = 0 @@ -2235,7 +2257,7 @@ Func _SCRAPE($oXMLProfil, $vNbThread = 1, $vFullScrape = 0) If StringLeft($aConfig[0], 2) = "\\" And $vFullScrape = 0 Then _Plink($oXMLProfil, "killall") ; Ask to kill ES ;Checking NbThread - $vTEMPPathSSCheck = _DownloadWRetry($iURLScraper & "api/ssuserInfos.php?devid=xxx&devpassword=yyy&softname=zzz&output=XML&ssid=" & $aConfig[13] & "&sspassword=" & $aConfig[14], $iScriptPath & "\Ressources\SSCheck.xml") + $vTEMPPathSSCheck = _DownloadWRetry($iURLSS & "api/ssuserInfos.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "output=XML&ssid=" & $aConfig[13] & "&sspassword=" & $aConfig[14], $iScriptPath & "\Ressources\SSCheck.xml") $vSSParticipation = Number(_XML_Read("/Data/ssuser/uploadsysteme", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/uploadinfos", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/romasso", 0, $vTEMPPathSSCheck)) + Number(_XML_Read("/Data/ssuser/uploadmedia", 0, $vTEMPPathSSCheck)) $vSSContrib = Number(_XML_Read("/Data/ssuser/contribution", 0, $vTEMPPathSSCheck)) $vSSLevel = Number(_XML_Read("/Data/ssuser/niveau", 0, $vTEMPPathSSCheck)) @@ -2272,6 +2294,12 @@ Func _SCRAPE($oXMLProfil, $vNbThread = 1, $vFullScrape = 0) IniWrite($iINIPath, "LAST_USE", "$vNbThread", $vNbThread) EndIf + If $vNbThread = 1 Then + $iURLScraper = _TestServer($iURLSSMirror, $iURLSS) + Else + $iURLScraper = _TestServer($iURLSS, $iURLSSMirror) + EndIf + ;Creating the romlist $aConfig[12] = _SelectSystem($oXMLSystem, $vFullScrape) If $aConfig[12] = "" Then @@ -2606,6 +2634,20 @@ Func _WizardAutoconf($vWizCancel) Return $vResultWZ EndFunc ;==>_WizardAutoconf +Func _TestServer($vURL, $vURLBackup) + Local $vTestPath + $vTestPath = _Download($vURL & "api/ssuserInfos.php?devid=" & $iDevId & "&devpassword=" & $iDevPassword & "&softname=" & $iSoftname & "output=xml&ssid=test&sspassword=test", @ScriptDir & "\test.xml", 5) + If FileExists($vTestPath) And FileGetSize($vTestPath) > 100 Then + FileDelete($vTestPath) + _LOG("--URL = " & $vURL) + Return $vURL + Else + FileDelete($vTestPath) + _LOG("--URL = " & $vURLBackup) + Return $vURLBackup + EndIf +EndFunc ;==>_TestServer + ;~ $aPicParameters[0] = Target_Width ;~ $aPicParameters[1] = Target_Height ;~ $aPicParameters[2] = Target_TopLeftX diff --git a/XPathBuilder/settings.config b/XPathBuilder/settings.config index 0c9ffaf..2e74e64 100644 --- a/XPathBuilder/settings.config +++ b/XPathBuilder/settings.config @@ -14,6 +14,8 @@ + + @@ -22,7 +24,6 @@ - diff --git a/changelog.txt b/changelog.txt index 2f49836..db85a41 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,15 @@ +2.1.0.4 +* Corrected : + - Some fallback in language xml + - Fallback function (problem with standard mix not founding some picture) +* Added : + - Possibity to "Fixe" a Size by media in Standard profil with : and + - Running on 2 servers now : Mirror and main server + - New MIX Possibilty : "Text" + - rotation GDI Function with directly in the Element. + - can be put to "genre" +Don't forget to see the Wiki : https://github.com/Universal-Rom-Tools/Universal-XML-Scraper/wiki/%5BTUTO%5D-Making-a-MIX-Template + 2.1.0.3 * Corrected : - Filename check is with extension now... diff --git a/changelog_next.txt b/changelog_next.txt index 2f49836..db85a41 100644 --- a/changelog_next.txt +++ b/changelog_next.txt @@ -1,3 +1,15 @@ +2.1.0.4 +* Corrected : + - Some fallback in language xml + - Fallback function (problem with standard mix not founding some picture) +* Added : + - Possibity to "Fixe" a Size by media in Standard profil with : and + - Running on 2 servers now : Mirror and main server + - New MIX Possibilty : "Text" + - rotation GDI Function with directly in the Element. + - can be put to "genre" +Don't forget to see the Wiki : https://github.com/Universal-Rom-Tools/Universal-XML-Scraper/wiki/%5BTUTO%5D-Making-a-MIX-Template + 2.1.0.3 * Corrected : - Filename check is with extension now... diff --git a/test2.au3 b/test2.au3 new file mode 100644 index 0000000..0161a56 --- /dev/null +++ b/test2.au3 @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +If Not _FileCreate(@ScriptDir & "\test") Then ; Testing UXS Directory + Global $iScriptPath = @AppDataDir & "\UXMLS" ; If not, use Path to current user's Roaming Application Data + DirCreate($iScriptPath) ; +Else + Global $iScriptPath = @ScriptDir + FileDelete($iScriptPath & "\test") +EndIf + +Global $iINIPath = $iScriptPath & "\UXS-config.ini" +Global $iLOGPath = $iScriptPath & "\LOGs\logTEST.txt" +Global $iVerboseLVL = IniRead($iINIPath, "GENERAL", "$vVerbose", 0) + +#include "./Include/_MultiLang.au3" +#include "./Include/_ExtMsgBox.au3" +#include "./Include/_Trim.au3" +#include "./Include/_Hash.au3" +;~ #include "./Include/_zip.au3" +#include "./Include/_XML.au3" +#include "./Include/MailSlot.au3" +#include "./Include/_GraphGDIPlus.au3" +#include "./Include/_MyFunction.au3" +#include "./Include/_ITaskBarList.au3" + + + + +Local $vPath = './Test.png' + +_GDIPlus_Text($vPath, 'youpiyoupiyou', 400, 200, 'Old Stamper', 40,0, 0xFF00FF00) \ No newline at end of file