public TracerWrapper(ITrace tracer) { if (tracer == null) throw new ArgumentNullException("tracer"); this.tracer = tracer; }
public RunSourceForm_copy(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _trace = trace; try { Initialize(); _tabResultMessage = tab_message; _tabResultGrid = tab_result2; _tabResultTree = tab_result4; //this.Icon = Properties.Resources.app; //string title = config.Get("RunsourceTitle"); //if (title != null) // __title = title; //tc_result.SelectedTab = _tabResultMessage; //cGrid.Culture = CultureInfo.CurrentUICulture; //_gridMaxWidth = _config.Get("GridMaxWidth").zParseAs<int>(); //_gridMaxHeight = _config.Get("GridMaxHeight").zParseAs<int>(); //_dataTableMaxImageWidth = _config.Get("DataTableMaxImageWidth").zParseAs<int>(); //_dataTableMaxImageHeight = _config.Get("DataTableMaxImageHeight").zParseAs<int>(); //initRunSource(); //SetFileSaved(); } catch (Exception ex) { _trace.WriteError(ex); zerrf.ErrorMessageBox(ex); } }
public Task<RouteResult> Route(IRazorRequest request, ITrace tracer) { Requires.NotNull(request, "request"); Requires.NotNull(tracer, "tracer"); // This is so slooooow! IFileInfo file; string[] pathFragments = request.Path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); for (int end = pathFragments.Length - 1; end >= 0; end--) { Tuple<string, string> candidate = CreateCandidate(pathFragments, end); file = ResolveCandidate(candidate.Item1.Replace('/', Path.DirectorySeparatorChar)); if (file != null) { return Task.FromResult(RouteResult.Successful(file, candidate.Item2)); } } file = ResolveCandidate(String.Empty); if (file != null) { return Task.FromResult(RouteResult.Successful(file, request.Path.TrimStart('/'))); } else { return Task.FromResult(RouteResult.Failed()); } }
/// <summary> /// Initializes a new instance of the <see cref="MockRailsEngineContext"/> class. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> /// <param name="trace">The trace.</param> /// <param name="urlInfo">The URL info.</param> public MockRailsEngineContext(IRequest request, IResponse response, ITrace trace, UrlInfo urlInfo) : this() { this.request = request; this.response = response; this.trace = trace; this.urlInfo = urlInfo; }
internal CallContextAsyncResult(IDisposable cleanup, AsyncCallback callback, object extraData) { _cleanup = cleanup; _callback = callback ?? NoopAsyncCallback; AsyncState = extraData; _trace = TraceFactory.Create(TraceName); }
public SubscriberConfigurator(string exchange, string replyExchange, IErrorSubscriber errorSubscriber, bool receiveSelfPublish, ITrace trace) { _exchange = exchange; _errorSubscriber = errorSubscriber; _receiveSelfPublish = receiveSelfPublish; _trace = trace; _replyExchange = replyExchange; }
private static async Task<Response> ExecuteCore(IEdgePage page, Request request, ITrace tracer) { Response resp = new Response(200); resp.Start(); await page.Run(request, resp); resp.End(); return resp; }
public Task<Response> Execute(IEdgePage page, Request request, ITrace tracer) { Requires.NotNull(page, "page"); Requires.NotNull(request, "request"); Requires.NotNull(tracer, "tracer"); return ExecuteCore(page, request, tracer); }
public Task Execute(IRazorPage page, IDictionary<string, object> environment, ITrace tracer) { Requires.NotNull(page, "page"); Requires.NotNull(environment, "environment"); Requires.NotNull(tracer, "tracer"); return ExecuteCore(page, environment, tracer); }
public OwinAppContext() { _trace = TraceFactory.Create(TraceName); AppName = HostingEnvironment.SiteName + HostingEnvironment.ApplicationID; if (string.IsNullOrWhiteSpace(AppName)) { AppName = Guid.NewGuid().ToString(); } }
public DemoTileListener(IMessageBus messageBus, ITrace trace) { _messageBus = messageBus; _trace = trace; _messageBus.AsObservable<TileLoadStartMessage>().Do(m => OnTileBuildStarted(m.TileCenter)).Subscribe(); _messageBus.AsObservable<TileLoadFinishMessage>().Do(m => OnTileBuildFinished(m.Tile)).Subscribe(); _messageBus.AsObservable<TileDestroyMessage>().Do(m => OnTileDestroyed(m.Tile)).Subscribe(); }
public override void SetUp() { this.oldTracer = Tracer.Trace; this.nonExistantPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + Guid.NewGuid(); base.SetUp(); PurgeDestination(); }
/// <summary> Creates instance of <see cref="SrtmDownloader"/>. </summary> /// <param name="schemaPath">Uri schema path.</param> /// <param name="fileSystemService">File system service.</param> /// <param name="server">Server.</param> /// <param name="trace">Trace.</param> public SrtmDownloader(string server, string schemaPath, IFileSystemService fileSystemService, ITrace trace) { _server = server; _schemaPath = schemaPath; _fileSystemService = fileSystemService; _trace = trace; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultEngineContext"/> class. /// </summary> /// <param name="container">The container.</param> /// <param name="urlInfo">Url information</param> /// <param name="context">The context.</param> /// <param name="server">The server.</param> /// <param name="request">The request.</param> /// <param name="response">The response.</param> /// <param name="trace">The trace.</param> /// <param name="session">The session.</param> public DefaultEngineContext(IMonoRailContainer container, UrlInfo urlInfo, HttpContext context, IServerUtility server, IRequest request, IResponse response, ITrace trace, IDictionary session) : base(container) { this.container = container; this.UnderlyingContext = context; this.UrlInfo = urlInfo; this.Request = request; this.Response = response; this.Session = session; this.Server = server; this.Trace = trace; }
public TraceManager() { try { Initialize(); } catch { _tracingEnabled = false; _Instance = null; } }
internal SharedTimer(TimeSpan interval) { Contract.Assert(interval > TimeSpan.Zero); _trace = TraceFactory.Create(TraceName); _interval = interval; _processLock = new object(); _addLock = new object(); _registrations = new LinkedList<TimerRegistration>(); _newRegistrations = new LinkedList<TimerRegistration>(); _emptyList = new LinkedList<TimerRegistration>(); _timer = new Timer(ProcessTimers, null, _interval, _interval); }
public Backup() { gTaskName = "Backup"; gTaskTrace = Trace.CurrentTrace; gConfig = new XmlConfig(); //string sPath = gConfig.Get("Backup/Log"); //if (sPath != null) // gTaskTrace.SetLogFile(sPath, LogOptions.IndexedFile); gTaskTrace.SetWriter(gConfig.Get("Backup/Log"), gConfig.Get("Backup/Log/@option").zTextDeserialize(FileOption.None)); gTaskProgress = new Progress(); gTaskProgressDetail = new Progress(); }
public RunSourceForm(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _trace = trace; _config = config; _runSourceParameters = runSourceParameters; try { // http://stackoverflow.com/questions/9056418/resources-getobjectthis-icon-crashes-application-on-windows-xp // pour ne pas avoir une exection avec : // this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); // Thread.Sleep(100); // dont work Initialize(); _tabResultMessage = tab_message; _tabResultGrid = tab_result2; _tabResultTree = tab_result4; this.Icon = Properties.Resources.app; string title = config.Get("RunsourceTitle"); if (title != null) __title = title; //tb_source.ConfigurationManager.CustomLocation = "ScintillaNET.xml"; //tb_source.ConfigurationManager.Language = "cs"; //InitScintilla(); Try(InitScintilla); tc_result.SelectedTab = _tabResultMessage; //ActiveControl = tb_source; cGrid.Culture = CultureInfo.CurrentUICulture; _gridMaxWidth = _config.Get("GridMaxWidth").zParseAs<int>(); _gridMaxHeight = _config.Get("GridMaxHeight").zParseAs<int>(); _dataTableMaxImageWidth = _config.Get("DataTableMaxImageWidth").zParseAs<int>(); _dataTableMaxImageHeight = _config.Get("DataTableMaxImageHeight").zParseAs<int>(); initRunSource(); SetFileSaved(); } catch (Exception ex) { _trace.WriteError(ex); zerrf.ErrorMessageBox(ex); } }
public MessageConsumer(string busId, IModel model, IMessageHelper messageHelper, ISendHelper sendHelper, Dictionary<string, ISerializer> serializers, IErrorSubscriber errorSubscriber, TaskScheduler scheduler, bool receiveSelfPublish, bool neverReply, string replyExchange, ITrace trace) : base(model) { _busId = busId; _messageHelper = messageHelper; _serializers = serializers; _errorSubscriber = errorSubscriber; _receiveSelfPublish = receiveSelfPublish; _neverReply = neverReply; _sendHelper = sendHelper; _replyExchange = replyExchange; _trace = trace; _taskFactory = new TaskFactory(CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskContinuationOptions.None, scheduler); }
internal OwinWebSocketWrapper(WebSocketContext context) { Contract.Assert(context != null); _trace = TraceFactory.Create(TraceName); _context = context; _cancellationTokenSource = new CancellationTokenSource(); _environment = new ConcurrentDictionary<string, object>(); _environment[WebSocketConstants.WebSocketSendAsyncKey] = new WebSocketSendAsync(SendAsync); _environment[WebSocketConstants.WebSocketReceiveAyncKey] = new WebSocketReceiveAsync(ReceiveAsync); _environment[WebSocketConstants.WebSocketCloseAsyncKey] = new WebSocketCloseAsync(CloseAsync); _environment[WebSocketConstants.WebSocketCallCancelledKey] = _cancellationTokenSource.Token; _environment[WebSocketConstants.WebSocketVersionKey] = WebSocketConstants.WebSocketVersion; _environment[typeof(WebSocketContext).FullName] = _context; }
void Awake() { var appManager = ApplicationManager.Instance; _geoPositionObserver = appManager.GetService<ITileController>(); _messageBus = appManager.GetService<IMessageBus>(); _trace = appManager.GetService<ITrace>(); var elevationProvider = appManager.GetService<IElevationProvider>(); _messageBus.AsObservable<GeoPosition>() .SubscribeOn(Scheduler.ThreadPool) .Do(position => { _trace.Info(CategoryName, "GeoPosition: {0}", position.ToString()); // notify ASM about position change to process tiles _geoPositionObserver.OnNext(position.Coordinate); // calculate new world position var mapPoint = GeoProjection.ToMapCoordinate(appManager.Coordinate, position.Coordinate); var elevation = elevationProvider.GetElevation(position.Coordinate); var worldPosition = new Vector3((float)mapPoint.X, elevation, (float)mapPoint.Y); // set transform on UI thread Observable.Start(() => transform.position = worldPosition, Scheduler.MainThread); }).Subscribe(); _messageBus.AsObservable<TileLoadFinishMessage>() .Take(1) .ObserveOnMainThread() .Subscribe(_ => { Observable.Start(() => { // read nmea file with gps data using (Stream stream = new FileStream(GpsTrackFile, FileMode.Open)) { _trace.Info(CategoryName, "start to read geopositions from {0}", GpsTrackFile); _mocker = new NmeaPositionMocker(stream, _messageBus); _mocker.OnDone += (s, e) => _trace.Info(CategoryName, "trace is finished"); _mocker.Start(Thread.Sleep); } }, Scheduler.ThreadPool); }); }
public static void PrintPacket1(PPacket ppacket, bool detail = false, ITrace trace = null) { if (trace == null) trace = Trace.CurrentTrace; //************* 0 3 0.465083 192.168.0.1 52581 173.194.66.94 443 TCP ACK 0x0001 0x4B2091F9 0x4B2091FA 0x4695DD86 0x401A . //_tr.WriteLine("group no time source port destination port protocal flags length sequence next seq ack number window urgent"); StringBuilder sb = new StringBuilder(); //_tr.Write("{0,5} {1,5} {2,10:0.000000}", ppacket.GroupNumber, ppacket.PacketNumber, ppacket.RelativeTime.TotalSeconds); sb.AppendFormat("{0,5} {1,5} {2,10:0.000000}", ppacket.GroupNumber, ppacket.PacketNumber, ppacket.RelativeTime.TotalSeconds); sb.AppendFormat(" {0,-15} {1,5} {2,-15} {3,5} {4,-10}", ppacket.Source, ppacket.SourcePort, ppacket.Destination, ppacket.DestinationPort, ppacket.IpProtocolCode); if (detail) { TcpDatagram tcp = ppacket.Tcp; if (tcp != null && ppacket.Ipv4.Protocol == IpV4Protocol.Tcp) { sb.AppendFormat(" {0,-20}", ppacket.GetTcpFlagsString()); sb.AppendFormat(" {0,6}", tcp.PayloadLength > 0 ? "0x" + ((short)tcp.PayloadLength).zToHex() : null); sb.AppendFormat(" 0x{0} {1,10} {2,10} {3,6} {4,6}", ppacket.Tcp.SequenceNumber.zToHex(), tcp.NextSequenceNumber != tcp.SequenceNumber ? "0x" + tcp.NextSequenceNumber.zToHex() : null, tcp.AcknowledgmentNumber != 0 ? "0x" + tcp.AcknowledgmentNumber.zToHex() : null, "0x" + tcp.Window.zToHex(), tcp.UrgentPointer != 0 ? "0x" + tcp.UrgentPointer.zToHex() : null); int i = 0; int maxDataChar = 50; foreach (byte b in tcp.Payload) { if (++i > maxDataChar) break; if (b >= 32 && b <= 126) sb.Append(((char)b).ToString()); else sb.Append("."); } } else if (ppacket.Packet.Ethernet == null) sb.Append(" not ethernet"); } trace.WriteLine(sb.ToString()); }
public Task<CompilationResult> Compile(IFileInfo file, ITrace tracer) { Requires.NotNull(file, "file"); Requires.NotNull(tracer, "tracer"); // Generate a content id string contentId = ContentIdentifier.GenerateContentId(file); tracer.WriteLine("CompilationManager - Content ID: {0}", contentId); WeakReference<Type> cacheEntry; if (Cache.TryGetValue(contentId, out cacheEntry)) { Type cached; if (cacheEntry.TryGetTarget(out cached)) { return Task.FromResult(CompilationResult.FromCache(cached)); } else { tracer.WriteLine("CompilationManager - Expired: {0}", contentId); Cache.Remove(contentId); } } foreach (var compiler in _compilers) { if (compiler.CanCompile(file)) { tracer.WriteLine("CompilationManager - Selected compiler: '{0}'", compiler.GetType().Name); return CompileWith(compiler, contentId, file); } } return Task.FromResult(CompilationResult.Failed(null, new[] { new CompilationMessage( MessageLevel.Error, Resources.DefaultCompilationManager_CannotFindCompiler, new FileLocation(file.PhysicalPath ?? file.Name)) })); }
internal OwinCallContext( OwinAppContext appContext, RequestContext requestContext, string requestPathBase, string requestPath, AsyncCallback cb, object extraData) { _trace = TraceFactory.Create(TraceName); _appContext = appContext; _requestContext = requestContext; _requestPathBase = requestPathBase; _requestPath = requestPath; AsyncResult = new CallContextAsyncResult(this, cb, extraData); _httpContext = _requestContext.HttpContext; _httpRequest = _httpContext.Request; _httpResponse = _httpContext.Response; }
private void Initialize() { // initialize services _compositionRoot = TestHelper.GetCompositionRoot(_worldZeroPoint); // get local references _messageBus = _compositionRoot.GetService<IMessageBus>(); _trace = _compositionRoot.GetService<ITrace>(); _tileController = _compositionRoot.GetService<ITileController>(); SetupMapData(); // set observer to react on geo position changes _messageBus.AsObservable<GeoPosition>() .ObserveOn(Scheduler.MainThread) .Subscribe(position => { _trace.Debug(TraceCategory, "GeoPosition: {0}", position.ToString()); _tileController.OnPosition(position.Coordinate, LevelOfDetails); }); }
public RunSourceFormExe(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _trace = trace; _trace.SetViewer(TraceWrited); _config = config; _runSourceParameters = runSourceParameters; _source.TextChanged += source_TextChanged; CreateMenu(); CreateTopTools(); this.InitializeForm(); InitExe(); InitMenu(); UpdateRunSourceStatus(); Try(SetKeyboardShortcuts); this.KeyPreview = true; this.Load += RunSourceForm_Load; this.FormClosing += RunSourceForm_FormClosing; this.FormClosed += RunSourceForm_FormClosed; //this.KeyDown += RunSourceForm_KeyDown; }
public RunSourceForm_v3(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _trace = trace; _trace.SetViewer(TraceWrited); _config = config; _runSourceParameters = runSourceParameters; this.ClientSize = new Size(1060, 650); CreateMenu(); CreateTopTools(); CreateScintillaControl(); _editPanel.Controls.Add(_source); CreateResultControls(); CreateStatusBar(); this.InitializeForm(); InitExe(); InitMenu(); this.KeyPreview = true; this.Load += RunSourceForm_Load; this.FormClosing += RunSourceForm_FormClosing; this.FormClosed += RunSourceForm_FormClosed; this.KeyDown += RunSourceForm_KeyDown; }
public ActivationResult ActivatePage(Type type, ITrace tracer) { Requires.NotNull(type, "type"); Requires.NotNull(tracer, "tracer"); IRazorPage page = null; try { page = Activator.CreateInstance(type) as IRazorPage; } catch (MissingMethodException) { return ActivationResult.Failed(); } if (page == null) { return ActivationResult.Failed(); } else { return ActivationResult.Successful(page); } }
protected override async Task <TryCatch <OrderByQueryPage> > GetNextPageAsync(ITrace trace, CancellationToken cancellationToken) { this.StartOfPageState = this.FeedRangeState.State; await this.bufferedEnumerator.MoveNextAsync(trace); return(this.bufferedEnumerator.Current); }
protected override async Task <TryCatch <OrderByQueryPage> > GetNextPageAsync(ITrace trace, CancellationToken cancellationToken) { // Unfortunately we need to keep both the epk range and partition key for queries // Since the continuation token format uses epk range even though we only need the partition key to route the request. FeedRangeInternal feedRange = this.PartitionKey.HasValue ? new FeedRangePartitionKey(this.PartitionKey.Value) : this.FeedRangeState.FeedRange; TryCatch <QueryPage> monadicQueryPage = await this.queryDataSource .MonadicQueryAsync( sqlQuerySpec : this.SqlQuerySpec, feedRangeState : new FeedRangeState <QueryState>(feedRange, this.FeedRangeState.State), queryPaginationOptions : this.QueryPaginationOptions, trace : trace, cancellationToken); if (monadicQueryPage.Failed) { return(TryCatch <OrderByQueryPage> .FromException(monadicQueryPage.Exception)); } QueryPage queryPage = monadicQueryPage.Result; return(TryCatch <OrderByQueryPage> .FromResult(new OrderByQueryPage(queryPage))); }
public static void Verbose(this ITrace trace, Exception exception, string message, params object[] args) => trace.TraceEvent(false, TraceEventType.Verbose, 0, exception, message, args);
public MapDataLibrary(IPathResolver pathResolver, ITrace trace) { _pathResolver = pathResolver; _trace = trace; }
/// <summary> /// /// </summary> internal bool Run() { ITrace.WriteLine(prefix: false); #region // Verifications // Todo Verifications with zip and 7z //if (Directory.Exists(_GamePath)) //{ //} #endregion /* Déplacé 2020 * // Creation of System folder and working assign * ITrace.WriteLine($"[Run] {Lang.CreationFolder}: '{_SystemName}'"); * Directory.CreateDirectory(_SystemName); * Directory.SetCurrentDirectory(_SystemPath); * * // Creation of Game folder * ITrace.WriteLine($"[Run] {Lang.CreationFolder}: '{_GamePath}'"); * Directory.CreateDirectory(_GamePath); */ //2020 Directory.SetCurrentDirectory(_GamePath); #region Creation of the Infos.xml if (Settings.Default.opInfos) { MakeXML.InfoGame(_GamePath, _ZeGame); } else { ITrace.WriteLine("[Run] Make info disabled"); } #endregion // Tree root + lvl1 MakeStructure(); // Copy Roms #region 22/08/2020 new rom management vApps = CopyRoms(_zBackGame.ApplicationPath, _Tree.Children[nameof(SubFolder.Roms)].Path); //vApps = CopySpecific(_zBackGame.ApplicationPath, _Tree.Children["Roms"].Path, "Roms", x => _zBackGame.ApplicationPath = x); #endregion // Video, Music, Manual vManual = CopySpecific(_zBackGame.ManualPath, _Tree.Children[nameof(SubFolder.Manuals)].Path, "Manual", x => _zBackGame.ManualPath = x); vMusic = CopySpecific(_zBackGame.MusicPath, _Tree.Children[nameof(SubFolder.Musics)].Path, "Music", x => _zBackGame.MusicPath = x); vVideo = CopySpecific(_zBackGame.VideoPath, _Tree.Children[nameof(SubFolder.Videos)].Path, "Video", x => _zBackGame.VideoPath = x); // CopySpecificFiles() old way; // Copy images CopyImages(); #region Copy CheatCodes if (Settings.Default.opCheatCodes && !string.IsNullOrEmpty(Settings.Default.CCodesPath)) { CopyCheatCodes(); } else { ITrace.WriteLine("[Run] Copy Cheat Codes disabled"); } #endregion #region Copy Clones if (Settings.Default.opClones) { CopyClones(); } else { ITrace.WriteLine($"[Run] Clone copy disabled"); } #endregion #region Serialization / backup ameliorated of launchbox datas (with found medias missing) if (Settings.Default.opEBGame) { MakeXML.Backup_Game(_GamePath, _zBackGame, "EBGame"); } else { ITrace.WriteLine($"[Run] Enhanced Backup Game disabled"); } #endregion #region Save Struct if (Settings.Default.opTreeV) { GetStruc(); } else { ITrace.WriteLine($"[Run] Save Struct disabled"); } #endregion #region 2020 Résultats // au lieu de mettre à true le bool au moment de la copie, //on fait un recheck au cas où l'utilisateur a modifié le contenu) //PackMeRes.ShowDialog(vGame, vManual, vMusic, vVideo, vApps); PackMeRes2 pmr2 = new PackMeRes2(_Tree.Path) { GameName = _zBackGame.Title, // Destinations /*CheatPath = _Tree.Children[nameof(SubFolder.CheatCodes)].Path, * ManualPath = _Tree.Children[nameof(SubFolder.Manuals)].Path, * MusicPath = _Tree.Children[nameof(SubFolder.Musics)].Path, * RomPath = _Tree.Children[nameof(SubFolder.Roms)].Path, * VideoPath = _Tree.Children[nameof(SubFolder.Videos)].Path,*/ // Sources SourceRomPath = _ZePlatform.FolderPath, SourceManuelPath = _ZePlatform.PlatformFolders.FirstOrDefault(x => x.MediaType == "Manual"), SourceMusicPath = _ZePlatform.PlatformFolders.FirstOrDefault(x => x.MediaType == "Music"), SourceVideoPath = _ZePlatform.PlatformFolders.FirstOrDefault(x => x.MediaType == "Video"), }; // Liste des manuels //pmr2.Musics = Directory.GetFiles(_Tree.Children["Musics"].Path, "*.*", System.IO.SearchOption.TopDirectoryOnly); pmr2.LoadDatas(); pmr2.ShowDialog(); //pmr2.AddManual(); #endregion #region 2020 choix du nom // Fenêtre pour le choix du nom GameName gnWindows = new GameName(); gnWindows.SuggestedGameName = _ZeGame.ExploitableFileName; gnWindows.ShowDialog(); // Changement de nom du dossier ushort i = 0; string destFolder = Path.Combine(_SystemPath, gnWindows.ChoosenGameName); if (!_GamePath.Equals(destFolder)) { while (i < 10) { try { Directory.Move(_GamePath, destFolder); ITrace.WriteLine("Folder successfully renamed"); // Attribution du résultat _GamePath = destFolder; // Sortie break; } catch (IOException ioe) { ITrace.WriteLine($"Try {i}: {ioe}"); Thread.Sleep(10); i++; } } } //string destArchLink = Path.Combine(path, $"{destArchive}"); //string destArchLink = Path.Combine(path, gnWindows.ChoosenGameName); // On verra si on dissocie un jour _ZeGame.ExploitableFileName = gnWindows.ChoosenGameName; #endregion // Archive //string destArchive = Path.Combine(_SystemPath, _ZeGame.ExploitableFileName); #region Compression // Zip if (Properties.Settings.Default.opZip) { // MessageBox.Show("test "+ destArchive); // Make_Zip(destArchive); // ZipCompression.Make_Folder(_GamePath, _SystemPath, destArchive); ZipCompression.Make_Folder(_GamePath, _SystemPath, _ZeGame.ExploitableFileName); } else { ITrace.WriteLine($"[Run] Zip Compression disabled"); } // 7-Zip if (Properties.Settings.Default.op7_Zip) { //MessageBox.Show("test " + destArchive); // SevenZipCompression.Make_Folder(_GamePath, _SystemPath, destArchive); SevenZipCompression.Make_Folder(_GamePath, _SystemPath, _ZeGame.ExploitableFileName); } else { ITrace.WriteLine($"[Run] 7z Compression disabled"); } #endregion // Erase the temp folder if (MessageBox.Show($"{Lang.EraseTmpFolder} '{_ZeGame.ExploitableFileName}' ?", Lang.Erase, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Directory.SetCurrentDirectory(_WFolder); Directory.Delete(_GamePath, true); Console.WriteLine($"[Run] folder {_GamePath} erased"); } catch (Exception exc) { Console.WriteLine($"[Run] Error when Erasing temp folder {_GamePath}\n{exc.Message }"); } } // Stop loggers if (_IScreen != null) { _IScreen.KillAfter(10); } ITrace.RemoveListerners(_Loggers); return(true); }
public abstract Task <ContainerProperties> GetCachedContainerPropertiesAsync( bool forceRefresh, ITrace trace, CancellationToken cancellationToken);
public abstract Task <string> GetCachedRIDAsync( bool forceRefresh, ITrace trace, CancellationToken cancellationToken);
public SourceCodeSplitter(ITrace trace) { _trace = trace; }
/// <summary> /// Creating default stub and mocks /// </summary> protected virtual void CreateDefaultStubsAndMocks() { writer = writer ?? new StringWriter(); engine = engine ?? new AspViewEngine(); engine.GetType().GetField("options", BindingFlags.Static | BindingFlags.NonPublic).SetValue(engine, new AspViewEngineOptions()); cookies = cookies ?? new Dictionary<string, HttpCookie>(); request = request ?? new StubRequest(cookies); response = response ?? new StubResponse(cookies); url = url ?? new UrlInfo("", "Stub", "Stub"); trace = trace ?? new StubTrace(); propertyBag = propertyBag ?? new Hashtable(); monoRailServices = monoRailServices ?? new StubMonoRailServices(); context = context ?? new StubEngineContext(request, response, monoRailServices, url); AspViewEngine.InitializeViewsStack(context); flash = flash ?? context.Flash; controller = controller ?? new ControllerStub(); controllerContext = controllerContext ?? new ControllerContextStub(); controllerContext.PropertyBag = propertyBag; context.Flash = flash; }
/// <summary> /// Delete all the rows from the table in an asynchronous way. It uses the <see cref="DeleteAsync(IDbConnection, string, QueryGroup, string, int?, IDbTransaction, ITrace, IStatementBuilder)"/> operation as the underlying operation. /// </summary> /// <param name="connection">The connection object to be used.</param> /// <param name="tableName">The name of the target table.</param> /// <param name="primaryKeys">The list of the primary keys to be deleted.</param> /// <param name="hints">The table hints to be used.</param> /// <param name="commandTimeout">The command timeout in seconds to be used.</param> /// <param name="transaction">The transaction to be used.</param> /// <param name="trace">The trace object to be used.</param> /// <param name="statementBuilder">The statement builder object to be used.</param> /// <returns>The number of rows that has been deleted from the table.</returns> public static async Task <int> DeleteAllAsync(this IDbConnection connection, string tableName, IEnumerable <object> primaryKeys, string hints = null, int?commandTimeout = null, IDbTransaction transaction = null, ITrace trace = null, IStatementBuilder statementBuilder = null) { var primary = GetAndGuardPrimaryKey(connection, tableName, transaction); var dbSetting = connection.GetDbSetting(); var hasImplicitTransaction = false; var count = primaryKeys?.AsList()?.Count; var deletedRows = 0; try { // Creates a transaction (if needed) if (transaction == null && count > ParameterBatchCount) { transaction = connection.EnsureOpen().BeginTransaction(); hasImplicitTransaction = true; } // Call the underlying method var splitted = primaryKeys.Split(ParameterBatchCount).AsList(); foreach (var keys in splitted) { if (keys.Any() != true) { break; } var field = new QueryField(primary.Name.AsQuoted(dbSetting), Operation.In, keys?.AsList()); deletedRows += await DeleteAsyncInternal(connection : connection, tableName : tableName, where : new QueryGroup(field), hints : hints, commandTimeout : commandTimeout, transaction : transaction, trace : trace, statementBuilder : statementBuilder); } // Commit the transaction if (hasImplicitTransaction) { transaction?.Commit(); } } finally { // Dispose the transaction if (hasImplicitTransaction) { transaction?.Dispose(); } } // Return the value return(deletedRows); }
public static void WriteTrace( IJsonWriter writer, ITrace trace) { TraceJsonWriter.WriteTrace(writer, trace); }
public DownloadWebresourceConfigTask(IOrganizationService service, ITrace trace) : base(service, trace) { }
/// <summary> /// Gère la copie en examinant la totale similitude des fichiers /// </summary> /// <param name="srcFile"></param> /// <param name="destLocation"></param> /// <param name="mediatype"></param> private bool Copy_Handler(string srcFile, string destLocation, string mediatype) { // 2020 // Test de la similitude en profondeur //FilesFunc.Check4Crash(); OPFiles neoOPF = new OPFiles() { }; neoOPF.IWrite += new RetourMessage((x) => ITrace.BeginLine(x)); neoOPF.IWriteLine += new RetourMessage((x) => ITrace.WriteLine(x)); // Booleen pour déterminer si l'on écrase ou pas bool overW = false; // Vérification en profondeur // Annulé EOPResult res = OPFiles.Copy_DeepVMode(dbPath, destLocation, $"Copy_{mediatype}", () => MD5.Create(), Dcs_Buttons.NoStop, x => ITrace.WriteLine(x)); string fileName = Path.GetFileName(srcFile); string destFile = Path.Combine(destLocation, fileName); EFileResult verif = neoOPF.DeepVerif(srcFile, destFile, () => MD5.Create()); bool copyRes = false; // Stocke le résultat de la copie switch (verif) { case EFileResult.DifferentSize: case EFileResult.DifferentHash: // Check selon les résultats de ce qu'il faut faire // Demande à l'utilisateur // EDestDecision res = MB_Decision.Show($"Copy_Handler: {Lang.Dest_File_Exists}, { Lang.Replace_Question} ?", $"{Lang.Alert} - Copy_Handler", destination: destLocation, buttons: Dcs_Buttons.All); EDestDecision res = MB_Decision.Show($"Copy_Handler: {Lang.Dest_File_Exists}, { Lang.Replace_Question} ?", $"{Lang.Alert} - Copy_Handler", source: srcFile, destination: destFile, buttons: Dcs_Buttons.All); // On passe si l'utilisateur ne veut pas écraser ou renommer /*if (res == EDestDecision.Pass || res == EDestDecision.PassAll) * return; */ // On utilise une fonction de traitement sur le fichier de destination (renommer, envoyer à la poubelle) neoOPF.DestFileAction(res, destFile); // Selon le résultat de la boite on copie ou non le fichier bool?overwrite = Handle_Copy(srcFile, ref destFile, res); if (overwrite != null) { copyRes = FilesFunc.Copy(srcFile, destFile, (bool)overwrite); } break; // Gère si la source a une taille 0 (entre autre) case EFileResult.Source_Error: break; case EFileResult.Destination_Error: case EFileResult.NoMatch: ITrace.WriteLine($"PackMe: Copy of '{fileName}'"); copyRes = FilesFunc.Copy(srcFile, destFile, false); break; default: ITrace.WriteLine($"PackMe: Copy of '{fileName}' avoided"); break; } return(copyRes); // 2020 //2020 EOPResult res = OPFiles.FileNameCompare(dbPath, destLocation, $"Copy_{mediatype}", Dcs_Buttons.NoStop, x => ITrace.WriteLine(x)); // assignation du chemin relatif à la variable // return CopyFile(dbPath, destLocation, res); }
public ValueTask PrefetchAsync(ITrace trace, CancellationToken cancellationToken) => this.bufferedEnumerator.PrefetchAsync(trace, cancellationToken);
public override Task <FeedResponse <T> > ReadNextAsync(ITrace trace, CancellationToken cancellationToken) { return(TaskHelper.RunInlineIfNeededAsync(() => this.feedIteratorInternal.ReadNextAsync(trace, cancellationToken))); }
public async ValueTask <bool> MoveNextAsync(ITrace trace) { if (trace == null) { throw new ArgumentNullException(nameof(trace)); } using (ITrace childTrace = trace.StartChild(name: nameof(MoveNextAsync), component: TraceComponent.Pagination, level: TraceLevel.Info)) { IQueue <PartitionRangePageAsyncEnumerator <TPage, TState> > enumerators = await this.lazyEnumerators.GetValueAsync( childTrace, cancellationToken : this.cancellationToken); if (enumerators.Count == 0) { this.Current = default; this.CurrentRange = default; this.nextState = default; return(false); } PartitionRangePageAsyncEnumerator <TPage, TState> currentPaginator = enumerators.Dequeue(); currentPaginator.SetCancellationToken(this.cancellationToken); if (!await currentPaginator.MoveNextAsync(childTrace)) { // Current enumerator is empty, // so recursively retry on the next enumerator. return(await this.MoveNextAsync(childTrace)); } if (currentPaginator.Current.Failed) { // Check if it's a retryable exception. Exception exception = currentPaginator.Current.Exception; while (exception.InnerException != null) { exception = exception.InnerException; } if (IsSplitException(exception)) { // Handle split List <FeedRangeEpk> childRanges = await this.feedRangeProvider.GetChildRangeAsync( currentPaginator.FeedRangeState.FeedRange, childTrace, this.cancellationToken); if (childRanges.Count == 0) { throw new InvalidOperationException("Got back no children"); } if (childRanges.Count == 1) { // We optimistically assumed that the cache is not stale. // In the event that it is (where we only get back one child / the partition that we think got split) // Then we need to refresh the cache await this.feedRangeProvider.RefreshProviderAsync(childTrace, this.cancellationToken); childRanges = await this.feedRangeProvider.GetChildRangeAsync( currentPaginator.FeedRangeState.FeedRange, childTrace, this.cancellationToken); } if (childRanges.Count() <= 1) { throw new InvalidOperationException("Expected more than 1 child"); } foreach (FeedRangeInternal childRange in childRanges) { PartitionRangePageAsyncEnumerator <TPage, TState> childPaginator = this.createPartitionRangeEnumerator( new FeedRangeState <TState>(childRange, currentPaginator.FeedRangeState.State)); enumerators.Enqueue(childPaginator); } // Recursively retry return(await this.MoveNextAsync(childTrace)); } // Just enqueue the paginator and the user can decide if they want to retry. enumerators.Enqueue(currentPaginator); this.Current = TryCatch <CrossFeedRangePage <TPage, TState> > .FromException(currentPaginator.Current.Exception); this.CurrentRange = currentPaginator.FeedRangeState.FeedRange; this.nextState = CrossPartitionRangePageAsyncEnumerator <TPage, TState> .GetNextRange(enumerators); return(true); } if (currentPaginator.FeedRangeState.State != default) { // Don't enqueue the paginator otherwise it's an infinite loop. enumerators.Enqueue(currentPaginator); } CrossFeedRangeState <TState> crossPartitionState; if (enumerators.Count == 0) { crossPartitionState = null; } else { FeedRangeState <TState>[] feedRangeAndStates = new FeedRangeState <TState> [enumerators.Count]; int i = 0; foreach (PartitionRangePageAsyncEnumerator <TPage, TState> enumerator in enumerators) { feedRangeAndStates[i++] = enumerator.FeedRangeState; } crossPartitionState = new CrossFeedRangeState <TState>(feedRangeAndStates); } this.Current = TryCatch <CrossFeedRangePage <TPage, TState> > .FromResult( new CrossFeedRangePage <TPage, TState>(currentPaginator.Current.Result, crossPartitionState)); this.CurrentRange = currentPaginator.FeedRangeState.FeedRange; this.nextState = CrossPartitionRangePageAsyncEnumerator <TPage, TState> .GetNextRange(enumerators); return(true); } }
/// <summary> /// ... /// Créer un fichier xml après collection des données dans le fichier xml de launchbox si activé /// </summary> /// <param name="xFile">believe... xml file </param> /// <param name="GameFile">Game file (exploitable)</param> internal int Initialize(string xFile, ShortGame sGame) { // Verif if (string.IsNullOrEmpty(ID)) { throw new Exception("Id property: null"); } if (string.IsNullOrEmpty(_SystemName)) { throw new Exception(); } _WFolder = Properties.Settings.Default.OutPPath; // Chemin du dossier temporaire du system _SystemPath = Path.Combine(_WFolder, _SystemName); _GamePath = Path.Combine(_SystemPath, $"{sGame.ExploitableFileName}"); // New Working Folder string logFile = Path.Combine(_WFolder, $"{_SystemName} - {sGame.ExploitableFileName}.log"); // Todo peut être déclencher un event sur le stop pour couper net ? var folderRes = OPFolders.SVerif(_GamePath, "Initialize", Dcs_Buttons.NoPass | Dcs_Buttons.NoRename, (string message) => ITrace.WriteLine(message, true)); if (folderRes == EDestDecision.Stop) { // ITrace.WriteLine("[Initialize] GoodBye !"); if (_IScreen != null) { _IScreen.Close(); } ITrace.RemoveListener(_IScreen); return(200); } #region System d'affichage string prefix = "PackMe"; //window if (Settings.Default.opLogWindow) { _IScreen = new InfoScreen(); _IScreen.Prefix = prefix; _IScreen.Show(); _Loggers.Add(_IScreen); } // file if (Settings.Default.opLogFile) { InfoToFile iLog = new InfoToFile(logFile, true); iLog.Prefix = prefix; _Loggers.Add(iLog); } // debug if (Debugger.IsAttached) { InfoToConsole iConsole = new InfoToConsole(); iConsole.Prefix = prefix; _Loggers.Add(iConsole); } ITrace.AddListeners(_Loggers); ITrace.WriteLine("===== Report of errors: ====="); ITrace.WriteLine($"[Initialize] ID:\t'{ID}'"); ITrace.WriteLine($"[Initialize] {Lang.SystemSelected}: '{_SystemName}'"); ITrace.WriteLine($"[Initialize] {Lang.GameSelected}: '{sGame.Title}' - Rom: '{sGame.ExploitableFileName}'"); #endregion /* * BackgroundWorker bw = new BackgroundWorker(); * bw.DoWork += new DoWorkEventHandler(BwWork); // PackMe.Initialize(_XmlFPlatform); * bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BWRunWorkerCompleted); * bw.RunWorkerAsync(); */ // Lecture du fichier platform XML_Functions xmlPlatform = new XML_Functions(); xmlPlatform.ReadFile(Path.Combine(Properties.Settings.Default.LBPath, Properties.Settings.Default.fPlatforms)); _ZePlatform = xmlPlatform.ScrapPlatform(_SystemName); // Reconstruct PlatformFolder Path foreach (PlatformFolder plfmFolder in _ZePlatform.PlatformFolders) { plfmFolder.FolderPath = ReconstructPath(plfmFolder.FolderPath); } // Lecture du fichier des jeux _XFunctions = new XML_Functions(); _XFunctions.ReadFile(xFile); // Get Main infos _zBackGame = _XFunctions.ScrapBackupGame(ID); _ZeGame = (GameInfo)_zBackGame; #region 2020 // Creation of System folder and working assign ITrace.WriteLine($"[Run] {Lang.CreationFolder}: '{_SystemName}'"); Directory.CreateDirectory(_SystemName); Directory.SetCurrentDirectory(_SystemPath); // Creation of Game folder ITrace.WriteLine($"[Run] {Lang.CreationFolder}: '{_GamePath}'"); Directory.CreateDirectory(_GamePath); #endregion #region Original Backup Game if (Settings.Default.opOBGame) { MakeXML.Backup_Game(_GamePath, _zBackGame, "TBGame"); } else { ITrace.WriteLine("[Run] Original Backup Game disabled"); } #endregion _LBoxDI = new DirectoryInfo(Settings.Default.LBPath); // Set active Directory to Root Directory.SetCurrentDirectory(_WFolder); #region Paths reconstruction _zBackGame.ApplicationPath = ReconstructPath(_zBackGame.ApplicationPath); _zBackGame.ManualPath = ReconstructPath(_zBackGame.ManualPath); _zBackGame.MusicPath = ReconstructPath(_zBackGame.MusicPath); _zBackGame.VideoPath = ReconstructPath(_zBackGame.VideoPath); #endregion return(0); }
public static bool IsVerbose(this ITrace trace) => trace?.ShouldTrace(TraceEventType.Verbose) ?? throw new ArgumentNullException(nameof(trace));
public abstract Task <IReadOnlyList <IReadOnlyList <string> > > GetPartitionKeyPathTokensAsync( ITrace trace, CancellationToken cancellationToken = default);
public DeployWebResourcesTask(IOrganizationService service, ITrace trace) : base(service, trace) { }
public PluginRegistraton(IOrganizationService service, OrganizationServiceContext context, ITrace trace) { _ctx = context; _service = service; _trace = trace; }
public abstract ValueTask <bool> MoveNextAsync(ITrace trace);
internal override Task <PartitionKeyRangeCache> GetPartitionKeyRangeCacheAsync(ITrace trace) { return(Task.FromResult(this.partitionKeyRangeCache.Object)); }
public async ValueTask <bool> MoveNextAsync(ITrace trace) { this.cancellationToken.ThrowIfCancellationRequested(); if (trace == null) { throw new ArgumentNullException(nameof(trace)); } if (!await this.crossPartitionRangePageAsyncEnumerator.MoveNextAsync(trace)) { this.Current = default; return(false); } TryCatch <CrossFeedRangePage <QueryPage, QueryState> > currentCrossPartitionPage = this.crossPartitionRangePageAsyncEnumerator.Current; if (currentCrossPartitionPage.Failed) { this.Current = TryCatch <QueryPage> .FromException(currentCrossPartitionPage.Exception); return(true); } CrossFeedRangePage <QueryPage, QueryState> crossPartitionPageResult = currentCrossPartitionPage.Result; QueryPage backendQueryPage = crossPartitionPageResult.Page; CrossFeedRangeState <QueryState> crossPartitionState = crossPartitionPageResult.State; QueryState queryState; if (crossPartitionState == null) { queryState = null; } else { // left most and any non null continuations IOrderedEnumerable <FeedRangeState <QueryState> > feedRangeStates = crossPartitionState .Value .ToArray() .OrderBy(tuple => ((FeedRangeEpk)tuple.FeedRange).Range.Min); List <ParallelContinuationToken> activeParallelContinuationTokens = new List <ParallelContinuationToken>(); { FeedRangeState <QueryState> firstState = feedRangeStates.First(); ParallelContinuationToken firstParallelContinuationToken = new ParallelContinuationToken( token: firstState.State != null ? ((CosmosString)firstState.State.Value).Value : null, range: ((FeedRangeEpk)firstState.FeedRange).Range); activeParallelContinuationTokens.Add(firstParallelContinuationToken); } foreach (FeedRangeState <QueryState> feedRangeState in feedRangeStates.Skip(1)) { this.cancellationToken.ThrowIfCancellationRequested(); if (feedRangeState.State != null) { ParallelContinuationToken parallelContinuationToken = new ParallelContinuationToken( token: feedRangeState.State != null ? ((CosmosString)feedRangeState.State.Value).Value : null, range: ((FeedRangeEpk)feedRangeState.FeedRange).Range); activeParallelContinuationTokens.Add(parallelContinuationToken); } } IEnumerable <CosmosElement> cosmosElementContinuationTokens = activeParallelContinuationTokens .Select(token => ParallelContinuationToken.ToCosmosElement(token)); CosmosArray cosmosElementParallelContinuationTokens = CosmosArray.Create(cosmosElementContinuationTokens); queryState = new QueryState(cosmosElementParallelContinuationTokens); } QueryPage crossPartitionQueryPage = new QueryPage( backendQueryPage.Documents, backendQueryPage.RequestCharge, backendQueryPage.ActivityId, backendQueryPage.ResponseLengthInBytes, backendQueryPage.CosmosQueryExecutionInfo, backendQueryPage.DisallowContinuationTokenMessage, queryState); this.Current = TryCatch <QueryPage> .FromResult(crossPartitionQueryPage); return(true); }
private ClientSideRequestStatisticsTraceDatum GetClientSideRequestStatsFromTrace(ITrace trace, string traceToFind) { if (trace.Name.Contains(traceToFind)) { foreach (object datum in trace.Data.Values) { if (datum is ClientSideRequestStatisticsTraceDatum clientSideStats) { return(clientSideStats); } } } foreach (ITrace child in trace.Children) { ClientSideRequestStatisticsTraceDatum datum = this.GetClientSideRequestStatsFromTrace(child, traceToFind); if (datum != null) { return(datum); } } return(null); }
public DeployPluginsTask(OrganizationServiceContext ctx, ITrace trace) : base(ctx, trace) { }
public DeployPluginsTask(IOrganizationService service, ITrace trace) : base(service, trace) { }
/// <summary> /// Copie les images / Copy the images /// </summary> /// <remarks>To Add Mask see 'Where'</remarks> private void CopyImages() { //2020/10/28 déplacé var res = MB_SimpleAll.Show($"{Lang.ImagesP} ?", Lang.ImagesTitle, buttons: Dcs_Buttons2.OverWrite | Dcs_Buttons2.Pass); ITrace.WriteLine(prefix: false); ITrace.WriteLine(prefix: false); Queue <PackFile> lPackFile = new Queue <PackFile>(); // Get All images (To Add mask see at Where) Console.WriteLine($"[CopyImages] Search all images for '{_ZeGame.Title}'"); foreach (PlatformFolder plfmFolder in _ZePlatform.PlatformFolders) { //filtre switch (plfmFolder.MediaType) { case "Manual": case "Music": case "Theme Video": case "Video": continue; } // 2020 - on modify pour certains titres, la recherche string toSearch = _ZeGame.Title.Replace(':', '_').Replace('\'', '_'); toSearch = toSearch.Replace("__", "_"); // Liste du contenu des dossiers foreach (var fichier in Directory.EnumerateFiles(plfmFolder.FolderPath, "*.*", System.IO.SearchOption.AllDirectories) .Where(s => Path.GetFileName(s).StartsWith($"{toSearch}-") || Path.GetFileName(s).StartsWith($"{_ZeGame.Title}.{_ZeGame.ID}-"))) { Console.WriteLine($"\t\t[CopyImages] Found '{fichier}' in '{plfmFolder.FolderPath}'"); PackFile tmp = new PackFile(plfmFolder.MediaType, fichier); lPackFile.Enqueue(tmp); } } ITrace.WriteLine(prefix: false); EDestDecision res = EDestDecision.None; // Copy Process while (lPackFile.Count != 0) { var pkFile = lPackFile.Dequeue(); int pos = pkFile.LinkToThePath.IndexOf(pkFile.Categorie); string tail1 = Path.GetDirectoryName(pkFile.LinkToThePath).Substring(pos); // Dossier de destination string destFolder = Path.Combine(_Tree.Children[nameof(SubFolder.Images)].Path, tail1); // Fichier de destination string destFile = Path.Combine(destFolder, Path.GetFileName(pkFile.LinkToThePath)); // Création des dossiers Console.WriteLine(destFolder); if (!Directory.Exists(destFolder)) { //2020 CreateVFolders(_Tree.Children["Images"], tail1); CreateVFolders(_Tree.Children[nameof(SubFolder.Images)], tail1); } //2020 FoncSchem.MakeListFolder(_Tree.Children["Images"]); FoncSchem.MakeListFolder(_Tree.Children[nameof(SubFolder.Images)]); // copy // TODO // 21/10/2020 // CopyFile(pkFile.LinkToThePath, dest, res); bool?rezDec = false; // On déclenche en cas de conflit un handle copy + une demande avant if (File.Exists(destFile)) { // On va demander une fois que faire en cas de conflit. if (res == EDestDecision.None) { res = MB_SimpleAll.Show($"{Lang.ImagesP} ?", Lang.ImagesTitle, buttons: Dcs_Buttons2.OverWrite | Dcs_Buttons2.Pass); } // rezDec = Handle_Copy(pkFile.LinkToThePath, ref destFile, res); } if (rezDec == null) { continue; } File.Copy(pkFile.LinkToThePath, destFile, (bool)rezDec); //21/10/2020 } }
/// <summary> Builds instance responsible for composing object graph. </summary> private static CompositionRoot BuildCompositionRoot(Action <IContainer, IConfigSection> action, ITrace trace) { // create entry point for library functionallity using default configuration overriding some properties return(new CompositionRoot(new Container(), ConfigBuilder.GetDefault().SetIndex("index/").Build()) // override library's default services with demo specific implementations .RegisterAction((container, config) => { container .RegisterInstance <ITrace>(trace) .Register(Component.For <IPathResolver>().Use <UnityPathResolver>()) .Register(Component.For <INetworkService>().Use <UnityNetworkService>()) .Register(Component.For <IMapDataLibrary>().Use <MapDataLibrary>()) .Register(Component.For <MaterialProvider>().Use <MaterialProvider>()); }) // override with scene specific implementations .RegisterAction(action) // setup object graph .Setup()); }
private static void WriteTraceRecursive( TextWriter writer, ITrace trace, TraceLevel level, AsciiTreeIndents asciiTreeIndents, bool isLastChild) { ITrace parent = trace.Parent; Stack <string> indentStack = new Stack <string>(); while (parent != null) { bool parentIsLastChild = (parent.Parent == null) || parent.Equals(parent.Parent.Children.Last()); if (parentIsLastChild) { indentStack.Push(asciiTreeIndents.Blank); } else { indentStack.Push(asciiTreeIndents.Parent); } parent = parent.Parent; } WriteIndents(writer, indentStack, asciiTreeIndents, isLastChild); writer.Write(trace.Name); writer.Write('('); writer.Write(trace.Id); writer.Write(')'); writer.Write(space); writer.Write(trace.Component); writer.Write('-'); writer.Write("Component"); writer.Write(space); writer.Write(trace.StartTime.ToString("hh:mm:ss:fff", CultureInfo.InvariantCulture)); writer.Write(space); writer.Write(trace.Duration.TotalMilliseconds.ToString("0.00")); writer.Write(" milliseconds"); writer.Write(space); writer.WriteLine(); if (trace.Data.Count > 0) { bool isLeaf = trace.Children.Count == 0; WriteInfoIndents(writer, indentStack, asciiTreeIndents, isLastChild: isLastChild, isLeaf: isLeaf); writer.WriteLine('('); foreach (KeyValuePair <string, object> kvp in trace.Data) { string key = kvp.Key; object value = kvp.Value; WriteInfoIndents(writer, indentStack, asciiTreeIndents, isLastChild: isLastChild, isLeaf: isLeaf); writer.Write(asciiTreeIndents.Blank); writer.Write('['); writer.Write(key); writer.Write(']'); writer.WriteLine(); string traceDatumToString; if (value is TraceDatum traceDatum) { TraceDatumTextWriter traceDatumTextWriter = new TraceDatumTextWriter(); traceDatum.Accept(traceDatumTextWriter); traceDatumToString = traceDatumTextWriter.ToString(); } else { traceDatumToString = value.ToString(); } string[] infoLines = traceDatumToString .TrimEnd(newLineCharacters) .Split(newLines, StringSplitOptions.None); foreach (string infoLine in infoLines) { WriteInfoIndents(writer, indentStack, asciiTreeIndents, isLastChild: isLastChild, isLeaf: isLeaf); writer.Write(asciiTreeIndents.Blank); writer.WriteLine(infoLine); } } WriteInfoIndents(writer, indentStack, asciiTreeIndents, isLastChild: isLastChild, isLeaf: isLeaf); writer.WriteLine(')'); } for (int i = 0; i < trace.Children.Count - 1; i++) { ITrace child = trace.Children[i]; WriteTraceRecursive(writer, child, level, asciiTreeIndents, isLastChild: false); } if (trace.Children.Count != 0) { ITrace child = trace.Children[trace.Children.Count - 1]; WriteTraceRecursive(writer, child, level, asciiTreeIndents, isLastChild: true); } }
public RpcPublisherConfigurator(string exchange, bool useFastReply, string replyExchange, IPublishingErrorHandler errorHandler, ITrace trace) : base(exchange, errorHandler, trace) { _useFastReply = useFastReply; _replyExchange = replyExchange; }
public abstract Task <PartitionKey> GetPartitionKeyValueFromStreamAsync( Stream stream, ITrace trace, CancellationToken cancellation);