Ejemplo n.º 1
0
        public long GetHash()
        {
            HashWriter ss = new HashWriter(nType, nVersion);

            ss << obj;
            return(ss.GetHash());


            return(SerializeHash(this));
        }
        public ISliceHash ComputeSliceHash(ISliceId sliceId, DateTime t)
        {
            // We do not consider the methods in the same type at the moment

            SliceDefinition sliceDef;

            // If we do not know the slice, we just return null
            if (!this.slices.TryGetValue(sliceId, out sliceDef))
            {
                return(null);
            }

            // TODO: wire the hashing option
            using (var tw = new HashWriter(false))
            {
                foreach (var methodId in sliceDef.Dependencies)
                {
                    tw.Write(methodId);
                    tw.Write(':');

                    var    methodHash = this.GetHashForDate(methodId, t, false);
                    Method methodModel;

                    if (methodHash == null || !this.TryGetMethodModelForHash(methodHash, out methodModel))
                    {
                        tw.WriteLine("<null>");
                    }
                    else
                    {
                        tw.WriteLine(this.GetResultHash(methodModel));
                    }
                }

                return(new SliceHash(tw.GetHash()));
            }
        }