예제 #1
0
 /// <summary>
 /// Getting a chunk file path
 /// </summary>
 /// <param name="idx_pair">Index min-max pair</param>
 /// <returns></returns>
 private string GetChunkFilePath( IndexPair idx_pair )
 {
     return CurrentDbPath+@"/rec_"+idx_pair.hash_min+"_"+idx_pair.hash_max+".dwarf";
 }
예제 #2
0
        /// <summary>
        /// Loading chunks list
        /// </summary>
        public void Load( string db_name, bool is_new_db )
        {
            CurrentDbPath = Config.Config.Instance.DataDirectory+@"\"+db_name;

            if ( !Directory.Exists(CurrentDbPath) ) {
                throw new ChunkException("Cannot find a directory for database: "+CurrentDbPath);
            }
            var rec_expr = new Regex(@"\b(.*)rec_(.*)_(.*).dwarf\b");

            string[] files = Directory.GetFiles(CurrentDbPath);
            foreach ( var filepath in files ) {
                if ( rec_expr.IsMatch( filepath ) ) {
                    var mtc = rec_expr.Match( filepath );
                    var min_hash = mtc.Groups[2].Value;
                    var max_hash = mtc.Groups[3].Value;
                    var ipk = new IndexPair() { hash_min = min_hash, hash_max = max_hash };
                    //chunks_lst[ ipk ] = db_name;
                    chunks_lst[ ipk ] = filepath;
                }
            }

            if ( !is_new_db )
                LoadRecordIndexes();
        }