private kWhStorage GetStorageProviderForPath(string originalQbxPath) { var serial = QbxPathUtils.GetSerialFromPath(originalQbxPath); var baseDir = QbxPathUtils.GetBaseDirFromPath(originalQbxPath); var counterId = QbxPathUtils.GetCounterIdFromPath(originalQbxPath); var storageId = QbxPathUtils.GetStorageIdFromPath(originalQbxPath); return(new kWhStorage(serial, baseDir, counterId, Precision.mWh, storageId)); }
private kWhStorage GetStorageProviderForPath(string originalQbxPath) { var storageProviderContext = new StorageProviderContext { SerialNumber = QbxPathUtils.GetSerialFromPath(originalQbxPath), CounterId = QbxPathUtils.GetCounterIdFromPath(originalQbxPath), Precision = Precision.mWh, StorageId = QbxPathUtils.GetStorageIdFromPath(originalQbxPath) }; IOptions <kWhStorageOptions> options = new OptionsWrapper <kWhStorageOptions>(_kWhStorageOptions); // Override path. options.Value.DataStorePath = QbxPathUtils.GetBaseDirFromPath(originalQbxPath); return(new kWhStorage(_loggerFactory, options, storageProviderContext)); }
public void TestGetBaseDirFromPath() { string baseDir = QbxPathUtils.GetBaseDirFromPath(@"./QboxNextData/Qbox_1546-002-442/1546-002-442_00000001.qbx"); Assert.That(baseDir, Is.EqualTo($".{Path.DirectorySeparatorChar}QboxNextData")); }