示例#1
0
        /// <summary>
        ///  Gets the FileInfo object for the xml file defining the shapes to be used by DOF.
        /// </summary>
        /// <returns>FileInfo object for the xml file defining the shapes to be used by DOF</returns>
        public FileInfo GetShapeDefinitionFile(string TableFilename = "", string RomName = "")
        {
            if (ShapeDefintionFilePattern != null && !ShapeDefintionFilePattern.Pattern.IsNullOrWhiteSpace() && ShapeDefintionFilePattern.IsValid)
            {
                return(ShapeDefintionFilePattern.GetFirstMatchingFile(GetReplaceValuesDictionary(TableFilename, RomName)));
            }
            Dictionary <int, FileInfo> IniFilesDict = GetIniFilesDictionary(TableFilename);

            if (IniFilesDict.Count > 0)
            {
                FileInfo FI = new FileInfo(Path.Combine(IniFilesDict.Select(KV => KV.Value).First().Directory.FullName, "DirectOutputShapes.xml"));
                if (FI.Exists)
                {
                    return(FI);
                }
            }
            FileInfo FII = new FilePattern("{DllDir}\\DirectOutputShapes.xml").GetFirstMatchingFile(GetReplaceValuesDictionary(TableFilename, RomName));

            if (FII != null && FII.Exists)
            {
                return(FII);
            }


            return(null);
        }
 private void UpdateFilePatternStatus(DataGridView DataGridView, int RowIndex)
 {
     if (RowIndex.IsBetween(0, DataGridView.Rows.Count - 1))
     {
         FilePattern F = new FilePattern((string)DataGridView[0, RowIndex].Value);
         DataGridView[1, RowIndex].Value = (F.IsValid ? "OK" : "Invalid file pattern");
     }
 }