예제 #1
0
        /// <summary>
        /// Load security data (tik data) from file (either zipped or on disk)
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        private SecurityImpl GetSecurity(string file)
        {
            try
            {
                //Check if file contains a zip definition
                if (file.ToLower().Contains("zip"))
                {
                    //Get zip file and tik file from filename
                    string[] parts    = file.ToLower().Split('\\');
                    string   tickfile = parts.Skip(parts.Length - 1).First();
                    string   zipfile  = string.Join(@"\", parts.Take(parts.Length - 1));

                    return(SecurityImpl.FromZip(zipfile, tickfile));
                }
                return(SecurityImpl.FromTik(file));
            }
            catch (Exception ex)
            {
                Debug("error reading TIK file: " + file + " err: " + ex.Message + ex.StackTrace);
                return(null);
            }
        }