Browse Source

Not using "my" prefix for VB.NET variables + No redundant declaration of Session variable type + Bug fix: Session timeout was incorrectly set in seconds, instead of milliseconds + Using -Property switch to initialize SessionOptions properties in PowerShell + Generating code for transfer settings + TransferOptions.ResumeSupport is settable + Setting TransferResumeSupport.Threshold automatically sets State to Smart

Source commit: ce746f6a04b2557b7fa77e1dbabdf41bb61de248
Martin Prikryl 9 years ago
parent
commit
04fab653e6

+ 1 - 1
dotnet/TransferOptions.cs

@@ -32,7 +32,7 @@ namespace WinSCP
         public FilePermissions FilePermissions { get; set; }
         public TransferMode TransferMode { get; set; }
         public string FileMask { get; set; }
-        public TransferResumeSupport ResumeSupport { get; private set; }
+        public TransferResumeSupport ResumeSupport { get; set; }
         public int SpeedLimit { get; set; }
         public OverwriteMode OverwriteMode { get; set; }
 

+ 11 - 13
dotnet/TransferResumeSupport.cs

@@ -54,25 +54,23 @@ namespace WinSCP
 
         private int GetThreshold()
         {
-            CheckSmart();
-            return _threshold;
-        }
-
-        private void SetThreshold(int threshold)
-        {
-            if (threshold <= 0)
+            if (State != TransferResumeSupportState.Smart)
             {
-                throw new ArgumentOutOfRangeException("threshold", "Threshold must be positive");
+                throw new InvalidOperationException("Threshold is undefined when state is not Smart");
             }
-            CheckSmart();
-            _threshold = threshold;
+            return _threshold;
         }
 
-        private void CheckSmart()
+        private void SetThreshold(int threshold)
         {
-            if (State != TransferResumeSupportState.Smart)
+            if (_threshold != threshold)
             {
-                throw new InvalidOperationException("Threshold is undefined when state is not Smart");
+                if (threshold <= 0)
+                {
+                    throw new ArgumentOutOfRangeException("threshold", "Threshold must be positive");
+                }
+                State = TransferResumeSupportState.Smart;
+                _threshold = threshold;
             }
         }
 

+ 255 - 0
source/core/Common.cpp

@@ -2928,6 +2928,8 @@ bool __fastcall IsHttpUrl(const UnicodeString & S)
 }
 //---------------------------------------------------------------------------
 const UnicodeString RtfPara = L"\\par\n";
+const UnicodeString AssemblyNamespace = L"WinSCP";
+const UnicodeString TransferOptionsClassName(L"TransferOptions");
 const UnicodeString RtfHyperlinkField = L"HYPERLINK";
 const UnicodeString RtfHyperlinkFieldPrefix = RtfHyperlinkField + L" \"";
 const UnicodeString RtfHyperlinkFieldSuffix = L"\" ";
