void OnAttachDebugger(MyProgrammableBlock programmableBlock) { if (!Debugger.IsAttached) { Debugger.Launch(); } }
private static void PrefixRecompilePb(MyProgrammableBlock __instance) { if (PBData.pbPair.TryGetValue(__instance.EntityId, out var pbData)) { pbData.SetRecompiled(); } }
private static void PrefixRecompilePb(MyProgrammableBlock __instance) { if (PBData.pbPair.ContainsKey(__instance.EntityId)) { PBData.pbPair[__instance.EntityId].SetRecompiled(); } }
public static ProgrammableBlockProxy Wrap(MyProgrammableBlock programmableBlock) { if (_reflections == null) { _reflections = new Reflections(typeof(MyProgrammableBlock)); } return(new ProgrammableBlockProxy(programmableBlock)); }
// ReSharper disable InconsistentNaming // ReSharper disable once SuggestBaseTypeForParameter private static void PrefixProfilePb(MyProgrammableBlock __instance, ref long __localTimingStart) { if (ProfilerConfig.takeIngameMeasurement) { return; } __localTimingStart = Stopwatch.GetTimestamp(); }
private static void SuffixProfilePB(MyProgrammableBlock __instance) { if (!EnablePatch) { return; } double dtInMS = (double)lastruntimeMS.GetValue(runtimeField.GetValue(__instance)); PBRan?.Invoke(__instance, dtInMS); }
public static void AddOrUpdatePair(MyProgrammableBlock entity, double runtime) { if (pbPair.ContainsKey(entity.EntityId)) { pbPair[entity.EntityId].UpdatePerformance(runtime); } else { pbPair[entity.EntityId] = new PBTracker(entity, runtime); } }
void OnUnbindScriptDll(MyProgrammableBlock programmableBlock) { if (IsFaulted) { return; } if (_proxyCache.TryGetValue(programmableBlock, out var proxy)) { proxy.UnloadProgram(); } }
static void CloseEditor(ref CloseEditorMsg msg, MyNetworkClient sender) { MyEntity entity = null; MyEntities.TryGetEntityById(msg.EntityId, out entity); MyProgrammableBlock block = entity as MyProgrammableBlock; if (block != null) { block.ConsoleOpen = false; } }
static void OpenEditorFailure(ref OpenEditorMsg msg, MyNetworkClient sender) { MyEntity entity = null; MyEntities.TryGetEntityById(msg.EntityId, out entity); MyProgrammableBlock block = entity as MyProgrammableBlock; if (block != null && block.ConsoleOpenRequest) { block.ConsoleOpenRequest = false; block.ShowEditorAllReadyOpen(); } }
async void OnBindScriptDll(MyProgrammableBlock programmableBlock) { if (IsFaulted) { return; } if (!_proxyCache.TryGetValue(programmableBlock, out var proxy)) { try { proxy = ProgrammableBlockProxy.Wrap(programmableBlock); _proxyCache[programmableBlock] = proxy; proxy.ProgrammableBlock.OnClose += OnProgrammableBlockClosed; } catch (BindingException e) { MyLog.Default.Error($"{Plugin.Ident}: {Resources.ProgrammableBlockExtensions_OnBindScriptDll_BindingFailed}: {e}"); MyLog.Default.Flush(); MyAPIGateway.Utilities.ShowMissionScreen( $"{Plugin.Ident}: {Resources.ProgrammableBlockExtensions_OnBindScriptDll_BindingFailed}", currentObjective: Resources.ProgrammableBlockExtensions_OnBindScriptDll_EnableDebugging, screenDescription: Resources.ProgrammableBlockExtensions_OnBindScriptDll_BindingError); IsFaulted = true; return; } } proxy.UnloadProgram(); var fileName = await FileDialog.RequestFileName( Resources.ProgrammableBlockExtensions_OnBindScriptDll_BindScriptDLL, Resources.ProgrammableBlockExtensions_OnBindScriptDll_Filters, proxy.FileName).ConfigureAwait(false); MyLog.Default.WriteLine($"After RequestFileName {Thread.CurrentThread.ManagedThreadId} {Debugger.IsAttached}"); MyLog.Default.Flush(); if (fileName != null) { MyLog.Default.WriteLine($"Found {fileName} {Thread.CurrentThread.ManagedThreadId}"); MyLog.Default.Flush(); LoadScriptAssembly(fileName, proxy); MyLog.Default.WriteLine($"Loaded {fileName} {Thread.CurrentThread.ManagedThreadId}"); MyLog.Default.Flush(); } proxy.ProgrammableBlock?.RaisePropertiesChanged(); }
private static void SuffixProfilePb(MyProgrammableBlock __instance, ref long __localTimingStart) { double dtInSeconds; if (!ProfilerConfig.takeIngameMeasurement) { dtInSeconds = (Stopwatch.GetTimestamp() - __localTimingStart) / (double)Stopwatch.Frequency; } else { dtInSeconds = (double)(lastruntimeMS.GetValue(runtimeField.GetValue(__instance))) / 1000.0; } PBData.AddOrUpdatePair(__instance, dtInSeconds); }
static void OpenEditorRequest(ref OpenEditorMsg msg, MyNetworkClient sender) { MyEntity entity = null; MyEntities.TryGetEntityById(msg.EntityId, out entity); MyProgrammableBlock block = entity as MyProgrammableBlock; if (block != null && block.ConsoleOpen == false) { block.UserId = msg.User; block.ConsoleOpen = true; Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); } else { Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Failure); } }
public static void AddOrUpdatePair(MyProgrammableBlock entity, double runtime) { if (pbPair.ContainsKey(entity.EntityId)) { pbPair[entity.EntityId].UpdatePerformance(runtime); } else { if (control == null) { //Log.Warn("The Itemscontrol is NULL!"); return; } control.Dispatcher.Invoke(() => { lock (pbPair) { pbPair[entity.EntityId] = new PBTracker(entity, runtime); } }); } }
ProgrammableBlockProxy(MyProgrammableBlock programmableBlock) { ProgrammableBlock = programmableBlock ?? throw new ArgumentNullException(nameof(programmableBlock)); }
bool IsAttachDebuggerButtonEnabled(MyProgrammableBlock programmableBlock) { return(IsWorkable() && !Debugger.IsAttached); }
bool IsAttachDebuggerButtonVisible(MyProgrammableBlock programmableBlock) { return(IsWorkable()); }
private static void SuffixProfilePb(MyProgrammableBlock __instance, ref long __localTimingStart) { var dtInSeconds = (Stopwatch.GetTimestamp() - __localTimingStart) / (double)Stopwatch.Frequency; PBData.AddOrUpdatePair(__instance, dtInSeconds); }
// ReSharper disable InconsistentNaming // ReSharper disable once SuggestBaseTypeForParameter private static void PrefixProfilePb(MyProgrammableBlock __instance, ref long __localTimingStart) { __localTimingStart = Stopwatch.GetTimestamp(); }
bool IsUnbindButtonVisible(MyProgrammableBlock programmableBlock) { return(IsWorkable()); }
bool IsUnbindButtonEnabled(MyProgrammableBlock programmableBlock) { return(IsWorkable() && _proxyCache.TryGetValue(programmableBlock, out var proxy) && proxy.HasLoadedProgram); }
public static void Postfix(MyProgrammableBlock __instance) { __HIT__.PopDebugTarget(__instance.EntityId); }
public PBTracker(MyProgrammableBlock PB, double ms) { this.PB = PB; UpdatePerformance(ms); }
bool IsBindButtonEnabled(MyProgrammableBlock programmableBlock) { return(IsWorkable()); }
// ReSharper disable InconsistentNaming // ReSharper disable once SuggestBaseTypeForParameter private static void PrefixProfilePb(MyProgrammableBlock __instance, ref MultiProfilerEntry __localProfilerHandle) { __localProfilerHandle = default(MultiProfilerEntry); ProfilerData.EntityEntry(__instance, ref __localProfilerHandle); __localProfilerHandle.Start(); }
public MySyncProgrammableBlock(MyProgrammableBlock block) { m_programmableBlock = block; }
public PBTracker(MyProgrammableBlock PB, double average) { this.PB = PB; }
public static void Prefix(MyProgrammableBlock __instance) { __HIT__.PushRunningDebugTarget(__instance.EntityId); }