Exemple #1
0
        public static PGNDefnCollection LoadInternal()
        {
            Assembly asm    = Assembly.GetExecutingAssembly();
            Stream   stream = asm.GetManifestResourceStream("OpenSkipperApplication.Resources.PGNDefns.N2kDfn.xml");

            PGNDefnCollection newDefns = XmlFileSerializer.Deserialize(stream);

            newDefns.FileType = FileTypeEnum.Internal;
            return(newDefns);
        }
Exemple #2
0
 // Public methods for changing the definition collections in use, will revert to internal definitions if provided with a fileName it cannot load from
 // Returns true, if new file has been loaded
 public static bool LoadPGNDefns(string fileName)
 {
     if ((PGNDefnCol != null) && !PGNDefnCol.IsChanged(fileName))
     {
         return(false);
     }
     PGNDefnCol = PGNDefnCollection.LoadFromFile(fileName);
     Settings.Default.N2kPath = fileName;
     Settings.Default.Save();
     return(true);
 }
Exemple #3
0
        // File IO
        public static PGNDefnCollection LoadFromFile(string fileName)
        {
            fileName = CommonRoutines.ResolveFileNameIfEmpty(fileName, DefDefnFile);
            if (fileName == "")
            {
                return(LoadInternal());
            }

            PGNDefnCollection pgnDefnCol = XmlFileSerializer.Deserialize(fileName);

            if (pgnDefnCol != null)
            {
                pgnDefnCol.FileName     = fileName;
                pgnDefnCol.FileDateTime = File.GetLastWriteTime(fileName);
                pgnDefnCol.FileType     = FileTypeEnum.NativeXMLFile;
                return(pgnDefnCol);
            }

            return(LoadInternal());
        }