コード例 #1
0
        /// <summary>
        /// Checks for a valid vinfo file in the specified directory, if the file is found it loads it and
        /// checks that it is compatible with previously loaded data and the library.
        /// </summary>
        /// <param name="directory">Directory to check.</param>
        /// <param name="staticDataStore">staticDataStore to check this dataVersionInfo against loaded dataVersionInfo for incompatibilities</param>
        /// <param name="dataVInfo">Static data version to check against.</param>
        /// <returns>true if a compatible vinfo file was found, false otherwise.</returns>
        private static bool CheckDataDirectoryVersion(string directory, StaticDataStore staticDataStore, out DataVersionInfo dataVInfo)
        {
            dataVInfo = null;

            string[] vInfoFile = Directory.GetFiles(directory, "*.vinfo");

            if (vInfoFile.GetLength(0) < 1 || string.IsNullOrEmpty(vInfoFile[0]))
            {
                return(false);
            }

            dataVInfo = LoadVinfo(vInfoFile[0]);

            if (!dataVInfo.IsCompatibleWithLibrary())
            {
                return(false);
            }
            foreach (DataVersionInfo dataVersionInfo in staticDataStore.LoadedDataSets)
            {
                if (!dataVersionInfo.IsCompatibleWithDataset(dataVInfo))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
 public bool IsCompatibleWithDataset(DataVersionInfo dataSetVInfo)
 {
     return(!IncompatibleData.Contains(dataSetVInfo) && !dataSetVInfo.IncompatibleData.Contains(this));
 }