Ejemplo n.º 1
0
        /// <summary>
        ///   Wywolywana gdy lokalnie zostanie wykryty nowy plik
        /// </summary>
        /// <param name = "descr"></param>
        /// <param name = "path"></param>
        public void NewFileVersion(FsFile<RelPath> descr, string path)
        {
            try
            {
                IList<PieceHash> hashes = _dataManager.HashAll(path);

                NewFileSignal mess = new NewFileSignal(descr.Path, descr, hashes);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
        private bool SecurityCheck(NewFileSignal message)
        {
            try
            {
                int pieceCount = ExchUtils.PieceCount(message.Descriptor.Size);
                if (message.Hashes.Count != pieceCount)
                {
                    //Console.WriteLine("Message with wrong hash count");
                    return false;
                }
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }