Ejemplo n.º 1
0
        public void AddComment(string xpath, System.Xml.XmlComment oXmlComment)
        {
            System.Xml.XmlNode Parent = XmlDocument.SelectSingleNode(xpath);
            int nI = 0;

            System.Xml.XmlNode selected = null;
            foreach (System.Xml.XmlNode oXmlNode in Parent.ChildNodes)
            {
                if (oXmlNode.NodeType == System.Xml.XmlNodeType.Element || oXmlNode.NodeType == System.Xml.XmlNodeType.Attribute)
                {
                    if (nI == 0)
                    {
                        selected = oXmlNode;
                        nI      += 1;
                    }
                }
            }
            if (nI > 0)
            {
                Parent.InsertBefore(oXmlComment, selected);
            }
            else
            {
                Parent.AppendChild(oXmlComment);
            }
            //System.Xml.XmlNode oXmlNode = XmlDocument.SelectSingleNode(xpath);
            //oXmlNode.AppendChild(oXmlComment);
        }
Ejemplo n.º 2
0
        public void AddComment(System.Xml.XmlNode Parent, System.Xml.XmlComment oXmlComment)
        {
            int nI = 0;

            System.Xml.XmlNode selected = null;
            foreach (System.Xml.XmlNode oXmlNode in Parent.ChildNodes)
            {
                if (oXmlNode.NodeType == System.Xml.XmlNodeType.Element || oXmlNode.NodeType == System.Xml.XmlNodeType.Attribute)
                {
                    if (nI == 0)
                    {
                        selected = oXmlNode;
                        nI      += 1;
                    }
                }
            }
            if (nI > 0)
            {
                Parent.InsertBefore(oXmlComment, selected);
            }
            else
            {
                Parent.AppendChild(oXmlComment);
            }
        }
Ejemplo n.º 3
0
 public void RemoveComment(System.Xml.XmlComment oXmlComment)
 {
     if (oXmlComment.ParentNode == null)
     {
         XmlDocument.RemoveChild(oXmlComment);
     }
     else
     {
         oXmlComment.ParentNode.RemoveChild(oXmlComment);
     }
 }
Ejemplo n.º 4
0
 public void InsertCommentAfter(System.Xml.XmlNode oXmlNoderef, System.Xml.XmlComment oXmlComment)
 {
     if (oXmlNoderef.ParentNode == null)
     {
         XmlDocument.InsertAfter(oXmlComment, oXmlNoderef);
     }
     else
     {
         oXmlNoderef.ParentNode.InsertAfter(oXmlComment, oXmlNoderef);
     }
 }
Ejemplo n.º 5
0
 public void RemoveComment(string xpath)
 {
     System.Xml.XmlComment oXmlComment = (System.Xml.XmlComment)XmlDocument.SelectSingleNode(xpath);
     if (oXmlComment.ParentNode == null)
     {
         XmlDocument.RemoveChild(oXmlComment);
     }
     else
     {
         oXmlComment.ParentNode.RemoveChild(oXmlComment);
     }
 }
Ejemplo n.º 6
0
        public override void Init(System.Xml.XmlNode xmlNode)
        {
            if (xmlNode.NodeType != System.Xml.XmlNodeType.Comment)
            {
                return;
            }

            System.Xml.XmlComment comment = xmlNode as System.Xml.XmlComment;
            Name = comment.Name;

            Value = comment.Value;

            CreateTextLine();
        }
