/// <inheritdoc /> protected override void RenderInputFields(Step step, StepMetadata stepMetadata) { var runJobStep = (RunJobStep)step; EditorGUI.BeginChangeCheck(); base.RenderInputFields(runJobStep, stepMetadata); EditorGUILayout.Space(); if (runJobStep.TargetJob == null) { EditorGUILayout.HelpBox("\"Target Job\" field is empty", MessageType.Warning); return; } if (runJobStep.TargetJob == JobTracker.FocusedJob) { EditorGUILayout.HelpBox("\"Target Job\" cannot be the same as a running job!", MessageType.Error); return; } if (EditorGUI.EndChangeCheck()) { UpdateJobVariables(runJobStep); } RenderExistingVariableFields(runJobStep); EditorGUILayout.Space(); RenderAdditionalVariableFields(runJobStep); RemovePendingKeys(runJobStep); }
public void shouldCheckEqualityOfDelegateToMetadata() { Func<string, int> data = int.Parse; var testee = new StepMetadata("Parse", typeof(int), typeof(string), typeof(int), ""); Assert.IsTrue(testee.DoesMethodMatch(data)); }
public void shouldParseNamedStepData() { var expected = new StepMetadata("Parse", typeof(int), typeof(string), typeof(int), "(0,0)"); var data = expected.ToString(); var actual = StepMetadata.Parse(data); Assert.IsTrue(expected.Equals(actual)); }
public Optional <IEnumerable <WeightedEdge <T> > > FindSpanningTreeEdges(IGraph <T> graph) { if (graph == null) { throw new ArgumentNullException(nameof(graph)); } if (graph.Count == 0) { return(Optional <IEnumerable <WeightedEdge <T> > > .None()); } var source = _sourceNodeProvider(graph); var distances = InitializeDistanceTable(graph, source); var verticesToProcess = new MinBinaryHeap <DistanceInfo <T> >(DistanceInfo <T> .DistanceComparer); var processedVertices = new HashSet <T>(graph.Comparer); var spanningTree = new HashSet <WeightedEdge <T> >(WeightedEdge <T> .NonDirectionalComparer(graph.Comparer)); verticesToProcess.Push(DistanceInfo <T> .Zero(source)); while (verticesToProcess.Count > 0) { var currentVertex = verticesToProcess.Pop().Single().PreviousVertex; var sourceDistance = distances[currentVertex]; processedVertices.Add(currentVertex); if (graph.Comparer.Equals(source, currentVertex) == false) { var edge = new WeightedEdge <T>(sourceDistance.PreviousVertex, currentVertex, sourceDistance.Distance); if (spanningTree.Contains(edge) == false) { spanningTree.Add(edge); } } foreach (var destinationVertex in graph.GetAdjacentVertices(currentVertex)) { if (processedVertices.Contains(destinationVertex)) { continue; } var step = StepMetadata <T> .ForSpanningTree(currentVertex, destinationVertex, distances); if (step.FoundShorterDistance()) { distances[destinationVertex] = step.ToSource(); verticesToProcess.Push(step.ToDestination()); } } } return(spanningTree); }
/// <summary> /// Simply generate StepMetadata object with a lot of details to get a big step for load testing of writing. /// </summary> /// <returns>Generated StepMetadata</returns> private static StepMetadata CreateBigMetadata() { var stepMetadata = new StepMetadata(); for (var i = 0; i < 1000; i++) { stepMetadata.Details.AddDetail("detail" + i, "just a detail to produce a lot of data that needs marshalling and writing."); } return(stepMetadata); }
public override StepMetadata ReadStepchartMetadata() { if (State != ReaderState.ReadingChartMetadata) { throw new InvalidOperationException("Reader is not positioned to read Chart metadata"); } var stepData = new StepMetadata(); do { ReadNextTag(out SmFileAttribute tag); switch (tag) { case SmFileAttribute.CHARTNAME: stepData.ChartName = ReadTagValue(); break; case SmFileAttribute.STEPSTYPE: stepData.PlayStyle = ReadTagValue().AsPlayStyle(); break; //case SmFileAttribute.DESCRIPTION: // break; //case SmFileAttribute.CHARTSTYLE: // break; case SmFileAttribute.DIFFICULTY: stepData.Difficulty = ReadTagValue().AsSongDifficulty(); break; case SmFileAttribute.METER: stepData.DifficultyRating = (int)double.Parse(ReadTagValue()); break; //case SmFileAttribute.CREDIT: // break; //case SmFileAttribute.DISPLAYBPM: // break; case SmFileAttribute.NOTES: break; default: SkipTagValue(); break; } } while (_lastReadTag != SmFileAttribute.NOTES); _reader.Read(); //Toss ':' token State = ReaderState.ReadingNoteData; return(stepData); }
private static string GenerateLightsChart(string file, StepMetadata referenceData) { using (var reader = StepmaniaFileReaderFactory.CreateReader(file)) { while (reader.ReadNextTag(out SmFileAttribute tag)) { if (reader.State != ReaderState.ReadingChartMetadata) { continue; } var stepData = reader.ReadStepchartMetadata(); if (stepData.PlayStyle == referenceData.PlayStyle && stepData.Difficulty == referenceData.Difficulty) { return(GenerateLightsChart(reader)); } } } throw new Exception($"Could not find note data to reference in {file}"); }
public virtual StepMetadata ReadStepchartMetadata() { if (State != ReaderState.ReadingChartMetadata) { throw new InvalidOperationException("Reader is not positioned to read chart metadata."); } _reader.Read(); //toss ':' token var stepData = new StepMetadata { PlayStyle = ReadNoteHeaderSection().AsPlayStyle(), ChartAuthor = ReadNoteHeaderSection(), Difficulty = ReadNoteHeaderSection().AsSongDifficulty(), DifficultyRating = (int)double.Parse(ReadNoteHeaderSection()) }; //Skip groove radar values - no one cares ReadNoteHeaderSection(); State = ReaderState.ReadingNoteData; return(stepData); }
internal LightsChart(string content, StepMetadata referenceChart) { Content = content; ReferenceChart = referenceChart; }
/// <summary> /// Initializes a new instance of the <see cref="StepInsertionResult"/> class. /// </summary> /// <param name="metadata">The instance of the <see cref="StepMetadata"/> class that this insertion result pertains to.</param> /// <param name="result">The result of the insertion process as defined by the <see cref="StepBuildResults"/> enum.</param> internal StepInsertionResult(StepMetadata metadata, StepBuildResults result) { this.Metadata = metadata; this.Outcome = result; }
/// <inheritdoc /> protected override void RenderFieldTypeToolbar(StepMetadata stepMetadata) { // do not render this section }
/// <inheritdoc /> protected override void RenderOutputFields(Step step, StepMetadata stepMetadata) { // do not render this section }