public SuccessStorySettingsView(SuccessStory plugin, IPlayniteAPI PlayniteApi, string PluginUserDataPath, SuccessStorySettings settings) { this.PlayniteApi = PlayniteApi; this.PluginUserDataPath = PluginUserDataPath; this.settings = settings; achievementsDatabase = new AchievementsDatabase(plugin, PlayniteApi, settings, PluginUserDataPath); InitializeComponent(); DataLoad.Visibility = Visibility.Collapsed; SetTotal(); switch (settings.NameSorting) { case "Name": cbDefaultSorting.Text = resources.GetString("LOCGameNameTitle"); break; case "LastActivity": cbDefaultSorting.Text = resources.GetString("LOCLastPlayed"); break; case "SourceName": cbDefaultSorting.Text = resources.GetString("LOCSourceLabel"); break; case "ProgressionValue": cbDefaultSorting.Text = resources.GetString("LOCSuccessStorylvGamesProgression"); break; } }
public SuccessStorySettingsView(SuccessStory plugin, IPlayniteAPI PlayniteApi, string PluginUserDataPath) { _PlayniteApi = PlayniteApi; _PluginUserDataPath = PluginUserDataPath; InitializeComponent(); DataLoad.Visibility = Visibility.Collapsed; SetTotal(); switch (PluginDatabase.PluginSettings.NameSorting) { case "Name": cbDefaultSorting.Text = resources.GetString("LOCGameNameTitle"); break; case "LastActivity": cbDefaultSorting.Text = resources.GetString("LOCLastPlayed"); break; case "SourceName": cbDefaultSorting.Text = resources.GetString("LOCSourceLabel"); break; case "ProgressionValue": cbDefaultSorting.Text = resources.GetString("LOCSuccessStorylvGamesProgression"); break; } LocalPath = PluginDatabase.PluginSettings.LocalPath.GetClone(); PART_ItemsControl.ItemsSource = LocalPath; }
public SuccessStoryDatabase(SuccessStory plugin, IPlayniteAPI PlayniteApi, SuccessStorySettings PluginSettings, string PluginUserDataPath) : base(PlayniteApi, PluginSettings, PluginUserDataPath) { _plugin = plugin; PluginName = "SuccessStory"; ControlAndCreateDirectory(PluginUserDataPath, "Achievements"); }
public SuccessStoryUI(IPlayniteAPI PlayniteApi, SuccessStorySettings Settings, string PluginUserDataPath, SuccessStory Plugin) : base(PlayniteApi, PluginUserDataPath) { _Settings = Settings; _Plugin = Plugin; _PluginUserDataPath = PluginUserDataPath; BtActionBarName = "PART_ScButton"; SpDescriptionName = "PART_ScDescriptionIntegration"; }
public SuccessStoryUI(SuccessStory Plugin, IPlayniteAPI PlayniteApi, string PluginUserDataPath) : base(PlayniteApi, PluginUserDataPath) { _Plugin = Plugin; _PluginUserDataPath = PluginUserDataPath; BtActionBarName = "PART_ScButton"; SpDescriptionName = "PART_ScDescriptionIntegration"; SpInfoBarFSName = "PART_ScSpInfoBar"; }
public AchievementsDatabase(SuccessStory plugin, IPlayniteAPI PlayniteApi, SuccessStorySettings Settings, string PluginUserDataPath, bool isRetroachievements = false) { _plugin = plugin; _PlayniteApi = PlayniteApi; _settings = Settings; _PluginUserDataPath = PluginUserDataPath; _isRetroachievements = isRetroachievements; PluginDatabasePath = PluginUserDataPath + "\\achievements\\"; if (!Directory.Exists(PluginDatabasePath)) { Directory.CreateDirectory(PluginDatabasePath); } }
protected void SubmitStory(object sender, EventArgs e) { try { string folderPath = Server.MapPath("/images/SuccessStory/"); string fileName = Path.GetFileName(imageUploader.FileName); if (fileName != "") { //Save the File to the Directory (Folder). imageUploader.SaveAs(folderPath + fileName); } //create object SuccessStory successStory = new SuccessStory(); successStory.Name = txtName.Text; successStory.StroryDescription = txtStoryDescription.Text; successStory.Image = fileName; //save success stories SuccessStory.SaveSuccessStory(successStory); //send email to admin string adminMessage = "New success story submitted by " + successStory; string adminEmailBody = Email.PopulateBody("Admin", adminMessage); Email.SendEmail("*****@*****.**", "New Success Story", adminEmailBody); //clear form txtName.Text = ""; txtStoryDescription.Text = ""; successStory.Image = ""; //show success message ShowSuccessMessage("Your story has been successfully uploaded and sent to admin."); } catch (Exception ex) { ShowError("Something went wrong. Please try again."); } }
public void BindSuccessStories() { lstSuccessStories.DataSource = SuccessStory.GetSuccessStories(true); lstSuccessStories.DataBind(); }
/// <summary> /// /// </summary> /// <param name="GameSourceName"></param> /// <param name="settings"></param> /// <returns></returns> public static bool VerifToAddOrShow(SuccessStory plugin, IPlayniteAPI PlayniteApi, SuccessStorySettings settings, string PluginUserDataPath, string GameSourceName) { if (settings.EnableSteam && GameSourceName.ToLower() == "steam") { if (PlayniteTools.IsDisabledPlaynitePlugins("SteamLibrary", PlayniteApi.Paths.ConfigurationPath)) { logger.Warn("SuccessStory - Steam is enable then disabled"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Steam-disabled", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsSteamDisabled")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } else { SteamAchievements steamAchievements = new SteamAchievements(PlayniteApi, settings, PluginUserDataPath); if (!steamAchievements.IsConfigured()) { logger.Warn("SuccessStory - Bad Steam configuration"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Steam-NoConfig", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsSteamBadConfig")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } } return(true); } if (settings.EnableGog && GameSourceName.ToLower() == "gog") { if (PlayniteTools.IsDisabledPlaynitePlugins("GogLibrary", PlayniteApi.Paths.ConfigurationPath)) { logger.Warn("SuccessStory - GOG is enable then disabled"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-GOG-disabled", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsGogDisabled")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } else { GogAchievements gogAchievements = new GogAchievements(PlayniteApi, settings, PluginUserDataPath); if (VerifToAddOrShowGog == null) { VerifToAddOrShowGog = gogAchievements.IsConnected(); } if (!(bool)VerifToAddOrShowGog) { logger.Warn("SuccessStory - Gog user is not authenticate"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Gog-NoAuthenticated", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsGogNoAuthenticate")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } } return(true); } if (settings.EnableOrigin && GameSourceName.ToLower() == "origin") { if (PlayniteTools.IsDisabledPlaynitePlugins("OriginLibrary", PlayniteApi.Paths.ConfigurationPath)) { logger.Warn("SuccessStory - Origin is enable then disabled"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Origin-disabled", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsOriginDisabled")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } else { OriginAchievements originAchievements = new OriginAchievements(PlayniteApi, settings, PluginUserDataPath); if (VerifToAddOrShowOrigin == null) { VerifToAddOrShowOrigin = originAchievements.IsConnected(); } if (!(bool)VerifToAddOrShowOrigin) { logger.Warn("SuccessStory - Origin user is not authenticated"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Origin-NoAuthenticate", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsOriginNoAuthenticate")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } } return(true); } if (settings.EnableXbox && GameSourceName.ToLower() == "xbox") { if (PlayniteTools.IsDisabledPlaynitePlugins("XboxLibrary", PlayniteApi.Paths.ConfigurationPath)) { logger.Warn("SuccessStory - Xbox is enable then disabled"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Xbox-disabled", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsXboxDisabled")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } else { XboxAchievements xboxAchievements = new XboxAchievements(PlayniteApi, settings, PluginUserDataPath); #if DEBUG logger.Debug($"SuccessStory [Ignored] - VerifToAddOrShowXbox: {VerifToAddOrShowXbox}"); #endif if (VerifToAddOrShowXbox == null) { VerifToAddOrShowXbox = xboxAchievements.IsConnected(); } #if DEBUG logger.Debug($"SuccessStory [Ignored] - VerifToAddOrShowXbox: {VerifToAddOrShowXbox}"); #endif if (!(bool)VerifToAddOrShowXbox) { logger.Warn("SuccessStory - Xbox user is not authenticated"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Xbox-NoAuthenticate", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsXboxNotAuthenticate")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } } return(true); } if (settings.EnableLocal && (GameSourceName.ToLower() == "playnite" || GameSourceName.ToLower() == "hacked")) { return(true); } if (settings.EnableRetroAchievements && GameSourceName.ToLower() == "retroachievements") { RetroAchievements retroAchievements = new RetroAchievements(PlayniteApi, settings, PluginUserDataPath); if (!retroAchievements.IsConfigured()) { logger.Warn("SuccessStory - Bad RetroAchievements configuration"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-RetroAchievements-NoConfig", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsRetroAchievementsBadConfig")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } return(true); } if (settings.EnableRpcs3Achievements && GameSourceName.ToLower() == "rpcs3") { Rpcs3Achievements rpcs3Achievements = new Rpcs3Achievements(PlayniteApi, settings, PluginUserDataPath); if (!rpcs3Achievements.IsConfigured()) { logger.Warn("SuccessStory - Bad RPCS3 configuration"); PlayniteApi.Notifications.Add(new NotificationMessage( "SuccessStory-Rpcs3-NoConfig", $"SuccessStory\r\n{resources.GetString("LOCSuccessStoryNotificationsRpcs3BadConfig")}", NotificationType.Error, () => plugin.OpenSettingsView() )); return(false); } return(true); } logger.Warn($"SuccessStory - VerifToAddOrShow() find no action for {GameSourceName}"); return(false); }
public static void UpdateSuccessStoryStatus(string storyID, string status) { SuccessStory.UpdateSuccessStoryStatus(Convert.ToInt32(storyID), Convert.ToBoolean(status)); }