コード例 #1
0
ファイル: Program.cs プロジェクト: SaigonThink/elfie-arriba
        private static CombinedSettings LoadSettings(string settingsJsonPath)
        {
            CombinedSettings settings     = new CombinedSettings();
            string           settingsJson = File.ReadAllText(settingsJsonPath);

            return(JsonConvert.DeserializeObject <CombinedSettings>(settingsJson, serializerSettings));
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: SaigonThink/elfie-arriba
        private static void SetSettings(Table table, CombinedSettings settings)
        {
            // Set and write security
            SecureDatabase db = new SecureDatabase();

            db.SetSecurity(table.Name, settings.Security);
            db.SaveSecurity(table.Name);

            // Create/Modify columns
            foreach (ColumnDetails cd in settings.Schema)
            {
                table.AddColumn(cd);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: SaigonThink/elfie-arriba
        private static void SetSettings(string tableName, string settingsJsonPath)
        {
            Console.WriteLine("Applying settings from '{0}' to '{1}'...", settingsJsonPath, tableName);

            // Read settings file
            CombinedSettings settings = LoadSettings(settingsJsonPath);

            // Create table, if required
            SecureDatabase db = new SecureDatabase();

            if (!db.TableExists(tableName))
            {
                db.AddTable(tableName, settings.ItemCountLimit);
            }

            // Apply the settings
            SetSettings(db[tableName], settings);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: SaigonThink/elfie-arriba
        private static void GetSettings(string tableName, string settingsJsonPath)
        {
            Console.WriteLine("Reading settings from '{0}' and writing to '{1}'...", tableName, settingsJsonPath);

            CombinedSettings settings = new CombinedSettings();

            SecureDatabase db = new SecureDatabase();

            settings.Security = db.Security(tableName);

            Table t = db[tableName];

            settings.ItemCountLimit = t.PartitionCount * ushort.MaxValue;
            settings.Schema         = new List <ColumnDetails>(t.ColumnDetails);

            string settingsJson = JsonConvert.SerializeObject(settings, serializerSettings);

            File.WriteAllText(settingsJsonPath, settingsJson);
        }