public void ConfigurePlugin(PluginSettings pluginSettings) { _useHashCaching = pluginSettings.Get("enableCaching", false); _enable = pluginSettings.Get("enable", false); //You can disable it even if loaded _enableJavascriptScrambling = pluginSettings.Get("scrambleJs", false); //This can be unstable Reconfigure(); }
public void PerformUpdate() { Directory.CreateDirectory(HearthstoneCollectionTrackerPlugin.PluginDataDir); // move collection info file into data dir string oldCollectionFilePath = Path.Combine(Hearthstone_Deck_Tracker.Config.Instance.DataDir, "CardCollection.xml"); string newCollectionFilePath = Path.Combine(HearthstoneCollectionTrackerPlugin.PluginDataDir, "Collection_Default.xml"); if (File.Exists(oldCollectionFilePath)) { List<BasicSetCollectionInfo> oldSetInfo = Hearthstone_Deck_Tracker.XmlManager<List<BasicSetCollectionInfo>>.Load(oldCollectionFilePath); var cards = Hearthstone_Deck_Tracker.Hearthstone.Database.GetActualCards(); foreach (var set in oldSetInfo) { foreach (var card in set.Cards) { var originalCard = cards.FirstOrDefault(c => c.Id == card.CardId); if (originalCard != null) { card.DesiredAmount = originalCard.Rarity == Rarity.Legendary ? 1 : 2; } } } // add TGT cards const string TGTSet = "The Grand Tournament"; oldSetInfo.Add(new BasicSetCollectionInfo() { SetName = TGTSet, Cards = cards.Where(c => c.Set == TGTSet).Select(c => new CardInCollection() { AmountGolden = 0, AmountNonGolden = 0, CardId = c.Id, DesiredAmount = c.Rarity == Rarity.Legendary ? 1 : 2 }).ToList() }); Hearthstone_Deck_Tracker.XmlManager<List<BasicSetCollectionInfo>>.Save(newCollectionFilePath, oldSetInfo); File.Delete(oldCollectionFilePath); } PluginSettings settings = new PluginSettings() { CurrentVersion = new ModuleVersion(_version), Accounts = new List<AccountSummary>() { new AccountSummary() { AccountName = "Default", FileStoragePath = newCollectionFilePath } }, ActiveAccount = "Default", CollectionWindowWidth = 395, CollectionWindowHeight = 560, DefaultShowAllCards = false, NotifyNewDeckMissingCards = true }; string settingsFilePath = Path.Combine(HearthstoneCollectionTrackerPlugin.PluginDataDir, "config.xml"); Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Save(settingsFilePath, settings); }
public void GetClientType_Should_Return_Deserialized_Type_Defined_In_Service() { IAlchemyPlugin plugin = new PluginTestsPlugin(); plugin.Services.SettingsDeserialization = new SettingsDeserializationService(); plugin.Services.SettingsDeserialization.ClientSettingsType = typeof(StronglyTypedPerson); IPluginSettings settings = new PluginSettings("a4t.typed.xml", plugin); var person = (StronglyTypedPerson)settings.GetAsClientType(); person.WasServerKeyLoaded.Should().BeFalse(); person.Name.Should().Be("SDLGuy"); person.Age.Should().Be(99); person.IsOld.Should().BeTrue(); person.Favorites.Count().Should().Be(3); person.Favorites.Last().Should().Be("Johny Walker"); }
public void TestInitialise() { _AutoConfigMessageListener = TestUtilities.CreateMockSingleton<IAutoConfigListener>(); _Listener = TestUtilities.CreateMockImplementation<IListener>(); _AutoConfigMessageListener.Setup(r => r.Listener).Returns(_Listener.Object); _StartupParameters = new PluginStartupParameters(null, null, null, null); _ClassFactorySnapshot = Factory.TakeSnapshot(); _PluginSettingsStorage = TestUtilities.CreateMockSingleton<IPluginSettingsStorage>(); _PluginSettings = new PluginSettings(); _PluginSettingsStorage.Setup(s => s.Load()).Returns(_PluginSettings); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _RuntimeEnvironment.Setup(r => r.IsTest).Returns(true); _BaseStationDatabase = new Mock<IBaseStationDatabase>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _BaseStationDatabase.Object.FileName = "fn"; _AutoConfigBaseStationDatabase = TestUtilities.CreateMockSingleton<IAutoConfigBaseStationDatabase>(); _AutoConfigBaseStationDatabase.Setup(a => a.Database).Returns(_BaseStationDatabase.Object); _BaseStationDatabase.Setup(d => d.GetLocations()).Returns(new List<BaseStationLocation>() { new BaseStationLocation() { LocationID = 9821 } } ); SetDBHistory(true); _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>(); _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>(); _Log = TestUtilities.CreateMockSingleton<ILog>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _StatusChangedEvent = new EventRecorder<EventArgs>(); _Plugin = new PluginNS.Plugin(); _Provider = new Mock<PluginNS.IPluginProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.FileExists(It.IsAny<string>())).Returns(true); _Provider.Setup(p => p.LocalNow).Returns(new DateTime(2001, 2, 3, 4, 5, 6)); _Provider.Setup(p => p.FileSize(It.IsAny<string>())).Returns(1000000L); _OptionsView = new Mock<PluginNS.IOptionsView>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.CreateOptionsView()).Returns(_OptionsView.Object); _Plugin.Provider = _Provider.Object; }
public DMXDeviceProvider(IRgbService rgbService, PluginSettings settings) : base(RGBDeviceProvider.Instance) { _rgbService = rgbService; _settings = settings; }
public void Constructor_Should_Work_If_No_Settings_Element_Exist() { IPluginSettings settings = new PluginSettings("a4t.settingless.xml"); settings.Keys.Count().Should().Be(0); }
public void Start(PluginStartArguments pluginStartArgs) { //initialize static context StaticContext.Initialize(pluginStartArgs.Plugin, pluginStartArgs.ServiceProvider); var entMan = new EntityManager(); var relMan = new EntityRelationManager(); var recMan = new RecordManager(); var storeSystemSettings = DbContext.Current.SettingsRepository.Read(); var systemSettings = new SystemSettings(storeSystemSettings); using (SecurityContext.OpenSystemScope()) { //Create transaction using (var connection = DbContext.Current.CreateConnection()) { try { connection.BeginTransaction(); //Here we need to initialize or update the environment based on the plugin requirements. //The default place for the plugin data is the "plugin_data" entity -> the "data" text field, which is used to store stringified JSON //containing the plugin settings or version #region << 1.Get the current ERP database version and checks for other plugin dependencies >> if (systemSettings.Version > 0) { //Do something if database version is not what you expect } //This plugin needs the webvella-crm plugin to be installed, so we will check this here var installedPlugins = new PluginService().Plugins; var crmPluginFound = false; foreach (var plugin in installedPlugins) { switch (plugin.Name) { case "webvella-crm": crmPluginFound = true; break; default: break; } } if (!crmPluginFound) { throw new Exception("'webvella-crm' plugin is required for the 'webvella-project' to operate"); } #endregion #region << 2.Get the current plugin settings from the database >> var currentPluginSettings = new PluginSettings(); QueryObject pluginDataQueryObject = EntityQuery.QueryEQ("name", WEBVELLA_PROJECT_PLUGIN_NAME); var pluginDataQuery = new EntityQuery("plugin_data", "*", pluginDataQueryObject); var pluginDataQueryResponse = recMan.Find(pluginDataQuery); if (!pluginDataQueryResponse.Success) { throw new Exception("plugin 'webvella-project' failed to get its settings due to: " + pluginDataQueryResponse.Message); } if (pluginDataQueryResponse.Object == null || !pluginDataQueryResponse.Object.Data.Any() || pluginDataQueryResponse.Object.Data[0]["data"] == DBNull.Value) { //plugin was not installed currentPluginSettings.Version = 20160429; { string json = JsonConvert.SerializeObject(currentPluginSettings); var settingsEntityRecord = new EntityRecord(); settingsEntityRecord["id"] = WEBVELLA_PROJECT_PLUGIN_ID; settingsEntityRecord["name"] = WEBVELLA_PROJECT_PLUGIN_NAME; settingsEntityRecord["data"] = json; var settingsSaveReponse = recMan.CreateRecord("plugin_data", settingsEntityRecord); if (!settingsSaveReponse.Success) { throw new Exception("plugin 'webvella-project' failed to save its settings in the database due to: " + pluginDataQueryResponse.Message); } } } else { string json = (string)((List <EntityRecord>)pluginDataQueryResponse.Object.Data)[0]["data"]; currentPluginSettings = JsonConvert.DeserializeObject <PluginSettings>(json); } #endregion #region << 3. Run methods based on the current installed version of the plugin >> if (currentPluginSettings.Version < 20160430) { try { currentPluginSettings.Version = 20160430; Patch160430(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20160610) { try { currentPluginSettings.Version = 20160610; Patch160610(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20160613) { try { currentPluginSettings.Version = 20160613; Patch160613(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20160627) { try { currentPluginSettings.Version = 20160627; Patch160627(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20160707) { try { currentPluginSettings.Version = 20160707; Patch160707(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20161118) { try { currentPluginSettings.Version = 20161118; Patch161118(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20161119) { try { currentPluginSettings.Version = 20161119; Patch161119(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { var exception = ex; throw ex; } } if (currentPluginSettings.Version < 20170119) { try { currentPluginSettings.Version = 20170119; Patch170119(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20170328) { try { currentPluginSettings.Version = 20170328; Patch170328(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20170502) { try { currentPluginSettings.Version = 20170502; Patch20170502(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20180912) { try { currentPluginSettings.Version = 20180912; Patch20180912(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } if (currentPluginSettings.Version < 20180913) { try { currentPluginSettings.Version = 20180913; Patch20180913(entMan, relMan, recMan, createSampleRecords); } catch (Exception ex) { throw ex; } } #endregion #region << 4. Save needed changes to the plugin setting data >> { string json = JsonConvert.SerializeObject(currentPluginSettings); var settingsEntityRecord = new EntityRecord(); settingsEntityRecord["id"] = WEBVELLA_PROJECT_PLUGIN_ID; settingsEntityRecord["name"] = WEBVELLA_PROJECT_PLUGIN_NAME; settingsEntityRecord["data"] = json; var settingsUpdateReponse = recMan.UpdateRecord("plugin_data", settingsEntityRecord); if (!settingsUpdateReponse.Success) { throw new Exception("plugin 'webvella-project' failed to update its settings in the database due to: " + pluginDataQueryResponse.Message); } } #endregion connection.CommitTransaction(); } catch (Exception ex) { connection.RollbackTransaction(); throw ex; } } StartupExtensions.SetSchedulePlans(); } }
public GeneralModuleConfigurationViewModel(Plugin plugin, PluginSettings settings) : base(plugin) { EnableActiveWindow = settings.GetSetting("EnableActiveWindow", true); }
/// <summary> /// See interface docs. /// </summary> /// <returns></returns> public PluginSettings Load() { var result = new PluginSettings(); lock(_SyncLock) { var fileName = FileName; if(Provider.FileExists(fileName)) { foreach(var line in Provider.FileReadAllLines(fileName)) { var splitPosn = line.IndexOf('='); if(splitPosn > 0) { var key = line.Substring(0, splitPosn); var value = HttpUtility.UrlDecode(line.Substring(splitPosn + 1)); result.Values.Add(key, value); } } } } return result; }
public LeagueOfLegendsModule(PluginSettings settings) { _colors = settings.GetSetting("ChampionColors", new Dictionary <Champion, SKColor>(DefaultChampionColors.Colors)); }
public void AddPluginSetting(PluginSetting pluginSetting) { PluginSettings.Add(pluginSetting); }
public void PluginSettingsStorage_Save_Translates_Key_Values_Correctly() { var worksheet = new ExcelWorksheetData(TestContext); var settings = new PluginSettings(); for(int i = 1;i <= worksheet.Int("Count");++i) { var key = worksheet.EString(String.Format("Key{0}", i)); var value = worksheet.EString(String.Format("Value{0}", i)); if(value != null) value = value.Replace(@"\n", "\n").Replace(@"\r", "\r"); settings.Values.Add(key, value); } _Provider.Setup(p => p.FileWriteAllLines(It.IsAny<string>(), It.IsAny<string[]>())).Callback((string fileName, string[] lines) => { Assert.AreEqual(worksheet.Int("LineCount"), lines.Length); for(int i = 1;i <= worksheet.Int("LineCount");++i) { Assert.AreEqual(worksheet.EString(String.Format("Line{0}", i)), lines[i - 1]); } }); _Storage.Save(settings); _Provider.Verify(p => p.FileWriteAllLines(It.IsAny<string>(), It.IsAny<string[]>()), Times.Once()); }
public void ConfigurePlugin(PluginSettings pluginSettings) { }
public void TestInitialise() { _PluginSettings = new PluginSettings(); _Plugin = new Mock<IPlugin>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties().Object; Mock.Get(_Plugin).Setup(p => p.Id).Returns("x"); }
private void LoadfilesBackground(System.Object sender, DoWorkEventArgs e) { string aerror = string.Empty; try { if (sender != null) { BackgroundWorker worker = (BackgroundWorker)sender; worker.DoWork -= LoadfilesBackground; } if (File.Exists(mPluginConfigfilename)) { this.mPluginConfig = (PluginSettings)Util.DeSerializeObject(mPluginConfigfilename, typeof(PluginSettings)); } //create default file if (mPluginConfig == null) { mPluginConfig = new PluginSettings(); mPluginConfig.Shortcuts = new SDictionary<string, string>(); mPluginConfig.Shortcuts.Add("hr", "House Recall"); mPluginConfig.Shortcuts.Add("mr", "House Mansion_Recall"); mPluginConfig.Shortcuts.Add("ah", "Allegiance Hometown"); mPluginConfig.Shortcuts.Add("ls", "Lifestone"); mPluginConfig.Shortcuts.Add("mp", "Marketplace"); mPluginConfig.Alerts = getbaseAlerts(); mPluginConfig.AlertKeyMob = "Monster"; mPluginConfig.AlertKeyPortal = "Portal"; mPluginConfig.AlertKeySalvage = "Salvage"; mPluginConfig.AlertKeyScroll = "Salvage"; mPluginConfig.AlertKeyThropy = "Trophy"; mPluginConfig.Alertwawfinished = "finished.wav"; } //HACK: Still hating the sounds // mplayer = new mediaplayer(); // mplayer.Volume = mPluginConfig.wavVolume; loadcolortable(); //Check for Gamedata.xml if (!File.Exists(Util.docPath + "\\GameData.xml")) { //Create it if !exists iGameData.defaultfill(); Util.SerializeObject(Util.docPath + "\\GameData.xml", iGameData); } //Now that it exists, check version and update if needed if (File.Exists(Util.docPath + "\\GameData.xml")) { iGameData = (AlincoVVS.PluginCore.GameData)Util.DeSerializeObject(Util.docPath + "\\GameData.xml", typeof(GameData)); //Look to code this for a single line revision of Gamedata version, currently must update in 2 locations if (iGameData.version < 10) { iGameData.defaultfill(); Util.SerializeObject(Util.docPath + "\\GameData.xml", iGameData); } } mWorldConfigfilename = Util.docPath + "\\" + Util.normalizePath(Core.CharacterFilter.Server); if (!Directory.Exists(mWorldConfigfilename)) { Directory.CreateDirectory(mWorldConfigfilename); } mExportInventoryname = Util.docPath + "\\Inventory"; if (!Directory.Exists(mExportInventoryname)) { Directory.CreateDirectory(mExportInventoryname); writebasexslt(mExportInventoryname + "\\Inventory.xslt"); } mExportInventoryname += "\\" + Core.CharacterFilter.Server + ".xml"; mWorldInventoryname = Util.docPath + "\\" + Util.normalizePath(Core.CharacterFilter.Server) + "\\Inventory.xml"; if (File.Exists(mWorldInventoryname)) { object tobj = Util.DeSerializeObject(mWorldInventoryname, typeof(SDictionary<int, InventoryItem>)); if (tobj != null) { mGlobalInventory = (global::AlincoVVS.PluginCore.SDictionary<int, global::AlincoVVS.PluginCore.InventoryItem>)tobj; mStorageInfo = (global::AlincoVVS.PluginCore.SDictionary<int, string>)Util.DeSerializeObject(mWorldInventoryname + "storage", typeof(SDictionary<int, string>)); } else { mGlobalInventory = new SDictionary<int, InventoryItem>(); } } else { writebasexslt(Util.docPath + "\\" + Util.normalizePath(Core.CharacterFilter.Server) + "\\Inventory.xslt"); } mCharConfigfilename = mWorldConfigfilename; mWorldConfigfilename += "\\Settings.xml"; if (File.Exists(mWorldConfigfilename)) { mWorldConfig = (WorldSettings)Util.DeSerializeObject(mWorldConfigfilename, typeof(WorldSettings)); } mCharConfigfilename += "\\" + Util.normalizePath(Core.CharacterFilter.Name) + ".xml"; if (File.Exists(mCharConfigfilename)) { mCharconfig = (CharSettings)Util.DeSerializeObject(mCharConfigfilename, typeof(CharSettings)); } if (mWorldConfig == null) { mWorldConfig = new WorldSettings(); } if (mCharconfig == null) { mCharconfig = new CharSettings(); } mProtectedCorpses.Add("Corpse of " + Core.CharacterFilter.Name); mFilesLoaded = true; } catch (Exception ex) { aerror = ex.Message + ex.StackTrace; Util.ErrorLogger(ex); } if (aerror != string.Empty) { Util.bcast(aerror); } }
public void GetClientType_Should_Return_ExpandoObject_When_No_ClientSettingsType_Defined() { IPluginSettings settings = new PluginSettings("a4t.typed.xml"); IDictionary<string, object> person = (ExpandoObject)settings.GetAsClientType(); person.ContainsKey("WasServerKeyLoaded").Should().BeFalse(); person.ContainsKey("Name").Should().BeTrue(); person["Name"].Should().Be("SDLGuy"); }
public HueService(ILogger logger, PluginSettings settings) { _logger = logger; _storedBridgesSetting = settings.GetSetting("Bridges", new List <PhilipsHueBridge>()); }
public LeagueOfLegendsConfigurationDialogViewModel(Plugin plugin, PluginSettings settings) : base(plugin) { _colors = settings.GetSetting("ChampionColors", DefaultChampionColors.GetNewDictionary()); DefaultChampionColors.EnsureAllChampionsPresent(_colors.Value); Colors = new BindableCollection <ChampionColor>(_colors.Value.Select(kvp => new ChampionColor(kvp.Key, Convert(kvp.Value)))); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel" /> class. /// </summary> /// <param name="parentWindow">The parent window.</param> /// <param name="refreshAccordion">The refresh accordion.</param> /// <exception cref="System.ArgumentNullException">parentWindow</exception> public MainWindowViewModel(Window parentWindow, Action refreshAccordion) { if (parentWindow == null) { throw new ArgumentNullException("parentWindow"); } if (refreshAccordion == null) { throw new ArgumentNullException("refreshAccordion"); } RefreshAccordion = refreshAccordion; ParentWindow = parentWindow; Channel.OnStatusTextMessage += Channel_OnStatusTextMessage; Channel.OnEntityBrowserMessage += Channel_OnEntityBrowserMessage; Channel.OnRestoreUiMessage += Channel_OnRestoreUiMessage; Channel.OnExitMessage += Channel_OnExitMessage; Channel.OnHideWhenMinimizedMessage += Channel_OnHideWhenMinimizedMessage; Channel.OnShowWhenMinimizedMessage += Channel_OnShowWhenMinimizedMessage; Channel.OnBalloonSettingsMessage += Channel_OnBalloonSettingsMessage; Channel.OnPerfGraphMessage += Channel_OnPerfGraphMessage; Channel.OnMetricsUpdateMessage += Channel_OnMetricsUpdateMessage; ExitCommand = new DelegateCommand(Exit); OptionsCommand = new DelegateCommand(ShowOptions); SqlServerCommand = new DelegateCommand(ShowSqlServer); RedisServerCommand = new DelegateCommand(ShowRedisServer); AboutCommand = new DelegateCommand(ShowAbout); CheckForUpdateCommand = new DelegateCommand(OnCheckForUpdate); Status.StatusChanged += Status_StatusChanged; string configFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; #if DEBUG configFile = configFile.Replace("vshost.", ""); #endif PluginSettings = new PluginSettings { ConfigurationFile = configFile, InteropMessageId = Application.WmMyMsg, EventLog = EventLog.Instance, DatabaseSettings = DatabaseSettings, RedisSettings = RedisSettings, Channel = new Channel( ) }; SectionsView = new CollectionViewSource { Source = Sections }; SectionsView.Filter += SectionsView_Filter; var ordinalSort = new SortDescription("Ordinal", ListSortDirection.Ascending); var nameSort = new SortDescription("Name", ListSortDirection.Ascending); SectionsView.SortDescriptions.Add(ordinalSort); SectionsView.SortDescriptions.Add(nameSort); var timer = new DispatcherTimer(TimeSpan.FromMilliseconds(5000), DispatcherPriority.Background, IsUpdateAvailable, System.Windows.Application.Current.Dispatcher); CloseUpdateAvailable = new DelegateCommand(() => UpdateAvailableClose = true); }
public WS281XConfigurationViewModel(Plugin plugin, PluginSettings settings) : base(plugin) { _definitions = settings.GetSetting <List <DeviceDefinition> >("DeviceDefinitions"); }
// Set appropriate version private static bool FixTargetFrameworkVersion(XElement projectElement, XNamespace xmlns) { return(SetOrUpdateProperty(projectElement, xmlns, "TargetFrameworkVersion", s => { if (UnityUtils.ScriptingRuntime > 0) { if (PluginSettings.OverrideTargetFrameworkVersion) { return "v" + PluginSettings.TargetFrameworkVersion; } } else { if (PluginSettings.OverrideTargetFrameworkVersionOldMono) { return "v" + PluginSettings.TargetFrameworkVersionOldMono; } } if (string.IsNullOrEmpty(s)) { ourLogger.Verbose("TargetFrameworkVersion in csproj is null or empty."); return string.Empty; } var version = string.Empty; try { version = s.Substring(1); // for windows try to use installed dotnet framework // Unity 2018.1 doesn't require installed dotnet framework, it references everything from Unity installation if (PluginSettings.SystemInfoRiderPlugin.operatingSystemFamily == OperatingSystemFamilyRider.Windows && UnityUtils.UnityVersion < new Version(2018, 1)) { var versions = PluginSettings.GetInstalledNetFrameworks(); if (versions.Any()) { var versionOrderedList = versions.OrderBy(v1 => new Version(v1)); var foundVersion = UnityUtils.ScriptingRuntime > 0 ? versionOrderedList.Last() : versionOrderedList.First(); // Unity may require dotnet 4.7.1, which may not be present var fvIsParsed = VersionExtensions.TryParse(foundVersion, out var fv); var vIsParsed = VersionExtensions.TryParse(version, out var v); if (fvIsParsed && vIsParsed && (UnityUtils.ScriptingRuntime == 0 || UnityUtils.ScriptingRuntime > 0 && fv > v)) { version = foundVersion; } else if (foundVersion == version) { ourLogger.Verbose("Found TargetFrameworkVersion {0} equals the one set-by-Unity itself {1}", foundVersion, version); } else if (ourLogger.IsVersboseEnabled()) { var message = $"Rider may require \".NET Framework {version} Developer Pack\", which is not installed."; Debug.Log(message); } } } } catch (Exception e) { ourLogger.Log(LoggingLevel.WARN, "Fail to FixTargetFrameworkVersion", e); } return "v" + version; } )); }
private void btnApplySettings_Click(object sender, EventArgs e) { // Save Settings PluginSettings.SaveSettings(); this.Close(); }
public void Get_Should_Return_Deserialized_Object_From_Root() { IPluginSettings settings = new PluginSettings("a4t.typed.xml"); var person = settings.Get<StronglyTypedPerson>(); person.WasServerKeyLoaded.Should().BeTrue(); person.Name.Should().Be("SDLGuy"); person.Age.Should().Be(99); person.IsOld.Should().BeTrue(); person.Favorites.Count().Should().Be(3); person.Favorites.Last().Should().Be("Johny Walker"); }
public static List <Log> ACTEncounterToModelList(EncounterData encounter) { int i = 0; try { MaxPlayers = Int32.Parse(PluginSettings.GetSetting <string>("MaxPlayers")); } catch (Exception ee) { MaxPlayers = 8; } List <Log> LogList = new List <Log>(); List <Player> PlayerList = new List <Player>(); encounter.GetAllies().ForEach(combatant => { Player Player = new Player(); if (IsLimitBreak(combatant.Name)) { Player.playerName = combatant.Name; Player.maxHit = combatant.GetMaxHit(true); PlayerList.Add(Player); } else if (!IsLimitBreak(combatant.Name) && GetCustomColumnData(combatant, "Job") != "") { Player.playerJob = GetCustomColumnData(combatant, "Job").ToUpper(); Player.playerName = FormatName(combatant.Name); Player.damagePercentage = ValidateAndFill("DamagePerc", combatant.DamagePercent); Player.dps = Math.Round(combatant.EncDPS).ToString(); Player.idps = (int)Math.Round(combatant.EncDPS); Player.maxHit = FormatSkill(ValidateAndFill("MaxHitIndividual", combatant.GetMaxHit(true))); Player.healingPercentage = ValidateAndFill("HealingPerc", combatant.HealedPercent); Player.hps = ValidateAndFill("HPS", Math.Round(combatant.EncHPS).ToString()); Player.ihps = (int)Math.Round(combatant.EncHPS); Player.maxHeal = FormatSkill(ValidateAndFill("MaxHeal", combatant.GetMaxHeal(true, false))); Player.overhealPercentage = ValidateAndFill("OverHealPerc", GetCustomColumnData(combatant, "OverHealPct")); Player.deaths = ValidateAndFill("Deaths", combatant.Deaths.ToString()); Player.crit = ValidateAndFill("Crit", Math.Round(combatant.CritDamPerc).ToString()); Player.dh = ValidateAndFill("DirectHit", GetCustomColumnData(combatant, "DirectHitPct")); Player.dhCrit = ValidateAndFill("DirectHitCrit", GetCustomColumnData(combatant, "CritDirectHitPct")); Player.critHealPercentage = ValidateAndFill("CritHealPerc", Math.Round(combatant.CritHealPerc).ToString()); PlayerList.Add(Player); } }); if (PluginSettings.GetSetting <string>("SortBy") == "DPS") { PlayerList.Sort((x, y) => y.idps.CompareTo(x.idps)); } else if (PluginSettings.GetSetting <string>("SortBy") == "HPS") { PlayerList.Sort((x, y) => y.ihps.CompareTo(x.ihps)); } PlayerList.Where(Player => Player.playerJob != "" && Player.playerJob != null).ToList().ForEach(Player => { i += 1; Player.number = i; Player.playerJob = i.ToString() + "-" + Player.playerJob; if (Player.playerName.Length > 18) { if (i <= 9) { Player.playerName = Player.playerName.Substring(0, 18); } else { Player.playerName = Player.playerName.Substring(0, 17); } } }); if (i > MaxPlayers) { int totaltimes = (int)Math.Ceiling((decimal)i / MaxPlayers); int begin = 0; int end = 0; for (int ix = 1; ix <= totaltimes; ix++) { end = ix * MaxPlayers; begin = end - MaxPlayers + 1; LogList.Add(CreateLog(begin, end, PlayerList, encounter, "[Part " + ix + " of " + totaltimes + "]")); } } else { LogList.Add(CreateLog(0, i, PlayerList, encounter, "")); } PlayerList.Where(Player => Player.playerName == "Limit Break").ToList().ForEach(Player => { LogList.Last().players.Add(Player); }); return(LogList); }
public void ConfigurePlugin(PluginSettings pluginSettings) { //Nothing to configure }
public OpenRGBDeviceProvider(IRgbService rgbService, PluginSettings settings) : base(RGB.NET.Devices.OpenRGB.OpenRGBDeviceProvider.Instance) { _rgbService = rgbService; _settings = settings; }
public RazerConfigurationViewModel(Plugin plugin, PluginSettings settings) : base(plugin) { LoadEmulatorDevices = settings.GetSetting("LoadEmulatorDevices", false); }
public OpenRGBConfigurationDialogViewModel(Plugin plugin, PluginSettings settings) : base(plugin) { _definitions = settings.GetSetting("DeviceDefinitions", new List <OpenRGBServerDefinition>()); Definitions = new BindableCollection <OpenRGBServerDefinition>(_definitions.Value); }
// ---------[ GUI FUNCTIONALITY ]--------- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { int gameId = property.serializedObject.FindProperty("m_data.gameId").intValue; // render base field Rect basePropertyRect = position; basePropertyRect.height = position.height - EditorGUIUtility.singleLineHeight; EditorGUI.PropertyField(basePropertyRect, property, label); // draw unwrapped directory string dir = property.stringValue; dir = PluginSettings.ReplaceDirectoryVariables(dir, gameId); Rect previewRect = position; previewRect.width = position.width - BUTTON_WIDTH; previewRect.y = basePropertyRect.height + basePropertyRect.y; previewRect.height = EditorGUIUtility.singleLineHeight; Rect buttonRect = previewRect; buttonRect.x = previewRect.xMax; buttonRect.width = BUTTON_WIDTH; using (new EditorGUI.DisabledScope(true)) { // NOTE(@jackson): The second param of GUIContent is a tooltip EditorGUI.LabelField(previewRect, new GUIContent(dir, dir)); } bool directoryIsValid = false; try { string testDir = dir; while (!directoryIsValid && !string.IsNullOrEmpty(testDir)) { testDir = Path.GetDirectoryName(testDir); directoryIsValid = Directory.Exists(testDir); } } catch { directoryIsValid = false; } using (new EditorGUI.DisabledScope(!directoryIsValid)) { string toolTip = null; if (directoryIsValid) { toolTip = "Locate directory"; } else { toolTip = "Invalid directory"; } if (GUI.Button(buttonRect, new GUIContent("...", toolTip))) { if (!Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } if (dir.StartsWith(Application.dataPath)) { string assetDir = dir.Substring(Application.dataPath.Length); assetDir = "Assets" + assetDir; var folderObject = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(assetDir); int folderId = folderObject.GetInstanceID(); EditorGUIUtility.PingObject(folderId); UnityEditor.Selection.activeObject = folderObject; } else { EditorUtility.RevealInFinder(dir); } } } }
public void Constructor_Should_Open_Given_Path() { IPluginSettings settings = new PluginSettings("a4t.xml"); settings.Keys.Count().Should().Be(10); }
public GeneralModuleConfigurationViewModel(Plugin plugin, PluginSettings settings) : base(plugin) { EnableActiveWindow = settings.GetSetting("EnableActiveWindow", true); AutoDefaultProfilesCreation = settings.GetSetting("AutoDefaultProfilesCreation", true); }
private double NextScanParameter(int pointNumber, int scanNumber) { PluginSettings outputSettings = config.outputPlugin.Settings; double scanParameter; string mode = (string)outputSettings["scanMode"]; switch (mode) { case "up": scanParameter = (double)outputSettings["start"] + ((double)outputSettings["end"] - (double)outputSettings["start"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); break; case "down": scanParameter = (double)outputSettings["end"] + ((double)outputSettings["start"] - (double)outputSettings["end"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); break; case "updown": if (scanNumber % 2 == 0) { scanParameter = (double)outputSettings["start"] + ((double)outputSettings["end"] - (double)outputSettings["start"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); } else { scanParameter = (double)outputSettings["end"] + ((double)outputSettings["start"] - (double)outputSettings["end"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); } break; case "downup": if (scanNumber % 2 != 0) { scanParameter = (double)outputSettings["start"] + ((double)outputSettings["end"] - (double)outputSettings["start"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); } else { scanParameter = (double)outputSettings["end"] + ((double)outputSettings["start"] - (double)outputSettings["end"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); } break; case "random": if (pointNumber == 0) { scanValues = new ArrayList(); for (int i = 0; i < (int)outputSettings["pointsPerScan"]; i++) // fill the array at the beginning of the scan { scanValues.Add((double)outputSettings["start"] + ((double)outputSettings["end"] - (double)outputSettings["start"]) * (i + 0.5) / ((int)outputSettings["pointsPerScan"])); } } Random rnd = new Random(); int selectedIndex = rnd.Next(0, scanValues.Count); scanParameter = (double)scanValues[selectedIndex]; scanValues.RemoveAt(selectedIndex); break; default: //scan up by default scanParameter = (double)outputSettings["start"] + ((double)outputSettings["end"] - (double)outputSettings["start"]) * (pointNumber + 0.5) / ((int)outputSettings["pointsPerScan"]); break; } return(scanParameter); }
public override void ShowOptionsForm(System.Windows.Forms.Form parentForm) { this.PluginSettings = Director.EditOptions(parentForm, this.PluginSettings); PluginSettingsSerializationHelper.SaveSettingsToFile(Director.PluginID, this.PluginSettings); }
public WS281XDeviceProvider(IRgbService rgbService, PluginSettings settings, ILogger logger) : base(RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance) { _settings = settings; _logger = logger; _rgbService = rgbService; }
public GeneralModule(IColorQuantizerService quantizerService, PluginSettings settings) { _quantizerService = quantizerService; _enableActiveWindow = settings.GetSetting("EnableActiveWindow", true); }
public void PerformUpdate() { Directory.CreateDirectory(HearthstoneCollectionTrackerPlugin.PluginDataDir); // move collection info file into data dir string oldCollectionFilePath = Path.Combine(Hearthstone_Deck_Tracker.Config.Instance.DataDir, "CardCollection.xml"); string newCollectionFilePath = Path.Combine(HearthstoneCollectionTrackerPlugin.PluginDataDir, "Collection_Default.xml"); if (File.Exists(oldCollectionFilePath)) { List <BasicSetCollectionInfo> oldSetInfo = Hearthstone_Deck_Tracker.XmlManager <List <BasicSetCollectionInfo> > .Load(oldCollectionFilePath); var cards = Hearthstone_Deck_Tracker.Hearthstone.Game.GetActualCards(); foreach (var set in oldSetInfo) { foreach (var card in set.Cards) { var originalCard = cards.FirstOrDefault(c => c.Id == card.CardId); if (originalCard != null) { card.DesiredAmount = originalCard.Rarity == "Legendary" ? 1 : 2; } } } // add TGT cards const string TGTSet = "The Grand Tournament"; oldSetInfo.Add(new BasicSetCollectionInfo() { SetName = TGTSet, Cards = cards.Where(c => c.Set == TGTSet).Select(c => new CardInCollection() { AmountGolden = 0, AmountNonGolden = 0, CardId = c.Id, DesiredAmount = c.Rarity == "Legendary" ? 1 : 2 }).ToList() }); Hearthstone_Deck_Tracker.XmlManager <List <BasicSetCollectionInfo> > .Save(newCollectionFilePath, oldSetInfo); File.Delete(oldCollectionFilePath); } PluginSettings settings = new PluginSettings() { CurrentVersion = new ModuleVersion(_version), Accounts = new List <AccountSummary>() { new AccountSummary() { AccountName = "Default", FileStoragePath = newCollectionFilePath } }, ActiveAccount = "Default", CollectionWindowWidth = 385, DefaultShowAllCards = false, NotifyNewDeckMissingCards = true }; string settingsFilePath = Path.Combine(HearthstoneCollectionTrackerPlugin.PluginDataDir, "config.xml"); Hearthstone_Deck_Tracker.XmlManager <PluginSettings> .Save(settingsFilePath, settings); }
public void Start() { var entMan = new EntityManager(); var relMan = new EntityRelationManager(); var recMan = new RecordManager(); var storeSystemSettings = DbContext.Current.SettingsRepository.Read(); var systemSettings = new SystemSettings(storeSystemSettings); //Open scope with a user we will use for the operations further ahead var user = new SecurityManager().GetUser(SystemIds.FirstUserId); using (SecurityContext.OpenScope(user)) { //Create transaction using (var connection = DbContext.Current.CreateConnection()) { try { connection.BeginTransaction(); //Here we need to initialize or update the environment based on the plugin requirements. //The default place for the plugin data is the "plugin_data" entity -> the "data" text field, which is used to store stringified JSON //containing the plugin settings or version #region << 1.Get the current ERP database version and checks for other plugin dependencies >> if (systemSettings.Version > 0) { //Do something if database version is not what you expect } //This plugin needs the webvella-crm plugin to be installed, so we will check this here var installedPlugins = new PluginService().Plugins; var corePluginFound = false; foreach (var plugin in installedPlugins) { if (plugin.Name == "webvella-core") { corePluginFound = true; break; } } if (!corePluginFound) { throw new Exception("'webvella-core' plugin is required for the 'webvella-crm' to operate"); } #endregion #region << 2.Get the current plugin settings from the database >> var currentPluginSettings = new PluginSettings(); QueryObject pluginDataQueryObject = EntityQuery.QueryEQ("name", WEBVELLA_CRM_PLUGIN_NAME); var pluginDataQuery = new EntityQuery("plugin_data", "*", pluginDataQueryObject); var pluginDataQueryResponse = recMan.Find(pluginDataQuery); if (!pluginDataQueryResponse.Success) { throw new Exception("plugin 'webvella-project' failed to get its settings due to: " + pluginDataQueryResponse.Message); } if (pluginDataQueryResponse.Object == null || !pluginDataQueryResponse.Object.Data.Any() || pluginDataQueryResponse.Object.Data[0]["data"] == DBNull.Value) { //plugin was not installed currentPluginSettings.Version = 20160429; { string json = JsonConvert.SerializeObject(currentPluginSettings); var settingsEntityRecord = new EntityRecord(); settingsEntityRecord["id"] = WEBVELLA_CRM_PLUGIN_ID; settingsEntityRecord["name"] = WEBVELLA_CRM_PLUGIN_NAME; settingsEntityRecord["data"] = json; var settingsSaveReponse = recMan.CreateRecord("plugin_data", settingsEntityRecord); if (!settingsSaveReponse.Success) { throw new Exception("plugin 'webvella-project' failed to save its settings in the database due to: " + pluginDataQueryResponse.Message); } } } else { string json = (string)((List <EntityRecord>)pluginDataQueryResponse.Object.Data)[0]["data"]; currentPluginSettings = JsonConvert.DeserializeObject <PluginSettings>(json); } #endregion #region << 3. Run methods based on the current installed version of the plugin >> if (currentPluginSettings.Version < 20160430) { currentPluginSettings.Version = 20160430; #region << Create CRM admin area >> //The areas are the main object for navigation for the user. You can attach entities and URLs later to them { var area = new EntityRecord(); area["id"] = CRM_ADMIN_AREA_ID; area["name"] = "crm_admin"; area["label"] = "CRM Admin"; area["icon_name"] = "users"; area["color"] = "pink"; area["folder"] = "Admin"; area["weight"] = 100; var areaRoles = new List <Guid>(); areaRoles.Add(SystemIds.AdministratorRoleId); area["roles"] = JsonConvert.SerializeObject(areaRoles); var createAreaResult = recMan.CreateRecord("area", area); if (!createAreaResult.Success) { throw new Exception("System error 10060. Area create with name : project_admin. Message:" + createAreaResult.Message); } } #endregion #region << wv_customer >> { #region << entity >> { InputEntity entity = new InputEntity(); entity.Id = CUSTOMER_ENTITY_ID; entity.Name = CUSTOMER_ENTITY_NAME; entity.Label = "Customer"; entity.LabelPlural = "Customers"; entity.System = true; entity.IconName = "building-o"; entity.Weight = 2; entity.RecordPermissions = new RecordPermissions(); entity.RecordPermissions.CanCreate = new List <Guid>(); entity.RecordPermissions.CanRead = new List <Guid>(); entity.RecordPermissions.CanUpdate = new List <Guid>(); entity.RecordPermissions.CanDelete = new List <Guid>(); //Create entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId); entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId); //READ entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId); entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId); //UPDATE entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId); entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId); { var response = entMan.CreateEntity(entity); if (!response.Success) { throw new Exception("System error 10050. Entity: " + CUSTOMER_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message); } } } #endregion #region << name >> { InputTextField textboxField = new InputTextField(); textboxField.Id = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9"); textboxField.Name = "name"; textboxField.Label = "Name"; textboxField.PlaceholderText = ""; textboxField.Description = ""; textboxField.HelpText = ""; textboxField.Required = true; textboxField.Unique = false; textboxField.Searchable = true; textboxField.Auditable = false; textboxField.System = true; textboxField.DefaultValue = string.Empty; textboxField.MaxLength = null; textboxField.EnableSecurity = true; textboxField.Permissions = new FieldPermissions(); textboxField.Permissions.CanRead = new List <Guid>(); textboxField.Permissions.CanUpdate = new List <Guid>(); //READ textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId); textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId); //UPDATE textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId); { var response = entMan.CreateField(CUSTOMER_ENTITY_ID, textboxField, false); if (!response.Success) { throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Field: name" + " Message:" + response.Message); } } } #endregion } #endregion #region << View name: admin_details >> { var createViewEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object; var createViewInput = new InputRecordView(); var viewRegion = new InputRecordViewRegion(); var viewSection = new InputRecordViewSection(); var viewRow = new InputRecordViewRow(); var viewColumn = new InputRecordViewColumn(); var viewItem = new InputRecordViewFieldItem(); #region << details >> createViewInput.Id = new Guid("3a0e1319-5357-49ec-9e85-8d9be2363fcf"); createViewInput.Type = "hidden"; createViewInput.Name = "admin_details"; createViewInput.Label = "Details"; createViewInput.Default = false; createViewInput.System = false; createViewInput.Weight = 15; createViewInput.CssClass = null; createViewInput.IconName = "building-o"; createViewInput.DynamicHtmlTemplate = null; createViewInput.DataSourceUrl = null; createViewInput.ServiceCode = null; createViewInput.Regions = new List <InputRecordViewRegion>(); #endregion #region << Header Region >> viewRegion = new InputRecordViewRegion(); viewRegion.Name = "header"; viewRegion.Label = "Header"; viewRegion.Render = true; viewRegion.Weight = 1; viewRegion.CssClass = ""; viewRegion.Sections = new List <InputRecordViewSection>(); #region << Section >> viewSection = new InputRecordViewSection(); viewSection.Id = Guid.NewGuid(); viewSection.Name = "details"; viewSection.Label = "Details"; viewSection.ShowLabel = false; viewSection.CssClass = ""; viewSection.Collapsed = false; viewSection.TabOrder = "left-right"; viewSection.Weight = 1; viewSection.Rows = new List <InputRecordViewRow>(); #region << Row >> viewRow = new InputRecordViewRow(); viewRow.Id = Guid.NewGuid(); viewRow.Weight = 1; viewRow.Columns = new List <InputRecordViewColumn>(); #region << Column 1 >> viewColumn = new InputRecordViewColumn(); viewColumn.GridColCount = 12; viewColumn.Items = new List <InputRecordViewItemBase>(); #region << name >> { viewItem = new InputRecordViewFieldItem(); viewItem.EntityId = CUSTOMER_ENTITY_ID; viewItem.EntityName = CUSTOMER_ENTITY_NAME; viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id; viewItem.FieldName = "name"; viewItem.Type = "field"; viewColumn.Items.Add(viewItem); } #endregion //Save column viewRow.Columns.Add(viewColumn); #endregion //Save row viewSection.Rows.Add(viewRow); #endregion //Save section viewRegion.Sections.Add(viewSection); #endregion //Save region createViewInput.Regions.Add(viewRegion); #endregion #region << relation options >> createViewInput.RelationOptions = new List <EntityRelationOptionsItem>(); #endregion #region << Sidebar >> createViewInput.Sidebar = new InputRecordViewSidebar(); createViewInput.Sidebar.CssClass = ""; createViewInput.Sidebar.Render = true; createViewInput.Sidebar.Render = true; createViewInput.Sidebar.Items = new List <InputRecordViewSidebarItemBase>(); #endregion #region << action items >> createViewInput.ActionItems = new List <ActionItem>(); var actionItem = new ActionItem(); { actionItem = new ActionItem(); actionItem.Name = "wv_record_delete"; actionItem.Menu = "page-title-dropdown"; actionItem.Weight = 1; actionItem.Template = "" + @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?"" ng-if=""ngCtrl.userHasRecordPermissions('canDelete')""> <i class=""fa fa-trash go-red""></i> Delete Record </a>" ; createViewInput.ActionItems.Add(actionItem); } { actionItem = new ActionItem(); actionItem.Name = "wv_back_button"; actionItem.Menu = "sidebar-top"; actionItem.Weight = 1; actionItem.Template = "" + @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>"; createViewInput.ActionItems.Add(actionItem); } #endregion { var response = entMan.CreateRecordView(CUSTOMER_ENTITY_ID, createViewInput); if (!response.Success) { throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Updated view: admin_details" + " Message:" + response.Message); } } } #endregion #region << View name: admin_create >> { var createViewEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object; var createViewInput = new InputRecordView(); var viewRegion = new InputRecordViewRegion(); var viewSection = new InputRecordViewSection(); var viewRow = new InputRecordViewRow(); var viewColumn = new InputRecordViewColumn(); var viewItem = new InputRecordViewFieldItem(); #region << details >> createViewInput.Id = new Guid("93043954-ae70-41a3-b4b7-665531a23a76"); createViewInput.Type = "create"; createViewInput.Name = "admin_create"; createViewInput.Label = "Create customer"; createViewInput.Default = false; createViewInput.System = false; createViewInput.Weight = 25; createViewInput.CssClass = null; createViewInput.IconName = "building-o"; createViewInput.DynamicHtmlTemplate = null; createViewInput.DataSourceUrl = null; createViewInput.ServiceCode = null; createViewInput.Regions = new List <InputRecordViewRegion>(); #endregion #region << Header Region >> viewRegion = new InputRecordViewRegion(); viewRegion.Name = "header"; viewRegion.Label = "Header"; viewRegion.Render = true; viewRegion.Weight = 1; viewRegion.CssClass = ""; viewRegion.Sections = new List <InputRecordViewSection>(); #region << Section >> viewSection = new InputRecordViewSection(); viewSection.Id = Guid.NewGuid(); viewSection.Name = "details"; viewSection.Label = "Details"; viewSection.ShowLabel = false; viewSection.CssClass = ""; viewSection.Collapsed = false; viewSection.TabOrder = "left-right"; viewSection.Weight = 1; viewSection.Rows = new List <InputRecordViewRow>(); #region << Row >> viewRow = new InputRecordViewRow(); viewRow.Id = Guid.NewGuid(); viewRow.Weight = 1; viewRow.Columns = new List <InputRecordViewColumn>(); #region << Column 1 >> viewColumn = new InputRecordViewColumn(); viewColumn.GridColCount = 12; viewColumn.Items = new List <InputRecordViewItemBase>(); #region << name >> { viewItem = new InputRecordViewFieldItem(); viewItem.EntityId = CUSTOMER_ENTITY_ID; viewItem.EntityName = CUSTOMER_ENTITY_NAME; viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id; viewItem.FieldName = "name"; viewItem.Type = "field"; viewColumn.Items.Add(viewItem); } #endregion //Save column viewRow.Columns.Add(viewColumn); #endregion //Save row viewSection.Rows.Add(viewRow); #endregion //Save section viewRegion.Sections.Add(viewSection); #endregion //Save region createViewInput.Regions.Add(viewRegion); #endregion #region << relation options >> createViewInput.RelationOptions = new List <EntityRelationOptionsItem>(); #endregion #region << Sidebar >> createViewInput.Sidebar = new InputRecordViewSidebar(); createViewInput.Sidebar.CssClass = ""; createViewInput.Sidebar.Render = true; createViewInput.Sidebar.Render = true; createViewInput.Sidebar.Items = new List <InputRecordViewSidebarItemBase>(); #endregion #region << action items >> createViewInput.ActionItems = new List <ActionItem>(); var actionItem = new ActionItem(); { actionItem = new ActionItem(); actionItem.Name = "wv_create_and_list"; actionItem.Menu = "create-bottom"; actionItem.Weight = 1; actionItem.Template = "" + @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""list"")' ng-if=""ngCtrl.createViewRegion != null"">Create & List</a>"; createViewInput.ActionItems.Add(actionItem); } { actionItem = new ActionItem(); actionItem.Name = "wv_create_and_details"; actionItem.Menu = "create-bottom"; actionItem.Weight = 2; actionItem.Template = "" + @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""ngCtrl.createViewRegion != null"">Create & Details</a>"; createViewInput.ActionItems.Add(actionItem); } { actionItem = new ActionItem(); actionItem.Name = "wv_create_cancel"; actionItem.Menu = "create-bottom"; actionItem.Weight = 3; actionItem.Template = "" + @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>"; createViewInput.ActionItems.Add(actionItem); } { actionItem = new ActionItem(); actionItem.Name = "wv_back_button"; actionItem.Menu = "sidebar-top"; actionItem.Weight = 1; actionItem.Template = "" + @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>"; createViewInput.ActionItems.Add(actionItem); } #endregion { var response = entMan.CreateRecordView(CUSTOMER_ENTITY_ID, createViewInput); if (!response.Success) { throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Updated view: admin_create" + " Message:" + response.Message); } } } #endregion #region << List name: admin >> { var createListEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object; var createListInput = new InputRecordList(); var listItem = new InputRecordListFieldItem(); var listSort = new InputRecordListSort(); var listQuery = new InputRecordListQuery(); #region << details >> createListInput.Id = new Guid("ff15f200-8e68-4683-8576-4c8244405ca9"); createListInput.Type = "hidden"; createListInput.Name = "admin"; createListInput.Label = "Customers"; createListInput.Weight = 11; createListInput.Default = false; createListInput.System = true; createListInput.CssClass = null; createListInput.IconName = "building-o"; createListInput.VisibleColumnsCount = 7; createListInput.ColumnWidthsCSV = null; createListInput.PageSize = 10; createListInput.DynamicHtmlTemplate = null; createListInput.DataSourceUrl = null; createListInput.ServiceCode = null; #endregion #region << action items >> createListInput.ActionItems = new List <ActionItem>(); var actionItem = new ActionItem(); { actionItem = new ActionItem(); actionItem.Name = "wv_record_details"; actionItem.Menu = "record-row"; actionItem.Weight = 1; actionItem.Template = "" + @"<a class=""btn btn-default btn-outline"" ng-href=""{{ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}""> <i class=""fa fa-fw fa-eye""></i> </a>" ; createListInput.ActionItems.Add(actionItem); } { actionItem = new ActionItem(); actionItem.Name = "wv_create_record"; actionItem.Menu = "page-title"; actionItem.Weight = 1; actionItem.Template = "" + @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""ngCtrl.userHasRecordPermissions('canCreate')"" ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}""> <i class=""fa fa-fw fa-plus""></i> Add New </a>"; createListInput.ActionItems.Add(actionItem); } #endregion #region << Columns >> createListInput.Columns = new List <InputRecordListItemBase>(); #region << name >> { var fieldName = "name"; listItem = new InputRecordListFieldItem(); listItem.EntityId = CUSTOMER_ENTITY_ID; listItem.EntityName = CUSTOMER_ENTITY_NAME; listItem.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id; listItem.FieldName = fieldName; listItem.Type = "field"; createListInput.Columns.Add(listItem); } #endregion #endregion #region << relation options >> createListInput.RelationOptions = new List <EntityRelationOptionsItem>(); #endregion #region << query >> listQuery = new InputRecordListQuery(); #endregion #region << Sort >> listSort = new InputRecordListSort(); #endregion { var response = entMan.CreateRecordList(CUSTOMER_ENTITY_ID, createListInput); if (!response.Success) { throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Updated List: admin" + " Message:" + response.Message); } } } #endregion #region << area add subscription: CRM Admin -> Customer >> { var updatedAreaId = CRM_ADMIN_AREA_ID; var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, CUSTOMER_ENTITY_NAME, "admin_details", "admin_create", "admin"); if (!updateAreaResult.Success) { throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message); } } #endregion #region << customer lookup list >> { var updateListEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object; var updateList = updateListEntity.RecordLists.Single(x => x.Name == "lookup"); var updateListInput = new InputRecordList(); var listItem = new InputRecordListFieldItem(); var listSort = new InputRecordListSort(); var listQuery = new InputRecordListQuery(); //Convert recordList to recordListInput updateListInput = updateList.DynamicMapTo <InputRecordList>(); //General list details //updateListInput.IconName = ""; //Fields #region << name >> listItem = new InputRecordListFieldItem(); listItem.EntityId = CUSTOMER_ENTITY_ID; listItem.EntityName = "customer"; listItem.FieldId = updateListEntity.Fields.Single(x => x.Name == "name").Id; listItem.FieldName = "name"; listItem.Type = "field"; updateListInput.Columns.Add(listItem); #endregion //Query #region << query descr >> listQuery = new InputRecordListQuery(); #endregion //Sort #region << Sort >> listSort = new InputRecordListSort(); listSort.FieldName = "name"; listSort.SortType = "ascending"; updateListInput.Sorts.Add(listSort); #endregion { var responseObject = entMan.UpdateRecordList(CUSTOMER_ENTITY_ID, updateListInput); if (!responseObject.Success) { throw new Exception("System error 10060. Entity: " + "user" + " Updated List: list_name" + " Message:" + responseObject.Message); } } } #endregion if (createSampleRecords) { #region << Create Sample Customer >> { var sampleRecord = new EntityRecord(); sampleRecord["id"] = new Guid("fb06213f-7632-495b-bb8d-ed5ff07dc515"); sampleRecord["name"] = "Buckley Miller & Wright"; var createSampleRecordResult = recMan.CreateRecord(CUSTOMER_ENTITY_NAME, sampleRecord); if (!createSampleRecordResult.Success) { throw new Exception("System error 10060. Create sample record. Message:" + createSampleRecordResult.Message); } } #endregion #region << Create Sample Customer User >> { var sampleRecord = new EntityRecord(); sampleRecord["id"] = new Guid("307fe376-a1c6-495e-a7c0-2a78797565f2"); sampleRecord["first_name"] = "Sample"; sampleRecord["last_name"] = "Customer"; sampleRecord["username"] = "******"; sampleRecord["email"] = "*****@*****.**"; sampleRecord["password"] = "******"; sampleRecord["enabled"] = true; sampleRecord["verified"] = true; sampleRecord["image"] = "/plugins/webvella-core/assets/avatar-deep-purple.png"; var createSampleRecordResult = recMan.CreateRecord(SystemIds.UserEntityId, sampleRecord); if (!createSampleRecordResult.Success) { throw new Exception("System error 10060. Create sample customer record. Message:" + createSampleRecordResult.Message); } } #endregion #region << Create Sample User Role>> { var sampleRecord = new EntityRecord(); sampleRecord["id"] = new Guid("27745245-09bd-4adb-8831-3870bcae46fe"); sampleRecord["name"] = "crm_customer"; sampleRecord["description"] = "Sample Customer role for CRM application"; var createSampleRecordResult = recMan.CreateRecord(SystemIds.RoleEntityId, sampleRecord); if (!createSampleRecordResult.Success) { throw new Exception("System error 10060. Create sample role record. Message:" + createSampleRecordResult.Message); } } #endregion #region << Create relation between sample customer and role >> { var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("27745245-09bd-4adb-8831-3870bcae46fe"), new Guid("307fe376-a1c6-495e-a7c0-2a78797565f2")); if (!createRelationNtoNResponse.Success) { throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message); } } #endregion #region << Create relation between sample customer and regular role >> { var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("f16ec6db-626d-4c27-8de0-3e7ce542c55f"), new Guid("307fe376-a1c6-495e-a7c0-2a78797565f2")); if (!createRelationNtoNResponse.Success) { throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message); } } #endregion } } #endregion #region << 4. Save needed changes to the plugin setting data >> { string json = JsonConvert.SerializeObject(currentPluginSettings); var settingsEntityRecord = new EntityRecord(); settingsEntityRecord["id"] = WEBVELLA_CRM_PLUGIN_ID; settingsEntityRecord["name"] = WEBVELLA_CRM_PLUGIN_NAME; settingsEntityRecord["data"] = json; var settingsUpdateReponse = recMan.UpdateRecord("plugin_data", settingsEntityRecord); if (!settingsUpdateReponse.Success) { throw new Exception("plugin 'webvella-project' failed to update its settings in the database due to: " + pluginDataQueryResponse.Message); } } #endregion connection.CommitTransaction(); } catch (Exception ex) { connection.RollbackTransaction(); throw ex; } } } }
public void UpdateSettings(PluginSettings settings) { }
public OscOnOff(SDConnection connection, InitialPayload payload) : base(connection, payload) { if (payload.Settings == null || payload.Settings.Count == 0) { this.settings = PluginSettings.CreateDefaultSettings(); Connection.SetSettingsAsync(JObject.FromObject(settings)); Logger.Instance.LogMessage(TracingLevel.INFO, $"OscOnOff: Settings initially set: {this.settings}"); } else { this.settings = payload.Settings.ToObject <PluginSettings>(); } /* if (this.settings.IncludeOscOnOff == true && this.settings.IP != null && this.settings.Name != null && this.settings.Port != 0 && this.settings.Bus != null) * { * if (payload.State == 1) * { * Image actionDefaultImage = Image.FromFile(@"Images/actionDefaultImage.png"); * var actionDefaultImageBase64 = Tools.ImageToBase64(actionDefaultImage, true); * Connection.SetImageAsync(actionDefaultImageBase64); * } * TotalMixListener(this.settings.Bus, this.settings.IP, this.settings.Port); * * var DictToUse = bankSettingInputBus; * if (this.settings.Bus == "Input") * { * DictToUse = bankSettingInputBus; * } * else if (this.settings.Bus == "Playback") * { * DictToUse = bankSettingPlaybackBus; * } * else if (this.settings.Bus == "Output") * { * DictToUse = bankSettingOutputBus; * } * if (DictToUse.ContainsKey(this.settings.Name)) * { * if (DictToUse.TryGetValue("/1/bus" + settings.Bus, out string busValue)) * { * if (busValue == "1") * { * if (DictToUse.TryGetValue(this.settings.Name, out string result)) * { * Logger.Instance.LogMessage(TracingLevel.INFO, "OscOnOff: In TotalMixListener: result: " + result); * Logger.Instance.LogMessage(TracingLevel.INFO, "OscOnOff: In TotalMixListener: settings.Name: " + settings.Name); * if (result == "1") * { * if (settings.Name.Contains("solo")) * { * * connection.StreamDeckConnection.SetStateAsync(1, connection.ContextId); * Image actionSoloImage = Image.FromFile(@"Images/actionSoloImage.png"); * var actionSoloImageBase64 = Tools.ImageToBase64(actionSoloImage, true); * Connection.SetImageAsync(actionSoloImageBase64); * * } * else * { * connection.StreamDeckConnection.SetStateAsync(1, connection.ContextId); * Image actionMutedImage = Image.FromFile(@"Images/actionMutedImage.png"); * var actionMutedImageBase64 = Tools.ImageToBase64(actionMutedImage, true); * Connection.SetImageAsync(actionMutedImageBase64); * * } * } * } * else * { * Logger.Instance.LogMessage(TracingLevel.INFO, "OscOnOff: Could not find the specific key in bankSetting dict"); * } * } * } * } * }*/ }
private void cmbSort_SelectedIndexChanged(object sender, EventArgs e) { PluginSettings.SetSetting("SortBy", cmbSort.Text); }
public void ProcessPatches() { using (SecurityContext.OpenSystemScope()) { var entMan = new EntityManager(); var relMan = new EntityRelationManager(); var recMan = new RecordManager(); var storeSystemSettings = DbContext.Current.SettingsRepository.Read(); var systemSettings = new SystemSettings(storeSystemSettings); //Create transaction using (var connection = DbContext.Current.CreateConnection()) { try { connection.BeginTransaction(); //Here we need to initialize or update the environment based on the plugin requirements. //The default place for the plugin data is the "plugin_data" entity -> the "data" text field, which is used to store stringified JSON //containing the plugin settings or version //TODO: Develop a way to check for installed plugins #region << 1.Get the current ERP database version and checks for other plugin dependencies >> if (systemSettings.Version > 0) { //Do something if database version is not what you expect } #endregion #region << 2.Get the current plugin settings from the database >> var currentPluginSettings = new PluginSettings() { Version = WEBVELLA_PROJECT_INIT_VERSION }; string jsonData = GetPluginData(); if (!string.IsNullOrWhiteSpace(jsonData)) { currentPluginSettings = JsonConvert.DeserializeObject <PluginSettings>(jsonData); } #endregion #region << 3. Run methods based on the current installed version of the plugin >> //Patch 20190203 { var patchVersion = 20190203; if (currentPluginSettings.Version < patchVersion) { try { currentPluginSettings.Version = patchVersion; Patch20190203(entMan, relMan, recMan); } catch (ValidationException ex) { var exception = ex; throw ex; } catch (Exception ex) { var exception = ex; throw ex; } } } //Patch 20190205 { var patchVersion = 20190205; if (currentPluginSettings.Version < patchVersion) { try { currentPluginSettings.Version = patchVersion; Patch20190205(entMan, relMan, recMan); } catch (ValidationException ex) { var exception = ex; throw ex; } catch (Exception ex) { var exception = ex; throw ex; } } } //Patch 20190206 { var patchVersion = 20190206; if (currentPluginSettings.Version < patchVersion) { try { currentPluginSettings.Version = patchVersion; Patch20190206(entMan, relMan, recMan); } catch (ValidationException ex) { var exception = ex; throw ex; } catch (Exception ex) { var exception = ex; throw ex; } } } //Patch 20190207 { var patchVersion = 20190207; if (currentPluginSettings.Version < patchVersion) { try { currentPluginSettings.Version = patchVersion; Patch20190207(entMan, relMan, recMan); } catch (ValidationException ex) { var exception = ex; throw ex; } catch (Exception ex) { var exception = ex; throw ex; } } } //Patch 20190208 { var patchVersion = 20190208; if (currentPluginSettings.Version < patchVersion) { try { currentPluginSettings.Version = patchVersion; Patch20190208(entMan, relMan, recMan); } catch (ValidationException ex) { var exception = ex; throw ex; } catch (Exception ex) { var exception = ex; throw ex; } } } #endregion SavePluginData(JsonConvert.SerializeObject(currentPluginSettings)); connection.CommitTransaction(); //connection.RollbackTransaction(); } catch (ValidationException ex) { connection.RollbackTransaction(); throw ex; } catch (Exception ex) { connection.RollbackTransaction(); throw ex; } } } }
private void dtpEndTime_ValueChanged(object sender, EventArgs e) { PluginSettings.SetSetting("EndTime", dtpEndTime.Value.ToString()); }
public void ProcessPatches() { using (SecurityContext.OpenSystemScope()) { var entMan = new EntityManager(); var relMan = new EntityRelationManager(); var recMan = new RecordManager(); var storeSystemSettings = DbContext.Current.SettingsRepository.Read(); var systemSettings = new SystemSettings(storeSystemSettings); //Create transaction using (var connection = DbContext.Current.CreateConnection()) { try { connection.BeginTransaction(); //Here we need to initialize or update the environment based on the plugin requirements. //The default place for the plugin data is the "plugin_data" entity -> the "data" text field, which is used to store stringified JSON //containing the plugin settings or version //TODO: Develop a way to check for installed plugins #region << 1.Get the current ERP database version and checks for other plugin dependencies >> if (systemSettings.Version > 0) { //Do something if database version is not what you expect } //This plugin needs the webvella-sdk plugin to be installed, so we will check this here //var installedPlugins = new PluginService().Plugins; //var corePluginFound = false; //foreach (var plugin in installedPlugins) //{ // if (plugin.Name == "webvella-core") // { // corePluginFound = true; // break; // } //} //if (!corePluginFound) // throw new Exception("'webvella-sdk' plugin is required for the 'webvella-sdk' to operate"); #endregion #region << 2.Get the current plugin settings from the database >> var currentPluginSettings = new PluginSettings() { Version = WEBVELLA_SDK_INIT_VERSION }; string jsonData = GetPluginData(); if (!string.IsNullOrWhiteSpace(jsonData)) { currentPluginSettings = JsonConvert.DeserializeObject <PluginSettings>(jsonData); } #endregion #region << 3. Run methods based on the current installed version of the plugin >> //this patch creates SDK application //duplicate this IF for next patches if (currentPluginSettings.Version < 20181215) { try { currentPluginSettings.Version = 20181215; Patch20181215(entMan, relMan, recMan); } catch (Exception ex) { var exception = ex; throw ex; } } //this patch creates SDK application //duplicate this IF for next patches if (currentPluginSettings.Version < 20190227) { try { currentPluginSettings.Version = 20190227; Patch20190227(entMan, relMan, recMan); } catch (Exception ex) { var exception = ex; throw ex; } } if (currentPluginSettings.Version < 20200610) { try { currentPluginSettings.Version = 20200610; Patch20200610(entMan, relMan, recMan); } catch (Exception ex) { var exception = ex; throw ex; } } if (currentPluginSettings.Version < 20201221) { try { currentPluginSettings.Version = 20201221; Patch20201221(entMan, relMan, recMan); } catch (Exception ex) { var exception = ex; throw ex; } } if (currentPluginSettings.Version < 20210429) { try { currentPluginSettings.Version = 20210429; Patch20210429(entMan, relMan, recMan); } catch (Exception ex) { var exception = ex; throw ex; } } #endregion SavePluginData(JsonConvert.SerializeObject(currentPluginSettings)); connection.CommitTransaction(); //connection.RollbackTransaction(); } catch (Exception ex) { connection.RollbackTransaction(); throw ex; } } } }
private void chlAttributes_ItemCheck(object sender, EventArgs e) { ItemCheckEventArgs args = (ItemCheckEventArgs)e; switch (args.Index) { case 0: PluginSettings.SetSetting("MaxHitParty", Checked(args.NewValue)); break; case 1: PluginSettings.SetSetting("TotalHealing", Checked(args.NewValue)); break; case 2: PluginSettings.SetSetting("MapName", Checked(args.NewValue)); break; case 3: PluginSettings.SetSetting("DamagePerc", Checked(args.NewValue)); break; case 4: PluginSettings.SetSetting("MaxHitIndividual", Checked(args.NewValue)); break; case 5: PluginSettings.SetSetting("HPS", Checked(args.NewValue)); break; case 6: PluginSettings.SetSetting("HealingPerc", Checked(args.NewValue)); break; case 7: PluginSettings.SetSetting("MaxHeal", Checked(args.NewValue)); break; case 8: PluginSettings.SetSetting("OverHealPerc", Checked(args.NewValue)); break; case 9: PluginSettings.SetSetting("Deaths", Checked(args.NewValue)); break; case 10: PluginSettings.SetSetting("Crit", Checked(args.NewValue)); break; case 11: PluginSettings.SetSetting("DirectHit", Checked(args.NewValue)); break; case 12: PluginSettings.SetSetting("DirectHitCrit", Checked(args.NewValue)); break; case 13: PluginSettings.SetSetting("CritHealPerc", Checked(args.NewValue)); break; } }
/// <summary> /// See interface docs. /// </summary> /// <param name="pluginSettings"></param> public void Save(PluginSettings pluginSettings) { if(pluginSettings == null) throw new ArgumentNullException("pluginSettings"); lock(_SyncLock) { List<string> lines = new List<string>(); for(int i = 0;i < pluginSettings.Values.Count;++i) { var key = pluginSettings.Values.Keys[i]; var value = pluginSettings.Values[i]; if(value != null) value = HttpUtility.UrlEncode(value); lines.Add(String.Format("{0}={1}", key, value)); } Provider.FileWriteAllLines(FileName, lines.ToArray()); } OnConfigurationChanged(EventArgs.Empty); }
public void Get_Should_Return_Client_Only_Deserialized_Object_From_Root() { IPluginSettings settings = new PluginSettings("a4t.typed.xml"); var person = settings.Get<StronglyTypedPerson>(true); person.WasServerKeyLoaded.Should().BeFalse(); person.Name.Should().Be("SDLGuy"); person.Age.Should().Be(99); person.IsOld.Should().BeTrue(); person.Favorites.Count().Should().Be(3); person.Favorites.ElementAt(1).Should().Be("Anguilla"); }