public RecentFileList(IPersist persister) { this.Persister = persister; this.FileList = new ObservableCollection <RecentFile>(); LoadRecent(); }
public MainViewModel(INetEase netEase, INetwork network, IDialog dialog, IPersist persist) : base(netEase, network, dialog) { this.persist = persist; string username = this.persist.GetString("Username"); if (!string.IsNullOrEmpty(username)) { this.HeaderMenuText = "Welcome \n" + username; var loginMenuItem = this.MenuItems.FirstOrDefault(p => p.Image == "res:login"); if (loginMenuItem != null) { loginMenuItem.Image = "res:listmenu"; loginMenuItem.Title = Texts.MenuMyPL; loginMenuItem.ViewModel = typeof(LoginViewModel); } } else { this.HeaderMenuText = "Fildo \nSearch Music and download it!"; } if (!this.NoInternet) { this.Init(); } }
public DataContainerPersist(IPersist <IData> keyPersist, IPersist <IData> recordPersist, IDataContainerFactory containerFactory) { this.keyPersist = keyPersist; this.recordPersist = recordPersist; this.containerFactory = containerFactory; verticalCompression = false; }
public RecentFileList(IPersist persister) { this.Persister = persister; this.FileList = new ObservableCollection<RecentFile>(); LoadRecent(); }
public void GetCollectionCreatesIfNotExists() { MongoPersist toTest = new MongoPersist( new MongoPersistSettings() { Collection = "newCollection" , ConnectionString = "" , DB = "test" }); IPersist asI = (IPersist)toTest; MongoProviderMockHelper helper = new MongoProviderMockHelper(); helper.PrimeDatabase(new List <BsonDocument>() { new BsonDocument("name", "test") }); //need to prime an empty collection so that the cursor works helper.PrimeCollection(new List <BsonDocument>() { }); toTest.MongoProvider = helper.MockProvider.Object; //this method should call create database IMongoCollection <PersistedMessage> result = toTest.GetCollection(); helper.MockDatabase.Verify(m => m.CreateCollection(It.IsAny <string>() , It.IsAny <CreateCollectionOptions>() , It.IsAny <System.Threading.CancellationToken>())); }
public OrderedSetPersist(IPersist <IData> keyPersist, IPersist <IData> recordPersist, IOrderedSetFactory orderedSetFactory) { this.keyPersist = keyPersist; this.recordPersist = recordPersist; this.orderedSetFactory = orderedSetFactory; verticalCompression = false; }
public void DBDoesNotExist() { MongoPersist toTest = new MongoPersist(new MongoPersistSettings() { Collection = "test", DB = "test", ConnectionString = "" }); MongoProviderMockHelper helper = new MongoProviderMockHelper(); //wire up cursor to return no databases bool doMoveNext = true; Func <bool> cursorMoveNext = () => { if (doMoveNext) { doMoveNext = false; return(true); } return(false); }; helper.PrimeDatabase(new List <BsonDocument>() { }); toTest.MongoProvider = helper.MockProvider.Object; IPersist asI = (IPersist)toTest; Assert.False(asI.DBExists); }
internal bool TrySetObjectValue(IPersist host, int paramIndex, int refId, int[] listNextLevel) { if (_deferListItems) { return(false); } try { if (host != null && Entities.TryGetValue(refId, out IPersist refEntity)) { PropertyValue.Init(refEntity); host.Parse(paramIndex, PropertyValue, listNextLevel); return(true); } } catch (Exception e) { // return silently if this kind of error has already been reported if (_errors.AddPropertyNotSet(host, paramIndex, PropertyValue, e)) { Logger?.LogError(LogEventIds.FailedPropertySetter, e, "Entity #{0,-5} {1}, error at parameter {2}", refId, host.GetType().Name.ToUpper(), paramIndex + 1); ErrorCount++; } } return(false); }
public DeferredReference(int paramIndex, IPersist hostEntity, int refId, int[] nestedIndex) { ParameterIndex = paramIndex; HostEntity = hostEntity; ReferenceId = refId; NestedIndex = nestedIndex; }
internal bool TrySetObjectValue(IPersist host, int paramIndex, int refId, int[] listNextLevel) { if (_deferListItems) { return(false); } try { IPersist refEntity; if (_entities.TryGetValue(refId, out refEntity) && host != null) { PropertyValue.Init(refEntity); (host).Parse(paramIndex, PropertyValue, listNextLevel); return(true); } } catch (Exception) { if (ErrorCount > MaxErrorCount) { throw new XbimParserException("Too many errors in file, parser execution terminated"); } ErrorCount++; var expressType = Metadata.ExpressType(host); var propertyName = paramIndex + 1 > expressType.Properties.Count ? "[UnknownProperty]" : expressType.Properties[paramIndex + 1].PropertyInfo.Name; Logger.ErrorFormat("Entity #{0,-5} {1}, error at parameter {2}-{3}", refId, expressType.Type.Name.ToUpper(), paramIndex + 1, propertyName); } return(false); }
internal bool TrySetObjectValue(IPersist host, int paramIndex, int refId, int[] listNextLevel) { if (_deferListItems) { return(false); } try { if (host != null && _entities.TryGetValue(refId, out IPersist refEntity)) { PropertyValue.Init(refEntity); (host).Parse(paramIndex, PropertyValue, listNextLevel); return(true); } } catch (Exception) { if (ErrorCount > MaxErrorCount) { throw new XbimParserException("Too many errors in file, parser execution terminated"); } ErrorCount++; Logger?.LogWarning("Entity #{0,-5} {1}, error at parameter {2}", refId, host.GetType().Name.ToUpper(), paramIndex + 1); // this means the case is handled. It would be added to defered references and caused new errors return(true); } return(false); }
public void DoTests() { IBaseFilter filter = null; try { Guid typeGuid; IPersist persist = null; Guid readGuid; // I decide to use the VMR9 filter because i love it ! // This test could work with other filters with the notable exception of the // VideoRendererDefault which is in fact a VMR7 on Windows XP... filter = (IBaseFilter) new VideoMixingRenderer9(); typeGuid = (typeof(VideoMixingRenderer9).GUID); // All DirectShow filters must implement IBaseFilter... // which inherit from IMediaFilter... // which inherit from IPersist persist = (IPersist)filter; persist.GetClassID(out readGuid); Debug.Assert(readGuid == typeGuid, "IPersist.GetClassID"); } finally { Marshal.ReleaseComObject(filter); } }
public int GetQtd(string guid) { IPersist <Carrinho> car = NewMethod(); Model.Carrinho iten = car.Get(guid); return(iten.Produtos.Count()); }
// Start is called before the first frame update void Start() { persistentData = GameManager.instance.persistentData; component = gameObject.GetComponent <IPersist>(); component.PersistenceComponent = this; GenerateId(); SetInitialState(); }
public NetEase() { this.searching = false; // TODO DI this.persist = Mvx.Resolve <IPersist>(); this.netEaseService = new NetEaseService(); this.fildoService = new FildoService(); }
public FileLogEntryController(Invoker dispatcher = null, Func<string, LogEntryParser, ILogFileWatcher<LogEntry>> createLogFileWatcher = null, IPersist persist = null) { Entries = new ObservableCollection<LogEntryViewModel>(); this.watcherFactory = createLogFileWatcher??CreateLogFileWatcher; wrappedDispatcher = dispatcher ?? new WrappedDispatcher().Invoke; Counter = new LogEntryCounter(Entries); this.recentFileList = new RecentFileList(persist?? new XmlPersister(ApplicationAttributes.Get(),9)); }
public Set(IDbConnection connection, ISQLConfiguration configuration, Assembly assembly, Contracts.IQuery <T> query, IPersist <T> persist, IModify <T> modify, IDelete <T> delete) { this.connection = connection; this.configuration = configuration; this.assembly = assembly; Query = query; Persist = persist; Modify = modify; Delete = delete; }
internal void SetObjectValue(IPersist value) { _propertyValue.Init(value); //CurrentInstance.SetPropertyValue(PropertyValue); _currentInstance.Entity.Parse(_currentInstance.CurrentParamIndex, _propertyValue, NestedIndex); if (_listNestLevel == 0) { _currentInstance.CurrentParamIndex++; } }
internal static string GenerateSource(IPersist persist) { if (persist is IPersistEntity e) { return($"#{e.EntityLabel} ({e.Model.SchemaVersion}.{e.ExpressType.ExpressName})"); } else { return(persist.ToString()); } }
/// <summary> /// Handles the case where a property was not expected for this entity. /// </summary> /// <param name="persistIfc">The item being parsed.</param> /// <param name="propIndex">Index of the property.</param> /// <param name="value">The value of the property.</param> internal static void HandleUnexpectedAttribute(this IPersist persistIfc, int propIndex, IPropertyValue value) { // TODO: Review this workaround for older IFC files with extraneous properties if (value.Type == StepParserType.Enum && string.CompareOrdinal(value.EnumVal, "NOTDEFINED") == 0) { return; } throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, persistIfc.GetType().Name.ToUpper())); }
public bool ExecuteHandler(object obj, IPersist executor) { try { return executor.Persist(obj); } finally { _container.Release(executor); } }
public HomeController([FromServices] ICreateClient createClient, [FromServices] ICreateBonusCard createBonusCard, [FromServices] IPersist persist, [FromServices] IGetClients getClients, [FromServices] ISearchClient searchClient) { _createClient = createClient; _createBonusCard = createBonusCard; _persist = persist; _getClients = getClients; _searchClient = searchClient; }
public void Save(StringBuilder sb) { foreach (Shape shape in shapes) { IPersist s = shape as IPersist; if (s != null) { s.Write(sb); } } Console.WriteLine(sb.ToString()); }
public void Load(IPersist targetObject, FileStream stream) { FieldInfo[] fields = targetObject.GetType().GetFields( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); foreach (FieldInfo field in fields) { string fieldName = field.Name; object fieldValue = field.GetValue(targetObject); } }
public FileType(ICommandHandler commands, IAppName appName, IFileHandler fileHandler, IPersist persist) { Commands = commands; AppName = appName; FileHandler = fileHandler; Persist = persist; _data = new Dictionary <string, string>(); _tplFile = new Dictionary <string, string>(); _pathToSaveFile = new Dictionary <string, string>(); _currentDirectory = Directory.GetCurrentDirectory(); Build(); }
public MainViewModel(ICoreApplicationService coreService, IChooseFileNameService chooseFileNameService, IPersist persist, IOpenSimulationService openSimulationService) { _coreService = coreService; _chooseFileNameService = chooseFileNameService; _openSimulationService = openSimulationService; _persist = persist; _coreService.IrpSimulationProgress += (s,e) => Progress=e.Value; _coreService.IrpProjectLoaded += (s, e) => OnProjectLoaded(e.Value); _coreService.IrpSimulationCompleted += (s,e) => OnSimulationCompleted(e.Value); }
public void Save(StringBuilder sb) { for (int i = 0; i < m_ListOfShapes.Count; i++) { if (m_ListOfShapes[i] is Ellipse) { m_Write = m_ListOfShapes[i] as Ellipse; m_Write.Write(sb); } if (m_ListOfShapes[i] is Rectangle) { m_Write = m_ListOfShapes[i] as Rectangle; m_Write.Write(sb); } } }
public List <Model.Shopping> GetShopping(string guid) { IPersist <Carrinho> car = NewMethod(); Model.Carrinho iten = car.Get(guid); var itens = (from Model.Produto item in iten.Produtos group item by item.Id into newitem orderby newitem.Key select new Model.Shopping { Contagem = newitem.Count(), ValorTotal = newitem.Sum(x => x.Valor), Produto = newitem.First(), }).ToList(); return(itens); }
public void DBExists() { MongoPersist toTest = new MongoPersist(new MongoPersistSettings() { Collection = "test", DB = "test", ConnectionString = "" }); MongoProviderMockHelper helper = new MongoProviderMockHelper(); helper.PrimeDatabase(new List <BsonDocument>() { new BsonDocument("name", "test") }); toTest.MongoProvider = helper.MockProvider.Object; IPersist asI = (IPersist)toTest; Assert.True(asI.DBExists); }
private static void RemoveMissing(IPersist persister) { if (persister == null) { return; } var files = persister.RecentFiles(int.MaxValue).ToArray(); foreach (var f in files) { if (System.IO.File.Exists(f)) { continue; } persister.RemoveFile(f, int.MaxValue); } }
public OperationCollectionPersist(IPersist <IData> keyPersist, IPersist <IData> recordPersist, IOperationCollectionFactory collectionFactory) { KeyPersist = keyPersist; RecordPersist = recordPersist; writes = new Action <BinaryWriter, IOperation> [OperationCode.MAX]; writes[OperationCode.REPLACE] = WriteReplaceOperation; writes[OperationCode.INSERT_OR_IGNORE] = WriteInsertOrIgnoreOperation; writes[OperationCode.DELETE] = WriteDeleteOperation; writes[OperationCode.DELETE_RANGE] = WriteDeleteRangeOperation; writes[OperationCode.CLEAR] = WriteClearOperation; reads = new Func <BinaryReader, IOperation> [OperationCode.MAX]; reads[OperationCode.REPLACE] = ReadReplaceOperation; reads[OperationCode.INSERT_OR_IGNORE] = ReadInsertOrIgnoreOperation; reads[OperationCode.DELETE] = ReadDeleteOperation; reads[OperationCode.DELETE_RANGE] = ReadDeleteRangeOperation; reads[OperationCode.CLEAR] = ReadClearOperation; CollectionFactory = collectionFactory; }
// Use this for initialization void Awake() { Debug.Log("GameControl.Awake()"); if (theStaticControl == null) { //DontDestroyOnLoad(gameObject); Debug.Log("ASSIGNING STATIC: theStaticControl"); theStaticControl = this; } //else if (control != this) //{ // Destroy(gameObject); //} if (PersistWithXml) { _Storage = new XmlStorage(); } else { _Storage = new BinaryStorage(); } Debug.Assert(_Storage != null, "_Storage is null!"); }
public void UseXmlPersister(string filepath) { Persister = new XmlPersister(filepath); }
public void UseRegistryPersister(string key) { Persister = new RegistryPersister(key); }
public void UseXmlPersister() { Persister = new XmlPersister(); }
public CommandProcessorRobotWorldLines(ICommandInterpreter commandInterpreter, World world, IPersist<WorldEdgeLine> store) : base(commandInterpreter, world) { _store = store; }
public void UseRegistryPersister() { Persister = new RegistryPersister(); }
public SantaGenerationHandler(IProvide provider,IPersist persister, SantaGenerator generator) { _provider = provider; _persister = persister; _generator = generator; }
/// <summary> /// Generates <see cref="PersistRecords"/> and gets <paramref name="persistable"/> to persist data to it /// </summary> /// <param name="persistable">The <see cref="IPersist"/>-aware instance</param> /// <returns>The <see cref="PersistRecords"/></returns> public static PersistRecords GetRecordsFromPersistable(IPersist persistable) { var pr = new PersistRecords(); persistable.PersistRecords(pr); return pr; }
public void UseXmlPersister(Stream stream) { Persister = new XmlPersister(stream); }
public KanbanBoard(IPersist persistency) { this.persistency = persistency; }
public ProfileM(string docdburi, string docdbkey, string redisuri) { _dac = new Persist(new Dbase(docdburi, docdbkey), new Cache(redisuri)); _dac.Connect("ProfileM", "ProfileCollection"); }
public DeviceM(string docdburi, string docdbkey, string redisuri) { this._persist = new Persist(new Dbase(docdburi, docdbkey), new Cache(redisuri)); this._persist.Connect("DeviceM", "Registry"); }
public NewContactResourceHandler(IPersist persister, IProvide provider) { _persister = persister; _provider = provider; }
public SavingClientHandler(IPersist<ClientDto> client) { _client = client; }
public ConfigM(string docdburi, string docdbkey, string redisuri) { this._persist = new Persist(new Dbase(docdburi, docdbkey), new Cache(redisuri)); this._persist.Connect("ConfigM", "ManifestCollection"); }
public SavingConfigurationHandler(IPersist<PushConfiguration> persistence) { _persistence = persistence; }
public NewRestrictionHandler(IPersist persister, IProvide provider) { _persister = persister; _provider = provider; }
public RefM(string docdburi, string docdbkey, string redisuri) { _dac = new Persist(new Dbase(docdburi, docdbkey), new Cache(redisuri)); _dac.Connect("RefM", "ReferenceCollection"); }
public MenuViewModel(IPersist persist) { _persist = persist; }