Ejemplo n.º 1
0
        TableBase Load <T>(eTableType type) where T : TableBase, new()
        {
            if (_tableData.ContainsKey(type))
            {
                return(_tableData[type]);
            }

            string LoadFileFullPath = System.IO.Directory.GetCurrentDirectory() + "\\" + type.ToString() + ".json";

            StreamReader fileReader = new StreamReader(LoadFileFullPath, Encoding.Unicode, false);
            string       json       = fileReader.ReadToEnd();

            fileReader.Close();

            if (json != null)
            {
                T t = new T();
                t.LoadTable(json);
                _tableData.Add(type, t);

                return(_tableData[type]);
            }

            return(null);
        }
Ejemplo n.º 2
0
    public TableBase Get(eTableType type)
    {
        if (_tableData.ContainsKey(type))
        {
            return(_tableData[type]);
        }

        return(null);
    }
Ejemplo n.º 3
0
    void LoadData <T>(eResourceKind kind, eTableType type) where T : class
    {
        Dictionary <string, object> tempDic = new Dictionary <string, object>();

        TableBase tb = TableManager._instance.Get(type);

        foreach (string key in tb._datas.Keys)
        {
            object obj  = Resources.Load(tb._datas[key]["Location"], typeof(T));
            T      temp = (T)Convert.ChangeType(obj, typeof(T));
            tempDic.Add(tb._datas[key]["Name"], temp);
        }

        _resourceData.Add(kind, tempDic);
    }
Ejemplo n.º 4
0
 public void SetTableHeight(Control ctrl, eTableType tt)
 {
     if (tt == eTableType.Minimized)
     {
         ctrl.Height = 56;
     }
     else if (tt == eTableType.Autosize)
     {
         // ctrl.Height = 256;
     }
     else
     {
         // ctrl.Height = 512;
     }
 }
Ejemplo n.º 5
0
        public string GetAllIndicies(eDBVersion version, eTableType tableType)
        {
            var sb = new StringBuilder();

            sb.Append("SELECT RDB$INDICES.RDB$RELATION_NAME, RDB$INDICES.RDB$INDEX_NAME,RDB$INDEX_SEGMENTS.RDB$FIELD_NAME,RDB$INDICES.rdb$unique_flag,RDB$INDICES.rdb$index_inactive,RDB$INDICES.rdb$index_type ");
            sb.Append("FROM RDB$INDEX_SEGMENTS JOIN RDB$INDICES ON RDB$INDICES.RDB$INDEX_NAME = RDB$INDEX_SEGMENTS.RDB$INDEX_NAME ");
            sb.Append("LEFT JOIN RDB$RELATION_FIELDS ON RDB$RELATION_FIELDS.rdb$field_position = (RDB$INDEX_SEGMENTS.RDB$FIELD_POSITION + 1) AND RDB$INDEX_SEGMENTS.RDB$FIELD_NAME = RDB$RELATION_FIELDS.rdb$field_name ");
            sb.Append("LEFT JOIN RDB$RELATION_CONSTRAINTS ON RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME = RDB$INDEX_SEGMENTS.RDB$INDEX_NAME ");
            string str = (tableType == eTableType.system)
                ? "WHERE RDB$INDICES.RDB$SYSTEM_FLAG > 0 AND RDB$INDICES.RDB$FOREIGN_KEY IS NULL "
                : "WHERE RDB$INDICES.RDB$SYSTEM_FLAG = 0 AND RDB$INDICES.RDB$FOREIGN_KEY IS NULL ";

            sb.Append(str);
            sb.Append("GROUP BY RDB$INDICES.RDB$RELATION_NAME,RDB$INDICES.RDB$INDEX_NAME,RDB$INDEX_SEGMENTS.RDB$FIELD_NAME,RDB$INDICES.rdb$index_type,RDB$INDICES.rdb$unique_flag,RDB$INDICES.rdb$index_inactive,RDB$INDICES.rdb$index_type ");
            sb.Append("ORDER BY RDB$INDICES.RDB$RELATION_NAME, RDB$INDICES.RDB$INDEX_NAME;");
            return(sb.ToString());
        }
Ejemplo n.º 6
0
    TableBase Load <T>(eTableType type) where T : TableBase, new()
    {
        if (_tableData.ContainsKey(type))
        {
            return(_tableData[type]);
        }

        TextAsset tAsset = Resources.Load("bin/" + type.ToString()) as TextAsset;

        if (tAsset != null)
        {
            T t = new T();
            t.LoadTable(tAsset.text);
            _tableData.Add(type, t);

            return(_tableData[type]);
        }

        return(null);
    }
Ejemplo n.º 7
0
 public string GetAllIndicies(eTableType tableType)
 {
     return(GetAllIndicies(Version, tableType));
 }