Ejemplo n.º 1
0
        public TFTPServerConfiguration Clone()
        {
            TFTPServerConfiguration result = new TFTPServerConfiguration();

            result.Name                  = Name;
            result.EndPoint              = EndPoint.Clone();
            result.SinglePort            = SinglePort;
            result.Ttl                   = Ttl;
            result.DontFragment          = DontFragment;
            result.RootPath              = RootPath;
            result.AutoCreateDirectories = AutoCreateDirectories;
            result.AllowRead             = AllowRead;
            result.AllowWrite            = AllowWrite;
            result.Timeout               = Timeout;
            result.Retries               = Retries;
            result.ConvertPathSeparator  = ConvertPathSeparator;
            result.WindowSize            = WindowSize;

            if (Alternatives != null)
            {
                result.Alternatives = new BindingList <ConfigurationAlternative>();
                foreach (ConfigurationAlternative alternative in Alternatives)
                {
                    result.Alternatives.Add(alternative.Clone());
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
 public TFTPServerResurrector(TFTPServerConfiguration config, EventLog eventLog)
 {
     m_Lock       = new object();
     m_Disposed   = false;
     m_Config     = config;
     m_EventLog   = eventLog;
     m_RetryTimer = new Timer(new TimerCallback(x => Resurrect()));
     Resurrect();
 }
Ejemplo n.º 3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            TFTPServerConfiguration result = EditConfiguration(new TFTPServerConfiguration());

            if (result != null)
            {
                m_ConfigurationList.Add(result);
                SelectRow(m_ConfigurationList.Count - 1);
                UpdateButtonStatus();
            }
        }
Ejemplo n.º 4
0
 private void EditConfiguration(int index)
 {
     if (index >= 0 && index < m_ConfigurationList.Count)
     {
         TFTPServerConfiguration result = EditConfiguration(m_ConfigurationList[index]);
         if (result != null)
         {
             m_ConfigurationList.Insert(index, result);
             m_ConfigurationList.RemoveAt(index + 1);
         }
     }
 }
Ejemplo n.º 5
0
        private TFTPServerConfiguration EditConfiguration(TFTPServerConfiguration input)
        {
            FormSettings f = new FormSettings();

            f.Configuration = input;

            DialogResult dialogResult = f.ShowDialog(this);

            while (dialogResult == DialogResult.OK &&
                   m_ConfigurationList.Any(x => (x != input && x.EndPoint.Address == f.Configuration.EndPoint.Address && x.EndPoint.Port == f.Configuration.EndPoint.Port)))
            {
                MessageBox.Show(string.Format("There already is a configuration for address {0}, port {1}.\r\nPlease select another endpoint.", f.Configuration.EndPoint.Address, f.Configuration.EndPoint.Port), "Validation error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dialogResult = f.ShowDialog(this);
            }
            return(dialogResult == DialogResult.OK ? f.Configuration : null);
        }