Esempio n. 1
0
        public AnalyticsManager(FormBrowser browser, PluginManager plugins, string file)
        {
            this.browser = browser;
            this.plugins = plugins;
            this.File    = AnalyticsFile.Load(file);

            this.currentTimer = new Timer {
                SynchronizingObject = browser
            };
            this.currentTimer.Elapsed += currentTimer_Elapsed;

            this.saveTimer = new Timer {
                SynchronizingObject = browser, Interval = 60000
            };
            this.saveTimer.Elapsed += saveTimer_Elapsed;

            if (this.File.LastCollectionVersion != Program.VersionTag)
            {
                ScheduleReportIn(TimeSpan.FromHours(12), string.Empty);
            }
            else
            {
                RestartTimer();
            }
        }
Esempio n. 2
0
        public static AnalyticsFile Load(string file)
        {
            AnalyticsFile config = new AnalyticsFile(file);

            try{
                Serializer.ReadIfExists(file, config);
            }catch (Exception e) {
                Program.Reporter.HandleException("Analytics File Error", "Could not open the analytics file.", true, e);
            }

            return(config);
        }
        public static AnalyticsReport Create(AnalyticsFile file, ExternalInfo info, PluginManager plugins)
        {
            Dictionary <string, string> editLayoutDesign = EditLayoutDesignPluginData;

            return(new AnalyticsReport {
                { "App Version", Program.VersionTag },
                { "App Type", Program.IsPortable ? "portable" : "installed" },
                { "App Dev Tools", Bool(BrowserUtils.HasDevTools) },
                0,
                { "System Name", SystemName },
                { "System Edition", SystemEdition },
                { "System Environment", Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit" },
                { "System Build", SystemBuild },
                { "System Locale", Program.Culture.Name.ToLower() },
                0,
                { "RAM", Exact(RamSize) },
                { "GPU", GpuVendor },
                0,
                { "Screen Count", Exact(Screen.AllScreens.Length) },
                { "Screen Resolution", info.Resolution ?? "(unknown)" },
                { "Screen DPI", info.DPI != null?Exact(info.DPI.Value) : "(unknown)" },
                0,
                { "Hardware Acceleration", Bool(SysConfig.HardwareAcceleration) },
                { "Clear Cache Automatically", Bool(SysConfig.ClearCacheAutomatically) },
                { "Clear Cache Threshold", Exact(SysConfig.ClearCacheThreshold) },
                0,
                { "Expand Links", Bool(UserConfig.ExpandLinksOnHover) },
                { "Search In First Column", Bool(UserConfig.OpenSearchInFirstColumn) },
                { "Keep Like Follow Dialogs Open", Bool(UserConfig.KeepLikeFollowDialogsOpen) },
                { "Best Image Quality", Bool(UserConfig.BestImageQuality) },
                { "Animated Images", Bool(UserConfig.EnableAnimatedImages) },
                0,
                { "Smooth Scrolling", Bool(UserConfig.EnableSmoothScrolling) },
                { "Custom Browser", CustomBrowser },
                { "Zoom", Exact(UserConfig.ZoomLevel) },
                0,
                { "Spell Check", Bool(UserConfig.EnableSpellCheck) },
                { "Spell Check Language", UserConfig.SpellCheckLanguage.ToLower() },
                { "Translation Target Language", UserConfig.TranslationTarget },
                0,
                { "Updates", Bool(UserConfig.EnableUpdateCheck) },
                { "Update Dismissed", Bool(!string.IsNullOrEmpty(UserConfig.DismissedUpdate)) },
                0,
                { "Tray", TrayMode },
                { "Tray Highlight", Bool(UserConfig.EnableTrayHighlight) },
                0,
                { "Notification Position", NotificationPosition },
                { "Notification Size", NotificationSize },
                { "Notification Timer", NotificationTimer },
                { "Notification Timer Speed", RoundUp(UserConfig.NotificationDurationValue, 5) },
                { "Notification Scroll Speed", Exact(UserConfig.NotificationScrollSpeed) },
                { "Notification Column Title", Bool(UserConfig.DisplayNotificationColumn) },
                { "Notification Media Previews", Bool(UserConfig.NotificationMediaPreviews) },
                { "Notification Link Skip", Bool(UserConfig.NotificationSkipOnLinkClick) },
                { "Notification Non-Intrusive", Bool(UserConfig.NotificationNonIntrusiveMode) },
                { "Notification Idle Pause", Exact(UserConfig.NotificationIdlePauseSeconds) },
                { "Custom Sound Notification", string.IsNullOrEmpty(UserConfig.NotificationSoundPath) ? "off" : Path.GetExtension(UserConfig.NotificationSoundPath) },
                { "Custom Sound Notification Volume", RoundUp(UserConfig.NotificationSoundVolume, 5) },
                0,
                { "Program Arguments", List(ProgramArguments) },
                { "Custom CEF Arguments", RoundUp((UserConfig.CustomCefArgs ?? string.Empty).Length, 10) },
                { "Custom Browser CSS", RoundUp((UserConfig.CustomBrowserCSS ?? string.Empty).Length, 50) },
                { "Custom Notification CSS", RoundUp((UserConfig.CustomNotificationCSS ?? string.Empty).Length, 50) },
                0,
                { "Plugins All", List(plugins.Plugins.Select(Plugin)) },
                { "Plugins Enabled", List(plugins.Plugins.Where(plugin => plugins.Config.IsEnabled(plugin)).Select(Plugin)) },
                0,
                { "Theme", Dict(editLayoutDesign, "_theme", "light/def") },
                { "Column Width", Dict(editLayoutDesign, "columnWidth", "310px/def") },
                { "Font Size", Dict(editLayoutDesign, "fontSize", "12px/def") },
                { "Large Quote Font", Dict(editLayoutDesign, "increaseQuoteTextSize", "false/def") },
                { "Small Compose Font", Dict(editLayoutDesign, "smallComposeTextSize", "false/def") },
                { "Avatar Radius", Dict(editLayoutDesign, "avatarRadius", "2/def") },
                { "Hide Tweet Actions", Dict(editLayoutDesign, "hideTweetActions", "true/def") },
                { "Move Tweet Actions", Dict(editLayoutDesign, "moveTweetActionsToRight", "true/def") },
                { "Theme Color Tweaks", Dict(editLayoutDesign, "themeColorTweaks", "true/def") },
                { "Revert Icons", Dict(editLayoutDesign, "revertIcons", "true/def") },
                { "Optimize Animations", Dict(editLayoutDesign, "optimizeAnimations", "true/def") },
                { "Reply Account Mode", ReplyAccountConfigFromPlugin },
                { "Template Count", Exact(TemplateCountFromPlugin) },
                0,
                { "Opened Options", LogRound(file.OpenOptions, 4) },
                { "Opened Plugins", LogRound(file.OpenPlugins, 4) },
                { "Opened About", LogRound(file.OpenAbout, 4) },
                { "Opened Guide", LogRound(file.OpenGuide, 4) },
                { "Desktop Notifications", LogRound(file.DesktopNotifications, 5) },
                { "Sound Notifications", LogRound(file.SoundNotifications, 5) },
                { "Notification Mutes", LogRound(file.NotificationMutes, 2) },
                { "Browser Context Menus", LogRound(file.BrowserContextMenus, 2) },
                { "Browser Extra Mouse Buttons", LogRound(file.BrowserExtraMouseButtons, 2) },
                { "Notification Context Menus", LogRound(file.NotificationContextMenus, 2) },
                { "Notification Extra Mouse Buttons", LogRound(file.NotificationExtraMouseButtons, 2) },
                { "Notification Keyboard Shortcuts", LogRound(file.NotificationKeyboardShortcuts, 2) },
                { "Browser Reloads", LogRound(file.BrowserReloads, 2) },
                { "Copied Usernames", LogRound(file.CopiedUsernames, 2) },
                { "Viewed Images", LogRound(file.ViewedImages, 2) },
                { "Downloaded Images", LogRound(file.DownloadedImages, 2) },
                { "Downloaded Videos", LogRound(file.DownloadedVideos, 2) },
                { "Used ROT13", LogRound(file.UsedROT13, 2) },
                { "Tweet Screenshots", LogRound(file.TweetScreenshots, 2) },
                { "Tweet Details", LogRound(file.TweetDetails, 2) },
                { "Video Plays", LogRound(file.VideoPlays, 4) }
            }.FinalizeReport());
        }
Esempio n. 4
0
 public void SetOwner(AnalyticsFile owner)
 {
     this.owner = owner;
 }