public ArchiveJob() { UniqueJobName = "New Job"; JobRootPath = "C:\\"; JobTarget = new Target(); Schedules = new List<JobSchedule>(); Active = true; var defSchedule = new JobSchedule(); Schedules.Add(defSchedule); }
public SCP(Target target) { _scp = new ScpClient(target.TargetServer.Host, target.TargetServer.UserInfo, target.Password); log.InfoFormat("SCP - Connecting to {0}", target.TargetServer); _scp.Connect(); _targetPath = target.TargetServer.LocalPath; if (!_targetPath.EndsWith("/")) _targetPath += "/"; }
public Proxy(Target target) { _client = new SshClient(target.ProxyServer.Host, target.ProxyServer.UserInfo, target.ProxyPassword); _client.Connect(); var fwPort = new ForwardedPortLocal("127.0.0.1",0, target.TargetServer.Host, (uint) target.TargetServer.Port); _client.AddForwardedPort(fwPort); fwPort.Start(); var port = HackExtractPort(fwPort); // TODO: Update the library to read it directly from BoundPort _localUri = string.Format("{0}://{1}@127.0.0.1:{2}{3}", target.TargetServer.Scheme, target.TargetServer.UserInfo, port, target.TargetServer.LocalPath); _subBackend = Backend.OpenBackend(new Uri(_localUri), target.Password); }
public static Backend OpenBackend(Target target) { if (target.ProxyServer != null) return new Proxy(target); return OpenBackend(target.TargetServer, target.Password); }
public void ReadXml(XmlReader reader) { var val = reader.GetAttribute("uid"); JobUID = string.IsNullOrEmpty(val) ? null : (int?)int.Parse(val); UniqueJobName = reader.GetAttribute("name"); JobRootPath = reader.GetAttribute("path"); Active = int.Parse(reader.GetAttribute("active")??"0") != 0; //- Read target reader.Read(); if (reader.Name != "Target") throw new Exception("Expecting Target node"); JobTarget = new Target(); JobTarget.ReadXml(reader); //reader.ReadEndElement(); //- Read Schedule reader.Read(); if (reader.Name != "Schedules") throw new Exception("Expecting Schedules node"); Schedules.Clear(); reader.Read(); for (;;) { if(reader.NodeType== XmlNodeType.EndElement) break; var schedule = new JobSchedule(); schedule.ReadXml(reader); Schedules.Add(schedule); } reader.ReadEndElement(); }