Ejemplo n.º 1
0
        public void OverwriteSample(string hash, string content, SampleDesc newDesc)
        {
            if (!archive.ContainsEntry(hash))
            {
                return;
            }

            archive.UpdateEntry(hash, content);
            index[hash] = newDesc;
        }
Ejemplo n.º 2
0
        public string GetSampleFromID(string id, out SampleDesc desc)
        {
            desc = new SampleDesc();
            var entry = archive[id];

            if (entry == null)
            {
                return(null);
            }
            desc = index[id];
            using (var stream = entry.OpenReader())
                return(new StreamReader(stream).ReadToEnd());
        }
Ejemplo n.º 3
0
        // Returns an id that can be used to register the sample position in the documentation flow
        public string RegisterSample(string source, SampleDesc desc)
        {
            var hash = StringHash(source);

            validFiles.Add(hash);
            desc.ID = hash;

            if (!archive.ContainsEntry(hash))
            {
                archive.AddEntry(hash, source);
                index[hash] = desc;
            }

            return(hash);
        }
Ejemplo n.º 4
0
 public string GetSampleFromContent(string content, out SampleDesc desc)
 {
     return(GetSampleFromID(StringHash(content), out desc));
 }
Ejemplo n.º 5
0
        // Returns an id that can be used to register the sample position in the documentation flow
        public string RegisterSample(string source, SampleDesc desc)
        {
            var hash = StringHash (source);
            validFiles.Add (hash);
            desc.ID = hash;

            if (!archive.ContainsEntry (hash)) {
                archive.AddEntry (hash, source);
                index[hash] = desc;
            }

            return hash;
        }
Ejemplo n.º 6
0
        public void OverwriteSample(string hash, string content, SampleDesc newDesc)
        {
            if (!archive.ContainsEntry (hash))
                return;

            archive.UpdateEntry (hash, content);
            index[hash] = newDesc;
        }
Ejemplo n.º 7
0
        public string GetSampleFromID(string id, out SampleDesc desc)
        {
            desc = new SampleDesc ();
            var entry = archive[id];

            if (entry == null)
                return null;
            desc = index[id];
            using (var stream = entry.OpenReader ())
                return new StreamReader (stream).ReadToEnd ();
        }
Ejemplo n.º 8
0
 public string GetSampleFromContent(string content, out SampleDesc desc)
 {
     return GetSampleFromID (StringHash (content), out desc);
 }