Пример #1
0
 private void OnSubscribed(string topic)
 {
     Subscribed?.Invoke(this, new SubscriptionEventArgs()
     {
         Topic = topic
     });
 }
        void IPusher.SubscriptionSuceeded(string channelName, string data)
        {
            if (Channels.TryGetValue(channelName, out Channel channel))
            {
                channel.SubscriptionSucceeded(data);
                if (Subscribed != null)
                {
                    Task.Run(() =>
                    {
                        try
                        {
                            Subscribed.Invoke(this, channel);
                        }
                        catch (Exception error)
                        {
                            InvokeErrorHandler(new SubscribedEventHandlerException(channel, error, data));
                        }
                    });
                }

                if (channel._subscribeCompleted != null)
                {
                    channel._subscribeCompleted.Release();
                }
            }
        }
        public JsonValue ToJson(JsonSerializer serializer)
        {
            var json = new JsonObject();

            Id.Serialize(json, serializer, "id");
            Name.Serialize(json, serializer, "name");
            Desc.Serialize(json, serializer, "desc");
            Closed.Serialize(json, serializer, "closed");
            Subscribed.Serialize(json, serializer, "subscribed");
            Organization.SerializeId(json, "idOrganization");
            BoardSource.SerializeId(json, "idBoardSource");
            // Don't serialize the Preferences collection because Trello wants individual properties.
            if (Prefs != null)
            {
                Prefs.PermissionLevel.Serialize(json, serializer, "prefs/permissionLevel");
                Prefs.SelfJoin.Serialize(json, serializer, "prefs/selfJoin");
                Prefs.CardCovers.Serialize(json, serializer, "prefs/cardCovers");
                Prefs.Invitations.Serialize(json, serializer, "prefs/invitations");
                Prefs.Voting.Serialize(json, serializer, "prefs/voting");
                Prefs.Comments.Serialize(json, serializer, "prefs/comments");
                Prefs.CardAging.Serialize(json, serializer, "prefs/cardAging");
                Prefs.CalendarFeed.Serialize(json, serializer, "prefs/calendarFeedEnabled ");
                Prefs.Background.Serialize(json, serializer, "prefs/background");
            }
            return(json);
        }
Пример #4
0
        internal virtual void SubscriptionSucceeded(string data)
        {
            if (IsSubscribed)
            {
                return;
            }

            IsSubscribed = true;

            Subscribed?.Invoke(this);
        }
Пример #5
0
        public JsonValue ToJson(JsonSerializer serializer)
        {
            var json = new JsonObject();

            Id.Serialize(json, serializer, "id");
            Board.SerializeId(json, "idBoard");
            Closed.Serialize(json, serializer, "closed");
            Name.Serialize(json, serializer, "name");
            Pos.Serialize(json, serializer, "pos");
            Subscribed.Serialize(json, serializer, "subscribed");
            return(json);
        }
Пример #6
0
        private void EnsureConnected(TcpClientWrapper client)
        {
            Subscribers.Add(client);
            Subscribed?.Invoke(client);

            Task.Factory.StartNew(() =>
            {
                while (client.State != TcpState.Closed)
                {
                    ;
                }
                Subscribers.Remove(client);
            });
        }
Пример #7
0
 private async Task AddSubscribedUsers(List <string> playerIds)
 {
     if (await Subscribed.AnyAsync())
     {
         foreach (var user in Subscribed)
         {
             var notificationId = user.NotificationUserIds;
             if (notificationId.Any())
             {
                 playerIds.AddRange(notificationId.Select(x => x.PlayerId));
             }
         }
     }
 }
Пример #8
0
        private async Task AddSubscribedUsers(List <string> playerIds)
        {
            if (await Subscribed.AnyAsync())
            {
                foreach (var user in Subscribed)
                {
                    var notificationIds = await _notifications.GetAll().Where(x => x.UserId == user.Id).ToListAsync();

                    if (notificationIds.Any())
                    {
                        playerIds.AddRange(notificationIds.Select(x => x.Token));
                    }
                }
            }
        }
Пример #9
0
        private async Task SendToSubscribers(EmailNotificationSettings settings, NotificationMessage message)
        {
            if (await Subscribed.AnyAsync())
            {
                foreach (var user in Subscribed)
                {
                    if (user.Email.IsNullOrEmpty())
                    {
                        continue;
                    }

                    message.To = user.Email;

                    await Send(message, settings);
                }
            }
        }