@@ -3111,3 +3113,256 @@ UnicodeString __fastcall AssemblyCommentLine(TAssemblyLanguage Language, const U
 
   return RtfCodeComment(Prefix + L" " + Text) + RtfPara;
 }
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyString(TAssemblyLanguage Language, UnicodeString S)
+{
+  switch (Language)
+  {
+    case alCSharp:
+      if (S.Pos(L"\\") > 0)
+      {
+        S = FORMAT(L"@\"%s\"", (ReplaceStr(S, L"\"", L"\"\"")));
+      }
+      else
+      {
+        S = FORMAT(L"\"%s\"", (ReplaceStr(S, L"\"", L"\\\"")));
+      }
+      break;
+
+    case alVBNET:
+      S = FORMAT(L"\"%s\"", (ReplaceStr(S, L"\"", L"\"\"")));
+      break;
+
+    case alPowerShell:
+      S = FORMAT(L"\"%s\"", (ReplaceStr(S, L"\"", L"`\"")));
+      break;
+
+    default:
+      DebugFail();
+      break;
+  }
+
+  return RtfString(S);
+}
+//---------------------------------------------------------------------
+static UnicodeString __fastcall RtfClass(const UnicodeString & Text)
+{
+  return RtfColorText(3, Text);
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall RtfLibraryClass(const UnicodeString & ClassName)
+{
+  return RtfLink(L"library_" + ClassName.LowerCase(), RtfClass(ClassName));
+}
+//---------------------------------------------------------------------
+static UnicodeString __fastcall RtfLibraryProperty(const UnicodeString & ClassName, const UnicodeString & PropertyName)
+{
+  return RtfLink(L"library_" + ClassName.LowerCase() + L"#" + PropertyName.LowerCase(), RtfOverrideColorText(PropertyName));
+}
+//---------------------------------------------------------------------
+UnicodeString AssemblyVariableName(const UnicodeString & ClassName)
+{
+  return ClassName.SubString(1, 1).LowerCase() + ClassName.SubString(2, ClassName.Length() - 1);
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyPropertyRaw(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name,
+  const UnicodeString & Value, bool Inline)
+{
+  UnicodeString Result;
+  UnicodeString RtfPropertyAndValue = RtfLibraryProperty(ClassName, Name) + L" = " + Value;
+  UnicodeString Indetation = (Inline ? L"" : L"    ");
+  UnicodeString SpaceOrPara = (Inline ? UnicodeString(L" ") : RtfPara);
+  switch (Language)
+  {
+    case alCSharp:
+      Result = Indetation + RtfPropertyAndValue + (Inline ? L"" : L",") + SpaceOrPara;
+      break;
+
+    case alVBNET:
+      Result = Indetation + L"." + RtfPropertyAndValue + SpaceOrPara;
+      break;
+
+    case alPowerShell:
+      Result = Indetation + RtfPropertyAndValue + SpaceOrPara;
+      break;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name,
+  const UnicodeString & Type, const UnicodeString & Member, bool Inline)
+{
+  UnicodeString PropertyValue;
+
+  switch (Language)
+  {
+    case alCSharp:
+    case alVBNET:
+      PropertyValue = RtfClass(Type) + RtfText(L"." + Member);
+      break;
+
+    case alPowerShell:
+      PropertyValue = RtfText(L"[" + AssemblyNamespace + L".") + RtfClass(Type) + RtfText(L"]::" + Member);
+      break;
+  }
+
+  return AssemblyPropertyRaw(Language, ClassName, Name, PropertyValue, Inline);
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName,
+  const UnicodeString & Name, const UnicodeString & Value, bool Inline)
+{
+  return AssemblyPropertyRaw(Language, ClassName, Name, AssemblyString(Language, Value), Inline);
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName,
+  const UnicodeString & Name, int Value, bool Inline)
+{
+  return AssemblyPropertyRaw(Language, ClassName, Name, IntToStr(Value), Inline);
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name, bool Value, bool Inline)
+{
+  UnicodeString PropertyValue;
+
+  switch (Language)
+  {
+    case alCSharp:
+      PropertyValue = (Value ? L"true" : L"false");
+      break;
+
+    case alVBNET:
+      PropertyValue = (Value ? L"True" : L"False");
+      break;
+
+    case alPowerShell:
+      PropertyValue = (Value ? L"$True" : L"$False");
+      break;
+  }
+
+  return AssemblyPropertyRaw(Language, ClassName, Name, PropertyValue, Inline);
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyNewClassInstance(TAssemblyLanguage Language, const UnicodeString & ClassName, bool Inline)
+{
+  UnicodeString VariableName = AssemblyVariableName(ClassName);
+  UnicodeString RtfClass = RtfLibraryClass(ClassName);
+
+  UnicodeString Result;
+  switch (Language)
+  {
+    case alCSharp:
+      if (!Inline)
+      {
+        Result += RtfClass + RtfText(L" " + VariableName  + L" = ");
+      }
+      Result += RtfKeyword(L"new") + RtfText(L" ") + RtfClass;
+      break;
+
+    case alVBNET:
+      if (!Inline)
+      {
+        Result += RtfText(VariableName + L" ") + RtfKeyword(L"As") + RtfText(L" ");
+      }
+      Result += RtfKeyword(L"New") + RtfText(" ") + RtfClass;
+      break;
+
+    case alPowerShell:
+      if (!Inline)
+      {
+        Result += RtfText(L"$" + VariableName + L" = ");
+      }
+      Result += RtfKeyword(L"New-Object") + RtfText(L" " + AssemblyNamespace + L".") + RtfClass;
+      break;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyNewClassInstanceStart(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, bool Inline)
+{
+  UnicodeString NewClassInstance = AssemblyNewClassInstance(Language, ClassName, Inline);
+  UnicodeString SpaceOrPara = (Inline ? UnicodeString(L" ") : RtfPara);
+
+  UnicodeString Result;
+  switch (Language)
+  {
+    case alCSharp:
+      Result =
+        NewClassInstance + SpaceOrPara +
+        RtfText(L"{") + SpaceOrPara;
+      break;
+
+    case alVBNET:
+      // Historically we use Dim .. With instead of object initilizer.
+      // But for inline use, we have to use object initialize.
+      // We should consistently always use object initilizers.
+      if (!Inline)
+      {
+        Result += RtfKeyword(L"Dim") + RtfText(L" ");
+      }
+      Result += NewClassInstance + SpaceOrPara + RtfKeyword(L"With");
+      if (Inline)
+      {
+        Result += RtfText(L" { ");
+      }
+      else
+      {
+        Result += RtfText(L" " + AssemblyVariableName(ClassName)) + RtfPara;
+      }
+      break;
+
+    case alPowerShell:
+      Result = NewClassInstance + RtfText(" -Property @{") + SpaceOrPara;
+      break;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------
+UnicodeString __fastcall AssemblyNewClassInstanceEnd(TAssemblyLanguage Language, bool Inline)
+{
+  UnicodeString InlineEnd = RtfText(L"}");
+
+  UnicodeString Result;
+  switch (Language)
+  {
+    case alCSharp:
+      if (Inline)
+      {
+        Result = InlineEnd;
+      }
+      else
+      {
+        Result = RtfText(L"};") + RtfPara;
+      }
+      break;
+
+    case alVBNET:
+      if (Inline)
+      {
+        Result = InlineEnd;
+      }
+      else
+      {
+        Result = RtfKeyword(L"End With") + RtfPara;
+      }
+      break;
+
+    case alPowerShell:
+      if (Inline)
+      {
+        Result = InlineEnd;
+      }
+      else
+      {
+        Result = RtfText(L"}") + RtfPara;
+      }
+      break;
+  }
+  return Result;
+}

+ 23 - 0
source/core/Common.h

@@ -204,6 +204,8 @@ MethodT __fastcall MakeMethod(void * Data, void * Code)
 //---------------------------------------------------------------------------
 enum TAssemblyLanguage { alCSharp, alVBNET, alPowerShell };
 extern const UnicodeString RtfPara;
+extern const UnicodeString AssemblyNamespace;
+extern const UnicodeString TransferOptionsClassName;
 //---------------------------------------------------------------------
 UnicodeString __fastcall RtfText(const UnicodeString & Text);
 UnicodeString __fastcall RtfColor(int Index);
@@ -221,7 +223,28 @@ UnicodeString __fastcall RtfSwitch(const UnicodeString & Name, const UnicodeStri
 UnicodeString __fastcall RtfEscapeParam(UnicodeString Param);
 UnicodeString __fastcall RtfRemoveHyperlinks(UnicodeString Text);
 UnicodeString __fastcall ScriptCommandLink(const UnicodeString & Command);
+UnicodeString __fastcall AssemblyString(TAssemblyLanguage Language, UnicodeString S);
 UnicodeString __fastcall AssemblyCommentLine(TAssemblyLanguage Language, const UnicodeString & Text);
+UnicodeString __fastcall AssemblyPropertyRaw(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name,
+  const UnicodeString & Value, bool Inline);
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name,
+  const UnicodeString & Type, const UnicodeString & Member, bool Inline);
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name,
+  const UnicodeString & Value, bool Inline);
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name, int Value, bool Inline);
+UnicodeString __fastcall AssemblyProperty(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, const UnicodeString & Name, bool Value, bool Inline);
+UnicodeString __fastcall RtfLibraryClass(const UnicodeString & ClassName);
+UnicodeString AssemblyVariableName(const UnicodeString & ClassName);
+UnicodeString __fastcall AssemblyNewClassInstance(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, bool Inline);
+UnicodeString __fastcall AssemblyNewClassInstanceStart(
+  TAssemblyLanguage Language, const UnicodeString & ClassName, bool Inline);
+UnicodeString __fastcall AssemblyNewClassInstanceEnd(TAssemblyLanguage Language, bool Inline);
 //---------------------------------------------------------------------------
 #include "Global.h"
 //---------------------------------------------------------------------------

+ 103 - 14
source/core/CopyParam.cpp

@@ -63,7 +63,11 @@ UnicodeString __fastcall TCopyParamType::GetInfoStr(
   bool SomeAttrIncluded;
   UnicodeString ScriptArgs;
   bool NoScriptArgs;
-  DoGetInfoStr(Separator, Attrs, Result, SomeAttrIncluded, UnicodeString(), ScriptArgs, NoScriptArgs);
+  UnicodeString AssemblyCode;
+  bool NoCodeProperties;
+  DoGetInfoStr(
+    Separator, Attrs, Result, SomeAttrIncluded,
+    UnicodeString(), ScriptArgs, NoScriptArgs, TAssemblyLanguage(0), AssemblyCode, NoCodeProperties);
   return Result;
 }
 //---------------------------------------------------------------------------
@@ -73,7 +77,11 @@ bool __fastcall TCopyParamType::AnyUsableCopyParam(int Attrs) const
   bool SomeAttrIncluded;
   UnicodeString ScriptArgs;
   bool NoScriptArgs;
-  DoGetInfoStr(L";", Attrs, Result, SomeAttrIncluded, UnicodeString(), ScriptArgs, NoScriptArgs);
+  UnicodeString AssemblyCode;
+  bool NoCodeProperties;
+  DoGetInfoStr(
+    L";", Attrs, Result, SomeAttrIncluded,
+    UnicodeString(), ScriptArgs, NoScriptArgs, TAssemblyLanguage(0), AssemblyCode, NoCodeProperties);
   return SomeAttrIncluded;
 }
 //---------------------------------------------------------------------------
@@ -82,19 +90,37 @@ UnicodeString __fastcall TCopyParamType::GenerateTransferCommandArgs(int Attrs,
   UnicodeString Result;
   bool SomeAttrIncluded;
   UnicodeString ScriptArgs;
-  DoGetInfoStr(L";", Attrs, Result, SomeAttrIncluded, Link, ScriptArgs, NoScriptArgs);
+  UnicodeString AssemblyCode;
+  bool NoCodeProperties;
+  DoGetInfoStr(
+    L";", Attrs, Result, SomeAttrIncluded,
+    Link, ScriptArgs, NoScriptArgs, TAssemblyLanguage(0), AssemblyCode, NoCodeProperties);
   return ScriptArgs;
 }
 //---------------------------------------------------------------------------
+UnicodeString __fastcall TCopyParamType::GenerateAssemblyCode(
+  TAssemblyLanguage Language, int Attrs, bool & NoCodeProperties) const
+{
+  UnicodeString Result;
+  bool SomeAttrIncluded;
+  UnicodeString ScriptArgs;
+  bool NoScriptArgs;
+  UnicodeString AssemblyCode;
+  DoGetInfoStr(L";", Attrs, Result, SomeAttrIncluded, UnicodeString(), ScriptArgs, NoScriptArgs, Language, AssemblyCode, NoCodeProperties);
+  return AssemblyCode;
+}
+//---------------------------------------------------------------------------
 void __fastcall TCopyParamType::DoGetInfoStr(
   UnicodeString Separator, int Options,
   UnicodeString & Result, bool & SomeAttrIncluded,
-  const UnicodeString & Link, UnicodeString & ScriptArgs, bool & NoScriptArgs) const
+  const UnicodeString & Link, UnicodeString & ScriptArgs, bool & NoScriptArgs, TAssemblyLanguage Language, UnicodeString & AssemblyCode,
+  bool & NoCodeProperties) const
 {
   TCopyParamType Defaults;
 
   bool SomeAttrExcluded = false;
   NoScriptArgs = false;
+  NoCodeProperties = false;
   SomeAttrIncluded = false;
   #define ADD(STR, EXCEPT) \
     if (FLAGCLEAR(Options, EXCEPT)) \
@@ -144,9 +170,13 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       ADD("", cpaIncludeMaskOnly | cpaNoTransferMode);
 
       ScriptArgs += RtfSwitchValue(TRANSFER_SWITCH, Link, TransferModeNames[TransferMode]);
+      const wchar_t * TransferModeMembers[] = { L"Binary", L"Ascii", L"Automatic" };
+      AssemblyCode += AssemblyProperty(
+        Language, TransferOptionsClassName, L"TransferMode", L"TransferMode", TransferModeMembers[TransferMode], false);
       if (AsciiFileMaskDiffers)
       {
         NoScriptArgs = true;
+        NoCodeProperties = true;
       }
     }
   }
@@ -156,6 +186,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
     {
       SomeAttrExcluded = true;
       NoScriptArgs = true;
+      NoCodeProperties = true;
     }
   }
 
@@ -166,6 +197,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       cpaIncludeMaskOnly);
 
     NoScriptArgs = true;
+    NoCodeProperties = true;
   }
 
   if ((InvalidCharsReplacement == NoReplacement) !=
@@ -178,6 +210,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
     }
 
     NoScriptArgs = true;
