Beispiel #1
0
 public void Remove(DisqusClientElement serviceConfig)
 {
     BaseRemove(serviceConfig.Name);
 }
        protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
        {
            base.DeserializeElement(reader, serializeCollectionKey);

            if (!string.IsNullOrEmpty(File))
            {
                string sourceFileFullPath;
                string configFileDirectory;
                string configFile;

                // Determine file location
                configFile = ElementInformation.Source;

                if (String.IsNullOrEmpty(configFile))
                {
                    sourceFileFullPath = File;
                }
                else
                {
                    configFileDirectory = System.IO.Path.GetDirectoryName(configFile);
                    sourceFileFullPath  = System.IO.Path.Combine(configFileDirectory, File);
                }

                if (System.IO.File.Exists(sourceFileFullPath))
                {
                    XDocument xdoc = XDocument.Load(sourceFileFullPath);

                    var disqusClients = xdoc.Descendants("DisqusClients").SingleOrDefault();

                    if (disqusClients == null)
                    {
                        return;
                    }

                    var clients = disqusClients.Descendants("add");

                    if (!clients.Any())
                    {
                        return;
                    }

                    DisqusClientElementCollection elements = new DisqusClientElementCollection();

                    foreach (var client in clients)
                    {
                        DisqusClientElement clientElement = new DisqusClientElement();

                        clientElement.Name      = client.Attribute("Name").Value;
                        clientElement.PublicKey = client.Attribute("PublicKey").Value;

                        var privateKeyAttrib = client.Attribute("PrivateKey");
                        if (privateKeyAttrib != null)
                        {
                            clientElement.PrivateKey = privateKeyAttrib.Value;
                        }

                        var accessTokenKeyAttrib = client.Attribute("AccessToken");
                        if (privateKeyAttrib != null)
                        {
                            clientElement.AccessToken = accessTokenKeyAttrib.Value;
                        }

                        elements.Add(clientElement);
                    }

                    DisqusClients = elements;
                }
            }
        }
Beispiel #3
0
 public void Add(DisqusClientElement serviceConfig)
 {
     BaseAdd(serviceConfig);
 }