public MegaCalculator(int accuracy, IStorage storage, List<IOperator> ops) { this.accuracy = accuracy; _storage = storage; _historylist = new List<Expression>(); _operators = ops; }
public object Deserialize(IStorage storage, Data.Node data, object result) { return data is Data.Short ? (data as Data.Short).Value : data is Data.Binary ? BitConverter.ToInt16((data as Data.Binary).Value, 0) : data is Data.String ? short.Parse((data as Data.String).Value, System.Globalization.CultureInfo.InvariantCulture.NumberFormat) : (short)0; }
public TextDeferredIndexer(DBreezeEngine engine) { this.DBreezeEngine = engine; LTrieSettings = new TrieSettings() { InternalTable = true }; Storage = new StorageLayer(Path.Combine(engine.MainFolder, TableFileName), LTrieSettings, engine.Configuration); LTrie = new LTrie(Storage); LTrie.TableName = "DBreeze.TextIndexer"; if (LTrie.Storage.Length > 100000) //Recreating file if its size more then 100KB and it is empty { if (LTrie.Count(true) == 0) { LTrie.Storage.RecreateFiles(); LTrie.Dispose(); Storage = new StorageLayer(Path.Combine(engine.MainFolder, TableFileName), LTrieSettings, engine.Configuration); LTrie = new LTrie(Storage); LTrie.TableName = "DBreeze.TextIndexer"; } } if (LTrie.Count(true) > 0) this.StartDefferedIndexing(); }
public RecordingStorage(IStorage storage) { _innerStorage = storage; Loaded = new HashSet<Uri>(); Saved = new HashSet<Uri>(); }
public PlayersController(IStorage<Models.Player> playerStorage, IStorage<Models.BoardGame> boardGamesStorage, DistanceCalculator distanceCalculator) { _playerStorage = playerStorage; _boardGamesStorage = boardGamesStorage; _distanceCalculator = distanceCalculator; }
public IStreamedService Create(IStorage storage) { Enforce.Argument(() => storage); return new StreamedService(storage); }
protected override ResourceSaveOperation CreateSaveOperationForItem(IStorage storage, CatalogContext context, CatalogItem item, CancellationToken cancellationToken) { // This method decides what to do with the item. // If it's a RegistrationMakerCatalogItem and it already exists, then don't write content. var registrationMakerCatalogItem = item as RegistrationMakerCatalogItem; if (registrationMakerCatalogItem != null) { var content = item.CreateContent(Context); // note: always do this first var resourceUri = item.GetItemAddress(); var saveOperation = new ResourceSaveOperation(); saveOperation.ResourceUri = resourceUri; if (!registrationMakerCatalogItem.IsExistingItem && content != null) { saveOperation.SaveTask = storage.Save(resourceUri, content, cancellationToken); } else { Trace.WriteLine(string.Format("Resource {0} already exists. Skipping.", resourceUri), "Debug"); } return saveOperation; } return base.CreateSaveOperationForItem(storage, context, item, cancellationToken); }
public RequestHistoryResource(IStorage storage) { if (!storage.Supports<IQueryRequests>()) throw new ArgumentException($"IStorage implementation of type '{storage.GetType().FullName}' does not support IQueryRequests.", nameof(storage)); _requests = storage.As<IQueryRequests>(); }
internal PObject(IStorage repository, int id, Dictionary<int, IPObject> objectsIndex, bool deferredLoad) { if (repository == null) throw new Exception("Хранилище данных не задано"); Id = id; _ownerCollection = null; this.storage = repository; this.objectsIndex = objectsIndex; this._deferredLoad = deferredLoad; // получение значений атрибутов _attrs = repository.ListAttributes(Id); if (objectsIndex != null) objectsIndex.Add(id, this); // загрузка коллекций _collections = new Dictionary<string, PCollection>(); List<string> collectsNames = storage.ListCollections(Id); foreach (string name in collectsNames) { string lowName = name.ToLower(); _collections.Add(lowName, new PCollection(this, lowName, deferredLoad)); } }
public AdventureStage(IMap map , IStorage storage , User user) { _User = user; _Observeds = new List<IObservedAbility>(); _Stroage = storage; _Map = map; }
public object Deserialize(IStorage storage, Data.Node data, object result) { return data is Data.DateTime ? (data as Data.DateTime).Value : data is Data.Binary ? new System.DateTime(BitConverter.ToInt64((data as Data.Binary).Value, 0)) : data is Data.String ? System.DateTime.Parse((data as Data.String).Value) : new System.DateTime(); }
public object Deserialize(IStorage storage, Data.Node data, object result) { Kean.Collection.IList<Data.Node> nodes; Reflect.Type type; Reflect.Type elementType; type = data.Type; elementType = this.GetElementType(type); if (data is Data.Collection) nodes = (data as Data.Collection).Nodes; else { // only one element so it was impossible to know it was a collection nodes = new Kean.Collection.List<Data.Node>(data); data.Type = data.OriginalType ?? elementType; Uri.Locator locator = data.Locator.Copy(); locator.Fragment += "0"; data.Locator = locator; } if (result.IsNull()) result = this.Create(type, elementType, nodes.Count); int i = 0; foreach (Data.Node child in nodes) { int c = i++; // ensure c is unique in every closure of lambda function below storage.Deserialize(child, elementType, d => this.Set(result, d, c)); } return result; }
public SerfidCore(IListener listener, IFilter filter, IStorage storage, IUser user) { _listener = listener; _filter = filter; _storage = storage; _user = user; }
internal CompoundFile(IStorage storage, System.Runtime.InteropServices.ComTypes.STATSTG statstg) { if (storage == null) { throw new ArgumentNullException("storage"); } _rootStorage = storage; _statstg = statstg; }
public void PolymorphicEnumeration() { var stgs = new IStorage[] { new MemoryStorage(), //new PersistedMemoryStorage(), new FileSystemStorage("fs"), //new EsentStorage("esent"), new SqlSeverStorage("server=.;database=overdb;integrated security=true"), }; foreach (var stg in stgs) { using (var db = new Database(stg, null, new GuidIdFactory())) { db.Delete(db.GetEnumerable()); db.SaveMany(new Animal[] { new Cat(), new Dog(), new Cow(), }.AsEnumerable()); var animals = db.GetEnumerable<Animal>(); Assert.That(animals.Count(), Is.EqualTo(3), "{0} not polymorphic", stg.GetType().Name); } } }
/// <summary> /// Initializes a new instance of the <see cref="ShareManager" /> class. /// </summary> /// <param name="pool"></param> /// <param name="daemonClient"></param> /// <param name="jobTracker"></param> /// <param name="storage"></param> public ShareManager(string pool, IDaemonClient daemonClient, IJobTracker jobTracker, IStorage storage) { _daemonClient = daemonClient; _jobTracker = jobTracker; _storage = storage; _logger = Log.ForContext<ShareManager>().ForContext("Component", pool); }
public Regulus.Project.Crystal.Game.Core CreateUser(Regulus.Remoting.ISoulBinder binder, IStorage storage, IMap zone , Battle.IZone battle) { var core = new Regulus.Project.Crystal.Game.Core(binder, storage, zone, battle); _Users.AddFramework(core); core.InactiveEvent += () => { _Users.RemoveFramework(core); }; return core; }
public Mapper(string filePath, Func<string, string, IEnumerable<KeyValuePair<string, string>>> map, IStorage storage) { this.Key = filePath; this.Value = storage.Read(filePath); this.map = map; this.storage = storage; }
public User(Remoting.ISoulBinder binder , IStorage storage) { _Machine = new Utility.StageMachine(); this._Binder = binder; _Account = new Data.Account(); _Storage = storage; }
public PaymentProcessor(string pool, IDaemonClient daemonClient, IStorage storage , IWalletConfig walletConfig) { _daemonClient = daemonClient; _storage = storage; _walletConfig = walletConfig; _logger = Log.ForContext<PaymentProcessor>().ForContext("Component", pool); }
public object Deserialize(IStorage storage, Data.Node data, object result) { return data is Data.String ? (data as Data.String).Value : data is Data.Binary ? System.Text.Encoding.UTF8.GetString((data as Data.Binary).Value) : data is Data.Null ? null : ""; }
public FormMain() { // инициализация компонентов InitializeComponent(); listBoxOptimizations.DisplayMember = "Title"; listBoxOptimizations.ValueMember = "Object"; webControlDetails.Crashed += webControlDetails_Crashed; // инициализация внутренних переменных this.Text = "Распил " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); // загрузка конфигурации _conf = RAppConfig.Load(Path.GetDirectoryName(Application.ExecutablePath) + "\\config.json"); // настройка навигации this.navMasterPath = new PNavigatorPath(_conf.MasterCollectionPath + ":0"); // команды _createAppCommandsButtons(panelAppCommands, _conf.Commands.Buttons); enableChildControls(panelAppCommands, false); // подключаем хранилище данных this._modelStorage = new SStorageFB(_conf.ConnectionString); // загружать модель не будем. Это сделает событие таймера }
public BarsTimeIntervalEnumerator(DataFeed dataFeed, IStorage storage, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize) : base(dataFeed, storage, symbol, priceType, period, startTime, preferredBufferSize) { this.endTime = endTime; this.Reset(); }
public static void SetUp( TestContext ctx ) { // Create connection here because it's not a real unit test // but uses real connection to the real drop box folder. storage = new DropBoxStorage(new TestConfiguration()); storage.OpenConnection(); }
public object Deserialize(IStorage storage, Data.Node data, object result) { return data is Data.Byte ? (data as Data.Byte).Value : data is Data.Binary ? (data as Data.Binary).Value[0] : data is Data.String ? byte.Parse((data as Data.String).Value, System.Globalization.CultureInfo.InvariantCulture.NumberFormat) : (byte)0; }
/***********************************************************************/ private StorageRoot(IStorage root, bool readOnly ) : base( root ) { rootIStorage = root; containerIsReadOnly = readOnly; dataSpaceManagerInitializationInProgress = false; }
public static async Task AddStorage(this MockServerHttpClientHandler handler, IStorage storage) { var files = await storage.List(CancellationToken.None); foreach (var file in files) { var storageFileUrl = file; var relativeFileUrl = "/" + storageFileUrl.ToString().Replace(storage.BaseAddress.ToString(), string.Empty); handler.SetAction(relativeFileUrl, async message => { var content = await storage.Load(storageFileUrl, CancellationToken.None); var response = new HttpResponseMessage(HttpStatusCode.OK); if (!string.IsNullOrEmpty(content.CacheControl)) { response.Headers.CacheControl = CacheControlHeaderValue.Parse(content.CacheControl); } response.Content = new StreamContent(content.GetContentStream()); if (!string.IsNullOrEmpty(content.ContentType)) { response.Content.Headers.ContentType = new MediaTypeHeaderValue(content.ContentType); } return response; }); } }
IList<string> GetCodes(IStorage storage, IList<string> codes=null) { var items= storage.ListItems(""); foreach (var item in items) { } return codes; }
public Computer(ICpu cpu, IRam ram, IVideoCard gpu, IStorage storage) { Storage = storage; Gpu = gpu; Ram = ram; Cpu = cpu; }
public JsonClient(IStorage storedCredentials, string url, string scopes) { _scopes = scopes; _url = new Uri(url); _storedCredentials = storedCredentials; _client = new WebClient { Encoding = Encoding.UTF8 }; }
public CloneViewModel(IDialog dialog, IMessenger messenger, IShellService shell, IStorage storage, IWebService web) { _dialog = dialog; _messenger = messenger; _shell = shell; _storage = storage; _web = web; _repositories = new ObservableCollection <ProjectViewModel>(); Repositories = CollectionViewSource.GetDefaultView(_repositories); Repositories.GroupDescriptions.Add(new PropertyGroupDescription("Owner")); _baseRepositoryPath = _storage.GetBaseRepositoryDirectory(); LoadRepositoriesAsync(); _cloneCommand = new DelegateCommand(OnClone, CanClone); _browseCommand = new DelegateCommand(OnBrowse); }
// Start the node public void start(bool verboseConsoleOutput) { char node_type = 'W'; // Check if we're in worker-only mode if (Config.workerOnly) { CoreConfig.simultaneousConnectedNeighbors = 4; } // Generate presence list PresenceList.init(IxianHandler.publicIP, Config.serverPort, node_type); // Initialize storage if (storage is null) { storage = IStorage.create(Config.blockStorageProvider); } if (!storage.prepareStorage()) { Logging.error("Error while preparing block storage! Aborting."); Program.noStart = true; return; } ActivityStorage.prepareStorage(); // Initialize the block chain blockChain = new BlockChain(); //runDiffTests(); //return; // Create the block processor and sync blockProcessor = new BlockProcessor(); blockSync = new BlockSync(); if (Config.devInsertFromJson) { Console.WriteLine("Inserting from JSON"); devInsertFromJson(); Program.noStart = true; return; } if (Config.apiBinds.Count == 0) { Config.apiBinds.Add("http://localhost:" + Config.apiPort + "/"); } // Start the HTTP JSON API server apiServer = new APIServer(Config.apiBinds, Config.apiUsers, Config.apiAllowedIps); if (IXICore.Platform.onMono() == false && !Config.disableWebStart) { System.Diagnostics.Process.Start(Config.apiBinds[0]); } miner = new Miner(); // Start the network queue NetworkQueue.start(); // prepare stats screen ConsoleHelpers.verboseConsoleOutput = verboseConsoleOutput; Logging.consoleOutput = verboseConsoleOutput; Logging.flush(); if (ConsoleHelpers.verboseConsoleOutput == false) { statsConsoleScreen.clearScreen(); } // Distribute genesis funds IxiNumber genesisFunds = new IxiNumber(Config.genesisFunds); // Check if this is a genesis node if (genesisFunds > (long)0) { Logging.info(String.Format("Genesis {0} specified. Starting operation.", genesisFunds)); distributeGenesisFunds(genesisFunds); genesisNode = true; blockProcessor.resumeOperation(); serverStarted = true; if (!isMasterNode()) { Logging.info("Network server is not enabled in modes other than master node."); } else { NetworkServer.beginNetworkOperations(); } } else { if (File.Exists(Config.genesisFile)) { Block genesis = new Block(Crypto.stringToHash(File.ReadAllText(Config.genesisFile))); blockChain.setGenesisBlock(genesis); } ulong lastLocalBlockNum = storage.getHighestBlockInStorage(); if (lastLocalBlockNum > 6) { lastLocalBlockNum = lastLocalBlockNum - 6; } if (Config.lastGoodBlock > 0 && Config.lastGoodBlock < lastLocalBlockNum) { lastLocalBlockNum = Config.lastGoodBlock; } if (lastLocalBlockNum > 0) { Block b = blockChain.getBlock(lastLocalBlockNum, true); if (b != null) { ConsensusConfig.minRedactedWindowSize = ConsensusConfig.getRedactedWindowSize(b.version); ConsensusConfig.redactedWindowSize = ConsensusConfig.getRedactedWindowSize(b.version); } } if (Config.recoverFromFile) { Block b = storage.getBlock(lastLocalBlockNum); blockSync.onHelloDataReceived(b.blockNum, b.blockChecksum, b.version, b.walletStateChecksum, b.getSignatureCount(), lastLocalBlockNum); } else { ulong blockNum = WalletStateStorage.restoreWalletState(lastLocalBlockNum); if (blockNum > 0) { Block b = blockChain.getBlock(blockNum, true); if (b != null) { blockSync.onHelloDataReceived(blockNum, b.blockChecksum, b.version, b.walletStateChecksum, b.getSignatureCount(), lastLocalBlockNum); } else { walletState.clear(); } } else { blockSync.lastBlockToReadFromStorage = lastLocalBlockNum; if (CoreConfig.preventNetworkOperations) { walletState.clear(); Block b = storage.getBlock(lastLocalBlockNum); blockSync.onHelloDataReceived(b.blockNum, b.blockChecksum, b.version, b.walletStateChecksum, b.getSignatureCount(), lastLocalBlockNum); } } // Start the server for ping purposes serverStarted = true; if (!isMasterNode()) { Logging.info("Network server is not enabled in modes other than master node."); } else { NetworkServer.beginNetworkOperations(); } // Start the network client manager NetworkClientManager.start(true); } } PresenceList.startKeepAlive(); TLC = new ThreadLiveCheck(); // Start the maintenance thread maintenanceThread = new Thread(performMaintenance); maintenanceThread.Name = "Node_Maintenance_Thread"; maintenanceThread.Start(); }
public VariablesController(IStorage storage) : base(storage) { }
/// <summary>Generic logic to pull items from storage based on the given recipes.</summary> /// <param name="storage">The available items.</param> /// <param name="recipes">The recipes to match.</param> protected bool GenericPullRecipe(IStorage storage, IRecipe[] recipes) { return(this.GenericPullRecipe(storage, recipes, out _)); }
/// <summary>Provide input to the machine.</summary> /// <param name="input">The available items.</param> /// <returns>Returns whether the machine started processing an item.</returns> public override bool SetInput(IStorage input) { return(false); }
public BinarySearchTreeSerializer(IStorage storage) { this.storage = storage; }
public UserFollowedHandler(IStorage storage, ILogger <UserFollowedHandler> logger) { _storage = storage; _logger = logger; }
public static Validity ValidateSectionMasterHash(this Nca nca, int index) { if (!nca.SectionExists(index)) { throw new ArgumentException(nameof(index), Messages.NcaSectionMissing); } if (!nca.CanOpenSection(index)) { return(Validity.MissingKey); } NcaFsHeader header = nca.Header.GetFsHeader(index); // The base data is needed to validate the hash, so use a trick involving the AES-CTR extended // encryption table to check if the decryption is invalid. // todo: If the patch replaces the data checked by the master hash, use that directly if (header.IsPatchSection()) { if (header.EncryptionType != NcaEncryptionType.AesCtrEx) { return(Validity.Unchecked); } Validity ctrExValidity = ValidateCtrExDecryption(nca, index); return(ctrExValidity == Validity.Invalid ? Validity.Invalid : Validity.Unchecked); } byte[] expectedHash; long offset; long size; switch (header.HashType) { case NcaHashType.Ivfc: NcaFsIntegrityInfoIvfc ivfcInfo = header.GetIntegrityInfoIvfc(); expectedHash = ivfcInfo.MasterHash.ToArray(); offset = ivfcInfo.GetLevelOffset(0); size = 1 << ivfcInfo.GetLevelBlockSize(0); break; case NcaHashType.Sha256: NcaFsIntegrityInfoSha256 sha256Info = header.GetIntegrityInfoSha256(); expectedHash = sha256Info.MasterHash.ToArray(); offset = sha256Info.GetLevelOffset(0); size = sha256Info.GetLevelSize(0); break; default: return(Validity.Unchecked); } IStorage storage = nca.OpenRawStorage(index); var data = new byte[size]; storage.Read(offset, data).ThrowIfFailure(); byte[] actualHash = Crypto.ComputeSha256(data, 0, data.Length); if (Util.ArraysEqual(expectedHash, actualHash)) { return(Validity.Valid); } return(Validity.Invalid); }
public TestBotState(IStorage storage) : base(storage, $"BotState:{typeof(BotState).Namespace}.{typeof(BotState).Name}") { }
public PhotoToTagProvider(IStorage storage) : base(storage) { _repositoryTag = storage.GetRepository <PhotoToTag>(); }
public JobState(IStorage storage) : base(storage, StorageKey) { }
public CustomKeyState(IStorage storage) : base(storage, PropertyName) { }
public EventViewModelBuilder(IStorage storage) : base(storage) { }
private void MoveNormal(Player player, byte fromSlot, byte toSlot, Storages toStorage, IStorage fromItemStorage, Item item, IStorage toItemStorage) { fromItemStorage.RemoveItem(item); if (!toItemStorage.AddItem(toSlot, item)) { fromItemStorage.AddItem(item); player.PlayerView.InventoryView.ItemMoveFailed(item); return; } player.PlayerView.InventoryView.ItemMoved(item, toSlot, toStorage); var isTradeOngoing = player.PlayerState.CurrentState == PlayerState.TradeOpened || player.PlayerState.CurrentState == PlayerState.TradeButtonPressed; var isItemMovedToOrFromTrade = toItemStorage == player.TemporaryStorage || fromItemStorage == player.TemporaryStorage; if (isTradeOngoing && isItemMovedToOrFromTrade && player.TradingPartner is Player tradingPartner) { // When Trading, send update to Trading-Partner if (fromItemStorage == player.TemporaryStorage) { tradingPartner.PlayerView.TradeView.TradeItemDisappear(fromSlot, item); } if (toItemStorage == player.TemporaryStorage) { tradingPartner.PlayerView.TradeView.TradeItemAppear(toSlot, item); } } }
public static long Save(IStorage delta, FileStream writer, string foundBaseNCA) { var filenameOffset = foundBaseNCA.Split(':'); if (delta.GetSize() < 0x40) { throw new InvalidDataException("Delta file is too small."); } if (foundBaseNCA.Length > 255) { throw new IndexOutOfRangeException("Base NCA filename isn't allowed to be longer then 255 characters"); } var Header = new DeltaFragmentHeader(new StorageFile(delta, OpenMode.Read)); var reader = new FileReader(new StorageFile(delta, OpenMode.Read)); reader.Position = 0; if (filenameOffset.Length == 1 && Header.Magic != DeltaTools.Ndv0Magic) { writer.Write(DeltaTools.LCA3Macic, 0, DeltaTools.LCA3Macic.Length); writer.WriteByte((byte)foundBaseNCA.Length); writer.Write(Encoding.ASCII.GetBytes(foundBaseNCA), 0, foundBaseNCA.Length); return(0); } if (Header.Magic == DeltaTools.Ndv0Magic) { var fragmentSize = Header.FragmentHeaderSize + Header.FragmentBodySize; //if (!isSplitNdv0 && delta.Length < fragmentSize) //{ // throw new InvalidDataException( // $"Delta file is smaller than the header indicates. (0x{fragmentSize} bytes)"); //} var headerData = reader.ReadBytes((int)Header.FragmentHeaderSize); headerData[0] = 0x54; //T (NDV0 to TDV0) writer.Write(headerData, 0, (int)Header.FragmentHeaderSize); } else { writer.Write(Encoding.ASCII.GetBytes(DeltaTools.Cdv0Magic), 0, DeltaTools.Cdv0Magic.Length); } writer.WriteByte((byte)foundBaseNCA.Length); writer.Write(Encoding.ASCII.GetBytes(foundBaseNCA), 0, foundBaseNCA.Length); var foundBaseNCAEndOffsetPos = foundBaseNCA.LastIndexOf(':') + 1; var foundBaseNCAEndOffsetLen = foundBaseNCA.Length - foundBaseNCAEndOffsetPos; var SplitNdv0EndOffsetPos = writer.Position - foundBaseNCAEndOffsetLen; long offset = 0; long deltaSize = delta.GetSize(); Console.WriteLine($"reader={reader.Position} writer={writer.Position}"); while (reader.Position < deltaSize) { ReadSegmentHeader(reader, writer, out var size, out var seek); if (seek > 0) { offset += seek; } if (size > 0) { offset += size; } reader.Position += size; } if (reader.Position == deltaSize) { if (filenameOffset.Length > 2) { var startOffset = long.Parse(filenameOffset[1], NumberStyles.HexNumber); var endOffset = startOffset + offset; var realEndOffset = endOffset.ToString($"X{foundBaseNCAEndOffsetLen}"); var posReal = writer.Position; writer.Position = SplitNdv0EndOffsetPos; writer.Write(Encoding.ASCII.GetBytes(realEndOffset), 0, realEndOffset.Length); writer.Position = posReal; } //Size of data untimmed in this function call return(offset); } throw new InvalidDataException("Fragment file seems to be corrupted!"); }
public CheckoutController(IStorage storage) : base(storage) { }
/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception> /// <exception cref="Db4objects.Db4o.Ext.DatabaseClosedException"></exception> /// <exception cref="System.NotSupportedException"></exception> public abstract override void Backup(IStorage targetStorage, string path);
public LocationController(IStorage storage) { _storage = storage; }
public AdapterWithErrorHandler(ICredentialProvider credentialProvider, ILogger <BotFrameworkHttpAdapter> logger, IStorage storage, UserState userState, ConversationState conversationState, IConfiguration configuration) : base(credentialProvider) { // These methods add middleware to the adapter. The middleware adds the storage and state objects to the // turn context each turn so that the dialog manager can retrieve them. this.UseStorage(storage); this.UseBotState(userState); this.UseBotState(conversationState); OnTurnError = async(turnContext, exception) => { // Log any leaked exception from the application. // NOTE: In production environment, you should consider logging this to // Azure Application Insights. Visit https://aka.ms/bottelemetry to see how // to add telemetry capture to your bot. logger.LogError(exception, $"[OnTurnError] unhandled error : {exception.Message}"); // Send a message to the user await turnContext.SendActivityAsync("The bot encountered an error or bug."); await turnContext.SendActivityAsync("To continue to run this bot, please fix the bot source code."); if (conversationState != null) { try { // Delete the conversationState for the current conversation to prevent the // bot from getting stuck in a error-loop caused by being in a bad state. // ConversationState should be thought of as similar to "cookie-state" in a Web pages. await conversationState.DeleteAsync(turnContext); } catch (Exception e) { logger.LogError(e, $"Exception caught on attempting to Delete ConversationState : {e.Message}"); } } // Send a trace activity, which will be displayed in the Bot Framework Emulator await turnContext.TraceActivityAsync("OnTurnError Trace", exception.Message, "https://www.botframework.com/schemas/error", "TurnError"); }; }
internal Statement(IStorage storage) { }
public AddRoleListExtensionsViewComponent(IStorage storage_) : base(storage_) { }
/// <summary>Provide input to the machine.</summary> /// <param name="input">The available items.</param> /// <returns>Returns whether the machine started processing an item.</returns> public override bool SetInput(IStorage input) { return(false); // no input required }
/// <summary> /// constructor to set up a CachingStorage with a configured page count /// and page size /// </summary> /// <param name="storage"> /// the /// <see cref="IStorage">IStorage</see> /// to be cached. /// </param> /// <param name="pageCount">the number of pages the cache should use.</param> /// <param name="pageSize">the size of the pages the cache should use.</param> public CachingStorage(IStorage storage, int pageCount, int pageSize) : base(storage ) { _pageCount = pageCount; _pageSize = pageSize; }
public DefaultAuthorizationCodeStore(IStorage storage) { _storage = storage; _mappingStringToAuthCodes = new Dictionary <string, AuthorizationCode>(); }
/// <summary> /// Creates a new instacen of MetricService /// </summary> /// <param name="storage"></param> /// <param name="pipelineId"></param> public MetricService(IStorage storage, string pipelineId) { _storage = storage; PipelineId = pipelineId; }
public InfoTestBase(ITestOutputHelper output, IStorage storage) : base(output, storage) { }
public AdapterWithErrorHandler(ICredentialProvider credentialProvider, ILogger <BotFrameworkHttpAdapter> logger, IStorage storage, UserState userState, ConversationState conversationState, ResourceExplorer resourceExplorer, IConfiguration configuration) : base(credentialProvider) { // combine path for cross platform support string[] paths = { ".", "AdapterWithErrorHandler.LG" }; string fullPath = Path.Combine(paths); _lgEngine = TemplateEngine.FromFiles(fullPath); this.UseStorage(storage); this.UseState(userState, conversationState); this.UseLanguageGenerator(new LGLanguageGenerator(resourceExplorer)); this.UseDebugger(configuration.GetValue <int>("debugport", 4712), events: new Events <AdaptiveEvents>()); OnTurnError = async(turnContext, exception) => { // Log any leaked exception from the application. logger.LogError($"Exception caught : {exception.Message}"); // Send a catch-all apology to the user. await turnContext.SendActivityAsync(_lgEngine.EvaluateTemplate("SomethingWentWrong", null)); if (conversationState != null) { try { // Delete the conversationState for the current conversation to prevent the // bot from getting stuck in a error-loop caused by being in a bad state. // ConversationState should be thought of as similar to "cookie-state" in a Web pages. await conversationState.DeleteAsync(turnContext); } catch (Exception e) { logger.LogError($"Exception caught on attempting to Delete ConversationState : {e.Message}"); } } }; }
/// <summary> /// default constructor to create a Caching storage with the default /// page count of 64 and the default page size of 1024. /// </summary> /// <remarks> /// default constructor to create a Caching storage with the default /// page count of 64 and the default page size of 1024. /// </remarks> /// <param name="storage"> /// the /// <see cref="IStorage">IStorage</see> /// to be cached. /// </param> public CachingStorage(IStorage storage) : this(storage, DefaultPageCount, DefaultPageSize ) { }
/// <summary> /// Initializes a new instance of the <see cref="NewsList"/>. /// </summary> /// <param name="storage">The special interface for direct access to the storage.</param> public NewsList(IStorage storage) : base(storage) { }
public NewsController(NEPService.NewsService.INewsService newsService, IStorage storageService, NEPService.ClientService.IClientService clientService) { _NewsService = newsService; _storageService = storageService; _clientService = clientService; }