Ejemplo n.º 7
0
        private Configuration LoadWebConfig(string projectDir)
        {
            string webConfigFilePath = Path.Combine(projectDir, Constants.WebConfig);

            if (File.Exists(webConfigFilePath))
            {
                try
                {
                    XElement webConfigXml = XElement.Load(webConfigFilePath);
                    System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
                    xmlDocument.Load(webConfigFilePath);

                    // Comment out connection strings if type has a configProtectionProvider
                    // This can comment out connection strings that do not have "EncryptedData"
                    IEnumerable <XElement> encryptedConnectionStringElement =
                        from element in webConfigXml.Elements("connectionStrings")
                        where (string)element.Attribute("configProtectionProvider") != null
                        select element;

                    if (encryptedConnectionStringElement.HasAny())
                    {
                        System.Xml.XmlNode elementToComment = xmlDocument.SelectSingleNode("/configuration/connectionStrings");
                        string             commentContents  = elementToComment.OuterXml;

                        // Its contents are the XML content of target node
                        System.Xml.XmlComment commentNode = xmlDocument.CreateComment(commentContents);

                        // Get a reference to the parent of the target node
                        System.Xml.XmlNode parentNode = elementToComment.ParentNode;

                        // Replace the target node with the comment
                        parentNode.ReplaceChild(commentNode, elementToComment);
                        xmlDocument.Save(webConfigFilePath);
                    }

                    var fileMap = new ExeConfigurationFileMap()
                    {
                        ExeConfigFilename = webConfigFilePath
                    };
                    var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
                    return(configuration);
                }
                catch (Exception ex)
                {
                    LogHelper.LogError(ex, string.Format("Error processing web.config file {0}", webConfigFilePath));
                }
            }
            return(null);
        }
Ejemplo n.º 8
0
 public XmlComment(System.Xml.XmlComment value)
 {
     this.value = value;
     members    = new Dictionary <string, Variable>
     {
         { "Content", new FVariable
           {
               ongetvalue = () => new Gstring(value.Value),
               onsetvalue = (_value) =>
               {
                   this.value.Value = _value.ToString();
                   return(0);
               }
           } },
     };
 }
        Stream(System.Xml.XmlCharacterData charData)
        {
            m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlCharacterData)));

            m_dataObjs.Add(new Snoop.Data.Int("Length", charData.Length));
            m_dataObjs.Add(new Snoop.Data.String("Data", charData.Data));

            System.Xml.XmlCDataSection cDataSection = charData as System.Xml.XmlCDataSection;
            if (cDataSection != null)
            {
                Stream(cDataSection);
                return;
            }

            System.Xml.XmlComment comment = charData as System.Xml.XmlComment;
            if (comment != null)
            {
                Stream(comment);
                return;
            }

            System.Xml.XmlSignificantWhitespace swSpace = charData as System.Xml.XmlSignificantWhitespace;
            if (swSpace != null)
            {
                Stream(swSpace);
                return;
            }

            System.Xml.XmlText txt = charData as System.Xml.XmlText;
            if (txt != null)
            {
                Stream(txt);
                return;
            }

            System.Xml.XmlWhitespace wSpace = charData as System.Xml.XmlWhitespace;
            if (wSpace != null)
            {
                Stream(wSpace);
                return;
            }
        }
        public static bool _CreateComment_System_Configuration_ConfigXmlDocument_System_String( )
        {
            //Parameters
            System.String data = null;

            //ReturnType/Value
            System.Xml.XmlComment returnVal_Real        = null;
            System.Xml.XmlComment returnVal_Intercepted = null;

            //Exception
            Exception exception_Real        = null;
            Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnValue_Real = System.Configuration.ConfigXmlDocument.CreateComment(data);
            }

            catch (Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnValue_Intercepted = System.Configuration.ConfigXmlDocument.CreateComment(data);
            }

            catch (Exception e)
            {
                exception_Intercepted = e;
            }


            Return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
Ejemplo n.º 11
0
        Stream(System.Xml.XmlComment comment)
        {
            m_dataObjs.Add(new Snoop.Data.ClassSeparator(typeof(System.Xml.XmlComment)));

            // no data to display at this level
        }
