private static void DrawMacroGraph() { foreach (BiDirectionalVertex <MacroRecording> vertex in (Collection <BiDirectionalVertex <MacroRecording> >)MacroGraph.mInstance.Vertices) { MacroGraph.LinkMacroChilds(vertex as MacroRecording); } }
public static void ReCreateMacroGraphInstance() { if (MacroGraph.mInstance == null) { MacroGraph.mInstance = new BiDirectionalGraph <MacroRecording>((ObservableCollection <BiDirectionalVertex <MacroRecording> >)null); } MacroGraph.mInstance.Vertices.Clear(); MacroGraph.CreateMacroGraphInstance(); }
private static void CreateMacroGraphInstance() { if (!Directory.Exists(RegistryStrings.MacroRecordingsFolderPath)) { return; } foreach (string file in Directory.GetFiles(RegistryStrings.MacroRecordingsFolderPath)) { string path = Path.Combine(RegistryStrings.MacroRecordingsFolderPath, file); if (File.Exists(path)) { try { MacroRecording macroRecording = JsonConvert.DeserializeObject <MacroRecording>(File.ReadAllText(path), Utils.GetSerializerSettings()); if (macroRecording != null) { if (!string.IsNullOrEmpty(macroRecording.Name)) { if (!string.IsNullOrEmpty(macroRecording.TimeCreated)) { if (macroRecording.Events == null) { ObservableCollection <MergedMacroConfiguration> macroConfigurations = macroRecording.MergedMacroConfigurations; // ISSUE: explicit non-virtual call if ((macroConfigurations != null ? (__nonvirtual(macroConfigurations.Count) > 0 ? 1 : 0) : 0) == 0) { continue; } } MacroGraph.mInstance.AddVertex((BiDirectionalVertex <MacroRecording>)macroRecording); } } } } catch { Logger.Error("Unable to deserialize userscript."); } } } MacroGraph.DrawMacroGraph(); }
public static bool CheckIfDependentMacrosAreAvailable(MacroRecording macro1) { if (macro1 == null) { return(false); } if (macro1.RecordingType == RecordingTypes.SingleRecording) { return(true); } return(macro1.MergedMacroConfigurations.SelectMany <MergedMacroConfiguration, string>((Func <MergedMacroConfiguration, IEnumerable <string> >)(macro2 => (IEnumerable <string>)macro2.MacrosToRun)).Distinct <string>().Count <string>() == macro1.Childs.Count && macro1.Childs.Cast <MacroRecording>().All <MacroRecording>((Func <MacroRecording, bool>)(childMacro => MacroGraph.CheckIfDependentMacrosAreAvailable(childMacro)))); }