Пример #10
0
        public JsonValue ToJson(JsonSerializer serializer)
        {
            var json = new JsonObject();

            Id.Serialize(json, serializer, "id");
            Board.SerializeId(json, "idBoard");
            Closed.Serialize(json, serializer, "closed");
            Desc.Serialize(json, serializer, "desc");
            Due.Serialize(json, serializer, "due", ForceDueDate);
            List.SerializeId(json, "idList");
            Name.Serialize(json, serializer, "name");
            Pos.Serialize(json, serializer, "pos");
            Subscribed.Serialize(json, serializer, "subscribed");
            CardSource.SerializeId(json, "idCardSource");
            UrlSource.Serialize(json, serializer, "urlSource");
            return(json);
        }
 internal virtual void SubscriptionSucceeded(string data)
 {
     if (!IsSubscribed)
     {
         IsSubscribed = true;
         if (Subscribed != null)
         {
             try
             {
                 Subscribed.Invoke(this);
             }
             catch (Exception error)
             {
                 _pusher.RaiseChannelError(new SubscribedEventHandlerException(this, error, data));
             }
         }
     }
 }
        public void Subscribe(int tripId, string userId)
        {
            var subscribedModel = _context.SubscribedModel.Where(x => x.TripId == tripId && x.UserId == userId).FirstOrDefault();

            if (subscribedModel == null)
            {
                subscribedModel        = new Subscribed();
                subscribedModel.TripId = tripId;
                subscribedModel.UserId = userId;
                _context.SubscribedModel.Add(subscribedModel);
            }
            else
            {
                _context.SubscribedModel.Remove(subscribedModel);
            }

            _context.SaveChanges();
        }
Пример #13
0
        /// <summary>
        /// AIMP のイベント通知を購読します
        /// </summary>
        /// <exception cref="ApplicationException" />
        public void Subscribe()
        {
            if (IsSubscribed)
            {
                throw new ApplicationException("既に通知を購読しています");
            }

            IsSubscribed = true;

            var isRunning = Helper.AimpRemoteWindowHandle != IntPtr.Zero;

            if (!isRunning)
            {
                throw new ApplicationException("AIMPが起動していないため、購読に失敗しました");
            }

            Helper.RegisterNotify(_Receiver);
            Subscribed?.Invoke();
        }
Пример #14
0
        public void Subscribe(NatsSubscription natsSubscription)
        {
            if (Subscriptions.ContainsKey(natsSubscription))
            {
                return;
            }

            Logger.Info($"{nameof(Subscribe)}: {natsSubscription.Subject}");
            List <IAsyncSubscription> subs = new List <IAsyncSubscription>();

            foreach (var conn in ConnectionsByName.Values)
            {
                IAsyncSubscription sub = conn.SubscribeAsync(natsSubscription.Subject, OnMessage);
                subs.Add(sub);
            }

            Subscriptions[natsSubscription] = subs;
            natsSubscription.Subscribed     = subs.Any();
            Subscribed?.Invoke(natsSubscription);
        }
Пример #15
0
        public JsonValue ToJson(JsonSerializer serializer)
        {
            var json = new JsonObject();

            Id.Serialize(json, serializer, "id");
            Board.SerializeId(json, "idBoard");
            Closed.Serialize(json, serializer, "closed");
            Desc.Serialize(json, serializer, "desc");
            Due.Serialize(json, serializer, "due", ForceDueDate);
            DueComplete.Serialize(json, serializer, "dueComplete");
            List.SerializeId(json, "idList");
            Name.Serialize(json, serializer, "name");
            Pos.Serialize(json, serializer, "pos");
            Subscribed.Serialize(json, serializer, "subscribed");
            CardSource.SerializeId(json, "idCardSource");
            UrlSource.Serialize(json, serializer, "urlSource");
            IdMembers.Serialize(json, serializer, "idMembers");
            IdLabels.Serialize(json, serializer, "idLabels");
            if (KeepFromSource != CardCopyKeepFromSourceOptions.None)
            {
                KeepFromSource.Serialize(json, serializer, "keepFromSource");
            }
            return(json);
        }
