public static ICrystalDifusionConnectionBase CreateCrystalConnection(ILoggerFactory loggerFactory, PostmanThread postmanThread) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); IConfigurationRoot config = builder.Build(); string user = config.GetSection("CrystalUserName").Value; string pass = config.GetSection("CrystalPassword").Value; IEnumerable <string> hosts = config.GetSection("CrystalHosts") .GetChildren() .Select(x => x.Value) .ToArray(); string host = hosts.FirstOrDefault(); int port = config.GetSection("CrystalPort").Value != null?Convert.ToInt16(config.GetSection("CrystalPort").Value) : 81; DifusionCredential credential = new DifusionCredential(user, pass, ""); ILogger <ICrystalDifusionConnectionBase> logger = loggerFactory.CreateLogger <ICrystalDifusionConnectionBase>(); ILogger <CrystalDifusionConnectionEvents> loggerConn = loggerFactory.CreateLogger <CrystalDifusionConnectionEvents>(); ListCircular <string> listCircular = new ListCircular <string>(); listCircular.Add(host); ICrystalDifusionConnectionBase conn = new CrystalDifusionConnectionBase(new Streaming.Crystal.Connection.Manager.CrystalAddress(listCircular, port), logger); connEvent = new CrystalDifusionConnectionEvents(conn, new DirectNoficationMessage(postmanThread), loggerConn, "1", credential, new CrystalConnectionStatistics()); return(conn); }
public CrystalAddress(ListCircular <string> hosts, int port) { if (hosts == null || port == 0) { throw new ArgumentException(); } this.hosts = hosts; this.port = port; }
private ListCircular <string> NewHosts() { ListCircular <string> listCircularHost = new ListCircular <string>(); foreach (string host in listHost) { listCircularHost.Add(host); } return(listCircularHost); }
public static void TestListCircular() { ListCircular <string> list = new ListCircular <string>(); for (var i = 0; i <= 10; i++) { list.Add(Convert.ToString(i)); } for (var i = 0; i <= 21; i++) { Console.WriteLine(list.Get()); } }
public ClientForm() { this._mainform = this; this._alltab = new Dictionary <TabCtrlName, TabPage>(); this._iLog = new IMessage() { LogOk = this._winMessageSuccess, LogInfo = this._winMessageInfo, LogError = this._winMessageError, Line = this._winStatusBar }; webwLock = new Object(); _chatHistory = new ListCircular <string>(Properties.Settings.Default.IRCChatHistory); InitializeComponent(); _TBSControl = new Control.TBSpellControl(this.FTBChatInput, this._iLog); this.tabPageClanChat.Controls.Add(_TBSControl); _IMGInformerControl = new Control.IMGInformerControl(this); this.flatGroupBox5.Controls.Add(_IMGInformerControl); this.TSTBFindNick.KeyUp += new KeyEventHandler(TSTBFindNick_KeyUp); this.TSTBNotifyFind.KeyUp += new KeyEventHandler(TSTBNotifyFind_KeyUp); this.TSCBGroup.KeyUp += new KeyEventHandler(TSCBGroup_KeyUp); this.TSCBGroup.SelectedIndexChanged += new EventHandler(TSCBGroup_SelectedIndexChanged); /// Not work in designer, auto remove it.. this.flatContextMenuStripChatBrowser.ShowCheckMargin = false; this.flatContextMenuStripChatBrowser.ShowImageMargin = true; this.flatContextMenuStripChatInput.ShowCheckMargin = false; this.flatContextMenuStripChatInput.ShowImageMargin = true; this.flatContextMenuStripChatWeb.ShowCheckMargin = false; this.flatContextMenuStripChatWeb.ShowImageMargin = true; this.flatContextMenuStripTray.ShowCheckMargin = false; this.flatContextMenuStripTray.ShowImageMargin = true; this.notifyIconMain.Visible = false; this.ImageInformer = (Image)Properties.Resources.InformerLoading; }