コード例 #1
0
        public SyncCookieRun AddCookieRun(byte[] binCookie, ReplicationCursorCollection replInfo)
        {
            SyncCookieRun ret = SerializeCookieRun(binCookie, replInfo);

            if (ret != null)
            {
                CookieRuns.Add(ret.CookieName, ret);
            }

            return(ret);
        }
コード例 #2
0
        private void SerializeUsn(ReplicationCursorCollection replInfo)
        {
            using (StreamWriter swriter = new StreamWriter(Path.Combine(CookiePath, USN_FILE_NAME), false))
            {
                foreach (ReplicationCursor replcursor in replInfo)
                {
                    if (!(replcursor.SourceServer == null))
                    {
                        swriter.WriteLine(replcursor.SourceServer + ";" + replcursor.UpToDatenessUsn);
                        UsnVectors.Add(replcursor.SourceServer, replcursor.UpToDatenessUsn);
                    }
                }

                swriter.Close();
            }
        }
コード例 #3
0
        private SyncCookieRun SerializeCookieRun(byte[] binCookie, ReplicationCursorCollection replInfo)
        {
            SyncCookieRun ret = null;

            string crname = Guid.NewGuid().ToString();

            string crpath = Path.Combine(RunPath, crname);

            Directory.CreateDirectory(crpath);

            ret = new SyncCookieRun(crname, crpath, binCookie, replInfo);

            CookieRuns.Add(crname, ret);

            return(ret);
        }
コード例 #4
0
        private void LoadUsn(ReplicationCursorCollection replInfo)
        {
            if (replInfo != null)
            {
                SerializeUsn(replInfo);
            }

            else if (GlobalHelper.PathContainsFile(CookiePath, USN_FILE_NAME))
            {
                using (StreamReader sr = new StreamReader(Path.Combine(CookiePath, USN_FILE_NAME)))
                {
                    string infoline = String.Empty;

                    while (!sr.EndOfStream)
                    {
                        infoline = sr.ReadLine();

                        UsnVectors.Add((infoline.Split(';'))[0], Convert.ToInt64((infoline.Split(';'))[1]));
                    }

                    sr.Close();
                }
            }
        }
コード例 #5
0
        public SyncRun AddRun(string dn, string filter, string attribs, SearchScope scope, byte[] cookie = null, ReplicationCursorCollection replInfo = null)
        {
            SyncRun ret = new SyncRun();

            string name = Guid.NewGuid().ToString();

            ret.ForestName = this.ForestName;
            ret.RootName   = this.RootName;
            ret.RunName    = name;
            ret.RunPath    = Path.Combine(this.RootPath, name);

            GlobalHelper.CreateDirectory(ret.RunPath);

            ret.EntryPoint = dn;
            ret.Filter     = filter;
            ret.Attributes = attribs;

            ret.Serialize();

            if (cookie != null)
            {
                ret.AddCookieRun(cookie, replInfo);
            }

            SyncRuns.Add(ret);

            return(ret);
        }
コード例 #6
0
        private void LoadInternal(string cookieRunName, string cookieRunPath, byte[] binCookie, ReplicationCursorCollection replInfo)
        {
            CookieName = cookieRunName;

            CookiePath = cookieRunPath;

            CookieDate = Directory.GetCreationTime(CookiePath);

            LoadCookie(binCookie);

            LoadUsn(replInfo);
        }
コード例 #7
0
        //see SyncBase
        #endregion

        #region constructor

        internal SyncCookieRun(string cookieRunName, string cookieRunPath, byte[] binCookie = null, ReplicationCursorCollection replInfo = null)
        {
            LoadInternal(cookieRunName, cookieRunPath, binCookie, replInfo);
        }