Exemplo n.º 1
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value is string path)
            {
                return(FsPathPersistence.Deserialize(path));
            }

            return(base.ConvertFrom(context, culture, value));
        }
Exemplo n.º 2
0
        public override bool IsValid(ITypeDescriptorContext context, object value)
        {
            if (value is string path)
            {
                return(FsPathPersistence.Deserialize(path).IsValid());
            }

            return(base.IsValid(context, value));
        }
Exemplo n.º 3
0
        public static FileSignature[] ReadFromFile(FsPath targetFile, bool internPath)
        {
            if (!targetFile.IsFile())
            {
                return(null);
            }

            var lines = targetFile.ReadAllLines()
                        .Where(_ => !string.IsNullOrEmpty(_));

            var result = lines
                         .Select(_ => new FileSignature
            {
                Md5Hash = _.Substring(0, 32),
                Path    = FsPathPersistence.Deserialize(_.Substring(33)).Intern(internPath)
            }).ToArray();

            return(result);
        }
Exemplo n.º 4
0
        public FsPath Deserialize(IDeserializer context, ICfgNode cfgNode)
        {
            string path = context.Deserialize <string>(cfgNode);

            return(FsPathPersistence.Deserialize(path));
        }