internal FtpOptionControl(FtpSettings settings)
 {
     this.components = null;
     this.InitializeComponent();
     this.cmbUploadFileNameCasing.DataSource = Enum.GetValues(typeof(CharacterCasing));
     Dictionary<string, Encoding> dictionary = new Dictionary<string, Encoding>(StringComparer.OrdinalIgnoreCase);
     dictionary.Add(Encoding.Default.WebName, Encoding.Default);
     Encoding encoding = Encoding.GetEncoding(Windows.GetOEMCP());
     dictionary[encoding.WebName] = encoding;
     dictionary[Encoding.UTF8.WebName] = Encoding.UTF8;
     foreach (string str in StringHelper.SplitString(settings.AdditionalEncodings, new char[] { ',' }))
     {
         if (!dictionary.ContainsKey(str))
         {
             try
             {
                 Encoding encoding2 = Encoding.GetEncoding(str);
                 dictionary[encoding2.WebName] = encoding2;
             }
             catch (ArgumentException)
             {
             }
         }
     }
     this.cmbEncoding.DataSource = new List<Encoding>(dictionary.Values);
     this.Settings = settings;
 }
Exemplo n.º 2
0
 public void ShowProperties(IWin32Window owner, IVirtualItem item)
 {
     Encoding listEncoding = this.Context.ListEncoding;
     using (PropertiesDialog dialog = new PropertiesDialog())
     {
         FtpSettings settings = new FtpSettings {
             UsePassive = this.Context.UsePassive,
             UseCache = this.Context.UseCache,
             UsePrefetch = this.Context.UsePrefetch,
             StoreCredential = this.Context.StoreCredential,
             UploadFileNameCasing = this.Context.UploadFileNameCasing,
             Encoding = (this.Context.ListEncoding == Encoding.Default) ? string.Empty : this.Context.ListEncoding.WebName
         };
         dialog.AddNewTab(Resources.sFtpContext, new FtpOptionControl(settings));
         if (dialog.Execute(owner, new IVirtualItem[] { item }))
         {
             this.Context.InitializeContext(settings);
         }
     }
     if (!((listEncoding == this.Context.ListEncoding) && this.Context.UseCache))
     {
         this.Context.Cache.Clear();
     }
 }
Exemplo n.º 3
0
 internal void InitializeContext(FtpSettings settings)
 {
     base.UsePassive = settings.UsePassive;
     this.UseCache = settings.UseCache;
     this.UsePrefetch = settings.UsePrefetch;
     this.StoreCredential = settings.StoreCredential;
     this.UploadFileNameCasing = settings.UploadFileNameCasing;
     if (!string.IsNullOrEmpty(settings.Encoding))
     {
         base.ListEncoding = Encoding.GetEncoding(settings.Encoding);
     }
     else
     {
         base.ListEncoding = Encoding.Default;
     }
 }