+    NoCodeProperties = true;
   }
 
   if ((PreserveRights != Defaults.PreserveRights) ||
@@ -198,12 +231,22 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       if (FLAGCLEAR(Options, Except))
       {
         ScriptArgs += RtfSwitchValue(PERMISSIONS_SWITCH, Link, Rights.Octal);
+
+        const UnicodeString FilePermissionsClassName = L"FilePermissions";
+        const bool Inline = true;
+        UnicodeString FilePermissions =
+          AssemblyNewClassInstanceStart(Language, FilePermissionsClassName, Inline) +
+          AssemblyProperty(Language, FilePermissionsClassName, L"Octal", Rights.Octal, Inline) +
+          AssemblyNewClassInstanceEnd(Language, Inline);
+
+        AssemblyCode += AssemblyPropertyRaw(Language, TransferOptionsClassName, L"FilePermissions", FilePermissions, false);
       }
     }
 
-    if (AddXToDirectories != Defaults.AddXToDirectories)
+    if ((AddXToDirectories != Defaults.AddXToDirectories) && FLAGCLEAR(Options, Except))
     {
-      NoScriptArgs = NoScriptArgs || FLAGCLEAR(Options, Except);
+      NoScriptArgs = true;
+      NoCodeProperties = true;
     }
   }
 
