private void BuildCollection(IFileViewModel fileViewModel, JsonNode jsonNode, Schema schema, List<string> path, CancellationToken? token)
 {
     if (token.HasValue && token.Value.IsCancellationRequested)
     return;
       foreach (JsonElement jsonElement in jsonNode)
       {
     path.Add(jsonElement.Key);
     SchemaObject schemaObject = schema.GetSchemaObject(path);
     if (schemaObject != null)
     {
       if (schemaObject.AutoCompleteTargetKey != null)
       {
     string prefix = schemaObject.Prefix;
     AddParameters(ref prefix, fileViewModel);
     if (jsonElement.Value is JsonNode)
       AddRange(schemaObject.AutoCompleteTargetKey, ((JsonNode)jsonElement.Value).Keys, prefix, fileViewModel);
     else
       Add(schemaObject.AutoCompleteTargetKey, jsonElement.Value.ToString(), prefix,fileViewModel);
       }
       JsonNode node = jsonElement.Value as JsonNode;
       if (node != null)
     BuildCollection(fileViewModel, node, schema, path, token);
       else
       {
     JsonArray array = jsonElement.Value as JsonArray;
     if (array != null)
       BuildCollection(fileViewModel, array, schema, path, token);
       }
     }
     path.RemoveAt(path.Count - 1);
       }
 }
 private void BuildCollection(IFileViewModel fileViewModel, JsonArray jsonArray, Schema schema, List<string> path, CancellationToken? token)
 {
     foreach (object obj in jsonArray)
       {
     path.Add("[0]");
     SchemaObject schemaObject = schema.GetSchemaObject(path);
     if (schemaObject == null) continue;
     if (schemaObject.AutoCompleteTargetKey != null)
     {
       string prefix = schemaObject.Prefix;
       AddParameters(ref prefix, fileViewModel);
       Add(schemaObject.AutoCompleteTargetKey, obj.ToString(), prefix, fileViewModel);
     }
     JsonNode node = obj as JsonNode;
     if (node != null)
       BuildCollection(fileViewModel, node, schema, path, token);
     JsonArray array = obj as JsonArray;
     if (array != null)
       BuildCollection(fileViewModel, array, schema, path, token);
     path.RemoveAt(path.Count - 1);
       }
 }
Esempio n. 3
0
        public BaseTextEditorViewModel(MainViewModel mainViewModel)
        {
            m_mainViewModel = mainViewModel;
              SetHighLight(Properties.Resources.Json_Mode, new[] {".json"}, "Json highlighting");
              SetHighLight(Properties.Resources.CSharp_Mode, new[] { ".cs" }, "C# highlighting");
              SetHighLight(Properties.Resources.CPP_Mode, new[] { ".c", ".h", ".cpp", ".hpp" }, "c/c++ highlighting");
              SetHighLight(Properties.Resources.CSS_Mode, new[] { ".css" }, "Css highlighting");
              SetHighLight(Properties.Resources.HTML_Mode, new[] { ".html", ".htm" }, "Html highlighting");
              SetHighLight(Properties.Resources.JavaScript_Mode, new[] { ".js" }, "Javascript highlighting");
              SetHighLight(Properties.Resources.XmlDoc, new[] { ".xml", ".xshd" }, "Xml highlighting");
              SetHighLight(Properties.Resources.Lua, new[] { ".lua", ".luac" }, "Lua highlighting");

              m_textDocument = new TextDocument();
              m_textDocument.TextChanged += TextDocumentOnTextChanged;

              m_findNextCommand = new ManualCommand(FindNext);
              m_replaceCommand = new ManualCommand(Replace);
              m_replaceAllCommand = new ManualCommand(ReplaceAll);
              m_settningsSchema = GetSettingsSchema(m_mainViewModel.SchemaManager);
              Settings = GetSettings();
        }
Esempio n. 4
0
 public SchemaObject(JsonObject jsonObject, Schema schema)
 {
     m_schema = schema;
       m_jsonObject = jsonObject;
 }
Esempio n. 5
0
 public SchemaObject(JsonElement jsonElement, Schema schema)
     : this((JsonObject)jsonElement.Value, schema)
 {
     m_name = jsonElement.Key;
 }
Esempio n. 6
0
 public void AddSchema(Schema schema)
 {
     m_schemas.Add(schema.Id, schema);
 }
Esempio n. 7
0
 public void AddLockedSchema(Schema schema)
 {
     m_lockedSchemas.AddSchema(schema);
 }