Ejemplo n.º 1
0
 public CompareSyncWorker(string leftPath, string rightPath)
 {
     LeftCompareRootPath  = leftPath;
     RightCompareRootPath = rightPath;
     Exclusions           = new FilterList();
     _syncBehavior        = new NoopBehavior(this);
 }
Ejemplo n.º 2
0
    public SyncBehavior CreateSyncObject(SyncBehavior obj, Transform parent = null)
    {
        var go = Instantiate(obj, parent, true);

        _syncObjects.Add(go);
        go.OnSyncAwake();
        go.OnSyncStart();
        return(go);
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DiskCache"/> class.
        /// </summary>
        /// <param name="filename">The path to the cache file.</param>
        /// <param name="size">Maximum cache size in bytes. When this size is exceeded,
        /// old items will be overwritten.</param>
        /// <param name="syncBehavior">The synchronization behaviour.</param>
        /// <param name="keySize">Byte length of keys.</param>
        public DiskCache(string filename, long size, SyncBehavior syncBehavior, int keySize)
        {
            lockObject = new object();
            writeOffset = 0;

            mKeySize = keySize;
            mSyncBehavior = syncBehavior;

            index = new Dictionary<string, CacheItem>();
            mFileName = filename;
            mSize = size;

            if (!string.IsNullOrEmpty(mFileName))
            {
                stream = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                BuildIndex();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DiskCache"/> class.
        /// </summary>
        /// <param name="filename">The path to the cache file.</param>
        /// <param name="size">Maximum cache size in bytes. When this size is exceeded,
        /// old items will be overwritten.</param>
        /// <param name="syncBehavior">The synchronization behaviour.</param>
        /// <param name="keySize">Byte length of keys.</param>
        public DiskCache(string filename, long size, SyncBehavior syncBehavior, int keySize)
        {
            lockObject  = new object();
            writeOffset = 0;

            mKeySize      = keySize;
            mSyncBehavior = syncBehavior;

            index     = new Dictionary <string, CacheItem>();
            mFileName = filename;
            mSize     = size;

            if (!string.IsNullOrEmpty(mFileName))
            {
                stream = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                BuildIndex();
            }
        }
Ejemplo n.º 5
0
 public void DestroySyncObject(SyncBehavior obj)
 {
     obj.OnSyncDestroy();
     _syncObjects.Remove(obj);
 }
Ejemplo n.º 6
0
 public void MirrorDir()
 {
     _syncBehavior = new MirrorBehavior(this);
     DoWork();
 }
Ejemplo n.º 7
0
        //public void CompareDir()
        //{
        //    _syncBehavior = new NoopBehavior();
        //}

        public void TestMirrorDir()
        {
            _syncBehavior = new MirrorTestBehavior(this);
            DoWork();
        }