Beispiel #1
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("[" + ID.ToString() + "] : ");
            switch (State)
            {
            case -1:
                sb.Append("<Locked>"); break;

            case 0:
                sb.Append("<Empty>"); break;

            case 1:
                sb.Append(KCDatabase.Instance.MasterShips[ShipID].Name + ", at " + CompletionTime.ToString()); break;
            }

            return(sb.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// Serializes this instance of <see cref="Task" /> into a <see cref="Carbon.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Carbon.Json.JsonObject"/> container to serialize this object into. If the caller
        /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
        /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Rest.ClientRuntime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="Task" /> as a <see cref="Carbon.Json.JsonNode" />.
        /// </returns>
        public Carbon.Json.JsonNode ToJson(Carbon.Json.JsonObject container, Microsoft.Rest.ClientRuntime.SerializationMode serializationMode)
        {
            container = container ?? new Carbon.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != ApiVersion ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ApiVersion) : null, "api_version", container.Add);
            AddIf(null != ClusterReference ? (Carbon.Json.JsonNode)ClusterReference.ToJson(null) : null, "cluster_reference", container.Add);
            AddIf(null != CompletionTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(CompletionTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "completion_time", container.Add);
            AddIf(null != CreationTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(CreationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "creation_time", container.Add);
            if (null != EntityReferenceList)
            {
                var __w = new Carbon.Json.XNodeArray();
                foreach (var __x in EntityReferenceList)
                {
                    AddIf(__x?.ToJson(null), __w.Add);
                }
                container.Add("entity_reference_list", __w);
            }
            AddIf(null != ErrorCode ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ErrorCode) : null, "error_code", container.Add);
            AddIf(null != ErrorDetail ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ErrorDetail) : null, "error_detail", container.Add);
            AddIf(null != LastUpdateTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(LastUpdateTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "last_update_time", container.Add);
            AddIf(null != LogicalTimestamp ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((long)LogicalTimestamp) : null, "logical_timestamp", container.Add);
            AddIf(null != OperationType ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(OperationType) : null, "operation_type", container.Add);
            AddIf(null != ParentTaskReference ? (Carbon.Json.JsonNode)ParentTaskReference.ToJson(null) : null, "parent_task_reference", container.Add);
            AddIf(null != PercentageComplete ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((int)PercentageComplete) : null, "percentage_complete", container.Add);
            AddIf(null != ProgressMessage ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ProgressMessage) : null, "progress_message", container.Add);
            AddIf(null != StartTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(StartTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "start_time", container.Add);
            AddIf(null != Status ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Status) : null, "status", container.Add);
            if (null != SubtaskReferenceList)
            {
                var __r = new Carbon.Json.XNodeArray();
                foreach (var __s in SubtaskReferenceList)
                {
                    AddIf(__s?.ToJson(null), __r.Add);
                }
                container.Add("subtask_reference_list", __r);
            }
            AddIf(null != Uuid ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Uuid) : null, "uuid", container.Add);
            AfterToJson(ref container);
            return(container);
        }