BExIS.Ddm.Providers.LuceneProvider.SearchDesigner.Save C# (CSharp) Method

Save() private method

private Save ( ) : void
return void
        private void Save()
        {
            XmlElement root;
            FileStream fileStream;

            try
            {

                this._configXML = new XmlDocument();
                if (String.IsNullOrEmpty(FileHelper.ConfigFilePath))
                {
                    root = this._configXML.CreateElement("luceneConfig");
                    this._configXML.AppendChild(root);

                }
                else
                {
                    fileStream = new FileStream(FileHelper.ConfigFilePath, FileMode.Open, FileAccess.Read);
                    this._configXML.Load(fileStream);
                    root = this._configXML.DocumentElement;
                    root.RemoveAll();

                    fileStream.Close();
                }

                //add primary data node
                if (this._includePrimaryData)
                {
                    XmlElement xe = this._configXML.CreateElement("field");
                    xe = SetPrimaryDataAttributeToNode(xe);
                    root.AppendChild(xe);
                }

                foreach (SearchAttribute sa in this._searchAttributeList)
                {
                    XmlElement xe = this._configXML.CreateElement("field");
                    xe = SetAttributesToNode(xe, sa);
                    root.AppendChild(xe);
                }

                //root.AppendChild(xe);
                //System.IO.File.
                object lk = new object();
                lock (fileStream = new FileStream(FileHelper.ConfigFilePath, FileMode.Open, FileAccess.Write))
                {
                    fileStream.SetLength(0);
                    this._configXML.Save(fileStream);
                    fileStream.Close();
                }
            }
            catch (Exception ex)
            {

            }
        }