@@ -240,15 +283,18 @@ void __fastcall TCopyParamType::DoGetInfoStr(
         if (PreserveTimeDirs && FLAGCLEAR(Options, ExceptDirs))
         {
           ScriptArgs += RtfSwitchValue(PRESERVETIME_SWITCH, Link, PRESERVETIMEDIRS_SWITCH_VALUE);
+          NoCodeProperties = true;
         }
         else
         {
+          DebugFail(); // should never get here
           ScriptArgs += RtfSwitch(PRESERVETIME_SWITCH, Link);
         }
       }
       else
       {
         ScriptArgs += RtfSwitch(NOPRESERVETIME_SWITCH, Link);
+        AssemblyCode += AssemblyProperty(Language, TransferOptionsClassName, L"PreserveTimestamp", false, false);
       }
     }
   }
@@ -260,7 +306,11 @@ void __fastcall TCopyParamType::DoGetInfoStr(
     {
       const int Except = cpaIncludeMaskOnly | cpaNoIgnorePermErrors;
       ADD(LoadStr(COPY_INFO_IGNORE_PERM_ERRORS), Except);
-      NoScriptArgs = NoScriptArgs || (FLAGCLEAR(Options, Except));
+      if (FLAGCLEAR(Options, Except))
+      {
+        NoScriptArgs = true;
+        NoCodeProperties = true;
+      }
     }
   }
 
@@ -270,7 +320,11 @@ void __fastcall TCopyParamType::DoGetInfoStr(
     {
       const int Except = cpaIncludeMaskOnly | cpaNoPreserveReadOnly;
       ADD(LoadStr(COPY_INFO_PRESERVE_READONLY), Except);
-      NoScriptArgs = NoScriptArgs || (FLAGCLEAR(Options, Except));
+      if (FLAGCLEAR(Options, Except))
+      {
+        NoScriptArgs = true;
+        NoCodeProperties = true;
+      }
     }
   }
 
@@ -289,7 +343,11 @@ void __fastcall TCopyParamType::DoGetInfoStr(
     {
       const int Except = cpaIncludeMaskOnly | cpaNoClearArchive;
       ADD(LoadStr(COPY_INFO_CLEAR_ARCHIVE), Except);
-      NoScriptArgs = NoScriptArgs || (FLAGCLEAR(Options, Except));
+      if (FLAGCLEAR(Options, Except))
+      {
+        NoScriptArgs = true;
+        NoCodeProperties = true;
+      }
     }
   }
 
@@ -301,7 +359,11 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       {
         const int Except = cpaIncludeMaskOnly | cpaNoRemoveBOM | cpaNoTransferMode;
         ADD(LoadStr(COPY_INFO_REMOVE_BOM), Except);
-        NoScriptArgs = NoScriptArgs || (FLAGCLEAR(Options, Except));
+        if (FLAGCLEAR(Options, Except))
+        {
+          NoScriptArgs = true;
+          NoCodeProperties = true;
+        }
       }
     }
 
@@ -311,7 +373,11 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       {
         const int Except = cpaIncludeMaskOnly | cpaNoRemoveCtrlZ | cpaNoTransferMode;
         ADD(LoadStr(COPY_INFO_REMOVE_CTRLZ),Except);
-        NoScriptArgs = NoScriptArgs || (FLAGCLEAR(Options, Except));
+        if (FLAGCLEAR(Options, Except))
+        {
+          NoScriptArgs = true;
+          NoCodeProperties = true;
+        }
       }
     }
   }
@@ -322,6 +388,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       cpaNoIncludeMask);
 
     ScriptArgs += RtfSwitch(FILEMASK_SWITCH, Link, IncludeFileMask.Masks);
+    AssemblyCode += AssemblyProperty(Language, TransferOptionsClassName, L"FileMask", IncludeFileMask.Masks, false);
   }
 
   DebugAssert(FTransferSkipList.get() == NULL);
@@ -333,6 +400,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
     ADD(FMTLOAD(COPY_INFO_CPS_LIMIT2, (LimitKB)), cpaIncludeMaskOnly);
 
     ScriptArgs += RtfSwitch(SPEED_SWITCH, Link, LimitKB);
+    AssemblyCode += AssemblyProperty(Language, TransferOptionsClassName, L"Speed", LimitKB, false);
   }
 
   if (NewerOnly != Defaults.NewerOnly)
@@ -344,30 +412,51 @@ void __fastcall TCopyParamType::DoGetInfoStr(
       if (FLAGCLEAR(Options, Except))
       {
         ScriptArgs += RtfSwitch(NEWERONLY_SWICH, Link);
+        NoCodeProperties = true;
       }
     }
   }
 
