internal override void WriteTo(RCJsonWriter writer) { writer.WriteStartObject(); base.WriteTo(writer); writer.WritePropertyName(JsonConstants.ITEMS); writer.WriteStartArray(); foreach (var item in Controls) { item.WriteTo(writer); } writer.WriteEndArray(); writer.WriteEndObject(); }
private static void GenerateIntelliDB(string path, string installationPath) { //nome file per gli oggetti di database string intelliFileDB = Path.Combine(installationPath, JsonConstants.INTELLI_FILE_DB); //cero le sottocartelle databasescript string[] folders = Directory.GetDirectories(path, "databasescript", SearchOption.AllDirectories); //per ognuna, se contiene la sub create\all, cerco tutti i file .sql List <String> files = new List <string>(); foreach (var folder in folders) { string sub = Path.Combine(folder, "create\\all"); if (Directory.Exists(sub)) { files.AddRange(Directory.GetFiles(sub, "*.sql")); } } if (UpdateNeeded(files.ToArray(), new string[] { intelliFileDB })) { string tmp = Path.GetTempFileName(); using (StreamWriter sw = new StreamWriter(tmp, false, new UTF8Encoding(false))) { using (RCJsonWriter writer = new RCJsonWriter(sw)) { writer.Formatting = Newtonsoft.Json.Formatting.Indented; writer.WriteStartArray(); foreach (string f in files) { SQLParser parser = new SQLParser(); parser.Parse(f); foreach (TableStructure t in parser.Tables) { t.WriteTo(writer); } } writer.WriteEndArray(); } } File.Copy(tmp, intelliFileDB, true); File.Delete(tmp); } }