Ejemplo n.º 12
0
        private void cxBtnOk_Click(object sender, EventArgs e)
        {
            string sSQLServOldPwd, sSQLServNewPwd;

            if (cxTextEditOldPwd.EditValue == null || Convert.ToString(cxTextEditOldPwd.EditValue).Trim() == "")
            {
                oSecMainFrm.MessageDlg("Old Password cannot be blank...", "mtWarning", "mbOk", 0);
                return;
            }
            if (cxTextEditNewPwd.EditValue == null || Convert.ToString(cxTextEditNewPwd.EditValue).Trim() == "")
            {
                oSecMainFrm.MessageDlg("Please enter the new password.", "mtWarning", "mbOk", 0);
                return;
            }
            if (cxTextEditConfirmPwd.EditValue == null || Convert.ToString(cxTextEditConfirmPwd.EditValue).Trim() == "")
            {
                oSecMainFrm.MessageDlg("Please enter the confirm password.", "mtWarning", "mbOk", 0);
                return;
            }

            try
            {
                sSQLServOldPwd = XpedeonCrypto.XpedeonServerDecrypt(PCFSecurity.oSecDM.sSuperUserPassword);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (!Convert.ToString(cxTextEditOldPwd.EditValue).Equals(sSQLServOldPwd, StringComparison.InvariantCulture))
            {
                oSecMainFrm.MessageDlg("Old Password does not match.", "mtWarning", "mbOk", 0);
                return;
            }
            if (Convert.ToString(cxTextEditNewPwd.EditValue) != Convert.ToString(cxTextEditConfirmPwd.EditValue))
            {
                oSecMainFrm.MessageDlg("New Password and Confirm Password dont match.", "mtWarning", "mbOk", 0);
                return;
            }

            try
            {
                sSQLServNewPwd = XpedeonCrypto.XpedeonServerEncrypt(Convert.ToString(cxTextEditNewPwd.EditValue));
                UpdateSQLServPassword(Convert.ToString(cxTextEditUserName.EditValue), Convert.ToString(cxTextEditNewPwd.EditValue), Convert.ToString(cxTextEditOldPwd.EditValue));

                string sAppPath = Application.StartupPath.ToString();
                System.Xml.XmlDocument xdDataBaseConnection = new System.Xml.XmlDocument();
                xdDataBaseConnection.Load(@sAppPath + "\\PCFSecurityAccessInfo.xml");
                if (xdDataBaseConnection.GetElementsByTagName("PASSWORD").Count > 0)
                {
                    // Get the target node using XPath
                    System.Xml.XmlNode xnOldPwd = xdDataBaseConnection.SelectSingleNode("//PASSWORD");
                    // Create a new comment node with XML content of the target node
                    System.Xml.XmlComment xcOldPwd = xdDataBaseConnection.CreateComment(xnOldPwd.OuterXml);
                    // Replace the target node with the comment
                    xdDataBaseConnection.DocumentElement.ReplaceChild(xcOldPwd, xnOldPwd);

                    // Create a new node
                    System.Xml.XmlElement xeNewPwd = xdDataBaseConnection.CreateElement("PASSWORD");
                    xeNewPwd.InnerText = sSQLServNewPwd;
                    // Add the node to the document
                    xdDataBaseConnection.DocumentElement.AppendChild(xeNewPwd);
                }
                xdDataBaseConnection.Save(@sAppPath + "\\PCFSecurityAccessInfo.xml");

                PCFSecurity.oSecDM.DataModuleCreate();

                oSecMainFrm.MessageDlg("Password Changed Successfully.", "mtConfirmation", "mbOk", 0);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 13
0
 internal XmlComment(XmlDocument owner, SystemXmlComment backingComment)
 {
     _owner          = owner;
     _backingComment = backingComment;
 }
Ejemplo n.º 14
0
 public System.Xml.XmlComment CreateComment(string Value)
 {
     System.Xml.XmlComment oXmlComment = XmlDocument.CreateComment(Value);
     return(oXmlComment);
 }
Ejemplo n.º 15
0
 public void UpdateComment(System.Xml.XmlComment oXmlComment, string value)
 {
     oXmlComment.Value = value;
 }
Ejemplo n.º 16
0
 public void UpdateComment(string xpath, string value)
 {
     System.Xml.XmlComment oXmlComment = (System.Xml.XmlComment)XmlDocument.SelectSingleNode(xpath);
     oXmlComment.Value = value;
 }