Ejemplo n.º 1
0
        /// <summary>
        /// Load directory replica into memory.
        /// </summary>
        private void LoadDirecotryReplica()
        {
            // Load directory replica
            var serailizer = new XmlSerializer(typeof(DirectoryReplica));

            if (File.Exists(Environment.ExpandEnvironmentVariables(REPLICA_PATH)))
            {
                using (var stream = new FileStream(Environment.ExpandEnvironmentVariables(REPLICA_PATH), FileMode.OpenOrCreate))
                {
                    Replica = (DirectoryReplica)serailizer.Deserialize(stream);
                }
            }
            else
            {
                Replica = new DirectoryReplica
                {
                    HighestUsnChanged = 0,
                    Bindings          = new List <UserRoleBinding>(),
                    Groups            = new List <Role>(),
                    Users             = new List <User>()
                };
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load directory replica into memory.
        /// </summary>
        private void LoadDirecotryReplica()
        {
            // Load directory replica
            var serailizer = new XmlSerializer(typeof(DirectoryReplica));

            if (File.Exists(Environment.ExpandEnvironmentVariables(REPLICA_PATH)))
            {
                using (var stream = new FileStream(Environment.ExpandEnvironmentVariables(REPLICA_PATH), FileMode.OpenOrCreate))
                {
                    Replica = (DirectoryReplica)serailizer.Deserialize(stream);
                }
            }
            else
            {
                Replica = new DirectoryReplica
                {
                    HighestUsnChanged = 0,
                    Bindings = new List<UserRoleBinding>(),
                    Groups = new List<Role>(),
                    Users = new List<User>()
                };
            }
        }