-  if (((ResumeSupport != Defaults.ResumeSupport) ||
-       ((ResumeSupport == rsSmart) && (ResumeThreshold != Defaults.ResumeThreshold))) &&
+  bool ResumeThresholdDiffers = ((ResumeSupport == rsSmart) && (ResumeThreshold != Defaults.ResumeThreshold));
+  if (((ResumeSupport != Defaults.ResumeSupport) || ResumeThresholdDiffers) &&
       (TransferMode != tmAscii) && FLAGCLEAR(Options, cpaNoResumeSupport))
   {
     UnicodeString Value;
+    UnicodeString CodeState;
+    int ResumeThresholdKB = (ResumeThreshold / 1024);
     switch (ResumeSupport)
     {
       case rsOff:
         Value = ToggleNames[ToggleOff];
+        CodeState = L"Off";
         break;
 
       case rsOn:
         Value = ToggleNames[ToggleOn];
+        CodeState = L"On";
         break;
 
       case rsSmart:
-        Value = IntToStr(ResumeThreshold / 1024);
+        Value = IntToStr(ResumeThresholdKB);
         break;
     }
     ScriptArgs += RtfSwitchValue(RESUMESUPPORT_SWITCH, Link, Value);
+
+    const UnicodeString ResumeSupportClassName = L"TransferResumeSupport";
+    const bool Inline = true;
+    UnicodeString ResumeSupportCode =
+      AssemblyNewClassInstanceStart(Language, ResumeSupportClassName, Inline);
+    if (ResumeSupport == rsSmart)
+    {
+      ResumeSupportCode += AssemblyProperty(Language, ResumeSupportClassName, L"Threshold", ResumeThresholdKB, Inline);
+    }
+    else
+    {
+      ResumeSupportCode += AssemblyProperty(Language, ResumeSupportClassName, L"State", L"TransferResumeSupportState", CodeState, Inline);
+    }
+    ResumeSupportCode += AssemblyNewClassInstanceEnd(Language, Inline);
+
+    AssemblyCode += AssemblyPropertyRaw(Language, TransferOptionsClassName, L"ResumeSupport", ResumeSupportCode, false);
   }
 
   if (SomeAttrExcluded)

+ 3 - 1
source/core/CopyParam.h

@@ -72,7 +72,8 @@ private:
   UnicodeString __fastcall RestoreChars(UnicodeString FileName) const;
   void __fastcall DoGetInfoStr(UnicodeString Separator, int Attrs,
     UnicodeString & Result, bool & SomeAttrIncluded,
-    const UnicodeString & Link, UnicodeString & ScriptArgs, bool & NoScriptArgs) const;
+    const UnicodeString & Link, UnicodeString & ScriptArgs, bool & NoScriptArgs,
+    TAssemblyLanguage Language, UnicodeString & AssemblyCode, bool & NoCodeProperties) const;
   TStrings * __fastcall GetTransferSkipList() const;
   void __fastcall SetTransferSkipList(TStrings * value);
 
@@ -104,6 +105,7 @@ public:
   bool __fastcall AnyUsableCopyParam(int Attrs) const;
   UnicodeString __fastcall GenerateTransferCommandArgs(
     int Attrs, const UnicodeString & Link, bool & NoScriptArgs) const;
+  UnicodeString __fastcall GenerateAssemblyCode(TAssemblyLanguage Language, int Attrs, bool & NoCodeProperties) const;
 
   bool __fastcall operator==(const TCopyParamType & rhp) const;
 

+ 37 - 132
source/core/SessionData.cpp

@@ -2559,26 +2559,11 @@ void __fastcall TSessionData::LookupLastFingerprint()
   }
 }
 //---------------------------------------------------------------------
-static UnicodeString __fastcall RtfClass(const UnicodeString & Text)
-{
-  return RtfColorText(3, Text);
-}
-//---------------------------------------------------------------------
-static UnicodeString __fastcall RtfLibraryClass(const UnicodeString & ClassName)
-{
-  return RtfLink(L"library_" + ClassName.LowerCase(), RtfClass(ClassName));
-}
-//---------------------------------------------------------------------
 static UnicodeString __fastcall RtfLibraryMethod(const UnicodeString & ClassName, const UnicodeString & MethodName)
 {
   return RtfLink(L"library_" + ClassName.LowerCase() + L"_" + MethodName.LowerCase(), RtfOverrideColorText(MethodName));
 }
 //---------------------------------------------------------------------
-static UnicodeString __fastcall RtfLibraryProperty(const UnicodeString & ClassName, const UnicodeString & PropertyName)
-{
-  return RtfLink(L"library_" + ClassName.LowerCase() + L"#" + PropertyName.LowerCase(), RtfOverrideColorText(PropertyName));
-}
-//---------------------------------------------------------------------
 UnicodeString __fastcall TSessionData::GenerateOpenCommandArgs()
 {
   std::unique_ptr<TSessionData> FactoryDefaults(new TSessionData(L""));
@@ -2656,115 +2641,36 @@ UnicodeString __fastcall TSessionData::GenerateOpenCommandArgs()
   return Result;
 }
 //---------------------------------------------------------------------
