Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Runtime.Serialization;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.IO;
- namespace NZBHags
- {
- public class NewsServer// : ISerializable
- {
- public bool isConnected { get; set; }
- public string name { get; set; }
- public string addr { get; set; }
- public string username { get; set; }
- public string password { get; set; }
- public int port { get; set; }
- public int connections { get; set; }
- public int timeout { get; set; }
- public NNTPConnection[] nntpConnections { get; set; }
- public NewsServer()
- {
- name = Properties.Settings.Default.servername;
- addr = Properties.Settings.Default.serveraddr;
- username = Properties.Settings.Default.serveruser;
- password = Properties.Settings.Default.serverpass;
- port = Properties.Settings.Default.serverport;
- connections = Properties.Settings.Default.serverconnections;
- timeout = Properties.Settings.Default.servertimeout;
- }
- public void Save()
- {
- Properties.Settings.Default.servername = name;
- Properties.Settings.Default.serveraddr = addr;
- Properties.Settings.Default.serveruser = username;
- Properties.Settings.Default.serverpass = password;
- Properties.Settings.Default.serverport = port;
- Properties.Settings.Default.serverconnections = connections;
- Properties.Settings.Default.servertimeout = timeout;
- Properties.Settings.Default.Save();
- }
- public void Connect(MainGUI mainGui)
- {
- Logging.Instance.Log("Connecting to {0}, spawning {1} connections", name, connections);
- nntpConnections = new NNTPConnection[connections];
- for (int i = 0; i < connections; i++)
- {
- nntpConnections[i] = new NNTPConnection(i, this, QueueHandler.Instance);
- nntpConnections[i].mainGui = mainGui;
- }
- isConnected = true;
- }
- public void Disconnect()
- {
- Logging.Instance.Log("Disconnting from {0}", name);
- if (nntpConnections != null)
- {
- foreach (NNTPConnection conn in nntpConnections)
- {
- conn.Disconnect();
- }
- }
- isConnected = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement