public static JSONNode GetData(DataID type, Vessel vessel)
        {
            switch (type)
            {
            case DataID.VesselName:
                return(new JSONString(vessel.vesselName));

            case DataID.Situation:
                return(new JSONString(vessel.situation.ToString()));

            case DataID.LaunchTime:
                return(new JSONNumber(vessel.launchTime));

            case DataID.MissionTime:
                return(new JSONNumber(vessel.missionTime));

            case DataID.LaunchedFrom:
                return(new JSONString(vessel.launchedFrom));

            case DataID.FullCrewInfo:
            {
                var retArr = new JSONArray();
                foreach (var crew in vessel.GetVesselCrew())
                {
                    var crewObj = new JSONObject();
                    crewObj.Add("Name", new JSONString(crew.displayName));
                    crewObj.Add("Gender", new JSONString(crew.gender.Description()));
                    crewObj.Add("Type", new JSONString(crew.type.ToString()));
                    crewObj.Add("Veteran", new JSONBool(crew.veteran));
                    crewObj.Add("Hero", new JSONBool(crew.isHero));
                    crewObj.Add("Badass", new JSONBool(crew.isBadass));

                    crewObj.Add("Level", new JSONNumber(crew.experienceLevel));
                    crewObj.Add("Courage", new JSONNumber(crew.courage));
                    crewObj.Add("Stupidity", new JSONNumber(crew.stupidity));
                    crewObj.Add("Trait", new JSONString(crew.trait));


                    crewObj.Add("G", new JSONNumber(crew.geeForce));
                    crewObj.Add("OutG", new JSONBool(crew.outDueToG));

                    crewObj.Add("Status", new JSONString(crew.rosterStatus.ToString()));

                    crewObj.Add("ID", new JSONString(crew.displayName.GetHashCode().ToString()));
                    retArr.Add(crewObj);
                }

                return(retArr);
            }

            case DataID.CrewUpdate:
            {
                var retObj           = new JSONObject();
                var crewMembers      = vessel.GetVesselCrew();
                var screenshotstaken = new Semaphore(crewMembers.Count, crewMembers.Count);
                foreach (var crew in crewMembers)
                {
                    var crewObj = new JSONObject();
                    crewObj.Add("G", new JSONNumber(crew.geeForce));
                    crewObj.Add("OutG", new JSONBool(crew.outDueToG));
                    crewObj.Add("Status", new JSONString(crew.rosterStatus.ToString()));
                    screenshotstaken.WaitOne();
                    CameraUtils.GetImage(crew.seat.portraitCamera, 200, 200, delegate(Texture2D image)
                        {
                            crewObj.Add("Camera",
                                        new JSONString("data:image/jpg;base64," +
                                                       Convert.ToBase64String(image.EncodeToJPG())));
                            retObj.Add(crew.displayName.GetHashCode().ToString(), crewObj);
                            screenshotstaken.Release(1);
                        });
                }

                foreach (var _ in crewMembers)
                {
                    screenshotstaken.WaitOne();
                }
                return(retObj);
            }

            case DataID.FuelData:
            {
                var resourceID = new Dictionary <string, Tuple <int, double, double, JSONObject> >();
                var freeID     = 0;
                foreach (var part in vessel.Parts.Where(x => x.Resources.Any()))
                {
                    foreach (var resource in part.Resources)
                    {
                        var resourceObject = new JSONObject();
                        Tuple <int, double, double, JSONObject> currResource;
                        if (resourceID.ContainsKey(resource.resourceName))
                        {
                            currResource = resourceID[resource.resourceName];
                        }
                        else
                        {
                            currResource = new Tuple <int, double, double, JSONObject>(freeID++, 0, 0, new JSONObject());
                            resourceID.Add(resource.resourceName, currResource);
                        }

                        resourceObject.Add("ID", new JSONNumber(part.flightID));
                        resourceObject.Add("Amount", new JSONNumber(resource.amount));
                        resourceObject.Add("MaxAmount", new JSONNumber(resource.maxAmount));
                        resourceID[resource.resourceName] = new Tuple <int, double, double, JSONObject>(
                            currResource.Item1,
                            currResource.Item2 + resource.amount, currResource.Item3 + resource.maxAmount,
                            currResource.Item4);
                        if (!currResource.Item4.Linq.Select(x => x.Key)
                            .Contains(part.partInfo.name.GetHashCode().ToString()))
                        {
                            var partTypeObj = new JSONObject();
                            partTypeObj.Add("Name", part.partInfo.title);
                            partTypeObj.Add("Parts", new JSONArray());
                            currResource.Item4.Add(part.partInfo.name.GetHashCode().ToString(), partTypeObj);
                        }

                        currResource.Item4[part.partInfo.name.GetHashCode().ToString()]["Parts"].Add(resourceObject);
                    }
                }

                var idsObj = new JSONObject();
                foreach (var pair in resourceID)
                {
                    var idObj = new JSONObject();
                    idObj.Add("Name", new JSONString(pair.Key));
                    idObj.Add("Amount", new JSONNumber(pair.Value.Item2));
                    idObj.Add("MaxAmount", new JSONNumber(pair.Value.Item3));
                    idObj.Add("Parts", resourceID[pair.Key].Item4);
                    idsObj.Add(pair.Value.Item1.ToString(), idObj);
                }

                return(idsObj);
            }

            default:
                return(new JSONString(""));
            }
        }