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

            archive.UpdateEntry(hash, content);
            index[hash] = newDesc;
        }
Esempio 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());
        }
Esempio 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);
        }
Esempio n. 4
0
 public string GetSampleFromContent(string content, out SampleDesc desc)
 {
     return(GetSampleFromID(StringHash(content), out desc));
 }
Esempio 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;
        }
Esempio n. 6
0
        public void OverwriteSample(string hash, string content, SampleDesc newDesc)
        {
            if (!archive.ContainsEntry (hash))
                return;

            archive.UpdateEntry (hash, content);
            index[hash] = newDesc;
        }
Esempio 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 ();
        }
Esempio n. 8
0
 public string GetSampleFromContent(string content, out SampleDesc desc)
 {
     return GetSampleFromID (StringHash (content), out desc);
 }