@@ -117,7 +117,7 @@ Namespace API.Base
117117 Private Const Name_LastUpdated As String = "LastUpdated"
118118
119119 Private Const Name_ScriptUse As String = "ScriptUse"
120- Private Const Name_ScriptFile As String = "ScriptFile "
120+ Private Const Name_ScriptData As String = "ScriptData "
121121
122122 Private Const Name_DataMerging As String = "DataMerging"
123123# Region "Downloaded data"
@@ -411,7 +411,7 @@ BlockNullPicture:
411411# End Region
412412# Region "Script"
413413 Friend Overridable Property ScriptUse As Boolean = False Implements IUserData.ScriptUse
414- Friend Overridable Property ScriptFile As SFile Implements IUserData.ScriptFile
414+ Friend Overridable Property ScriptData As String Implements IUserData.ScriptData
415415# End Region
416416# End Region
417417# Region "Plugins Support"
@@ -585,16 +585,7 @@ BlockNullPicture:
585585 DownloadedPictures( True ) = x.Value(Name_PicturesCount).FromXML( Of Integer )( 0 )
586586 LastUpdated = AConvert( Of Date )(x.Value(Name_LastUpdated), ADateTime.Formats.BaseDateTime, Nothing )
587587 ScriptUse = x.Value(Name_ScriptUse).FromXML( Of Boolean )( False )
588- Dim s$ = x.Value(Name_ScriptFile)
589- If Not s.IsEmptyString Then
590- If SFile.IsDirectory(s) Then
591- ScriptFile = s
592- Else
593- ScriptFile = New SFile(s) With {.Path = MyFile.Path}
594- End If
595- Else
596- ScriptFile = Nothing
597- End If
588+ ScriptData = x.Value(Name_ScriptData)
598589 DataMerging = x.Value(Name_DataMerging).FromXML( Of Boolean )( False )
599590 ChangeCollectionName(x.Value(Name_CollectionName), False )
600591 Labels.ListAddList(x.Value(Name_LabelsName).StringToList( Of String , List( Of String ))( "|" , EDP.ReturnValue), LAP.NotContainsOnly, LAP.ClearBeforeAdd)
@@ -635,15 +626,7 @@ BlockNullPicture:
635626 x.Add(Name_PicturesCount, DownloadedPictures( True ))
636627 x.Add(Name_LastUpdated, AConvert( Of String )(LastUpdated, ADateTime.Formats.BaseDateTime, String .Empty))
637628 x.Add(Name_ScriptUse, ScriptUse.BoolToInteger)
638- If Not ScriptFile.IsEmptyString Then
639- If ScriptFile.Path = MyFile.Path Then
640- x.Add(Name_ScriptFile, ScriptFile.File)
641- Else
642- x.Add(Name_ScriptFile, ScriptFile)
643- End If
644- Else
645- x.Add(Name_ScriptFile, String .Empty)
646- End If
629+ x.Add(Name_ScriptData, ScriptData)
647630 x.Add(Name_CollectionName, CollectionName)
648631 x.Add(Name_LabelsName, Labels.ListToString(, "|" , EDP.ReturnValue))
649632 x.Add(Name_DataMerging, DataMerging.BoolToInteger)
@@ -964,17 +947,18 @@ BlockNullPicture:
964947 End Function
965948 Private Sub RunScript()
966949 Try
950+ Const spa$ = "{0}"
967951 If ScriptUse Then
968952 Dim ScriptPattern$
969- If Not ScriptFile .IsEmptyString Then
970- ScriptPattern = ScriptFile
953+ If Not ScriptData .IsEmptyString Then
954+ ScriptPattern = ScriptData
971955 Else
972- ScriptPattern = Settings.ScriptFile .Value
956+ ScriptPattern = Settings.ScriptData .Value
973957 End If
974958 If Not ScriptPattern.IsEmptyString Then
975- ScriptPattern &= " {0} "
959+ If Not ScriptPattern.Contains(spa) Then ScriptPattern &= $ " ""{spa}"" "
976960 Using b As New BatchExecutor With {.RedirectStandardError = True }
977- b.Execute({ String .Format(ScriptPattern, MyFile.CutPath( 1 ).ToString )}, EDP.SendInLog + EDP.ThrowException)
961+ b.Execute({ String .Format(ScriptPattern, MyFile.CutPath( 1 ).PathNoSeparator )}, EDP.SendInLog + EDP.ThrowException)
978962 If b.HasError Or Not b.ErrorOutput.IsEmptyString Then Throw New Exception(b.ErrorOutput, b.ErrorException)
979963 End Using
980964 End If
@@ -1035,11 +1019,8 @@ BlockNullPicture:
10351019 End If
10361020 f.CutPath.Exists(SFO.Path)
10371021 Directory.Move(UserBefore.File.CutPath(, EDP.ThrowException).Path, f.Path)
1038- If Not ScriptFile.IsEmptyString AndAlso ScriptFile.Path = UserBefore.File.Path Then
1039- Dim ff As SFile = ScriptFile
1040- f.Path = MyFile.Path
1041- ScriptFile = ff
1042- End If
1022+ If Not ScriptData.IsEmptyString AndAlso ScriptData.Contains(UserBefore.File.PathNoSeparator) Then _
1023+ ScriptData = ScriptData.Replace(UserBefore.File.PathNoSeparator, MyFile.PathNoSeparator)
10431024 Settings.UsersList.Remove(UserBefore)
10441025 Settings.UpdateUsersList(User)
10451026 UpdateUserInformation()
@@ -1093,11 +1074,8 @@ BlockNullPicture:
10931074 New ErrorsDescriber( False , False , False , New List( Of SFile))).Count = 0 Then
10941075 UserBefore.File.CutPath.Delete(SFO.Path, Settings.DeleteMode, EDP.SendInLog)
10951076 End If
1096- If Not ScriptFile.IsEmptyString AndAlso ScriptFile.Path = UserBefore.File.Path Then
1097- Dim f As SFile = ScriptFile
1098- f.Path = MyFile.Path
1099- ScriptFile = f
1100- End If
1077+ If Not ScriptData.IsEmptyString AndAlso ScriptData.Contains(UserBefore.File.PathNoSeparator) Then _
1078+ ScriptData = ScriptData.Replace(UserBefore.File.PathNoSeparator, MyFile.PathNoSeparator)
11011079 UpdateUserInformation()
11021080 End If
11031081 Catch ioex As InvalidOperationException When ioex.HelpLink = 1
@@ -1263,7 +1241,7 @@ BlockNullPicture:
12631241 Property DownloadImages As Boolean
12641242 Property DownloadVideos As Boolean
12651243 Property ScriptUse As Boolean
1266- Property ScriptFile As SFile
1244+ Property ScriptData As String
12671245 Function GetLVI( ByVal Destination As ListView) As ListViewItem
12681246 Function GetLVIGroup( ByVal Destination As ListView) As ListViewGroup
12691247 Sub LoadUserInformation()
0 commit comments