Пример #16
0
 public void Add(Subscribed subscribed)
 {
     _db.Subscribed.Add(subscribed);
 }
Пример #17
0
 public void UpdateSubscribed(Subscribed subscribed)
 {
     _db.Entry(subscribed).State = EntityState.Modified;
 }
Пример #18
0
 public void DeleteSubscribtion(Subscribed subscribed)
 {
     _db.Subscribed.Remove(subscribed);
 }
Пример #19
0
 protected virtual void OnSubscribed(Subscribe subscribe)
 {
     Subscribed?.Invoke(this, new SubscriptionEventArgs(subscribe));
 }
Пример #20
0
 public virtual void Subscribe(Action callback)
 {
     Subscribed?.Invoke(this, callback);
 }
Пример #21
0
        public void LogSettings()
        {
            log.Info(Program.MaskFilePath(ConfigFile));
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Disconnect Between Sync: " + DisconnectOutlookBetweenSync);
            if (TimezoneMaps.Count > 0)
            {
                log.Info("  Custom Timezone Mapping:-");
                TimezoneMaps.ToList().ForEach(tz => log.Info("    " + tz.Key + " => " + tz.Value));
            }
            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Personal API Keys: " + UsingPersonalAPIkeys());
            log.Info("    Client Identifier: " + PersonalClientIdentifier);
            log.Info("    Client Secret: " + (PersonalClientSecret.Length < 5
                ? "".PadLeft(PersonalClientSecret.Length, '*')
                : PersonalClientSecret.Substring(0, PersonalClientSecret.Length - 5).PadRight(5, '*')));
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);
            log.Info("  Assigned API key: " + AssignedClientIdentifier);

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.BrowserUserAgent != Proxy.DefaultBrowserAgent)
            {
                log.Info("  Browser Agent: " + Proxy.BrowserUserAgent);
            }
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  Authentication Required: " + Proxy.AuthenticationRequired);
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup + "; DelayedStartup: " + StartupDelay.ToString());
            log.Info("  HideSplashScreen: " + (UserIsBenefactor() ? HideSplashScreen.ToString() : "N/A"));
            log.Info("  SuppressSocialPopup: " + (UserIsBenefactor() ? SuppressSocialPopup.ToString() : "N/A"));
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            log.Info("  MuteClickSounds: " + MuteClickSounds);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);
            log.Info("  Error Reporting: " + CloudLogging ?? "Undefined");

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Skip Version: " + SkipVersion);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));
            log.Info("  Timezone Database: " + TimezoneDB.Instance.Version);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            TimeZone curTimeZone = TimeZone.CurrentTimeZone;

            log.Info("  System Time Zone: " + curTimeZone.StandardName + "; DST=" + curTimeZone.IsDaylightSavingTime(DateTime.Now));
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }
 public SubscribedController(ISubscribed _subscribed, Subscribed subscriber)
 {
     this._subscribed = _subscribed;
     _subscriber      = subscriber;
 }
Пример #23
0
 public override void OnCompleted(ref State state, Action cont)
 {
     var newState = new Subscribed(cont, null);
     var s = Interlocked.CompareExchange(ref state, newState, this);
     if (s != this) {
         //log mismatch... ?
         s.OnCompleted(ref state, cont);
     }
 }
Пример #24
0
 public virtual void Subscribe <TParameter>(Action <TParameter> callback)
 {
     Subscribed?.Invoke(this, callback);
 }
 /// <summary>
 /// Called when an observer is subscribed.
 /// </summary>
 /// <param name="observer">The newly subscribed observer.</param>
 protected virtual void OnSubscribed(IObserver <T> observer)
 {
     Subscribed?.Invoke(this, new ObserverEventArgs <T>(observer));
 }
Пример #26
0
        private void RaiseOnReSubscribe()
        {
            OnSubscribed();

            Subscribed?.Invoke(this, new EventArgs());
        }
