/// <summary> /// Create a new job /// </summary> /// <param name="cmd">Command</param> /// <param name="obj">Object for dispose</param> public static Job Create(IModule module, IJobable obj) { if (module == null || obj == null) return null; Job j = new Job(obj, module.FullPath); // Append to global list JobCollection.Current.Add(j); module.WriteInfo(Lang.Get("Job_Created"), j.Id.ToString(), ConsoleColor.Green); return j; }
/// <summary> /// Create a new job /// </summary> /// <param name="cmd">Command</param> /// <param name="obj">Object for dispose</param> public static Job Create(IModule module, IJobable obj) { if (module == null || obj == null) { return(null); } Job j = new Job(obj, module.FullPath); // Append to global list JobCollection.Current.Add(j); module.WriteInfo(Lang.Get("Job_Created"), j.Id.ToString(), ConsoleColor.Green); return(j); }
public override bool Run() { ForwardedPort port; switch (Method) { default: case EForwardMethod.LocalToRemote: { port = new ForwardedPortRemote(RemoteHost.Address, (uint)RemoteHost.Port, LocalHost.Address, (uint)LocalHost.Port); break; } case EForwardMethod.RemoteToLocal: { port = new ForwardedPortLocal(LocalHost.Address.ToString(), (uint)LocalHost.Port, RemoteHost.Address.ToString(), (uint)RemoteHost.Port); break; } } WriteInfo("Connecting ..."); SshClient SSH = new SshClient(Host.Address.ToString(), Host.Port, User, Password); SSH.Connect(); WriteInfo("Connected successful"); Thread thread = new Thread(new ParameterizedThreadStart(jobRun)); thread.IsBackground = true; thread.Name = "SSH-PortForwarding"; thread.Start(new object[] { SSH, port }); IJobable job = thread; job.Tag = SSH; job.DisposeTag = true; CreateJob(job); return(true); }
/// <summary> /// Constructor /// </summary> /// <param name="obj">Object</param> /// <param name="fullPathModule">FullPath module</param> private Job(IJobable obj, string fullPathModule) { _Object = obj; _FullPathModule = fullPathModule; }