private void Close(CloseInfo closeInfo) { this.OnClosing(EventArgs.Empty); foreach (var item in this.services.Reverse <ICremaService>()) { item.Close(closeInfo); } this.services.Clear(); this.domainContext = null; this.dataBases = null; this.userContext = null; foreach (var item in this.plugins) { item.Release(); } foreach (var item in this.authentications) { item.InvokeExpiredEvent(Authentication.SystemID); } this.dispatcher.InvokeAsync(() => { this.log?.Dispose(); this.log = null; }); this.address = null; this.userID = null; this.isConnected = false; this.OnClosed(new ClosedEventArgs(closeInfo.Reason, closeInfo.Message)); CremaLog.Info("Crema closed."); }
public Authentication Login(SecureString password) { this.Dispatcher.VerifyAccess(); this.CremaHost.DebugMethod(Authentication.System, this, nameof(Login), this); this.ValidateLogin(password); var users = new User[] { this }; var authentication = new Authentication(new UserAuthenticationProvider(this), Guid.NewGuid()); this.Sign(authentication); if (this.Authentication != null) { var message = "다른 기기에서 동일한 아이디로 접속하였습니다."; var closeInfo = new CloseInfo() { Reason = CloseReason.Reconnected, Message = message }; this.Authentication.InvokeExpiredEvent(this.ID, message); this.Container.InvokeUsersLoggedOutEvent(this.Authentication, users, closeInfo); } this.Authentication = authentication; this.IsOnline = true; this.Container.InvokeUsersStateChangedEvent(this.Authentication, users); this.Container.InvokeUsersLoggedInEvent(this.Authentication, users); return(this.Authentication); }
void IDomainServiceCallback.OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo) { this.service.Abort(); this.service = null; this.timer?.Dispose(); this.timer = null; this.serviceDispatcher.Dispose(); this.serviceDispatcher = null; this.InvokeAsync(() => { this.cremaHost.RemoveService(this); }, nameof(IDomainServiceCallback.OnServiceClosed)); }
public void Close(CloseInfo closeInfo) { this.serviceDispatcher?.Invoke(() => { this.timer?.Dispose(); this.timer = null; if (this.service != null) { try { if (closeInfo.Reason != CloseReason.NoResponding) { this.service.Unsubscribe(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { this.service.Close(); } else { this.service.Abort(); } } else { this.service.Abort(); } } catch { this.service.Abort(); } this.service = null; } this.serviceDispatcher.Dispose(); this.serviceDispatcher = null; }); }
protected override void OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo) { this.Callback.OnServiceClosed(signatureDate, closeInfo); }
public void InvokeUsersLoggedOutEvent(Authentication authentication, User[] users, CloseInfo closeInfo) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeUsersLoggedOutEvent), users, closeInfo.Reason, closeInfo.Message); var comment = EventMessageBuilder.LogoutUser(authentication, users); this.CremaHost.Debug(eventLog); this.CremaHost.Info(comment); this.OnUsersLoggedOut(new ItemsEventArgs <IUser>(authentication, users)); }
protected override void OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo) { }
public void InvokeClose(CloseInfo closeInfo) { this.Close(closeInfo); }
public void RemoveService(ICremaService service, CloseInfo closeInfo) { this.closeInfo = closeInfo; this.RemoveService(service); }
public async ValueTask SendChannelClose(CloseInfo info) { await _protocol.Writer.WriteAsync(new CloseWriter(), info); }
void IUserServiceCallback.OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo) { throw new NotImplementedException(); }
protected abstract void OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo);
public ValueTask OnChannelCloseAsync(ushort channelId, CloseInfo info) { throw new NotImplementedException(); }
ValueTask IConnectionHandler.OnCloseAsync(CloseInfo info) { Logger.LogDebug($"{nameof(RabbitMQSession)} {ConnectionId}: Close received"); ConnectionClosedSrc.SetResult(info); return(default);
public static ValueTask SendConnectionCloseAsync(this RabbitMQProtocolWriter protocol, CloseInfo info, CancellationToken token = default) { return(protocol.SendClose(0, 10, 50, info, token)); }
//выборка из xml /// <summary> /// чтение хml файла Закрытых фирм /// </summary> public void ReadCloseXmil() { XmlDocument xDoc = new XmlDocument(); DateTime temData = DateTime.Now; try { //загружаем хмл xDoc.Load(pathXmlCloseInfo); // получим корневой элемент XmlElement xRoot = xDoc.DocumentElement; // обход всех узлов в корневом элементе foreach (XmlNode xnode in xRoot) { //обьект для заполнения данными из листа CloseInfo сloseInfo = new CloseInfo(); // получаем атрибут name if (xnode.Attributes.Count > 0) { XmlNode attr = xnode.Attributes.GetNamedItem("Name"); if (attr != null) { //заполняем обьект // сompany.Name = attr.Value; // Console.WriteLine(attr.Value); } } // обходим все дочерние узлы элемента user foreach (XmlNode childnode in xnode.ChildNodes) { // если узел Id if (childnode.Name == "Id") { сloseInfo.Id = int.Parse(childnode.InnerText); Console.WriteLine($"ID {childnode.InnerText}"); } // если узел закрытия организации if (childnode.Name == "CloseDate") { сloseInfo.CloseDate = DateTime.Parse(childnode.InnerText); temData = DateTime.Parse(childnode.InnerText); Console.WriteLine($"дата закрытия компании: {childnode.InnerText}"); } сloseInfo.TimeDayClose = JobDateTTime(temData); //вычитаем даты Console.WriteLine($"Дата закрытия организации: {сloseInfo.TimeDayClose}\t\n"); } closeinfoList.Add(сloseInfo); // при каждой итераци добавляем в список новый обьект SaveDanni(сloseInfo, "CloseInfoItems"); // запись в json } Console.WriteLine(); foreach (CloseInfo com in closeinfoList) { Console.WriteLine($"Номер ID :{com.Id} - Дата закрытия:{com.CloseDate} - Количество дней существования фирмы {com.TimeDayClose}"); } //Console.WriteLine($"Количество действующих компаний = {companesTrue}"); } catch (Exception ex) { Console.WriteLine($"Что то пошло не так...Надо разбиратся...\t\n{ex}"); } Console.Read(); }