public AdvancedConfig() { Browser = new JsonBrowser(); Server = new JsonServer(); Easy = new JsonMode(); Normal = new JsonMode(); Hard = new JsonMode(); }
public ClientConfigAttribute(Type jsonConverter) { this.name = ""; if (!jsonConverter.IsSubclassOf(typeof(JsonConverter))) { throw new ArgumentException("Parameter must be subclass of JsonConverter", "jsonConverter"); } this.jsonConverter = jsonConverter; this.mode = JsonMode.Custom; }
void PopMode(JsonMode expectedMode) { JsonMode mode = PeekMode(); if (mode != expectedMode) { throw new ArgumentException(GetModeMessage(mode)); } modes.Pop(); }
public SerializationOptions(string name, Type jsonConverter) { this.name = name; if (!jsonConverter.IsSubclassOf(typeof(ExtJsonConverter))) { throw new ArgumentException("Parameter must be subclass of ExtJsonConverter", "jsonConverter"); } this.jsonConverter = jsonConverter; this.mode = JsonMode.Custom; }
string GetModeMessage(JsonMode expectedMode) { switch (expectedMode) { case JsonMode.ARRAY: return("Invalid array passed in, ',' or ']' expected (" + currentPosition + ")"); case JsonMode.KEY: return("Invalid object passed in, key name or ':' expected (" + currentPosition + ")"); case JsonMode.OBJECT: return("Invalid object passed in, key value expected (" + currentPosition + ")"); default: return("Invalid JSON string"); } }
public SerializationOptions(string name, JsonMode mode) { this.name = name; this.mode = mode; }
public SerializationOptions(JsonMode mode, int priority) { this.mode = mode; this.priority = priority; }
public SerializationOptions(JsonMode mode) { this.mode = mode; }
public ClientConfigAttribute(string name, JsonMode mode) { this.name = name; this.mode = mode; }
void PopMode(JsonMode expectedMode) { JsonMode mode = PeekMode (); if (mode != expectedMode) throw new ArgumentException (GetModeMessage (mode)); modes.Pop (); }
void PushMode(JsonMode newMode) { modes.Push(newMode); }
public ConfigOptionAttribute(JsonMode mode) { this.mode = mode; }
public ConfigOptionAttribute(Type jsonConverter) { this.name = ""; if (!jsonConverter.IsSubclassOf(typeof(ExtJsonConverter))) { throw new ArgumentException("Parameter must be subclass of ExtJsonConverter", "jsonConverter"); } this.jsonConverter = jsonConverter; this.mode = JsonMode.Custom; }
public ConfigOptionAttribute(string name, JsonMode mode, int priority) { this.name = name; this.mode = mode; this.priority = priority; }
public ConfigOptionAttribute(string name, JsonMode mode) { this.name = name; this.mode = mode; }
public ConfigOptionAttribute(JsonMode mode, int priority) { this.mode = mode; this.priority = priority; }
public SerializationOptions(string name, JsonMode mode, int priority) { this.name = name; this.mode = mode; this.priority = priority; }
public JsonExporter(bool lowcase, JsonMode mode, string outdir, ExportOptions options) : base(outdir, options) { this.Lowcase = lowcase; this.Mode = mode; }
void OnGUI() { if (_items == null) { Load(); } if (string.IsNullOrEmpty(_newUrl)) { _newUrl = UrlDefault; } if (string.IsNullOrEmpty(_newRes)) { _newRes = ResDefault; } var needSave = false; if (_items.Count > 0) { EditorGUILayout.LabelField("List of csv resources", EditorStyles.boldLabel); _scrollPos = GUILayout.BeginScrollView(_scrollPos, false, true); for (var i = 0; i < _items.Count; i++) { var item = _items[i]; GUILayout.BeginHorizontal(GUI.skin.box); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField( "External url path:", EditorStyles.label, GUILayout.Width(EditorGUIUtility.labelWidth)); EditorGUILayout.SelectableLabel( item.Url, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField( "Local resource path:", EditorStyles.label, GUILayout.Width(EditorGUIUtility.labelWidth)); EditorGUILayout.SelectableLabel( item.Resource, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField( "Convert to JSON:", EditorStyles.label, GUILayout.Width(EditorGUIUtility.labelWidth)); GUI.enabled = false; EditorGUILayout.EnumPopup(item.JsonMode); GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (GUILayout.Button("Remove", GUILayout.Width(80f), GUILayout.Height(52f))) { _items.Remove(item); needSave = true; } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.Space(4f); EditorGUILayout.LabelField("New external csv", EditorStyles.boldLabel); GUILayout.BeginHorizontal(GUI.skin.box); GUILayout.BeginVertical(); _newUrl = EditorGUILayout.TextField("External Url path:", _newUrl).Trim(); _newRes = EditorGUILayout.TextField("Resource file:", _newRes).Trim(); _newJson = (JsonMode)EditorGUILayout.EnumPopup("Convert to JSON:", _newJson); GUILayout.EndVertical(); if (GUILayout.Button("Add", GUILayout.Width(80f), GUILayout.Height(52f))) { var newItem = new RecordInfo(); newItem.Url = _newUrl; newItem.Resource = _newRes; newItem.JsonMode = _newJson; _items.Add(newItem); _newUrl = UrlDefault; _newRes = ResDefault; _newJson = JsonMode.None; needSave = true; } GUILayout.EndHorizontal(); if (needSave) { Save(); } GUILayout.Space(4f); GUI.enabled = _items.Count > 0; if (GUILayout.Button("Update data from external urls", GUILayout.Height(30f))) { var res = Process(_items); EditorUtility.DisplayDialog(titleContent.text, res ?? "Success", "Close"); } GUI.enabled = true; }
string GetModeMessage(JsonMode expectedMode) { switch (expectedMode) { case JsonMode.ARRAY: return "Invalid array passed in, ',' or ']' expected (" + currentPosition + ")"; case JsonMode.KEY: return "Invalid object passed in, key name or ':' expected (" + currentPosition + ")"; case JsonMode.OBJECT: return "Invalid object passed in, key value expected (" + currentPosition + ")"; default: return "Invalid JSON string"; } }
void PushMode(JsonMode newMode) { modes.Push (newMode); }
public ClientConfigAttribute(JsonMode mode) { this.mode = mode; }