Пример #27
0
        private async void _wsclient_OnMessage(object sender, MessageEventArgs e)
        {
            // Ignore if its not text
            if (!e.IsText)
            {
                return;
            }

            // Try to parse else ignore message
            TwitchPubSubPayload received;

            try
            {
                received = JsonConvert.DeserializeObject <TwitchPubSubPayload>(e.Data);
            }
            catch
            {
                // TODO: remove console debugging output
                Console.WriteLine("PUBSUB Deserialize Failure...");
                return;
            }

            // PONG received
            if (received.Type == "PONG")
            {
                // Stop PONG timer
                _pongtimer.Stop();

                // TODO: remove console debugging output
                #if DEBUG
                Console.WriteLine("PUBSUB PONG RECEIVED");
                #endif
            }

            // RECONNECT received
            else if (received.Type == "RECONNECT")
            {
                // Silently reconnect
                await Reconnect();
            }

            // RESONSE received
            else if (received.Type == "RESPONSE")
            {
                switch (received.Type)
                {
                // Server error
                case "ERR_SERVER":

                    break;

                // Bad message error
                case "ERR_BADMESSAGE":

                    break;

                // Bad oauth error
                case "ERR_BADAUTH":

                    break;

                // Bad topic error
                case "ERR_BADTOPIC":

                    break;

                // All OK
                default:
                    Messenger.Default.Send <bool>(true, "PubSubConnectionChanged");
                    Subscribed?.Invoke(this, null);
                    break;
                }
            }

            // PubSub message on event registered for
            else if (received.Type == "MESSAGE")
            {
                Message?.Invoke(this, new EventArgs());
                Console.WriteLine("PUBSUB MESSAGE: " + received.Data.Message);
            }
        }
Пример #28
0
        public void LogSettings()
        {
            log.Info(Program.MaskFilePath(ConfigFile));
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            if (OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Info("  Shared Calendar: " + SharedCalendar);
            }
            else
            {
                log.Info("  Mailbox/FolderStore Name: " + MailboxName);
            }
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.ToString());
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Only Responded Invites: " + OnlyRespondedInvites);
            log.Info("  Filter String: " + OutlookDateFormat);
            log.Info("  GAL Blocked: " + OutlookGalBlocked);
            if (TimezoneMaps.Count > 0)
            {
                log.Info("  Custom Timezone Mapping:-");
                TimezoneMaps.ToList().ForEach(tz => log.Info("    " + tz.Key + " => " + tz.Value));
            }

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + (UseGoogleCalendar == null ? "" : UseGoogleCalendar.ToString(true)));
            log.Info("  Exclude Goals: " + ExcludeGoals);
            log.Info("  Personal API Keys: " + UsingPersonalAPIkeys());
            log.Info("    Client Identifier: " + PersonalClientIdentifier);
            log.Info("    Client Secret: " + (PersonalClientSecret.Length < 5
                ? "".PadLeft(PersonalClientSecret.Length, '*')
                : PersonalClientSecret.Substring(0, PersonalClientSecret.Length - 5).PadRight(5, '*')));
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);
            log.Info("  Assigned API key: " + AssignedClientIdentifier);
            log.Info("  Cloak Email: " + CloakEmail);

            log.Info("SYNC OPTIONS:-");
            log.Info(" How");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  SetEntriesPrivate: " + SetEntriesPrivate);
            log.Info("  SetEntriesAvailable: " + SetEntriesAvailable + (SetEntriesAvailable ? "; " + AvailabilityStatus : ""));
            log.Info("  SetEntriesColour: " + SetEntriesColour + (SetEntriesColour ? "; " + SetEntriesColourValue + "; \"" + SetEntriesColourName + "\"" : ""));
            if ((SetEntriesPrivate || SetEntriesAvailable || SetEntriesColour) && SyncDirection == Sync.Direction.Bidirectional)
            {
                log.Info("    TargetCalendar: " + TargetCalendar.Name);
                log.Info("    CreatedItemsOnly: " + CreatedItemsOnly);
            }
            if (ColourMaps.Count > 0)
            {
                log.Info("  Custom Colour/Category Mapping:-");
                if (OutlookOgcs.Factory.OutlookVersionName == OutlookOgcs.Factory.OutlookVersionNames.Outlook2003)
                {
                    log.Fail("    Using Outlook2003 - categories not supported, although mapping exists");
                }
                else
                {
                    ColourMaps.ToList().ForEach(c => log.Info("    " + OutlookOgcs.Calendar.Categories.OutlookColour(c.Key) + ":" + c.Key + " <=> " +
                                                              c.Value + ":" + GoogleOgcs.EventColour.Palette.GetColourName(c.Value)));
                }
            }
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }
            log.Info(" When");
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info(" What");
            log.Info("  AddLocation: " + AddLocation);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddAttendees: " + AddAttendees);
            log.Info("  AddColours: " + AddColours);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    UseOutlookDefaultReminder: " + UseOutlookDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.BrowserUserAgent != Proxy.DefaultBrowserAgent)
            {
                log.Info("  Browser Agent: " + Proxy.BrowserUserAgent);
            }
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  Authentication Required: " + Proxy.AuthenticationRequired);
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup + "; DelayedStartup: " + StartupDelay.ToString());
            log.Info("  HideSplashScreen: " + (UserIsBenefactor() ? HideSplashScreen.ToString() : "N/A"));
            log.Info("  SuppressSocialPopup: " + (UserIsBenefactor() ? SuppressSocialPopup.ToString() : "N/A"));
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            log.Info("  MuteClickSounds: " + MuteClickSounds);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);
            log.Info("  Error Reporting: " + CloudLogging ?? "Undefined");

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Skip Version: " + SkipVersion);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));
            log.Info("  Timezone Database: " + TimezoneDB.Instance.Version);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            TimeZone curTimeZone = TimeZone.CurrentTimeZone;

            log.Info("  System Time Zone: " + curTimeZone.StandardName + "; DST=" + curTimeZone.IsDaylightSavingTime(DateTime.Now));
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }
Пример #29
0
 /// <summary>
 /// Filter by if the currently authenticated user's subscribed threads.
 /// </summary>
 public GraphQueryArgument <bool> SubscribedQueryArgument(bool value)
 {
     return(Subscribed.GetQueryArgumentAndSetValue(value));
 }
