private CEUtil(string ceUri, string osName, string ceUser, string password, LogMsg logMsg) { #if (P8_451) // P8 4.5 authentication UsernameToken token = new UsernameToken(ceUser, password, PasswordOption.SendPlainText); UserContext.SetProcessSecurityToken(token); #else // P8 5.0 authentication UsernameCredentials cred = new UsernameCredentials(ceUser, password); ClientContext.SetProcessCredentials(cred); #endif conn = Factory.Connection.GetConnection(ceUri); isCredentialsEstablished = true; // Get domain name PropertyFilter pf = new PropertyFilter(); pf.AddIncludeProperty(0, null, null, "Name", null); pf.AddIncludeProperty(0, null, null, "Id", null); domain = Factory.Domain.FetchInstance(conn, null, null); objStore = Factory.ObjectStore.FetchInstance(domain, osName, null); // Successfully initialized CEUtil object: save singleton instance this.logMsg = logMsg; gCEUtil = this; }
internal LocalRecordStoreTable(IObjectStore root) { m_root = root; m_storageLock = new CrossThreadLock(false); m_itemCache = new LRUCache<string, object>(0); m_recordStores = new Dictionary<string, LocalRecordStore>(); m_commitScheduler = new RecordItemCommitScheduler(this); }
public IntermediateController( ILogger logger, IObjectStore objectStore, IEmailService emailService, ISearchService searchService) : base(logger, objectStore, emailService) { _SearchService = searchService; }
public LocalisationController(ILogger logger, IObjectStore objectStore, IEmailService emailService, ISearchService searchService) : base(logger, objectStore, emailService) { _SearchService = searchService; }
public StateTracker(IObjectStore objectStore, ITriggerPersist globalAutoPersistTrigger) { ObjectStore = objectStore; AutoPersistTrigger = globalAutoPersistTrigger; if (AutoPersistTrigger != null) AutoPersistTrigger.PersistRequired += (s, e) => RunAutoPersist(); }
public ProfilController(ILogger logger, IObjectStore objectStore, IEmailService emailService, IMembershipService membershipService) : base(logger, objectStore, emailService) { _MembershipService = membershipService; }
internal LocalVault(HealthVaultApp app, IObjectStore vocabStore, IObjectStore recordStore) { m_app = app; m_vocabRoot = vocabStore; m_recordRoot = recordStore; m_vocabStore = new LocalVocabularyStore(m_app, m_vocabRoot); m_recordStores = new LocalRecordStoreTable(m_recordRoot); }
public bool Login() { UserContext.SetProcessSecurityToken(new UsernameToken(_userName, _userPass, PasswordOption.SendPlainText)); _connection = Factory.Connection.GetConnection(_webServiceURI); _domain = Factory.Domain.FetchInstance(_connection, "", null); _objectStore = Factory.ObjectStore.FetchInstance(_domain, _objStoreName, null); return true; }
public PayPalController(ICustomerRepository customerRepository, ICMSRepository cmsRepository, IObjectStore objectStore) : base(customerRepository,objectStore,cmsRepository) { _cmsRepository = cmsRepository; _objectStore = objectStore; _customerRepository = customerRepository; this.ThemeName = "Admin"; }
private static void UpdateSingleDocument(JObject document, IObjectStore store) { var objid = (string)document[DocumentMetadata.IdPropertyName]; var obj = JObject.Parse(store.GetById(objid)); foreach (var p in GetRealProperties(document)) // remove properties starting with obj[p] = document[p]; store.Set(objid, obj); }
protected IObjectStore<string> NewObjectStore(string fileName = null, Action<Settings> modifySettings = null) { _lastFileName = fileName ?? Path.GetRandomFileName(); var settings = new Settings(_lastFileName) { Serializer = new ServiceStackSerializer() }; if (modifySettings != null) modifySettings(settings); _lastObjectStore = Raptile.OpenObjectStore<string>(settings); return _lastObjectStore; }
public ClientController(ILogger logger, IObjectStore objectStore, IEmailService emailService, IMembershipService membershipService, IInvoiceService invoiceService) : base(logger, objectStore, emailService) { _MembershipService = membershipService; _InvoiceService = invoiceService; }
public BookingController( ILogger logger, IObjectStore objectStore, IMembershipService membershipService, IEmailService emailService, IPaymentService paymentService) : base(logger, objectStore, emailService) { _MembershipService = membershipService; _PaymentService = paymentService; }
private static void UpdateSingleDocument(BSonDoc document, IObjectStore store) { var obj = store.GetById((byte[])document[DocumentMetadata.IdPropertyName]); BSonDoc val = GetValue(document); foreach (var p in GetRealProperties(val)) // remove properties starting with if (document.HasProperty(p)) obj[p] = val[p]; store.Set(obj); }
public AccountController( IFormsAuthenticationService formsService, IMembershipService membershipService, ILogger logger, IEmailService emailService, IObjectStore objectStore) : base(logger, objectStore, emailService) { this._FormsService = formsService; this._MembershipService = membershipService; }
public void Given() { _store = NewObjectStore(modifySettings: s => { s.AddNamedGroup<Foo>("FoosWithB", f => f.Name.StartsWith("B")); s.AddPropertyIndex<Foo>("name", f => new { f.Name }); }); _store.Set("123", new Foo { Name = "Belzebub"}); _store.Set("100", new Foo { Name = "Aaron", Time = new DateTime(2011,6,6) }); }
/// <summary> /// Instantiates a new WocketRepository. /// </summary> public WocketRepository() { // ObjectStores are created by the factory and are singleton per type. // IE, there will only ever be one Wocket ObjectStore. var factory = new ObjectStoreFactory(); _objectStore = factory.CreateObjectStore<Wocket>(); // As an alternate, you could make an IoC container responsible for // instantiating the ObjectFactory and only use the Dependency-Injection // constructor below. }
/// <summary> /// Initializes a new instance of the <see cref="ProcessReplaceRulesProvider"/> class. /// </summary> /// <param name="objectStore"> /// </param> /// <param name="serviceLocator"> /// The service locator. /// </param> /// <param name="injectServices"> /// The inject services. /// </param> /// <param name="uniqueFlags"> /// The unique Flags. /// </param> public ProcessReplaceRulesProvider( [NotNull] IObjectStore objectStore, [NotNull] IServiceLocator serviceLocator, [NotNull] IInjectServices injectServices, [NotNull] IEnumerable <bool> uniqueFlags) { this.ServiceLocator = serviceLocator; this._objectStore = objectStore; this._injectServices = injectServices; this._uniqueFlags = uniqueFlags; }
/// <summary> /// The remote all where. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> /// <param name="whereFunc"> /// The where function. /// </param> /// <typeparam name="T"> /// </typeparam> public static void Remove( [NotNull] this IObjectStore objectStore, [NotNull] Func <string, bool> whereFunc) { CodeContracts.VerifyNotNull(objectStore, "objectStore"); CodeContracts.VerifyNotNull(whereFunc, "whereFunc"); foreach (var i in objectStore.GetAll <object>().Where(k => whereFunc(k.Key)).ToList()) { objectStore.Remove(i.Key); } }
/// <summary> /// The remote all where. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> /// <param name="whereFunc"> /// The where function. /// </param> /// <typeparam name="T"> /// </typeparam> public static void RemoveOf <T>( [NotNull] this IObjectStore objectStore, [NotNull] Func <KeyValuePair <string, T>, bool> whereFunc) { CodeContracts.VerifyNotNull(objectStore, "objectStore"); CodeContracts.VerifyNotNull(whereFunc, "whereFunc"); foreach (var i in objectStore.GetAll <T>().Where(whereFunc).ToList()) { objectStore.Remove(i.Key); } }
public void CanGetBooleanValues() { string test = "boolean: true"; IObjectStore n = test.ParseYaml(); Assert.True(n.GetBool("boolean")); string falsies = "boolean: false"; n = falsies.ParseYaml(); Assert.False(n.GetBool("boolean")); }
private T InstantiateObject(IObjectStore objectInformation) { if (objectInformation.HasKey("custom-implementation")) { var typename = objectInformation.GetString("custom-implementation"); return(typename.Instantiate <T>(objectInformation)); } else { return(entityType.Instantiate <T>(objectInformation)); } }
private static void UpdateSingleDocument(JObject document, IObjectStore store) { var objid = (string)document[DocumentMetadata.IdPropertyName]; var obj = JObject.Parse(store.GetById(objid)); foreach (var p in GetRealProperties(document)) // remove properties starting with { obj[p] = document[p]; } store.Set(objid, obj); }
public Armor(IObjectStore data) { ShortLog.DebugFormat("Loading Armor: {0}", data.GetString("name")); this.Name = data.GetString("name"); this.ArmorClass = data.GetInteger("armor_class"); this.Weight = data.GetFloat("weight"); this.MaximumDexterityBonus = data.GetInteger("maximum_dexterity_bonus"); this.ArmorCheckPenalty = data.GetInteger("armor_check_penalty"); this.ArcaneSpellFailureChance = data.GetInteger("arcane_spell_failure_chance"); this.ArmorType = data.GetEnum <ArmorType>("armor_type"); this.Value = data.GetString("cost").ToCoinValue(); }
public LevelingClassFeature(IObjectStore configuration) : base(configuration) { var levelConfiguration = configuration.GetObjectListOptional("levels"); if (levelConfiguration != null) { foreach (var l in levelConfiguration) { levels.Add(new Level(l)); } } }
public ClassOriginGroup(IObjectStore data) { Origins = new WeightedOptionTable <ClassOrigin>(); Name = data.GetString("class"); var table = data.GetObjectList("table"); foreach (var entry in table) { var origin = new ClassOrigin(Name, entry); Origins.AddEntry(origin, origin.Weighting); } }
public HomelandGroup(IObjectStore data) { Homelands = new WeightedOptionTable <Homeland>(); Name = data.GetString("race"); var table = data.GetObjectList("table"); foreach (var entry in table) { var homeland = new Homeland(Name, entry); Homelands.AddEntry(homeland, homeland.Weighting); } }
public CombatStyle(IObjectStore configuration) { this.CombatStyleName = configuration.GetString("name"); bonusFeats = new Dictionary <int, string[]>(); var bonus = configuration.GetObjectList("bonus-feats"); foreach (var level in bonus) { bonusFeats.Add(level.GetInteger("level"), level.GetList("feats")); } }
public CachingObjectStore(IObjectStore inner, ICache <string, object> cache) { if (inner == null) { throw new ArgumentNullException("inner"); } if (cache == null) { throw new ArgumentNullException("cache"); } m_inner = inner; m_cache = cache; }
public DefaultObjectUpdateService( ILogger <DefaultObjectUpdateService> logger, IMetadataStore metadataStore, IObjectStore objectStore, ISubscriberStore subscriberStore, ISubscriberQueueStore subscriberQueueStore) { this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.metadataStore = metadataStore ?? throw new ArgumentNullException(nameof(metadataStore)); this.objectStore = objectStore ?? throw new ArgumentNullException(nameof(objectStore)); this.subscriberStore = subscriberStore ?? throw new ArgumentNullException(nameof(subscriberStore)); this.subscriberQueueStore = subscriberQueueStore ?? throw new ArgumentNullException(nameof(subscriberQueueStore)); }
public void GetListWillReturnStringListIfKeyHasChildren() { string list = @"--- list: - one - two - three "; IObjectStore parsedYaml = list.ParseYaml(); string[] items = parsedYaml.GetList("list"); Assert.Equal(new string[] { "one", "two", "three" }, items); }
internal LocalItemStore(IObjectStore store, ICache <string, object> cache) { m_lock = new CrossThreadLock(false); if (cache != null) { m_objectStore = new CachingObjectStore(store, cache); } else { m_objectStore = store; } }
/// <summary> /// Returns the XML deserialized object data for the specified key /// </summary> /// <param name="store">The object store instance</param> /// <param name="key">The object key</param> /// <param name="encoding">The string encoding used</param> /// <returns>An object containing the data</returns> public static T ReadXml <T>(this IObjectStore store, string key, Encoding encoding = null) { encoding = encoding ?? Encoding.UTF8; var xml = store.Read(key, encoding); var serializer = new XmlSerializer(typeof(T)); using (var reader = new StringReader(xml)) { return((T)serializer.Deserialize(reader)); } }
internal LocalItemStore(IObjectStore store, ICache<string, object> cache) { m_lock = new CrossThreadLock(false); if (cache != null) { m_objectStore = new CachingObjectStore(store, cache); } else { m_objectStore = store; } }
/// <summary> /// The get. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> /// <param name="originalKey"> /// The original key. /// </param> /// <typeparam name="T"> /// </typeparam> /// <returns> /// </returns> public static T Get <T>([NotNull] this IObjectStore objectStore, [NotNull] string originalKey) { CodeContracts.VerifyNotNull(objectStore, "objectStore"); CodeContracts.VerifyNotNull(originalKey, "originalKey"); var item = objectStore.Get(originalKey); if (item is T) { return((T)item); } return(default);
public SpellList(IObjectStore data) : this() { Class = data.GetString("class"); var levelData = data.GetObject("levels"); foreach (var key in levelData.Keys) { var level = int.Parse(key); var spells = levelData.GetList(key); Levels.Add(level, spells); } }
public CachingObjectStore(IObjectStore inner, ICache<string, object> cache) { if (inner == null) { throw new ArgumentNullException("inner"); } if (cache == null) { throw new ArgumentNullException("cache"); } m_inner = inner; m_cache = cache; }
public CharacterWealth(IObjectStore data) : this() { Name = data.GetString("name"); var levels = data.GetObjectList("levels"); foreach (var c in levels) { var wl = new CharacterWealthLevel(); wl.Level = c.GetInteger("level"); wl.Value = c.GetString("amount").ToCoinValue(); Levels.Add(wl); } }
/// <summary> /// Saves the object data in XML format for the specified key /// </summary> /// <param name="store">The object store instance</param> /// <param name="key">The object key</param> /// <param name="obj">The object to be saved</param> /// <param name="encoding">The string encoding used</param> /// <returns>True if the object was saved successfully</returns> public static bool SaveXml <T>(this IObjectStore store, string key, T obj, Encoding encoding = null) { encoding = encoding ?? Encoding.UTF8; using (var writer = new StringWriter()) { var serializer = new XmlSerializer(typeof(T)); serializer.Serialize(writer, obj); var xml = writer.ToString(); return(store.SaveString(key, xml, encoding)); } }
private void LoadObject(IObjectStore data) { Name = data.GetString("name"); ShortLog.Debug("Loading Race: " + Name); SizeSetting = (CharacterSize)System.Enum.Parse(typeof(CharacterSize), data.GetString("size")); HeightRange = DiceStrings.ParseDice(data.GetString("height")); WeightRange = DiceStrings.ParseDice(data.GetString("weight")); BaseMovementSpeed = data.GetInteger("basemovementspeed"); var languages = data.GetObject("languages"); KnownLanguages.Add(languages.GetListOptional("known")); AvailableLanguages.Add(languages.GetListOptional("available")); }
/// <summary> /// Get the file contract batch from the parse store /// </summary> /// <param name="parseStorePath">Location for reading the parsed content</param> /// <param name="metaDataStoresPath">MetaDataStore data location</param> /// <param name="skip">Number of files to skip from parse store</param> /// <param name="take">Number of files to pick in this batch from parse store. Set it to -1 to create batch based on size</param> /// <param name="size">Size of files in this batch. Set it to -1 to prepare batch based on file count</param> public IEnumerable <IFileContract> GetFileContractBatch(IObjectStore parseStore, IMetaDataStore metaDataStore, int skip, int take, long size = -1) { if (null == parseStore) { throw new ArgumentNullException("GetFileContractBatch", "parsestore"); } if (null == metaDataStore) { throw new ArgumentNullException("GetFileContractBatch", "metaDataStore"); } return(m_fileContracter.GetFileContractBatch(parseStore, metaDataStore, skip, take, size)); }
public RegistrationService( IObjectStore objectStore) { _objectStore = objectStore; if (_objectStore.KeyExists(storeKey)) { _registrations = objectStore.LoadObject <List <UserRegistration> >(storeKey); } else { _registrations = new List <UserRegistration>(); } }
public ArmorTraining(IObjectStore configuration) : base(configuration) { MaxDexBonusModifier = new DelegateStatModifier( StatNames.MaxDexterityBonus, "Ability", () => { return(this.TotalValue); } ); ArmorCheckBonusModifier = new DelegateStatModifier( StatNames.ArmorCheckPenalty, "Ability", () => { return(this.TotalValue); } ); }
public SpellCasting(IObjectStore configuration, EntityGateway <SpellList> spellLists) { this.SpellListName = configuration.GetString("list"); this.SpellList = spellLists.Find(this.SpellListName); this.SpellType = configuration.GetEnum <SpellType>("spell-type"); this.castingAbilityType = configuration.GetEnum <AbilityScoreTypes>("casting-ability"); var slots = configuration.GetObject("spell-slots"); foreach (var slot in slots.Keys) { var spellCounts = slots.GetList(slot).Select(x => x.ToInteger()).ToArray(); spellSlots.Add(slot.ToInteger(), spellCounts); } }
public override void OnHandle(IStore store, string collection, JObject command, JObject document) { IObjectStore st = store.GetCollection(collection); if (document != null) { JToken r = document.Property(CommandKeyword.Id); st.Set((string)r, document); return; } }
public TemplateSentenceGenerator(IObjectStore data) : this() { Name = data.GetString("name"); var descs = data.GetObjectListOptional("descriptors"); LoadDescriptors(descs); var temps = data.GetObjectListOptional("templates"); if (temps != null) { this.Templates.Add(temps.Select(x => new PhraseTemplate(x.GetString("template")))); } }
private void SetupKernel() { using (var kernel = CreateKernel()) { m_ObjectStore = kernel.Get <IObjectStore>(); m_Log = kernel.Get <ILoggerFactory>().GetCurrentClassLogger(); m_ScriptFactory = kernel.Get <IScriptFactory>(); m_ParameterFactory = kernel.Get <IParameterFactory>(); if (DirtyRangeFlagger.IsEnabled()) { m_DirtyRangeFlagger = kernel.Get <DirtyRangeFlagger>(); } } }
public IEnumerable <Feat> Load(IObjectStore configuration) { var craftsmanFeats = new List <Feat>(); var skills = GatewayProvider.Get <Skill>().Where(x => x.IsProfessionSkill || x.IsCraftSkill); foreach (var skl in skills) { var yaml = configuration.GetString("loader-template"); yaml = yaml.Formatted(skl.Name); var crft = new Feat(yaml.ParseYaml()); craftsmanFeats.Add(crft); } return(craftsmanFeats); }
internal RecordItemChangeTable(IObjectStore changeStore, ICache<string, object> cache) { if (changeStore == null) { throw new ArgumentNullException("changeStore"); } if (cache != null) { m_changeStore = new CachingObjectStore(changeStore, cache); } else { m_changeStore = changeStore; } m_lock = new CrossThreadLock(false); }
public void Given() { _store = NewObjectStore(); for (var i = 0; i < 4000; i++) _store.Set(i.ToString(), new Foo {Name = Path.GetRandomFileName()}); _store.Set("12345", new Foo { Name = "Alfred" }); for (var i = 4000; i < 8000; i++) _store.Set(i.ToString(), new Foo {Name = Path.GetRandomFileName()}); _store.Set("54321", new Foo { Name = "Arthur" }); _store = ReloadObjectStore(); }
public InMemoryObjectStoreActorTest(ITestOutputHelper output) { var converter = new Converter(output); Console.SetOut(converter); _persistInterest = new MockPersistResultInterest(); _queryResultInterest = new MockQueryResultInterest(); _world = World.StartWithDefaults("test-object-store"); var entryAdapterProvider = new EntryAdapterProvider(_world); entryAdapterProvider.RegisterAdapter(new Test1SourceAdapter()); _dispatcher = new MockDispatcher <Test1Source, ObjectEntry <Test1Source>, State <string> >(new MockConfirmDispatchedResultInterest()); _objectStore = _world.ActorFor <IObjectStore>(typeof(Vlingo.Symbio.Store.Object.InMemory.InMemoryObjectStoreActor <Test1Source, ObjectEntry <Test1Source>, State <string> >), _dispatcher); }
/// <summary> /// Private constructor /// </summary> /// <param keyName="userName">Username for Connect Engine</param> /// <param keyName="password">Password for Connect Engine</param> /// <param keyName="uri">URI</param> /// <param keyName="osName">Object Store Name</param> private CEConnection(string userName, string password, string uri, string osName) { //logger.Debug("Initializing " + typeof(CEConnection)); System.Net.ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true; UsernameCredentials creds = new UsernameCredentials(userName, password); // Associate this ClientContext with the whole process. ClientContext.SetProcessCredentials(creds); // Get the connection and default domain. this._connection = Factory.Connection.GetConnection(uri); this._domain = Factory.Domain.GetInstance(this._connection, null); // Get an object store. this._objectStore = Factory.ObjectStore.FetchInstance(this._domain, osName, null); }
public static IEnumerable<XElement> EnumModbusSlaveNodes(IObjectStore store) { var cfg = default(XDocument); try { cfg = XDocument.Load(new StringReader(store.ReadObject("", CodesysConst.CFG))); } catch (XmlException xe) { TRACE.TraceEvent(TraceEventType.Error, 0, "XML exception at PLC config loading: “{0}”. Returning empty node collection.", xe.Message); return Enumerable.Empty<XElement>(); } return cfg.Root .Elements("module") .Elements("module-list") .Elements("module") .Where(x => (string)x.Attribute("type-name") == "MODBUS_ID400"); }
public void Given() { _store = NewObjectStore(); _store.Set("12345", new Foo { Name = "Alfred"}); }
public HomeController(ILogger logger, IObjectStore objectStore, Worki.Infrastructure.Email.IEmailService emailService, IBlogService blogService) : base(logger,objectStore,emailService) { this._IBlogService = blogService; }
public ControllerBase(ILogger logger,IObjectStore objectStore, IEmailService emailService) { this._Logger = logger; this._ObjectStore = objectStore; this._EmailService = emailService; }
/// <summary> /// Instantiates a new WocketRepository with Dependency Injection. /// </summary> /// <param name="objectStore">Instance of IObjectStore to use.</param> public WocketRepository(IObjectStore<Wocket> objectStore) { _objectStore = objectStore; }
public void TearDown() { _objectStore = null; }
public EncryptedObjectStore(IObjectStore inner, ICryptographer cryptographer, string encryptionKey) { m_inner = inner; m_cryptographer = cryptographer; m_encryptionKey = encryptionKey; }
public TransactionManager(IObjectStore objectStore) { Assert.AssertNotNull(objectStore); this.objectStore = objectStore; }