public static string GenerateServerRequestString(List <ModSyncModMetaData> mods) { StringBuilder json = new StringBuilder(); if (mods.Count > 0) { json.Append("["); } bool isFirst = true; foreach (var modSyncModMetaData in mods) { if (!isFirst) { json.Append(","); } isFirst = false; PlayerModAndVersion pmv = new PlayerModAndVersion(); pmv.MF = modSyncModMetaData.ModDirName.ToUpper(); pmv.V = modSyncModMetaData.LocalModData.Version; json.Append(JsonUtility.ToJson(pmv)); } if (mods.Count > 0) { json.Append("]"); } return(json.ToString()); }
public static string GenerateServerRequestString(string modDirectoryName, string modVersion) { StringBuilder json = new StringBuilder("["); PlayerModAndVersion pmv = new PlayerModAndVersion(); pmv.MF = modDirectoryName.ToUpper(); pmv.V = modVersion; json.Append(JsonUtility.ToJson(pmv)); json.Append("]"); return(json.ToString()); }