private static void SetupDefaultOsuNodes() { // TODO: UNFINISHED - All nodes disabled by default. User sets true to static field named Enabled? System enables parents as needed. // This property is for actually scanning the node (different than the "StatePresentable" prop on StatePropAttribute). // // Program should initialize nodes by scanning this "enabled" field. Base Node should have abstract method // Node.Present()/Hide() which sets the StatePropAttribute "enabled" to true/false. // // Base node should also have method Node.Rename(string) which renames the StatePropAttribute "name" prop. // level 0 nodes (master nodes) var mapIdNode = new MapIdNode(); var mapTimeNode = new MapTimeNode(); // level 1 nodes var beatmapNode = new BeatmapNode(); // level 2 nodes var mapStartNode = new MapStartNode(); var mapBreakNode = new MapBreakNode(); var mapPausedNode = new PausedNode(); // level 3 var statusNode = new StatusNode(); // level 4 var modsNode = new ModsNode(); // other var ppNowNode = new PPNode(); var bpmNode = new BpmNode(); // level 0 mapIdNode.Precedes(beatmapNode); //mapIdNode.Precedes(leaderboardNode); mapTimeNode.Precedes(bpmNode, mapBreakNode, ppNowNode, mapPausedNode); // level 1 beatmapNode.Precedes(bpmNode, mapStartNode, ppNowNode, mapBreakNode, mapPausedNode); // level 2 mapPausedNode.Precedes(statusNode); mapStartNode.Precedes(statusNode); mapBreakNode.Precedes(statusNode); // level 3 statusNode.Precedes(modsNode, ppNowNode); // level 4 modsNode.Precedes(bpmNode); }
/// <summary> /// Updates the status node. /// </summary> protected override bool UpdateStatus() { // get the status from the server. ComHdaClient client = DefaultClient; ComHdaClient.ServerStatus?status = client.GetStatus(); // check the client has been abandoned. if (!Object.ReferenceEquals(client, DefaultClient)) { return(false); } // update the server status. lock (StatusNodeLock) { StatusNode.ServerUrl.Value = Configuration.ServerUrl; if (status != null) { StatusNode.SetStatusCode(DefaultSystemContext, StatusCodes.Good, DateTime.UtcNow); if (String.IsNullOrEmpty(status.Value.szStatusString)) { StatusNode.ServerState.Value = Utils.Format("{0}", status.Value.wStatus); } else { StatusNode.ServerState.Value = Utils.Format("{0} '{1}'", status.Value.wStatus, status.Value.szStatusString); } StatusNode.CurrentTime.Value = status.Value.ftCurrentTime; StatusNode.LastUpdateTime.Value = DateTime.MinValue; StatusNode.StartTime.Value = status.Value.ftStartTime; StatusNode.VendorInfo.Value = status.Value.szVendorInfo; StatusNode.SoftwareVersion.Value = Utils.Format("{0}.{1}.{2}", status.Value.wMajorVersion, status.Value.wMinorVersion, status.Value.wBuildNumber); } else { StatusNode.SetStatusCode(DefaultSystemContext, StatusCodes.BadOutOfService, DateTime.UtcNow); } StatusNode.ClearChangeMasks(DefaultSystemContext, true); return(status != null); } }
public bool VisitStatusNode(StatusNode node, CompilationState state) { switch (node.Status) { case Status.Ok: state.Write("{ "); state.Write("ok = "); WriteString(state, "Ok"); state.Write(" }"); break; case Status.Error: state.Write("{ "); state.Write("err = "); (node.Error ?? new ConstantValueNode(DataValueType.String, "Error")).AcceptVisitor(this, state); state.Write(" }"); break; } return(true); }