Пример #30
0
 public Subscribed(Action cont, Subscribed next)
 {
     this.cont = cont;
     this.next = next;
 }
        public void LogSettings()
        {
            log.Info(Program.SettingsFile);
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            if (OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Info("  Shared Calendar: " + SharedCalendar);
            }
            else
            {
                log.Info("  Mailbox/FolderStore Name: " + MailboxName);
            }
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.Name);
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Filter String: " + OutlookDateFormat);
            log.Info("  GAL Blocked: " + OutlookGalBlocked);

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + UseGoogleCalendar.Name);
            log.Info("  Personal API Keys: " + UsingPersonalAPIkeys());
            log.Info("    Client Identifier: " + PersonalClientIdentifier);
            log.Info("    Client Secret: " + (PersonalClientSecret.Length < 5
                ? "".PadLeft(PersonalClientSecret.Length, '*')
                : PersonalClientSecret.Substring(0, PersonalClientSecret.Length - 5).PadRight(5, '*')));
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);
            log.Info("  Assigned API key: " + AssignedClientIdentifier);
            log.Info("  Cloak Email: " + CloakEmail);

            log.Info("SYNC OPTIONS:-");
            log.Info(" Main");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");
            log.Info("  AddAttendees: " + AddAttendees);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  SetEntriesPrivate: " + SetEntriesPrivate);
            log.Info("  SetEntriesAvailable: " + SetEntriesAvailable);
            if ((SetEntriesPrivate || SetEntriesAvailable) && SyncDirection == SyncDirection.Bidirectional)
            {
                log.Info("    TargetCalendar: " + TargetCalendar.Name);
                log.Info("    CreatedItemsOnly: " + CreatedItemsOnly);
            }
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  Authentication Required: " + Proxy.AuthenticationRequired);
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup + "; DelayedStartup: " + StartupDelay.ToString());
            log.Info("  HideSplashScreen: " + ((Subscribed != DateTime.Parse("01-Jan-2000") || Donor) ? HideSplashScreen.ToString() : "N/A"));
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            log.Info("  MuteClickSounds: " + MuteClickSounds);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));
            log.Info("  Timezone Database: " + TimezoneDB.Instance.Version);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }
Пример #32
0
        public void LogSettings()
        {
            log.Info(Program.SettingsFile);
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.Name);
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Filter String: " + OutlookDateFormat);

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + UseGoogleCalendar.Name);
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);

            log.Info("SYNC OPTIONS:-");
            log.Info(" Main");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");
            log.Info("  AddAttendees: " + AddAttendees);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup);
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }