Пример #1
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();
            }
        }
Пример #2
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();
                }
            }
        }