Ejemplo n.º 1
0
        public static PinboardFileV1 Load(ParsedPath pinboardFileName)
        {
            PinboardFileV1 data = null;

            if (pinboardFiles == null)
            {
                pinboardFiles = new Dictionary <ParsedPath, PinboardFileV1>();
            }

            if (pinboardFiles.TryGetValue(pinboardFileName, out data))
            {
                return(data);
            }

            try
            {
                data = PinboardFileReaderV1.ReadFile(pinboardFileName);
            }
            catch
            {
                throw new ContentFileException("Unable to read pinboard file '{0}'".CultureFormat(pinboardFileName));
            }

            pinboardFiles.Add(pinboardFileName, data);

            return(data);
        }
        private Dictionary <ParsedPath, PinboardFileV1> ReadPinboardFiles(IEnumerable <ParsedPath> pinboardFiles)
        {
            Dictionary <ParsedPath, PinboardFileV1> pinboards = new Dictionary <ParsedPath, PinboardFileV1>();

            foreach (var pinboardFile in pinboardFiles)
            {
                Context.WriteMessage("Reading pinboard file '{0}'", pinboardFile);

                PinboardFileV1 pinboard = null;

                try
                {
                    pinboard = PinboardFileReaderV1.ReadFile(pinboardFile);
                }
                catch (Exception e)
                {
                    throw new ContentFileException("Unable to read pinboard file '{0}'".CultureFormat(pinboardFile), e);
                }

                pinboards.Add(pinboardFile, pinboard);
            }

            return(pinboards);
        }