-UnicodeString __fastcall TSessionData::AssemblyString(TAssemblyLanguage Language, UnicodeString S)
-{
-  switch (Language)
-  {
-    case alCSharp:
-      if (S.Pos(L"\\") > 0)
-      {
-        S = FORMAT(L"@\"%s\"", (ReplaceStr(S, L"\"", L"\"\"")));
-      }
-      else
-      {
-        S = FORMAT(L"\"%s\"", (ReplaceStr(S, L"\"", L"\\\"")));
-      }
-      break;
-
-    case alVBNET:
-      S = FORMAT(L"\"%s\"", (ReplaceStr(S, L"\"", L"\"\"")));
-      break;
-
-    case alPowerShell:
-      S = FORMAT(L"\"%s\"", (ReplaceStr(S, L"\"", L"`\"")));
-      break;
-
-    default:
-      DebugFail();
-      break;
-  }
-
-  return RtfString(S);
-}
-//---------------------------------------------------------------------
-void __fastcall TSessionData::AddAssemblyPropertyRaw(
-  UnicodeString & Result, TAssemblyLanguage Language,
-  const UnicodeString & Name, const UnicodeString & Value)
-{
-  switch (Language)
-  {
-    case alCSharp:
-      Result += L"    " + RtfLibraryProperty(L"SessionOptions", Name) + L" = " + Value + L"," + RtfPara;
-      break;
-
-    case alVBNET:
-      Result += L"    ." + RtfLibraryProperty(L"SessionOptions", Name) + L" = " + Value + RtfPara;
-      break;
-
-    case alPowerShell:
-      Result += RtfText(L"$sessionOptions.") + RtfLibraryProperty(L"SessionOptions", Name) + L" = " + Value + RtfPara;
-      break;
-  }
-}
+UnicodeString SessionOptionsClassName(L"SessionOptions");
+UnicodeString SessionClassName(L"Session");
 //---------------------------------------------------------------------
 void __fastcall TSessionData::AddAssemblyProperty(
   UnicodeString & Result, TAssemblyLanguage Language,
   const UnicodeString & Name, const UnicodeString & Type,
   const UnicodeString & Member)
 {
-  UnicodeString PropertyValue;
-
-  switch (Language)
-  {
-    case alCSharp:
-    case alVBNET:
-      PropertyValue = RtfClass(Type) + RtfText(L"." + Member);
-      break;
-
-    case alPowerShell:
-      PropertyValue = RtfText(L"[WinSCP.") + RtfClass(Type) + RtfText(L"]::" + Member);
-      break;
-  }
-
-  AddAssemblyPropertyRaw(Result, Language, Name, PropertyValue);
+  Result += AssemblyProperty(Language, SessionOptionsClassName, Name, Type, Member, false);
 }
 //---------------------------------------------------------------------
 void __fastcall TSessionData::AddAssemblyProperty(
   UnicodeString & Result, TAssemblyLanguage Language,
-  const UnicodeString & Name, UnicodeString Value)
+  const UnicodeString & Name, const UnicodeString & Value)
 {
-  AddAssemblyPropertyRaw(Result, Language, Name, AssemblyString(Language, Value));
+  Result += AssemblyProperty(Language, SessionOptionsClassName, Name, Value, false);
 }
 //---------------------------------------------------------------------
 void __fastcall TSessionData::AddAssemblyProperty(
   UnicodeString & Result, TAssemblyLanguage Language,
   const UnicodeString & Name, int Value)
 {
-  AddAssemblyPropertyRaw(Result, Language, Name, IntToStr(Value));
+  Result += AssemblyProperty(Language, SessionOptionsClassName, Name, Value, false);
 }
 //---------------------------------------------------------------------
 void __fastcall TSessionData::AddAssemblyProperty(
   UnicodeString & Result, TAssemblyLanguage Language,
   const UnicodeString & Name, bool Value)
 {
-  UnicodeString PropertyValue;
-
-  switch (Language)
-  {
-    case alCSharp:
-      PropertyValue = (Value ? L"true" : L"false");
-      break;
-
-    case alVBNET:
-      PropertyValue = (Value ? L"True" : L"False");
-      break;
-
-    case alPowerShell:
-      PropertyValue = (Value ? L"$True" : L"$False");
-      break;
-  }
-
-  AddAssemblyPropertyRaw(Result, Language, Name, PropertyValue);
+  Result += AssemblyProperty(Language, SessionOptionsClassName, Name, Value, false);
 }
 //---------------------------------------------------------------------
 void __fastcall TSessionData::GenerateAssemblyCode(
@@ -2773,32 +2679,18 @@ void __fastcall TSessionData::GenerateAssemblyCode(
   std::unique_ptr<TSessionData> FactoryDefaults(new TSessionData(L""));
   std::unique_ptr<TSessionData> SessionData(Clone());
 
-  UnicodeString SessionOptionsCommentLine =
-    AssemblyCommentLine(Language, LoadStr(CODE_SESSION_OPTIONS));
-
   switch (Language)
   {
     case alCSharp:
-      Head +=
-        SessionOptionsCommentLine +
-        RtfLibraryClass(L"SessionOptions") + RtfText(L" sessionOptions = ") + RtfKeyword(L"new") + RtfText(" ") + RtfLibraryClass(L"SessionOptions") + RtfPara +
-        RtfText(L"{") + RtfPara;
-      break;
-
     case alVBNET:
-      Head +=
-        SessionOptionsCommentLine +
-        RtfKeyword(L"Dim") + RtfText(" mySessionOptions ") + RtfKeyword(L"As") + RtfText(L" ") + RtfKeyword(L"New") + RtfText(" ") + RtfLibraryClass(L"SessionOptions") + RtfPara +
-        RtfKeyword(L"With") + RtfText(" mySessionOptions") + RtfPara;
+      // noop
       break;
 
     case alPowerShell:
       Head +=
         AssemblyCommentLine(Language, LoadStr(CODE_PS_ADD_TYPE)) +
         RtfKeyword(L"Add-Type") + RtfText(" -Path ") + AssemblyString(Language, "WinSCPnet.dll") + RtfPara +
-        RtfPara +
-        SessionOptionsCommentLine +
-        RtfText(L"$sessionOptions = ") + RtfKeyword(L"New-Object") + RtfText(" WinSCP.") + RtfLibraryClass(L"SessionOptions") + RtfPara;
+        RtfPara;
       break;
 
     default:
@@ -2806,6 +2698,10 @@ void __fastcall TSessionData::GenerateAssemblyCode(
       break;
   }
 
+  Head +=
+    AssemblyCommentLine(Language, LoadStr(CODE_SESSION_OPTIONS)) +
+    AssemblyNewClassInstanceStart(Language, SessionOptionsClassName, false);
+
   UnicodeString ProtocolMember;
   switch (SessionData->FSProtocol)
   {
@@ -2933,14 +2829,15 @@ void __fastcall TSessionData::GenerateAssemblyCode(
   }
   if (SessionData->Timeout != FactoryDefaults->Timeout)
   {
-    AddAssemblyProperty(Head, Language, L"TimeoutInMilliseconds", SessionData->Timeout);
+    AddAssemblyProperty(Head, Language, L"TimeoutInMilliseconds", SessionData->Timeout * 1000);
     SessionData->Timeout = FactoryDefaults->Timeout;
   }
 
   switch (Language)
   {
     case alCSharp:
-      Head += RtfText(L"};") + RtfPara;
+    case alPowerShell:
+      Head += AssemblyNewClassInstanceEnd(Language, false);
       break;
 
     case alVBNET:
@@ -2951,6 +2848,8 @@ void __fastcall TSessionData::GenerateAssemblyCode(
 
   std::unique_ptr<TStrings> RawSettings(SessionData->SaveToOptions(FactoryDefaults.get()));
 
+  UnicodeString SessionOptionsVariableName = AssemblyVariableName(SessionOptionsClassName);
+
   if (RawSettings->Count > 0)
   {
     Head += RtfPara;
@@ -2959,36 +2858,42 @@ void __fastcall TSessionData::GenerateAssemblyCode(
     {
       UnicodeString Name = RawSettings->Names[Index];
       UnicodeString Value = RawSettings->ValueFromIndex[Index];
-      UnicodeString SettingsCode;
+      UnicodeString AddRawSettingsMethod =
+        RtfLibraryMethod(SessionOptionsClassName, L"AddRawSettings") +
+        FORMAT(L"(%s, %s)", (AssemblyString(Language, Name), AssemblyString(Language, Value)));
       switch (Language)
       {
         case alCSharp:
-          SettingsCode = RtfText(L"sessionOptions.") + RtfLibraryMethod(L"SessionOptions", L"AddRawSettings") + RtfText(L"(%s, %s);") + RtfPara;
+          Head += RtfText(SessionOptionsVariableName + L".") + AddRawSettingsMethod + RtfText(L";") + RtfPara;
           break;
 
         case alVBNET:
-          SettingsCode = RtfText(L"    .") + RtfLibraryMethod(L"SessionOptions", L"AddRawSettings") + RtfText(L"(%s, %s)") + RtfPara;
+          Head += RtfText(L"    .") + AddRawSettingsMethod + RtfPara;
           break;
 
         case alPowerShell:
-          SettingsCode = RtfText(L"$sessionOptions.") + RtfLibraryMethod(L"SessionOptions", L"AddRawSettings") + RtfText(L"(%s, %s)") + RtfPara;
+          Head += RtfText(L"$" + SessionOptionsVariableName + L".") + AddRawSettingsMethod + RtfPara;
           break;
       }
-      Head += FORMAT(SettingsCode, (AssemblyString(Language, Name), AssemblyString(Language, Value)));
     }
   }
 
   UnicodeString CodeCommentLine = L"    " + AssemblyCommentLine(Language, LoadStr(CODE_CONNECT));
+  UnicodeString SessionVariableName = AssemblyVariableName(SessionClassName);
+  UnicodeString RtfSessionClass = RtfLibraryClass(SessionClassName);
+  UnicodeString RtfSessionOpenMethod = RtfLibraryMethod(SessionClassName, L"Open");
+
+  UnicodeString NewSessionInstance = AssemblyNewClassInstance(Language, SessionClassName, false);
 
   switch (Language)
   {
     case alCSharp:
       Head +=
         RtfPara +
-        RtfKeyword(L"using") + RtfText(" (") + RtfLibraryClass(L"Session") + RtfText(L" session = ") + RtfKeyword(L"new") + RtfText(" ") + RtfLibraryClass(L"Session") + RtfText(L"())") + RtfPara +
+        RtfKeyword(L"using") + RtfText(" (") + NewSessionInstance + RtfText(L"())") + RtfPara +
         RtfText(L"{") + RtfPara +
         CodeCommentLine +
-        RtfText(L"    session.") + RtfLibraryMethod(L"Session", L"Open") + RtfText(L"(sessionOptions);") + RtfPara;
+        RtfText(L"    " + SessionVariableName + L".") + RtfSessionOpenMethod + RtfText(L"(" + SessionOptionsVariableName + L");") + RtfPara;
 
       Tail =
         RtfText(L"}") + RtfPara;
@@ -2996,11 +2901,11 @@ void __fastcall TSessionData::GenerateAssemblyCode(
 
     case alVBNET:
       Head +=
-        RtfKeyword(L"End With") + RtfPara +
+        AssemblyNewClassInstanceEnd(Language, false) +
         RtfPara +
-        RtfKeyword(L"Using") + RtfText(" mySession As ") + RtfLibraryClass(L"Session") + RtfText(L" = ") + RtfKeyword(L"New") + RtfText(" ") + RtfLibraryClass(L"Session") + RtfPara +
+        RtfKeyword(L"Using") + RtfText(L" ") + NewSessionInstance + RtfPara +
         CodeCommentLine +
-        RtfText(L"    mySession.") + RtfLibraryMethod(L"Session", L"Open") + RtfText(L"(mySessionOptions)") + RtfPara;
+        RtfText(L"    " + SessionVariableName + L".") + RtfSessionOpenMethod + RtfText(L"(" + SessionOptionsVariableName + L")") + RtfPara;
 
       Tail =
         RtfKeyword(L"End Using");
@@ -3009,18 +2914,18 @@ void __fastcall TSessionData::GenerateAssemblyCode(
     case alPowerShell:
       Head +=
         RtfPara +
-        RtfText(L"$session = ") + RtfKeyword(L"New-Object") + RtfText(" WinSCP.") + RtfLibraryClass(L"Session") + RtfPara +
+        NewSessionInstance + RtfPara +
         RtfPara +
         RtfKeyword(L"try") + RtfPara +
         RtfText(L"{") + RtfPara +
         CodeCommentLine +
-        RtfText(L"    $session.") + RtfLibraryMethod(L"Session", L"Open") + RtfText(L"($sessionOptions)") + RtfPara;
+        RtfText(L"    $" + SessionVariableName + L".") + RtfSessionOpenMethod + RtfText(L"($" + SessionOptionsVariableName + L")") + RtfPara;
 
       Tail =
         RtfText(L"}") + RtfPara +
         RtfKeyword(L"finally") + RtfPara +
         RtfText(L"{") + RtfPara +
-        RtfText(L"    $session.") + RtfLibraryMethod(L"Session", L"Dispose") + RtfText(L"()") + RtfPara +
+        RtfText(L"    $" + SessionVariableName + L".") + RtfLibraryMethod(SessionClassName, L"Dispose") + RtfText(L"()") + RtfPara +
         RtfText(L"}") + RtfPara;
       break;
   }

+ 1 - 5
source/core/SessionData.h

@@ -376,13 +376,9 @@ private:
   static void __fastcall AddSwitch(UnicodeString & Result, const UnicodeString & Name);
   static void __fastcall AddSwitch(UnicodeString & Result, const UnicodeString & Name, const UnicodeString & Value);
   static void __fastcall AddSwitch(UnicodeString & Result, const UnicodeString & Name, int Value);
-  static UnicodeString __fastcall AssemblyString(TAssemblyLanguage Language, UnicodeString S);
-  static void __fastcall AddAssemblyPropertyRaw(
-    UnicodeString & Result, TAssemblyLanguage Language,
-    const UnicodeString & Name, const UnicodeString & Value);
   static void __fastcall AddAssemblyProperty(
     UnicodeString & Result, TAssemblyLanguage Language,
-    const UnicodeString & Name, UnicodeString Value);
+    const UnicodeString & Name, const UnicodeString & Value);
   static void __fastcall AddAssemblyProperty(
     UnicodeString & Result, TAssemblyLanguage Language,
     const UnicodeString & Name, const UnicodeString & Type,

+ 45 - 12
source/forms/GenerateUrl.cpp

@@ -462,7 +462,7 @@ UnicodeString __fastcall TGenerateUrlDialog::GenerateScript(UnicodeString & Scri
   return Result;
 }
 //---------------------------------------------------------------------------
-UnicodeString __fastcall TGenerateUrlDialog::GenerateAssemblyCode()
+UnicodeString __fastcall TGenerateUrlDialog::GenerateAssemblyCode(UnicodeString & AssemblyDescription)
 {
   TAssemblyLanguage Language = static_cast<TAssemblyLanguage>(AssemblyLanguageCombo->ItemIndex);
 
@@ -472,12 +472,43 @@ UnicodeString __fastcall TGenerateUrlDialog::GenerateAssemblyCode()
 
   FData->GenerateAssemblyCode(Language, Head, Tail, Indent);
 
+  UnicodeString Result = Head;
+
+  UnicodeString Code;
+  if (FTransfer)
+  {
+    bool NoCodeProperties;
+    UnicodeString CopyParamProperties =
+      FCopyParam.GenerateAssemblyCode(Language, FCopyParamAttrs, NoCodeProperties);
+
+    if (NoCodeProperties)
+    {
+      AssemblyDescription += LoadStr(GENERATE_URL_COPY_PARAM_CODE_REMAINING) + L"\n";
+    }
+
+    if (!CopyParamProperties.IsEmpty())
+    {
+      Code +=
+        AssemblyNewClassInstanceStart(Language, TransferOptionsClassName, false) +
+        CopyParamProperties +
+        AssemblyNewClassInstanceEnd(Language, false);
+    }
+  }
+  else
+  {
+    Code = AssemblyCommentLine(Language, LoadStr(GENERATE_URL_YOUR_CODE));
+  }
+
   UnicodeString Indentation = UnicodeString::StringOfChar(L' ', Indent);
+  Code = Indentation + ReplaceStr(Code, RtfPara, RtfPara + Indentation);
+  if (DebugAlwaysTrue(Code.SubString(Code.Length() - Indentation.Length() + 1, Indentation.Length()) == Indentation))
+  {
+    Code.SetLength(Code.Length() - Indentation.Length());
+  }
 
-  UnicodeString Result =
-    Head +
-    Indentation + AssemblyCommentLine(Language, LoadStr(GENERATE_URL_YOUR_CODE)) +
-    Tail;
+  Result += Code;
+
+  Result += Tail;
 
   return Result;
 }
@@ -522,12 +553,6 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
     else if (DebugAlwaysTrue(OptionsPageControl->ActivePage == AssemblySheet))
     {
       ResultGroupCaption = LoadStr(GENERATE_URL_CODE);
-      UnicodeString AssemblyDescription;
-      if (HostKeyUnknown)
-      {
-        AssemblyDescription += LoadStr(GENERATE_URL_HOSTKEY_UNKNOWN) + L"\n";
-      }
-      AssemblyDescriptionLabel->Caption = AssemblyDescription;
     }
     ResultGroup->Caption = ResultGroupCaption;
 
@@ -580,7 +605,15 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
     }
     else if (DebugAlwaysTrue(OptionsPageControl->ActivePage == AssemblySheet))
     {
-      Result = GenerateAssemblyCode();
+      UnicodeString AssemblyDescription;
+      if (HostKeyUnknown)
+      {
+        AssemblyDescription += LoadStr(GENERATE_URL_HOSTKEY_UNKNOWN) + L"\n";
+      }
+
+      Result = GenerateAssemblyCode(AssemblyDescription);
+
+      AssemblyDescriptionLabel->Caption = AssemblyDescription;
 
       WordWrap = false;
       FixedWidth = true;

+ 1 - 1
source/forms/GenerateUrl.h

@@ -74,7 +74,7 @@ protected:
   virtual void __fastcall Dispatch(void * AMessage);
   UnicodeString __fastcall GenerateUrl();
   UnicodeString __fastcall GenerateScript(UnicodeString & ScriptDescription);
-  UnicodeString __fastcall GenerateAssemblyCode();
+  UnicodeString __fastcall GenerateAssemblyCode(UnicodeString & AssemblyDescription);
 
 public:
   __fastcall TGenerateUrlDialog(

+ 1 - 0
source/resource/TextsWin.h

@@ -567,6 +567,7 @@
 #define GENERATE_URL_SCRIPT_DESC 1965
 #define GENERATE_URL_PATH_TO_SCRIPT 1966
 #define GENERATE_URL_YOUR_CODE  1967
+#define GENERATE_URL_COPY_PARAM_CODE_REMAINING 1968
 
 // 2xxx is reserved for TextsFileZilla.h
 

+ 1 - 0
source/resource/TextsWin1.rc

@@ -570,6 +570,7 @@ BEGIN
         GENERATE_URL_SCRIPT_DESC, "Execute the script using a command like:"
         GENERATE_URL_PATH_TO_SCRIPT, "C:\\path\\to\\script\\script.txt"
         GENERATE_URL_YOUR_CODE, "Your code"
+        GENERATE_URL_COPY_PARAM_CODE_REMAINING, "Some configured transfer settings do not have an equivalent in .NET assembly API. Use the Session.AddRawConfiguration instead."
 
         WIN_VARIABLE_STRINGS, "WIN_VARIABLE"
         WINSCP_COPYRIGHT, "Copyright © 2000-2016 Martin Prikryl"

+ 1 - 1
source/windows/GUIConfiguration.cpp

@@ -1,9 +1,9 @@
 //---------------------------------------------------------------------------
 #include <vcl.h>
 #pragma hdrstop
+#include <Common.h>
 #include "GUIConfiguration.h"
 #include "GUITools.h"
-#include <Common.h>
 #include <FileInfo.h>
 #include <TextsCore.h>
 #include <TextsWin.h>