Пример #1
0
        public static Dictionary <string, string> ParseParams(string paramString, IEventAggregator eventAggregator)
        {
            var d = new Dictionary <string, string>();

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            try
            {
                doc.LoadXml(paramString);
                var nsMgr = new System.Xml.XmlNamespaceManager(doc.NameTable);
                nsMgr.AddNamespace("x", "urn:schemas-microsoft-com:xml-analysis");
                foreach (System.Xml.XmlNode n in doc.SelectNodes("/x:Parameters/x:Parameter", nsMgr))
                {
                    d.Add(n["Name"].InnerText, n["Value"].InnerText);
                }

                // if we did not find the proper namespace try searching for just the raw names
                if (d.Count == 0)
                {
                    foreach (System.Xml.XmlNode n in doc.SelectNodes("/Parameters/Parameter", nsMgr))
                    {
                        d.Add(n["Name"].InnerText, n["Value"].InnerText);
                    }
                }
            } catch (Exception ex)
            {
                Log.Error(ex, "{class} {method} Error merging query parameters", "DaxHelper", "ParseParams");
                eventAggregator.PublishOnUIThread(new OutputMessage(MessageType.Error, "The Following Error occurred while trying to parse a parameter block: " + ex.Message));
            }
            return(d);
        }
Пример #2
0
        public string ParseXmlString(string inputXml, params string[] tokensToSkip)
        {
            var xmlDoc = new System.Xml.XmlDocument();

            xmlDoc.LoadXml(inputXml);

            // Swap out tokens in the attributes of all nodes.
            var nodes = xmlDoc.SelectNodes("//*");

            if (nodes != null)
            {
                foreach (var node in nodes.OfType <System.Xml.XmlElement>().Where(n => n.HasAttributes))
                {
                    foreach (var attribute in node.Attributes.OfType <System.Xml.XmlAttribute>().Where(a => !a.Name.Equals("xmlns", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(a.Value)))
                    {
                        attribute.Value = ParseString(attribute.Value, tokensToSkip);
                    }
                }
            }

            // Swap out tokens in the values of any elements with a text value.
            nodes = xmlDoc.SelectNodes("//*[text()]");
            if (nodes != null)
            {
                foreach (var node in nodes.OfType <System.Xml.XmlElement>())
                {
                    if (!string.IsNullOrEmpty(node.InnerText))
                    {
                        node.InnerText = ParseString(node.InnerText, tokensToSkip);
                    }
                }
            }

            return(xmlDoc.OuterXml);
        }
Пример #3
0
        private void LoadScalesAndChords()
        {
            var xDoc = new System.Xml.XmlDocument();

            xDoc.Load("Scales.xml");
            var xmlScales = xDoc.SelectNodes("SCALES/SCALE");
            int i         = 0;

            foreach (System.Xml.XmlNode n in xmlScales)
            {
                var scale = new Scale();
                scale.Category = n.SelectSingleNode("CATEGORY").InnerText;
                scale.Name     = n.SelectSingleNode("NAME").InnerText;
                var intervals = n.SelectSingleNode("INTERVALS").InnerText.Split(',');
                scale.Intervals.AddRange(intervals);
                scale.BlueNotes.AddRange(n.SelectSingleNode("BLUE_NOTES").InnerText.Split(','));
                scale.ChordColor = Color.LightGreen;
                scale.ID         = i;
                i += 1;
                m_scales.Add(scale);
            }

            xmlScales = xDoc.SelectNodes("SCALES/CHORD");
            foreach (System.Xml.XmlNode n in xmlScales)
            {
                var scale = new Scale();
                scale.Name = n.SelectSingleNode("NAME").InnerText;
                var intervals = n.SelectSingleNode("INTERVALS").InnerText.Split(',');
                scale.Intervals.AddRange(intervals);
                scale.ChordColor = Color.Yellow;
                m_chords.Add(scale);
            }
        }
Пример #4
0
        internal static FolderDatasetList Parse(Server oServer, string strKey, int iTimestamp, System.Xml.XmlDocument oCatalog, out string strEdition)
        {
            strEdition = string.Empty;
            ArrayList oList = new ArrayList();


            // --- get the catalog edition ---

            System.Xml.XmlNodeList oNodeList = oCatalog.SelectNodes("//" + Geosoft.Dap.Xml.Common.Constant.Tag.CONFIGURATION_TAG);
            if (oNodeList != null && oNodeList.Count != 0)
            {
                System.Xml.XmlNode oAttr = oNodeList[0].Attributes.GetNamedItem(Geosoft.Dap.Xml.Common.Constant.Attribute.VERSION_ATTR);
                if (oAttr != null)
                {
                    strEdition = oAttr.Value;
                }
            }


            oNodeList = oCatalog.SelectNodes("//" + Geosoft.Dap.Xml.Common.Constant.Tag.ITEM_TAG);
            if (oNodeList != null)
            {
                foreach (System.Xml.XmlElement oDatasetNode in oNodeList)
                {
                    Geosoft.Dap.Common.DataSet oDataSet;
                    oServer.Command.Parser.DataSet(oDatasetNode, out oDataSet);
                    oList.Add(oDataSet);
                }
            }
            return(new FolderDatasetList(strKey, iTimestamp, oList));
        }
Пример #5
0
        /// <summary>
        /// 载入C#工程项目文件
        /// </summary>
        /// <param name="fileName">文件名</param>
        public override void LoadProjectFile(string fileName)
        {
            this.projectFileName = fileName;

            System.IO.StreamReader myReader = new System.IO.StreamReader(fileName, System.Text.Encoding.GetEncoding(936));
            string strText = myReader.ReadToEnd();

            myReader.Close();

            System.Xml.XmlDocument myXMLDoc = new System.Xml.XmlDocument();
            myXMLDoc.LoadXml(strText);

            this.rootPath = System.IO.Path.GetDirectoryName(fileName);
            this.files.Clear();

            bool For2005 = false;

            if (myXMLDoc.DocumentElement.Name == "Project")
            {
                if (myXMLDoc.DocumentElement.GetAttribute("xmlns") == "http://schemas.microsoft.com/developer/msbuild/2003")
                {
                    For2005 = true;
                }
            }

            if (For2005)
            {
                System.Xml.XmlNamespaceManager ns = new System.Xml.XmlNamespaceManager(myXMLDoc.NameTable);
                ns.AddNamespace("a", "http://schemas.microsoft.com/developer/msbuild/2003");
                foreach (System.Xml.XmlElement myFileElement in myXMLDoc.SelectNodes("a:Project/a:ItemGroup/a:Compile", ns))
                {
                    ProjectFileEntity NewFile = new ProjectFileEntity();
                    NewFile.FileName = myFileElement.GetAttribute("Include");
                    string name = NewFile.FileName;
                    name = name.Trim().ToLower();
                    if (name.EndsWith(".cs"))
                    {
                        NewFile.CanAnalyse = true;
                    }
                    else
                    {
                        NewFile.CanAnalyse = false;
                    }
                    this.files.Add(NewFile);
                }
            }
            else
            {
                foreach (System.Xml.XmlElement myFileElement in myXMLDoc.SelectNodes("VisualStudioProject/CSHARP/Files/Include/File"))
                {
                    ProjectFileEntity NewFile = new ProjectFileEntity();
                    NewFile.FileName   = myFileElement.GetAttribute("RelPath");
                    NewFile.CanAnalyse = (myFileElement.GetAttribute("BuildAction") == "Compile");
                    this.files.Add(NewFile);
                }
            }
        }
Пример #6
0
        public static void ParseParams(string paramString, Dictionary <string, QueryParameter> paramDict, IEventAggregator eventAggregator)
        {
            bool foundXmlNameSpacedParams = false;

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            try
            {
                doc.LoadXml(paramString);
                var nsMgr = new System.Xml.XmlNamespaceManager(doc.NameTable);
                nsMgr.AddNamespace("x", "urn:schemas-microsoft-com:xml-analysis");
                foreach (System.Xml.XmlNode n in doc.SelectNodes("/x:Parameters/x:Parameter", nsMgr))
                {
                    foundXmlNameSpacedParams = true;
                    string paramTypeName = n["Value"].Attributes["xsi:type"].Value;
                    Type   paramType     = DaxStudio.Common.XmlTypeMapper.GetSystemType(paramTypeName);
                    object val           = Convert.ChangeType(n["Value"].InnerText, paramType);
                    if (!paramDict.ContainsKey(n["Name"].InnerText))
                    {
                        paramDict.Add(n["Name"].InnerText, new QueryParameter(n["Name"].InnerText, val, paramTypeName));
                    }
                    else
                    {
                        paramDict[n["Name"].InnerText] = new QueryParameter(n["Name"].InnerText, val, paramTypeName);
                    }
                }

                // if we did not find the proper namespace try searching for just the raw names
                if (!foundXmlNameSpacedParams)
                {
                    foreach (System.Xml.XmlNode n in doc.SelectNodes("/Parameters/Parameter", nsMgr))
                    {
                        string paramTypeName = "xsd:string";
                        if (n["Value"].Attributes.Count > 0)
                        {
                            if (n["Value"].Attributes["xsi:type"] != null)
                            {
                                paramTypeName = n["Value"].Attributes["xsi:type"].Value;
                            }
                        }


                        if (!paramDict.ContainsKey(n["Name"].InnerText))
                        {
                            paramDict.Add(n["Name"].InnerText, new QueryParameter(n["Name"].InnerText, n["Value"].InnerText, paramTypeName));
                        }
                        else
                        {
                            paramDict[n["Name"].InnerText] = new QueryParameter(n["Name"].InnerText, n["Value"].InnerText, paramTypeName);
                        }
                    }
                }
            } catch (Exception ex)
            {
                Log.Error(ex, "{class} {method} Error merging query parameters", "DaxHelper", "ParseParams");
                eventAggregator.PublishOnUIThread(new OutputMessage(MessageType.Error, "The Following Error occurred while trying to parse a parameter block: " + ex.Message));
            }
        }
Пример #7
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            System.Xml.XmlDocument sett = new System.Xml.XmlDocument();
            try
            {
                sett.Load(AppDomain.CurrentDomain.BaseDirectory + "config.xml");
                ipaddress.address           = System.Net.IPAddress.Parse(sett.SelectSingleNode("settings/server/ip").InnerText);
                port.Text                   = sett.SelectSingleNode("settings/server/port").InnerText;
                rootpath.Text               = sett.SelectSingleNode("settings/server/wwwdirectory").InnerText;
                errorpath.Text              = sett.SelectSingleNode("settings/server/errorsdirectory").InnerText;
                browsedirectories.IsChecked = (sett.SelectSingleNode("settings/server/browseDirectories").InnerText == "true" ? true : false);
                var prms = sett.SelectNodes("settings/server/param");
                for (int i = 0; i < prms.Count; i++)
                {
                    if (prms[i].Attributes["name"].InnerText == "headerTimeout")
                    {
                        headertimeout.Text = prms[i].Attributes["value"].InnerText;
                    }
                    else if (prms[i].Attributes["name"].InnerText == "bodyOfRequestTimeout")
                    {
                        bodytimeout.Text = prms[i].Attributes["value"].InnerText;
                    }
                }
                var defaultpg = sett.SelectNodes("settings/server/rootDocuments/file");
                for (int i = 0; i < defaultpg.Count; i++)
                {
                    listBox.Items.Add(defaultpg[i].Attributes["filename"].InnerText);
                }

                var interpreters = sett.SelectNodes("settings/server/cgiinterpreters/interpreter");
                for (int i = 0; i < interpreters.Count; i++)
                {
                    listView.Items.Add(new interpreteritem()
                    {
                        endswith = interpreters[i].Attributes["endswith"].InnerText, path = interpreters[i].Attributes["interpreterpath"].InnerText
                    });
                }

                var mimetypes = sett.SelectNodes("settings/server/mimetypes/type");
                for (int i = 0; i < mimetypes.Count; i++)
                {
                    listView2.Items.Add(new mimetypeitem()
                    {
                        endswith = mimetypes[i].Attributes["endswith"].InnerText, mimetype = mimetypes[i].Attributes["mimetype"].InnerText
                    });
                }
            }
            catch
            {
            }
        }
Пример #8
0
        private void Init()
        {
            System.Xml.XmlDocument _document = new System.Xml.XmlDocument();
            _document.Load(Xy.Tools.IO.File.foundConfigurationFile("UrlControl", Xy.AppSetting.FILE_EXT));
            System.Xml.XmlNodeList default_xnl = _document.SelectNodes("UrlRewrite/Item");

            _defaultUrlControl = new URLCollection(string.Empty, string.Empty, string.Empty, string.Empty);
            foreach (System.Xml.XmlNode _xn in default_xnl)
            {
                _defaultUrlControl.Add(new URLItem(_xn));
            }

            _defaultUrlControl.Add(new URLItem(null, null, @".*\.js$", "application/x-javascript", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.css$", "text/css", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.gif$", "image/gif", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.jpg$", "image/jpeg", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.png$", "image/png", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.bmp$", "image/bmp", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.swf$", "application/x-shockwave-flash", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.ico$", "image/x-icon", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @"^/Xy_(App|Data|Log)/.*", "text/html", false, false, "Prohibit", 0));
            _defaultUrlControl.Add(new URLItem(null, null, @"^/Xy_Theme/[^/]+/Xy_(Cache|Include|Page|Xslt)/.*", "text/html", false, false, "Prohibit", 0));
            _defaultUrlControl.Add(new URLItem(null, "Xy.Web,Xy.Web.Page.ErrorPage", @"^/error\.aspx", "text/html", true, false, "MainContent", 0));

            _urlControl = new List <URLCollection>();
            foreach (System.Xml.XmlElement _xe in _document.SelectNodes("UrlRewrite/UrlCollection"))
            {
                URLCollection _urlItemCollection = new URLCollection(_xe);
                if (_urlItemCollection.SiteUrlReg == null && string.IsNullOrEmpty(_urlItemCollection.Name))
                {
                    continue;
                }

                foreach (System.Xml.XmlNode _xn in _xe.SelectNodes("Item"))
                {
                    _urlItemCollection.Add(new URLItem(_xn));
                }
                URLCollection _parent = null;
                if (!string.IsNullOrEmpty(_urlItemCollection.Inherit))
                {
                    _parent = GetUrlItemCollection(_urlItemCollection.Inherit);
                }
                if (_parent == null)
                {
                    _parent = _defaultUrlControl;
                }
                _urlItemCollection.AddRange(_parent.ToArray());
                _urlControl.Add(_urlItemCollection);
            }
        }
Пример #9
0
        public Webresource(System.IO.Stream xml)
        {
            var doc = new System.Xml.XmlDocument();

            doc.Load(xml);

            this.Forms           = new FormList();
            this.Forms.Namespace = doc.SelectSingleNode("/webresource/forms")?.Attributes["namespace"]?.InnerText;
            this.Forms.Typings   = doc.SelectSingleNode("/webresource/forms")?.Attributes["typings"]?.InnerText;
            var forms = doc.SelectNodes("/webresource/forms/form");

            foreach (System.Xml.XmlNode form in forms)
            {
                this.Forms.Add(new Form
                {
                    EntityLogicalName = form.Attributes["entitylogicalname"]?.InnerText,
                    Name  = form.Attributes["name"]?.InnerText,
                    Title = form.Attributes["title"]?.InnerText
                });
            }

            this.Deploys = new DeployList();
            this.Deploys.ManagedSolution = doc.SelectSingleNode("/webresource/deploys")?.Attributes["managed-solution"]?.InnerText;

            var solutions = doc.SelectNodes("/webresource/solutions/solution");

            if (solutions != null)
            {
                var res = new List <string>();
                foreach (System.Xml.XmlNode solution in solutions)
                {
                    res.Add(solution.Attributes["name"].InnerText);
                }
                this.Deploys.Solutions = res.ToArray();
            }

            var deploys = doc.SelectNodes("/webresource/deploys/deploy");

            foreach (System.Xml.XmlNode deploy in deploys)
            {
                this.Deploys.Add(new Deploy
                {
                    Name        = deploy.Attributes["name"]?.InnerText,
                    Filename    = deploy.Attributes["file"]?.InnerText,
                    Description = deploy.Attributes["description"]?.InnerText
                });
            }
        }
Пример #10
0
        public void Reload()
        {
            list = new System.Collections.Specialized.HybridDictionary();

            System.Xml.XmlDocument x = new System.Xml.XmlDocument();
            if (!File.Exists(GetPathName()))
            {
                return;                                          //Nothing to load
            }
            x.Load(GetPathName());
            foreach (System.Xml.XmlNode node in x.SelectNodes("//Timer"))
            {
                if (node.Attributes["name"] == null)
                {
                    continue;
                }

                string name = node.Attributes["name"].Value;
                if (name == null)
                {
                    continue;
                }
                Timer timer = Create(name);

                foreach (System.Xml.XmlNode lap in node.SelectNodes("lap"))
                {
                    string   startText = (lap.Attributes["start"] != null) ? lap.Attributes["start"].Value : null;
                    DateTime start     = DateTime.Parse(startText, GetCulture());
                    string   task      = (lap.Attributes["task"] != null) ? lap.Attributes["task"].Value : null;

                    if (lap.Attributes["end"] == null)
                    {
                        timer.AddFluent(start, task);
                    }
                    else
                    {
                        string   endText = lap.Attributes["end"].Value;
                        DateTime end     = DateTime.Parse(endText, GetCulture());
                        timer.AddFluent(start, end, task);
                    }
                }
            }

            foreach (System.Xml.XmlNode node in x.SelectNodes("//Group"))
            {
                Groups.Add(TimerGroup.Parse(node, this));
            }
        }
Пример #11
0
        private void frmSplash_Load(object sender, EventArgs e)
        {
            clsitem itm = null;

            System.Xml.XmlNode     tit = null;
            System.Xml.XmlNodeList nl = null;
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument(), inf = new System.Xml.XmlDocument();
            doc.Load(Application.StartupPath + "\\Data\\Game.xml");
            nl = doc.SelectNodes("/xml/Game");
            foreach (System.Xml.XmlNode n in nl)
            {
                itm      = new clsitem();
                tit      = n.SelectSingleNode("title");
                itm.Name = tit.InnerText;
                tit      = n.SelectSingleNode("data");
                if (tit != null)
                {
                    itm.Value = tit.InnerText;
                    inf.Load(Application.StartupPath + tit.InnerText);
                    tit         = inf.SelectSingleNode("/xml/Game/title");
                    itm.Version = tit.Attributes.GetNamedItem("version").Value;
                    itm.Img     = Application.StartupPath + tit.Attributes.GetNamedItem("splash").Value;
                    itm.Author  = inf.SelectSingleNode("/xml/Game/author").InnerText;
                }
                cboGames.Items.Add(itm);
            }
            doc = null;
        }
Пример #12
0
        private void getCode()
        {
            ShowLoading();
            System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
            string code = txtPapel.Text;

            Task.Factory.StartNew(
                () => {
                xml.Load(string.Format("http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoAjax.asp?CodigoPapel={0}", code));
            }
                ).ContinueWith(
                t => {
                try
                {
                    txtValidado.Text = "*Não encontrado.";
                    foreach (System.Xml.XmlElement node in xml.SelectNodes("ComportamentoPapeis/Papel"))
                    {
                        txtValidado.Text = node.Attributes.GetNamedItem("Nome").InnerText;
                    }
                }
                catch (Exception ex)
                {
                    Insights.Report(ex);
                    txtValidado.Text = "*N/D.";
                }
                finally
                {
                    this._loadPop.Hide();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()
                );
        }
Пример #13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // modify the connection string to make it work for the current user on this machine
            this.invoicesTableAdapter.Connection.ConnectionString = GetConnectionString();

            // auto-generated:
            // This line of code loads data into the 'nWINDDataSet.Invoices' table.
            this.invoicesTableAdapter.Fill(this.nWINDDataSet.Invoices);

            // show default view:
            // this assumes an application setting of type string called "DefaultView"
            var view = Properties.Settings.Default.DefaultView;

            if (!string.IsNullOrEmpty(view))
            {
                c1FlexPivotPage1.ViewDefinition = view;
            }
            else
            {
                // build default view now
                var fp = c1FlexPivotPage1.FlexPivotEngine;
                fp.BeginUpdate();
                fp.RowFields.Add("ProductName");
                fp.ColumnFields.Add("Country");
                fp.ValueFields.Add("ExtendedPrice");
                fp.EndUpdate();
            }

            // build menu with predefined views:
            var doc = new System.Xml.XmlDocument();

            doc.LoadXml(Properties.Resources.FlexPivotViews);
            var menuView = new C1.Win.C1Command.C1CommandMenu();

            menuView.Text  = "&View";
            menuView.Image = Properties.Resources.Views_small;
            foreach (System.Xml.XmlNode nd in doc.SelectNodes("FlexPivotViews/C1FlexPivotPage"))
            {
                var cmd = new C1.Win.C1Command.C1Command();
                cmd.Text     = nd.Attributes["id"].Value;
                cmd.UserData = nd;
                cmd.Click   += menuView_DropDownItemClicked;
                var link = new C1.Win.C1Command.C1CommandLink(cmd);
                menuView.CommandLinks.Add(link);
            }
            c1FlexPivotPage1.Updated += c1FlexPivotPage1_Updated;

            // add new view menu to C1FlexPivotPage toolstrip
            var menuLink = new C1.Win.C1Command.C1CommandLink(menuView);

            c1FlexPivotPage1.ToolBar.CommandLinks.Insert(3, menuLink);

            // add collapse all menu to C1FlexPivotPage toolstrip
            collapseAllView        = new C1.Win.C1Command.C1Command();
            collapseAllView.Text   = "&CollapseAll";
            collapseAllView.Image  = Properties.Resources.CollapseAll;
            collapseAllView.Click += collapseAllView_Click;
            C1.Win.C1Command.C1CommandLink collapseAllViewLink = new C1.Win.C1Command.C1CommandLink(collapseAllView);
            c1FlexPivotPage1.ToolBar.CommandLinks.Add(collapseAllViewLink);
        }
Пример #14
0
        public static string GetServerIP()
        {
            string result = "";

            var doc = new System.Xml.XmlDocument();

            string path = AppDomain.CurrentDomain.BaseDirectory + "Config.xml";

            if (System.IO.File.Exists(path))
            {
                doc.Load(AppDomain.CurrentDomain.BaseDirectory + "Config.xml");

                var entities = doc.SelectNodes("//Config/Entry");

                foreach (System.Xml.XmlNode node in entities)
                {
                    var name  = node.Attributes.GetNamedItem("Name");
                    var value = node.Attributes.GetNamedItem("Value");

                    if (name == null || value == null)
                    {
                        continue;
                    }

                    if (name.Value == "WebService")
                    {
                        result = value.Value;
                    }
                }
            }

            return(result.Split(':')[1].Replace('/', ' ').TrimStart());
        }
Пример #15
0
        public static string ReadFromConfigXMlFile(string fieldName)
        {
            string result = "";

            var doc = new System.Xml.XmlDocument();

            string path = AppDomain.CurrentDomain.BaseDirectory + "Config.xml";

            if (System.IO.File.Exists(path))
            {
                doc.Load(AppDomain.CurrentDomain.BaseDirectory + "Config.xml");

                var entities = doc.SelectNodes("//Config/Entry");

                foreach (System.Xml.XmlNode node in entities)
                {
                    var name  = node.Attributes.GetNamedItem("Name");
                    var value = node.Attributes.GetNamedItem("Value");

                    if (name == null || value == null)
                    {
                        continue;
                    }

                    if (name.Value == fieldName.Trim())
                    {
                        result = value.Value;
                    }
                }
            }

            return(result.Trim());
        }
Пример #16
0
        // reads messages
        public List <MailModel> GetMessages()
        {
            List <MailModel> messages = new List <MailModel>();
            string           title;
            string           summary;

            System.Net.WebClient webclient = new System.Net.WebClient();

            // gmail log in
            webclient.Credentials = new System.Net.NetworkCredential(this.config["mailboxCredentials:logInAddress"], this.config["mailboxCredentials:logInPassword"]);
            // get contents
            string result = System.Text.Encoding.UTF8.GetString(webclient.DownloadData(@"https://mail.google.com/mail/feed/atom"));

            // messages.Add(new MailModel("abc", result)); return messages;
            // parse as xml
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(result.Replace(@"<feed version=""0.3"" xmlns=""http://purl.org/atom/ns#"">", @"<feed>"));

            // generate list
            foreach (System.Xml.XmlNode node in doc.SelectNodes(@"/feed/entry"))
            {
                title   = node.SelectSingleNode("title").InnerText;
                summary = node.SelectSingleNode("summary").InnerText;
                try {
                    string plain = this.cipherDriver.Decrypt(summary);
                    messages.Add(new MailModel(title, plain));
                } catch (Exception) {
                    // wiadomosc niekompatybilna z danym szyfrem np. szyfrowane rc4 a deszyfrowane seal
                    messages.Add(new MailModel(title, summary));
                }
            }

            return(messages);
        }
Пример #17
0
        private void barEditItem1_EditValueChanged(object sender, EventArgs e)
        {
            this.defaultLookAndFeel1.LookAndFeel.SkinName = barEditItem1.EditValue.ToString();
            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            //保存皮肤
            String configFile = Application.ExecutablePath + ".config";

            System.Xml.XmlDocument document = new System.Xml.XmlDocument();
            document.Load(configFile);
            System.Xml.XmlNodeList nodes = document.SelectNodes("/configuration/userSettings/Book.UI.Properties.Settings/setting");
            foreach (System.Xml.XmlNode node in nodes)
            {
                if (node.Attributes["name"].Value == "Skin")
                {
                    node.FirstChild.InnerText = barEditItem1.EditValue.ToString();
                }
            }
            document.Save(configFile);

            //Invoices.BaseEditForm f=new Invoices.BaseEditForm();

            //f.defaultLookAndFeel1.LookAndFeel.SkinName = barEditItem1.EditValue.ToString();

            //.defaultLookAndFeel.LookAndFeel.SkinName = barEditItem1.EditValue.ToString();
        }
Пример #18
0
        public void setTPU(String tpuHandlerServerUrl, String codApp, String codStampa)
        {
            String tpuUrl = tpuHandlerServerUrl + "?codApp=" + codApp + "&codStampa=" + codStampa;
            String tpu    = new StreamReader((new MemoryStream(this.getWebObjects(tpuUrl)))).ReadToEnd();

            System.Xml.XmlDocument tpuXML = new System.Xml.XmlDocument();
            tpuXML.LoadXml(tpu);

            this.reportDoc.setXML(tpuXML.OuterXml, tpuXML.DocumentElement.Name);

            System.Xml.XmlNodeList xNodes = tpuXML.SelectNodes("stampa/sections/section/content/pictureBox");
            if (xNodes != null)
            {
                foreach (System.Xml.XmlNode xn in xNodes)
                {
                    System.Xml.XmlNode nodo = xn.SelectSingleNode("file");
                    if (!String.IsNullOrEmpty(nodo.Attributes["value"].Value))
                    {
                        int          lio          = tpuUrl.LastIndexOf('/');
                        byte[]       byteImage    = this.getWebObjects(tpuUrl.Substring(0, lio) + "/" + nodo.Attributes["value"].Value);
                        MemoryStream memoryStream = new MemoryStream(byteImage);
                        Bitmap       image        = (Bitmap)Image.FromStream(memoryStream);
                        this.AddImage(xn.Attributes["name"].Value, image, true);
                    }
                }
            }
        }
Пример #19
0
 /// <summary>
 /// Retrieves list of goofs from specified xml file
 /// </summary>
 /// <param name="xmlPath">path of xml file to read from</param>
 public IList<IIMDbGoof> ReadGoofs(
     string xmlPath)
 {
     try
     {
         List<IIMDbGoof> goofs = new List<IIMDbGoof>();
         System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
         doc.Load(xmlPath);
         System.Xml.XmlNodeList goofList = doc.SelectNodes("/Goofs/Goof");
         if (goofList != null)
             foreach (System.Xml.XmlNode goofNode in goofList)
             {
                 if (goofNode["Category"] != null
                     && goofNode["Category"].InnerText != null
                     && goofNode["Category"].InnerText.Trim() != ""
                     && goofNode["Description"] != null
                     && goofNode["Description"].InnerText != null
                     && goofNode["Description"].InnerText.Trim() != "")
                 {
                     IMDbGoof goof = new IMDbGoof();
                     goof.Category = goofNode["Category"].InnerText;
                     goof.Description = goofNode["Description"].InnerText;
                     goofs.Add(goof);
                 }
             }
         return goofs;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #20
0
        /// <summary>
        /// 从XML中的Xpath的多个row中转换多个dic
        /// </summary>
        /// <param name="xmlContent"></param>
        /// <param name="xPath"></param>
        /// <returns></returns>
        public static Dictionary <string, string>[] GetDicArrayFromXML(string xmlContent, string xPath)
        {
            List <Dictionary <string, string> > DicList = new List <Dictionary <string, string> >();

            System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
            xml.LoadXml(xmlContent);
            var allNodes = xml.SelectNodes(xPath);

            for (int i = 0; i < allNodes.Count; i++)
            {
                if (allNodes[i].Name.ToLower().Trim() == "row")
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    for (int c = 0; c < allNodes[i].ChildNodes.Count; c++)
                    {
                        string nodeName = allNodes[i].ChildNodes[c].Name;
                        if (!dic.ContainsKey(nodeName))
                        {
                            dic.Add(nodeName, allNodes[i].ChildNodes[c].InnerText);
                        }
                        else
                        {
                            LogHelper.AddParseMsg("xml Rows 节点内容重复" + nodeName);
                        }
                    }
                    DicList.Add(dic);
                }
                else
                {
                    LogHelper.AddParseMsg("xml 节点不是row");
                }
            }
            return(DicList.ToArray());
        }
Пример #21
0
        public static void CreateGamesIni(string inputXML,string gamesIniPath)
        {
            //string filename = args[0];
                //Console.WriteLine(filename);
                System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();
                xdoc.Load(inputXML);

                var di = new DirectoryInfo(gamesIniPath);
                var fi = new FileInfo(gamesIniPath + "\\games.ini");
                di.Attributes &= FileAttributes.Normal;

                if (File.Exists(fi.FullName))
                    fi.Attributes &= ~FileAttributes.ReadOnly;

                using (System.IO.StreamWriter file = new System.IO.StreamWriter(gamesIniPath + "\\games.ini", true))
                {
                    file.WriteLine("# This file is only used for remapping specific games to other Emulators and/or Systems.");
                    file.WriteLine("# If you don't want your game to use the Default_Emulator, you would set the Emulator key here.");
                    file.WriteLine("# This file can also be used when you have Wheels with games from other Systems.");
                    file.WriteLine("# You would then use the System key to tell HyperLaunch what System to find the emulator settings.");
                    file.WriteLine("");

                }

                foreach (System.Xml.XmlNode node in xdoc.SelectNodes("menu/game"))
                {
                    string GameName = node.SelectSingleNode("@name").InnerText;
                    string sysName = node.SelectSingleNode("System").InnerText;
                    using (System.IO.StreamWriter file = new System.IO.StreamWriter(gamesIniPath + "\\games.ini", true))
                    {
                        file.WriteLine("[{0}]", GameName);
                        file.WriteLine(@"System={0}", sysName);
                    }
                }
        }
Пример #22
0
        /// <summary>
        /// Get currency exchange rate in euro's
        /// </summary>
        public static float GetCurrencyRateInEuro(string currency)
        {
            if (currency.ToLower() == "")
            {
                throw new ArgumentException("Invalid Argument! Currency parameter cannot be empty!");
            }

            if (currency.ToLower() == "eur")
            {
                throw new ArgumentException("Invalid Argument! Cannot get exchange rate from EURO to EURO");
            }

            try
            {
                // Create with currency parameter, a valid RSS url to ECB euro exchange rate feed
                string rssUrl = string.Concat("http://www.ecb.int/rss/fxref-", currency.ToLower() + ".html");

                // Create & Load New Xml Document
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.Load(rssUrl);

                // Create XmlNamespaceManager for handling XML namespaces.
                System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("rdf", "http://purl.org/rss/1.0/");
                nsmgr.AddNamespace("cb", "http://www.cbwiki.net/wiki/index.php/Specification_1.1");

                // Get list of daily currency exchange rate between selected "currency" and the EURO
                System.Xml.XmlNodeList nodeList = doc.SelectNodes("//rdf:item", nsmgr);

                // Loop Through all XMLNODES with daily exchange rates
                foreach (System.Xml.XmlNode node in nodeList)
                {
                    // Create a CultureInfo, this is because EU and USA use different sepperators in float (, or .)
                    CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
                    ci.NumberFormat.CurrencyDecimalSeparator = ".";

                    try
                    {
                        // Get currency exchange rate with EURO from XMLNODE
                        float exchangeRate = float.Parse(
                            node.SelectSingleNode("//cb:statistics//cb:exchangeRate//cb:value", nsmgr).InnerText,
                            NumberStyles.Any,
                            ci);

                        return(exchangeRate);
                    }
                    catch { }
                }

                // currency not parsed!!
                // return default value
                return(0);
            }
            catch
            {
                // currency not parsed!!
                // return default value
                return(0);
            }
        }
Пример #23
0
		void menuitem_Click(object sender, EventArgs e)
		{

			System.Windows.Forms.OpenFileDialog of = new System.Windows.Forms.OpenFileDialog();
			of.DefaultExt = ".xml";
			of.Filter = "XMLファイル(*.xml)|*.xml";
			if (of.ShowDialog((System.Windows.Forms.IWin32Window)_host.Win32WindowOwner) == System.Windows.Forms.DialogResult.OK) {
				try {
					System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();
					xdoc.Load(of.FileName);

					// 擬似的に放送に接続した状態にする
					_host.StartMockLive("lv0", System.IO.Path.GetFileNameWithoutExtension(of.FileName), DateTime.Now);
					
					// ファイル内のコメントをホストに登録する
					foreach (System.Xml.XmlNode node in xdoc.SelectNodes("packet/chat")) {
						Hal.OpenCommentViewer.Control.OcvChat chat = new Hal.OpenCommentViewer.Control.OcvChat(node);
						_host.InsertPluginChat(chat);
					}
					_host.ShowStatusMessage("インポートに成功しました。");

				}catch(Exception ex){
					NicoApiSharp.Logger.Default.LogException(ex);
					_host.ShowStatusMessage("インポートに失敗しました。");

				}
			}
			
		}
Пример #24
0
        public System.Collections.Generic.IEnumerable<Table> ListTables(string xmsclientrequestId = null)
        {
            List<Table> lTables = new List<Table>();

            string strResult = Internal.InternalMethods.QueryTables(AccountName, SharedKey, UseHTTPS, xmsclientrequestId);

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            using (System.Xml.XmlReader re = System.Xml.XmlReader.Create(new System.IO.StringReader(strResult)))
            {
                doc.Load(re);
            }
            System.Xml.XmlNamespaceManager man = new System.Xml.XmlNamespaceManager(doc.NameTable);
            man.AddNamespace("f", "http://www.w3.org/2005/Atom");
            man.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
            man.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices");

            foreach (System.Xml.XmlNode n in doc.SelectNodes("//f:feed/f:entry", man))
            {
                yield return new Table()
                {
                    AzureTableService = this,
                    Url = new Uri(n.SelectSingleNode("f:id", man).InnerText),
                    Name = n.SelectSingleNode("f:content/m:properties/d:TableName", man).InnerText
                };

            }
        }
Пример #25
0
        /// <summary>
        /// Removes all of the entries from managedcourses.xml for the given
        /// assignment manager course.
        /// </summary>
        public static bool UnregisterAssignmentManagerCourse(EnvDTE._DTE dte, string guid)
        {
            Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(Constants.KeyName);
            string sAppDataPath             = (string)key.GetValue(Constants.ValueName);
            string sFolderName  = sAppDataPath + Constants.ApplicationPath;
            string sManagedFile = sFolderName + Constants.ManagedCoursesFileName;
            string strURL       = "";

            System.Xml.XmlDocument xmlDoc = null;
            System.Xml.XmlNode     xmlNode = null, xmlPathNode = null;
            System.Xml.XmlNodeList xmlNodes = null;

            xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.Load(sManagedFile);

            if ((xmlNode = xmlDoc.SelectSingleNode("/managedcourses/course[assnmgr/guid='" + EscapeStringForXPath(guid) + "']")) != null)
            {
                if (((xmlPathNode = xmlDoc.SelectSingleNode("/managedcourses/course/assnmgr[guid='" + EscapeStringForXPath(guid) + "']")) != null) &&
                    ((xmlPathNode = xmlPathNode.SelectSingleNode("amurl")) != null))
                {
                    strURL = xmlPathNode.InnerText;
                }

                xmlNode.ParentNode.RemoveChild(xmlNode);
                xmlDoc.PreserveWhitespace = true;
                xmlDoc.Save(sManagedFile);
            }

            // Return true if there are now no more courses.
            return(((xmlNodes = xmlDoc.SelectNodes("/managedcourses/course")) == null) || (xmlNodes.Count == 0));
        }
Пример #26
0
        /// <summary>
        /// 解压缩文档
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="folderPath"></param>
        /// <returns></returns>
        public static System.Xml.XmlDocument UnArchiveFiles(string filename, string folderPath)
        {
            ArchiveHelper.Extract(filename, folderPath);
            var doc = new System.Xml.XmlDocument();

            doc.Load(System.IO.Path.Combine(folderPath, "layout.xml"));
            //替换背景路径
            var background = doc.SelectSingleNode("/layout/property/background");

            if (background != null)
            {
                string backgroundPathOld = background.Attributes["src"].Value;
                if (backgroundPathOld != string.Empty)
                {
                    if (backgroundPathOld.IndexOf(":", StringComparison.CurrentCulture) == -1)
                    {
                        background.Attributes["src"].Value = System.IO.Path.Combine(folderPath, backgroundPathOld);
                    }
                }
            }
            //替换图片路径
            foreach (System.Xml.XmlNode item in doc.SelectNodes("/layout/items/image"))
            {
                string imagePathOld = item.Attributes["src"].Value;
                if (imagePathOld != string.Empty)
                {
                    if (imagePathOld.IndexOf(":", StringComparison.CurrentCulture) == -1)
                    {
                        item.Attributes["src"].Value = System.IO.Path.Combine(folderPath, imagePathOld);
                    }
                }
            }
            doc.Save(System.IO.Path.Combine(folderPath, "layout.xml"));
            return(doc);
        }
Пример #27
0
        public async Task <string> LoadImages(string xaml)
        {
            var doc = new System.Xml.XmlDocument(); bool foundone = false;

            doc.LoadXml(xaml);
            var nodes = doc.SelectNodes("//*[@Image]");

            foreach (System.Xml.XmlNode n in nodes)
            {
                var image = n.Attributes["Image"].Value;
                Console.WriteLine("Image: " + image);
                if (System.Text.RegularExpressions.Regex.Match(image, "[a-f0-9]{24}").Success)
                {
                    WriteVerbose("Loading image id " + image);
                    using (var b = await Interfaces.Image.Util.LoadBitmap(image))
                    {
                        image = Interfaces.Image.Util.Bitmap2Base64(b);
                    }
                    foundone = true;
                    n.Attributes["Image"].Value = image;
                }
            }
            if (foundone)
            {
                return(doc.OuterXml);
            }
            return(xaml);
        }
Пример #28
0
        private void SetupGPSchemes()
        {
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            System.Xml.XmlNodeList nl  = null;
            bool enabled = true;

            gpReset();
            Masterminds = new System.Collections.ArrayList();
            foreach (Control c in grpBx2.Controls)
            {
                if (c is CheckBox)
                {
                    Masterminds.Add(new clsitem(c.Text, (string)c.Tag));
                }
            }

            foreach (clsitem c in this.Expansions)
            {
                doc.Load(Application.StartupPath + c.Value);
                nl = doc.SelectNodes("/xml/Cards/set/schemes/card");
                Label lbl = new Label();
                lbl.Text     = c.Name + ":";
                lbl.Location = new Point(4, 12);
                lbl.AutoSize = true;
                grpBx3.Controls.Add(lbl);
                foreach (System.Xml.XmlNode n in nl)
                {
                    addChk(n.Attributes["name"].Value, enabled, null, grpBx3);
                }
            }
            grpBx2.Visible = false;
            grpBx3.Visible = true;
            doc            = null;
            this.Text      = "Choose Scheme";
        }
Пример #29
0
        //获取指定的SQL NODE 节点。
        private System.Xml.XmlNode getSqlNode(string xmlFileName, string sqlName)
        {
            //string xmlFileFullName = xmlFileName + ".xml";

            System.Xml.XmlDocument xDoc = createXmlDocument(xmlFileName);

            System.Xml.XmlNodeList nodes = xDoc.SelectNodes(SQL_PARAMS_PATH);
            foreach (System.Xml.XmlNode node in nodes)
            {
                if (node.NodeType != System.Xml.XmlNodeType.Element)
                {
                    continue;
                }

                if (node.Attributes["Name"] == null)
                {
                    continue;
                }

                if (string.Compare(node.Attributes["Name"].Value.ToString(), sqlName, true) != 0)
                {
                    continue;
                }

                return(node);
            }
            return(null);
        }
Пример #30
0
        /// <summary>
        /// 初始化画面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormOutInventoryIndex_Load(object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                IEnumerable <User> users = PharmacyDatabaseService.GetAllUsers(out message);
                var list = users.Select(p => new ListItem {
                    ID = p.Id.ToString(), Name = p.Account
                }).ToList();
                list.Insert(0, new ListItem {
                    ID = Guid.Empty.ToString(), Name = "-请选择-"
                });
            }
            catch (Exception)
            {
                MessageBox.Show("画面初始化失败");
            }

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            string xmlFile             = AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.SalePriceType.xml";

            doc.Load(xmlFile);
            System.Xml.XmlNodeList NodeList = doc.SelectNodes("/SalePriceType/SaleOutInventoryChecker");
            FirstChecker    = NodeList[0].Attributes[0].Value.ToString();
            SecondChecker   = NodeList[0].Attributes[1].Value.ToString();
            InventoryKeeper = NodeList[0].Attributes[2].Value.ToString();

            dgvOutInventory.DataSource    = null;
            this.pagerControl.RecordCount = 0;
        }
Пример #31
0
        public List<Queue> ListQueues(
            string prefix = null,
            bool IncludeMetadata = false,
            int timeoutSeconds = 0,
            Guid? xmsclientrequestId = null)
        {
            List<Queue> lQueues = new List<Queue>();
            string strNextMarker = null;
            do
            {
                string sRet = Internal.InternalMethods.ListQueues(UseHTTPS, SharedKey, AccountName, prefix, strNextMarker,
                    IncludeMetadata: IncludeMetadata, timeoutSeconds: timeoutSeconds, xmsclientrequestId: xmsclientrequestId);

                //Microsoft.SqlServer.Server.SqlContext.Pipe.Send("After Internal.InternalMethods.ListQueues = " + sRet);

                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                using (System.IO.StringReader sr = new System.IO.StringReader(sRet))
                {
                    doc.Load(sr);
                }

                foreach (System.Xml.XmlNode node in doc.SelectNodes("EnumerationResults/Queues/Queue"))
                {
                    lQueues.Add(Queue.ParseFromXmlNode(this, node));
                };

                strNextMarker = doc.SelectSingleNode("EnumerationResults/NextMarker").InnerText;

                //Microsoft.SqlServer.Server.SqlContext.Pipe.Send("strNextMarker == " + strNextMarker);

            } while (!string.IsNullOrEmpty(strNextMarker));

            return lQueues;
        }
Пример #32
0
        public void DBConnect()
        {
            // Create test sample of 10 records
            // use the same db connection for the collection of tests
            string source = "server=SYD-SQL-DEV1; Integrated Security=SSPI; database=Salt_Testing";

            conn = new SqlConnection(source);
            // delete possibly existing sample data in the database
            // insert sample data into the database

            try
            {
                System.Xml.XmlDocument docTestFixtureData = new System.Xml.XmlDocument();
                docTestFixtureData.Load(strFileName);

                System.Xml.XmlNodeList nodeDbRecords = docTestFixtureData.SelectNodes(strDbRows);
                foreach (System.Xml.XmlNodeList nodeDbRecord in nodeDbRecords)
                {
                    foreach (System.Xml.XmlNode nodeDbCell in nodeDbRecord)
                    {
                        System.Diagnostics.Debug.WriteLine(nodeDbCell.Value);
                    }
                }
            }
            catch
            {
            }


            ds = new DataSet();             // reset ds for each test
        }
Пример #33
0
        public static void RemoveWoutWareCommentNodes(System.Xml.XmlDocument doc)
        {
            System.Xml.XmlNamespaceManager nsmgr = SimpleHelper.GetDefaultNamespace(doc);

            System.Xml.XmlNodeList EvalVersionTags = doc
                                                     .SelectNodes("//dft:text[contains(translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉÈÊÀÁÂÒÓÔÙÚÛÇÅÏÕÑŒ', 'abcdefghijklmnopqrstuvwxyzäöüéèêàáâòóôùúûçåïõñœ'),'aspose')]", nsmgr);


            // System.Xml.XmlNode xnProd = doc.SelectSingleNode("//comment()[contains(., 'Produced by application')]", nsmgr);
            // System.Xml.XmlNode xnWout = doc.SelectSingleNode("//comment()[contains(., 'woutware.com')]", nsmgr);

            System.Xml.XmlNode xnProd = doc
                                        .SelectSingleNode("//comment()[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉÈÊÀÁÂÒÓÔÙÚÛÇÅÏÕÑŒ', 'abcdefghijklmnopqrstuvwxyzäöüéèêàáâòóôùúûçåïõñœ'),'produced by application')]", nsmgr);

            System.Xml.XmlNode xnWout = doc
                                        .SelectSingleNode("//comment()[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉÈÊÀÁÂÒÓÔÙÚÛÇÅÏÕÑŒ', 'abcdefghijklmnopqrstuvwxyzäöüéèêàáâòóôùúûçåïõñœ'),'woutware.com')]", nsmgr);

            if (xnProd != null)
            {
                System.Console.WriteLine(xnProd.InnerText);
                xnProd.ParentNode.RemoveChild(xnProd);
            }

            if (xnWout != null)
            {
                System.Console.WriteLine(xnWout.InnerText);
                xnWout.ParentNode.RemoveChild(xnWout);
            }

            using (System.IO.FileStream fs = new System.IO.FileStream(@"d:\Test.xml", System.IO.FileMode.Create
                                                                      , System.IO.FileAccess.Write, System.IO.FileShare.None))
            {
                SimpleHelper.SaveDocument(doc, fs, true);
            }
        }
Пример #34
0
        private void CheckElements(System.Xml.XmlDocument doc, XHtmlMode mode)
        {
            if (mode == XHtmlMode.None)
            {
                return;
            }

            //Select all the nodes
            System.Xml.XmlNodeList list = doc.SelectNodes("//*");
            foreach (System.Xml.XmlElement element in list)
            {
                if (mode == XHtmlMode.StrictValidation)
                {
                    CheckStrictValidation(element);
                }
                else if (mode == XHtmlMode.BasicValidation)
                {
                    CheckBasicValidation(element);
                }
                else
                {
                    throw new ArgumentException("XHtmlMode not supported", "mode");
                }
            }
        }
Пример #35
0
        public static System.Xml.XmlDocument SetInfopathForm(
            System.Xml.XmlDocument part, string InfopathFormUrl)
        {
            // Delete existing processing instructions.
            foreach (System.Xml.XmlNode pi in part.SelectNodes(
                         "processing-instruction()"))
            {
                pi.ParentNode.RemoveChild(pi);
            }
            // Add an xml declaration
            System.Xml.XmlDeclaration decl =
                part.CreateXmlDeclaration("1.0", null, null);
            part.InsertBefore(decl, part.DocumentElement);
            // Create the mso-application procesing instruction.
            System.Xml.XmlProcessingInstruction progid = part.CreateProcessingInstruction(
                "mso-application", "progid='InfoPath.Document'");
            part.InsertBefore(progid, part.DocumentElement);
            // Create the mso-infoPathSolution processing instruction
            System.Xml.XmlProcessingInstruction form = part.CreateProcessingInstruction(
                "mso-infoPathSolution", "PIVersion='1.0.0.0' href='" +
                InfopathFormUrl + "'");
            part.InsertBefore(form, part.DocumentElement);

            return(part);
        }
Пример #36
0
        public LuceneSearchService(string Searchterm)
        {
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            string xpath = "[@name='MyArticles']";

            this._searchterm = Searchterm;
            doc.Load(HttpRuntime.AppDomainAppPath + "/App_Data/xml/indexConfig.xml");
            this._indexConfigNodes = doc.SelectNodes("/indexConfiguration/*" + xpath);
            if (Searchterm.StartsWith("§§INDEX§§")) this.IndexFiles(); else this.SearchIndex();
        }
Пример #37
0
 public static RetEntity Parse(string ret) {
     var entity = new RetEntity();
     System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
     doc.LoadXml(ret);
     entity.Result = doc.DocumentElement.GetAttribute("result");
     entity.Method = doc.DocumentElement.GetAttribute("name");
     foreach (System.Xml.XmlNode node in doc.SelectNodes("//Item")) {
         entity.Messages.Add(Message.Parse(node));
     };
     return entity;
 }
Пример #38
0
 public static void LoadModules()
 {
     string dir = AppDomain.CurrentDomain.BaseDirectory + "modules.config";
     var doc = new System.Xml.XmlDocument();
     doc.Load(dir);
     var nodeList = doc.SelectNodes("Assemblys/Assembly");
     foreach (System.Xml.XmlNode item in nodeList)
     {
         string dllPath = AppDomain.CurrentDomain.BaseDirectory + item.Attributes.GetNamedItem("path").Value;
         Assembly target = Assembly.LoadFile(dllPath);
         BuildManager.AddReferencedAssembly(target);
     }
 }
Пример #39
0
		/// <summary>
		/// Build counters by reading settings file
		/// </summary>
		private void InitializeCountersFromSettings()
		{
			System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
			doc.Load(ConfigurationManager.AppSettings["settingsFile"]);

			// Création des compteurs
			foreach (System.Xml.XmlNode monitor in doc.SelectNodes("/Monitor/*"))
			{
				switch (monitor.Attributes["type"].Value)
				{
					case "predefined":
						switch (monitor.Attributes["value"].Value)
						{
							case "CPU":
								CreateCPU();
								break;

							case "VirtualMemory":
								CreateVirtualMemory();
								break;

							case "PhysicalMemory":
								CreatePhysicalMemory();
								break;

							case "Network":
								CreateNetwork();
								break;

							case "Disk":
								CreateDisk();
								break;
								
							case "CPUFrequency":
								CreateCPUFrequency();
								break;
								
							default:
								throw new Exception(String.Format("value {0} unknown", monitor.Attributes["value"].Value));
						}
						break;
					case "perfmon":
						CreateSpecific(monitor.Attributes["value"].Value);
						break;

					default:
						throw new Exception(String.Format("type {0} unknown", monitor.Attributes["type"].Value));
				}
			}
		}
Пример #40
0
 private static void Init()
 {
     System.Xml.XmlDocument _document = new System.Xml.XmlDocument();
     _document.Load(Xy.Tools.IO.File.foundConfigurationFile("App", Xy.AppSetting.FILE_EXT));
     _connections = new Dictionary<string, DataSettingItem>();
     foreach (System.Xml.XmlNode _item in _document.SelectNodes("AppSetting/ConnectionStrings/Item")) {
         DataSettingItem _dbi = new DataSettingItem(
             _item.Attributes["Name"].Value,
             _item.Attributes["ConnectionString"].Value,
             _item.Attributes["Provider"].Value,
             _item.Attributes["TimeOut"] == null ? 30 : Convert.ToInt32(_item.Attributes["TimeOut"].Value));
         _connections.Add(_dbi.Name, _dbi);
     }
 }
Пример #41
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            System.Xml.XmlDocument Doc = new System.Xml.XmlDocument();
            Doc.Load("c:\\Controles.xml");
            System.Xml.XmlNodeList lista;
            lista = Doc.SelectNodes(@"//Control");
            System.Xml.XmlElement e;
            string clase, top, heigh, left, width, text;
            //Assembly objAssembly=System.Reflection.Assembly.LoadFrom("C:\\Windows\\Microsoft.NET\\Framework\\v1.1.4322\\System.Windows.Forms.dll");
            Assembly objAssembly = Assembly.LoadWithPartialName("System.Windows.Forms");
            Object b;
            for (int i=0; i < lista.Count; i++)
            {
                e = (System.Xml.XmlElement)lista[i];
                clase = e.GetAttribute("clase");
                top = e.GetAttribute("top");
                heigh = e.GetAttribute("height");
                left = e.GetAttribute("left");
                width = e.GetAttribute("width");
                text = e.GetAttribute("text");
                Type t = objAssembly.GetType(clase);
                //b = Activator.CreateInstance(t);
                b = t.InvokeMember("", BindingFlags.CreateInstance, null, null, null);
                //Activator.CreateInstance(t);

                /*
                Button c = (Button)b;
                c.Location = new System.Drawing.Point(int.Parse(left) , int.Parse(top));
                c.Text = text;
                c.Name = "boton" + i.ToString();
                */
                t.InvokeMember("Location", BindingFlags.SetProperty, null, b,
                    new object[] {new System.Drawing.Point(int.Parse(left) , int.Parse(top))});
                t.InvokeMember("Text", BindingFlags.SetProperty, null, b, new object[] {text});
                t.InvokeMember("Name", BindingFlags.SetProperty, null, b, new object[] {"control" + i.ToString()});

                //PropertyInfo pi = t.GetProperty("Name");
                //PropertyInfo pi2 = t.GetProperty("Pepe");

                this.Controls.Add((Control)b);
            }
        }
Пример #42
0
 private static void LoadControl()
 {
     System.Xml.XmlDocument _document = new System.Xml.XmlDocument();
     _document.Load(Xy.Tools.IO.File.foundConfigurationFile("App", Xy.AppSetting.FILE_EXT));
     foreach (System.Xml.XmlNode _item in _document.SelectNodes("AppSetting/Controls/Control")) {
         string _name = _item.Attributes["Name"].InnerText;
         string _assembly = _item.Attributes["Type"].InnerText;
         if (string.IsNullOrEmpty(_name) || string.IsNullOrEmpty(_assembly)) throw new System.Xml.XmlException("Control format error");
         Add(_name, _assembly);
         if (_item.HasChildNodes) {
             _config.Add(_name, _item.ChildNodes);
         }
     }
 }
Пример #43
0
        public static Dictionary<string, string> ParseParams(string paramString)
        {
            var d = new Dictionary<string,string>();
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(paramString);
            var nsMgr = new System.Xml.XmlNamespaceManager(doc.NameTable);
            nsMgr.AddNamespace("x", "urn:schemas-microsoft-com:xml-analysis");
            foreach( System.Xml.XmlNode n in doc.SelectNodes("/x:Parameters/x:Parameter",nsMgr))
            {
                d.Add(n["Name"].InnerText, n["Value"].InnerText);
            }

            // if we did not find the proper namespace try searching for just the raw names
            if (d.Count == 0)
            {
                foreach (System.Xml.XmlNode n in doc.SelectNodes("/Parameters/Parameter", nsMgr))
                {
                    d.Add(n["Name"].InnerText, n["Value"].InnerText);
                }

            }
            return d;
        }
Пример #44
0
 public static string[] GetArrayVal(string xml, string xpath, bool isGetXml)
 {
     System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
     xd.LoadXml(xml);
     System.Xml.XmlNodeList xnl = xd.SelectNodes(xpath);
     List<string> list = new List<string>();
     if (xnl.Count > 0)
     {
         foreach (System.Xml.XmlNode xn in xnl)
         {
             list.Add(isGetXml ? xn.InnerXml : xn.InnerText);
         }
     }
     return list.ToArray();
 }
        public ActionResult Index()
        {
            string[] colors = new string[] {
                        "#8D38C9",
                        "#00FFFF",
                        "#FF00FF",
                        "#008000",
                        "#FFFF00",
                        "#0000FF",
                        "#FF0000"
                };

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.Load(Server.MapPath("~/Areas/Draw_Basic/Content/Australia.xml"));

            List<object> info = new List<object>();
            List<AbstractSprite> sprites = new List<AbstractSprite>();

            int i = 0;
            foreach (System.Xml.XmlNode state in doc.SelectNodes("states/state"))
            {
                PathSprite sprite = new PathSprite
                {
                    Path = state.SelectSingleNode("path").InnerText,
                    FillStyle = "#808080",
                    StrokeStyle = "#000",
                    LineWidth = 1,
                    Linejoin = StrokeLinejoin.Round
                    //Cursor = "pointer"
                };

                //sprite.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0}, {1});", JSON.Serialize(colors[i]), i);
                //sprite.Listeners.MouseOut.Handler = "onMouseOut(this);";

                sprites.Add(sprite);
                i++;

                info.Add(new
                {
                    state = state.SelectSingleNode("name").InnerText,
                    desc = state.SelectSingleNode("description").InnerText
                });
            }

            ViewData["mapInfo"] = info;

            return View(sprites);
        }
Пример #46
0
 private void button1_Click(object sender, EventArgs e)
 {
     System.IO.StreamReader sr = new System.IO.StreamReader(@"cars.xml");
     System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);
     System.Xml.XmlDocument carCollectionDoc = new System.Xml.XmlDocument();
     carCollectionDoc.Load(xr);
     linkLabel1.Text = carCollectionDoc.InnerText;
     linkLabel2.Text = "First child node: " + carCollectionDoc.FirstChild.InnerText;
     linkLabel3.Text = "Second child node: " + carCollectionDoc.FirstChild.NextSibling.InnerText;
     System.Xml.XmlNode carcollection = carCollectionDoc.FirstChild.NextSibling;
     linkLabel4.Text = "Now that we have a reference to 'carcollection': " + carcollection.FirstChild.InnerText;
     linkLabel5.Text = "First child of collection: " + carcollection.FirstChild.InnerText;
     linkLabel6.Text = "First child of the first child of carcollection: " + carcollection.FirstChild.FirstChild.InnerText;
     System.Xml.XmlNodeList carCollectionItems = carCollectionDoc.SelectNodes("carcollection/car");
     System.Xml.XmlNode make = carCollectionItems.Item(0).SelectSingleNode("make");
     linkLabel7.Text = "make.InnerText: " + make.InnerText;
 }
        public void initPicker()
        {
            BindingList<Models.TaskStatus> taskStatus = listView.ItemsSource as BindingList<Models.TaskStatus>;
            if (!System.IO.File.Exists(string.Format(@"{0}\{1}", Environment.CurrentDirectory, Properties.Settings.Default["FileStatusTaskColor"])))
            {
                System.Drawing.Color color;
                if (taskStatus[0].Color != null)
                    color = System.Drawing.Color.FromArgb(Convert.ToInt32(taskStatus[0].Color));
                else
                    color = new System.Drawing.Color();

                colPicker.SelectedColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);

            }
            else
            {
                System.Drawing.Color color;
                System.Xml.XmlDocument document = new System.Xml.XmlDocument();
                document.Load(string.Format(@"{0}\{1}", Environment.CurrentDirectory, Properties.Settings.Default["FileStatusTaskColor"]));
                System.Xml.XmlNodeList nodeList = document.SelectNodes("TasksStatuses/TaskStatus");
                bool find = false;
                //foreach(System.Xml.XmlElement in document.SelectNodes)
                foreach(System.Xml.XmlNode node in nodeList)
                {

                    System.Xml.XmlNode colorNode = node.SelectSingleNode("Color");
                    System.Xml.XmlNode idNode = node.SelectSingleNode("Id");
                    System.Xml.XmlNode endNode = node.SelectSingleNode("End");

                    if (idNode.InnerText != taskStatus[0].Id)
                        continue;
                    find = true;
                    color = System.Drawing.Color.FromArgb(Convert.ToInt32(colorNode.InnerText));
                    colPicker.SelectedColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
                    endStatus.IsChecked = Convert.ToBoolean(endNode.InnerText);
                    break;
                }
                if (!find)
                {
                    color = System.Drawing.Color.Azure;
                    colPicker.SelectedColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
                }
            }
        }
Пример #48
0
 public static string GetValue(string xml, string xpath, bool isGetXml)
 {
     System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
     xd.LoadXml(xml);
     System.Xml.XmlNodeList xnl = xd.SelectNodes(xpath);
     if (xnl.Count > 0)
     {
         System.Text.StringBuilder sbValue = new System.Text.StringBuilder();
         foreach (System.Xml.XmlNode xn in xnl)
         {
             sbValue.Append(isGetXml ? xn.InnerXml : xn.InnerText);
             break;
         }
         return sbValue.ToString();
     }
     else
     {
         return string.Empty;
     }
 }
Пример #49
0
        private void Init()
        {
            System.Xml.XmlDocument _document = new System.Xml.XmlDocument();
            _document.Load(Xy.Tools.IO.File.foundConfigurationFile("UrlControl", Xy.AppSetting.FILE_EXT));
            System.Xml.XmlNodeList default_xnl = _document.SelectNodes("UrlRewrite/Item");

            _defaultUrlControl = new URLCollection(string.Empty, string.Empty, string.Empty, string.Empty);
            foreach (System.Xml.XmlNode _xn in default_xnl) {
                _defaultUrlControl.Add(new URLItem(_xn));
            }

            _defaultUrlControl.Add(new URLItem(null, null, @".*\.js$", "application/x-javascript", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.css$", "text/css", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.gif$", "image/gif", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.jpg$", "image/jpeg", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.png$", "image/png", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.bmp$", "image/bmp", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.swf$", "application/x-shockwave-flash", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @".*\.ico$", "image/x-icon", false, false, "ResourceFile", URLItem.DEFAULTAGE));
            _defaultUrlControl.Add(new URLItem(null, null, @"^/Xy_(App|Data|Log)/.*", "text/html", false, false, "Prohibit", 0));
            _defaultUrlControl.Add(new URLItem(null, null, @"^/Xy_Theme/[^/]+/Xy_(Cache|Include|Page|Xslt)/.*", "text/html", false, false, "Prohibit", 0));
            _defaultUrlControl.Add(new URLItem(null, "Xy.Web,Xy.Web.Page.ErrorPage", @"^/error\.aspx", "text/html", true, false, "MainContent", 0));

            _urlControl = new List<URLCollection>();
            foreach (System.Xml.XmlElement _xe in _document.SelectNodes("UrlRewrite/UrlCollection")) {
                URLCollection _urlItemCollection = new URLCollection(_xe);
                if (_urlItemCollection.SiteUrlReg == null && string.IsNullOrEmpty(_urlItemCollection.Name)) continue;

                foreach (System.Xml.XmlNode _xn in _xe.SelectNodes("Item")) {
                    _urlItemCollection.Add(new URLItem(_xn));
                }
                URLCollection _parent = null;
                if (!string.IsNullOrEmpty(_urlItemCollection.Inherit)) {
                    _parent = GetUrlItemCollection(_urlItemCollection.Inherit);
                }
                if (_parent == null) _parent = _defaultUrlControl;
                _urlItemCollection.AddRange(_parent.ToArray());
                _urlControl.Add(_urlItemCollection);
            }
        }
Пример #50
0
        internal static bool IsError(string xmlResponse, out string sMessage)
        {
            System.Xml.XmlDocument objXML = new System.Xml.XmlDocument();
            objXML.LoadXml(xmlResponse);
            System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(objXML.NameTable);
            nsmgr.AddNamespace("x", objXML.DocumentElement.NamespaceURI);
            sMessage = "";

            if (objXML.SelectSingleNode("/x:error/x:code", nsmgr) != null)
            {
                //System.Windows.Forms.MessageBox.Show(objXML.SelectSingleNode("/x:error/x:code", nsmgr).InnerText);
                sMessage = objXML.SelectSingleNode("/x:error/x:code", nsmgr).InnerText + ": " + objXML.SelectSingleNode("/x:error/x:message", nsmgr).InnerText;
                if (objXML.SelectSingleNode("/x:error/detail", nsmgr) !=null) {
                    //System.Windows.Forms.MessageBox.Show("here");
                    foreach (System.Xml.XmlNode node in objXML.SelectNodes("/x:error/x:detail/validationErrors")) {
                        sMessage += ": " + node.SelectSingleNode("validationError/message").InnerText;
                    }
                }
                return true;
            }

            return false;
        }
Пример #51
0
        private void button1_Click(object sender, EventArgs e)
        {
            // StreamReader will retrieve the file from the source
            // and will convert it into a stream ready to be processed
            System.IO.StreamReader sr = new System.IO.StreamReader(@"cars.xml");

            // XmlTextReader
            System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);

            // XmlDocument
            System.Xml.XmlDocument carCollectionDoc = new System.Xml.XmlDocument();

            carCollectionDoc.Load(xr);

            // using the InnerText property will give us just the data
            // ... since we are at the entire Document level, it will
            // give us *all* the values (no delimiter).
            linkLabel1.Text = carCollectionDoc.InnerText;

            linkLabel2.Text = " First child node: " + carCollectionDoc.FirstChild.InnerText;

            linkLabel3.Text = " Second child node: " + carCollectionDoc.FirstChild.NextSibling.InnerText;

            System.Xml.XmlNode carcollection = carCollectionDoc.FirstChild.NextSibling;

            linkLabel4.Text = "Now that we have a reference to 'carcollection': " + carcollection.FirstChild.InnerText;

            linkLabel5.Text = "First child of carcollection: " + carcollection.FirstChild.InnerText;

            linkLabel6.Text = "First child of the first child of carcollection: " + carcollection.FirstChild.FirstChild.InnerText;

            System.Xml.XmlNodeList carCollectionItems = carCollectionDoc.SelectNodes("carcollection/car");

            System.Xml.XmlNode make = carCollectionItems.Item(0).SelectSingleNode("make");

            linkLabel7.Text = "make.InnerText: " + make.InnerText;
        }
Пример #52
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            System.Xml.XmlDocument Doc = new System.Xml.XmlDocument();
            Doc.Load("c:\\Controles.xml");
            System.Xml.XmlNodeList lista;
            lista = Doc.SelectNodes(@"//Control");
            System.Xml.XmlElement e;
            string clase, top, heigh, left, width, text;
            System.Reflection.Assembly objAssembly=System.Reflection.Assembly.LoadFrom("C:\\Windows\\Microsoft.NET\\Framework\\v1.1.4322\\System.Windows.Forms.dll");
            Object b;
            for (int i=0; i < lista.Count; i++)
            {
                e = (System.Xml.XmlElement)lista[i];
                clase = e.GetAttribute("clase");
                top = e.GetAttribute("top");
                heigh = e.GetAttribute("height");
                left = e.GetAttribute("left");
                width = e.GetAttribute("width");
                text = e.GetAttribute("text");
                Type t = objAssembly.GetType(clase);
                b = Activator.CreateInstance(t);
                Button c = (Button)b;
                c.Location = new System.Drawing.Point(int.Parse(left) , int.Parse(top));
                c.Text = text;
                c.Name = "boton" + i.ToString();
                this.Controls.Add(c);
            }
        }
Пример #53
0
        /// <summary>   
        /// 获取Rss资源   
        /// </summary>   
        /// <param name="RssURL"></param>   
        /// <returns></returns>   
        public static DataTable ReadRss(string RssURL)
        {
            DataTable Dt = new DataTable();
            DataColumn Title = new DataColumn("Title", typeof(string));
            DataColumn Author = new DataColumn("Author", typeof(string));
            DataColumn PubDate = new DataColumn("PubDate", typeof(string));
            DataColumn Link = new DataColumn("Link", typeof(string));
            Dt.Columns.Add(Title);
            Dt.Columns.Add(Author);
            Dt.Columns.Add(PubDate);
            Dt.Columns.Add(Link);

            System.Net.WebRequest myRequest = System.Net.WebRequest.Create(RssURL);
            System.Net.WebResponse myResponse = myRequest.GetResponse();

            System.IO.Stream rssStream = myResponse.GetResponseStream();
            System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument();
            rssDoc.Load(rssStream);

            System.Xml.XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item");
            for (int i = 0; i < rssItems.Count; i++)
            {
                DataRow Row = Dt.NewRow();
                System.Xml.XmlNode rssDetail;
                //标题
                rssDetail = rssItems.Item(i).SelectSingleNode("title");
                if (rssDetail != null)
                {
                    Row["Title"] = rssDetail.InnerText;
                }
                else
                {
                    Row["Title"] = "";
                }
                //作者
                rssDetail = rssItems.Item(i).SelectSingleNode("author");
                if (rssDetail != null)
                {
                    Row["Author"] = rssDetail.InnerText;
                }
                else
                {
                    Row["Author"] = "";
                }
                //发布时间
                rssDetail = rssItems.Item(i).SelectSingleNode("pubDate");
                if (rssDetail != null)
                {
                    Row["PubDate"] = Convert.ToDateTime(rssDetail.InnerText).ToString("yyyy年MM月dd日");
                }
                else
                {
                    Row["PubDate"] = "";
                }
                //链接地址
                rssDetail = rssItems.Item(i).SelectSingleNode("link");
                if (rssDetail != null)
                {
                    Row["Link"] = rssDetail.InnerText;
                }
                else
                {
                    Row["Link"] = "";
                }
                Dt.Rows.Add(Row);
            }
            return Dt;
        }
Пример #54
0
        private void SetUserOptionValues()
        {
            string tempFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            while (Directory.Exists(tempFolder))
            {
                tempFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            }
            Directory.CreateDirectory(tempFolder);

            try
            {
                Slyce.Common.Utility.UnzipFile(Settings.Default.DebugCSPDatabasePath, tempFolder);
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.Load(Path.Combine(tempFolder, "options.xml"));

                foreach (System.Xml.XmlNode userOptionNode in doc.SelectNodes("/*/*/*"))
                {
                    foreach (Project.UserOption opt in Project.Instance.UserOptions)
                    {
                        if (opt.VariableName == userOptionNode.Name)
                        {
                            object obj = null;

                            switch (opt.VarType.Name.ToLower())
                            {
                                case "string":
                                    obj = userOptionNode.InnerText;
                                    break;
                                case "int32":
                                    obj = int.Parse(userOptionNode.InnerText);
                                    break;
                                case "double":
                                    obj = double.Parse(userOptionNode.InnerText);
                                    break;
                                case "boolean":
                                    obj = bool.Parse(userOptionNode.InnerText);
                                    break;
                                case "enum":
                                    obj = userOptionNode.InnerText;
                                    break;
                                default:
                                    throw new NotImplementedException("This object type has not been catered for yet: " + opt.VarType.Name);
                            }
                            try
                            {
                                Loader.Instance.SetUserOption(userOptionNode.Name, obj);
                            }
                            catch (Exception ex)
                            {
                                if (ex.Message.IndexOf("not found") >= 0)
                                {
                                    // Do nothing. This useroption is saved in the .aaproj file but has now been removed from the actual template
                                }
                                else
                                {
                                    throw;
                                }
                            }
                            break;
                        }
                    }
                }
            }
            finally
            {
                Slyce.Common.Utility.DeleteDirectoryBrute(tempFolder);
            }
        }
Пример #55
0
        static void Main(string[] _args)
        {
            List<string> args = new List<string>(_args);
            Dictionary<string, string> options = Duplicati.Library.Utility.CommandLineParser.ExtractOptions(args);

            if (args.Count != 1)
            {
                Console.WriteLine("Usage: ");
                Console.WriteLine("  WixProjBuilder.exe <projfile> [option=value]");
                return;
            }

            if (!System.IO.File.Exists(args[0]))
            {
                Console.WriteLine(string.Format("File not found: {0}", args[0]));
                return;
            }

            string wixpath;
            if (options.ContainsKey("wixpath"))
                wixpath = options["wixpath"];
            else
                wixpath = System.Environment.GetEnvironmentVariable("WIXPATH");

            if (string.IsNullOrEmpty(wixpath))
            {
                string[] known_wix_names = new string[] 
                {
                    "Windows Installer XML v3",
                    "Windows Installer XML v3.1",
                    "Windows Installer XML v3.2",
                    "Windows Installer XML v3.3",
                    "Windows Installer XML v3.4",
                    "Windows Installer XML v3.5",
                    "Windows Installer XML v3.6",
                    "Windows Installer XML v3.7",
                    "Windows Installer XML v3.8",
                    "Windows Installer XML v3.9",
                    "WiX Toolset v3.6",
                    "WiX Toolset v3.7",
                    "WiX Toolset v3.8",
                    "WiX Toolset v3.9",
                };

                foreach(var p in known_wix_names)
                {
                    foreach(var p2 in new string[] {"%ProgramFiles(x86)%", "%programfiles%"})
                    {
                        wixpath = System.IO.Path.Combine(System.IO.Path.Combine(Environment.ExpandEnvironmentVariables(p2), p), "bin");
                        if (System.IO.Directory.Exists(wixpath))
                        {
                            Console.WriteLine(string.Format("*** wixpath not specified, using: {0}", wixpath));
                            break;
                        }
                    }

                    if (System.IO.Directory.Exists(wixpath))
                        break;
                    }

            }


            if (!System.IO.Directory.Exists(wixpath))
            {
                Console.WriteLine(string.Format("WiX not found, please install Windows Installer XML 3 or greater"));
                Console.WriteLine(string.Format("  supply path to WiX bin folder with option --wixpath=...path..."));
                return;
            }

            args[0] = System.IO.Path.GetFullPath(args[0]);

            Console.WriteLine(string.Format("Parsing wixproj file: {0}", args[0]));

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.Load(args[0]);

            string config = "Release";
            if (options.ContainsKey("configuration"))
                config = options["configuration"];

            string projdir = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(args[0]));

            List<string> includes = new List<string>();
            List<string> refs = new List<string>();
            List<string> content = new List<string>();

            System.Xml.XmlNamespaceManager nm = new System.Xml.XmlNamespaceManager(doc.NameTable);
            nm.AddNamespace("ms", "http://schemas.microsoft.com/developer/msbuild/2003");

            foreach (System.Xml.XmlNode n in doc.SelectNodes("ms:Project/ms:ItemGroup/ms:Compile", nm))
                includes.Add(n.Attributes["Include"].Value);

            foreach (System.Xml.XmlNode n in doc.SelectNodes("ms:Project/ms:ItemGroup/ms:Content", nm))
                content.Add(n.Attributes["Include"].Value);

            foreach (System.Xml.XmlNode n in doc.SelectNodes("ms:Project/ms:ItemGroup/ms:WixExtension", nm))
                refs.Add(n.Attributes["Include"].Value);


            string objdir = System.IO.Path.Combine(System.IO.Path.Combine(projdir, "obj"), config);
            string packagename = "output";
            string outdir = System.IO.Path.Combine("bin", config);
            string outtype = "Package";

            //TODO: Support multiconfiguration system correctly
            foreach (System.Xml.XmlNode n in doc.SelectNodes("ms:Project/ms:PropertyGroup/ms:Configuration", nm))
                if (true) //if (string.Compare(n.InnerText, config, true) == 0)
                {
                    System.Xml.XmlNode p = n.ParentNode;
                    if (p["OutputName"] != null)
                        packagename = p["OutputName"].InnerText;
                    if (p["OutputType"] != null)
                        outtype = p["OutputType"].InnerText;
                    if (p["OutputPath"] != null)
                        outdir = p["OutputPath"].InnerText.Replace("$(Configuration)", config);
                    if (p["IntermediateOutputPath"] != null)
                        objdir = p["IntermediateOutputPath"].InnerText.Replace("$(Configuration)", config);
                }

            if (!objdir.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                objdir += System.IO.Path.DirectorySeparatorChar;

            string msiname = System.IO.Path.Combine(outdir, packagename + ".msi");

            Console.WriteLine("  Compiling ... ");
            if (includes.Count == 0)
            {
                Console.WriteLine("No files found to compile in project file");
                return;
            }

            string compile_args = "\"" + string.Join("\" \"", includes.ToArray()) + "\"";
            compile_args += " -out \"" + objdir.Replace("\\", "\\\\") + "\"";

            if (options.ContainsKey("platform") && options["platform"] == "x64")
                compile_args += " -dPlatform=x64 -dWin64=yes";
            else
                compile_args += " -dPlatform=x86 -dWin64=no";

            int res = Execute(
                System.IO.Path.Combine(wixpath, "candle.exe"), 
                projdir,
                compile_args);

            if (res != 0)
            {
                Console.WriteLine("Compilation failed, aborting");
                return;
            }

            Console.WriteLine("  Linking ...");

            for (int i = 0; i < includes.Count; i++)
                includes[i] = System.IO.Path.Combine(objdir, System.IO.Path.GetFileNameWithoutExtension(includes[i]) + ".wixobj");

            for (int i = 0; i < refs.Count; i++)
                if (!System.IO.Path.IsPathRooted(refs[i]))
                {
                    refs[i] = FindDll(refs[i] + ".dll", new string[] { projdir, wixpath });
                    if (!System.IO.Path.IsPathRooted(refs[i]))
                        refs[i] = FindDll(refs[i]);
                }

            string link_args = "\"" + string.Join("\" \"", includes.ToArray()) + "\"";

            if (refs.Count > 0)
                link_args += " -ext \"" + string.Join("\" -ext \"", refs.ToArray()) + "\"";

            link_args += " -out \"" + msiname + "\"";

            res = Execute(
                System.IO.Path.Combine(wixpath, "light.exe"),
                projdir,
                link_args);

            if (res != 0)
            {
                Console.WriteLine("Link failed, aborting");
                return;
            }

            if (!System.IO.Path.IsPathRooted(msiname))
                msiname = System.IO.Path.GetFullPath(System.IO.Path.Combine(projdir, msiname));

            Console.WriteLine(string.Format("Done: {0}", msiname));
        }
Пример #56
0
        private List<FilterDialog.FilterEntry> DecodeFilter(string filter)
        {
            List<FilterDialog.FilterEntry> res = new List<FilterDialog.FilterEntry>();
            if (string.IsNullOrEmpty(filter))
                return res;

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(filter);
            foreach (System.Xml.XmlNode n in doc.SelectNodes("root/filter"))
            {
                res.Add(new FilterDialog.FilterEntry(
                    bool.Parse(n.Attributes["include"].Value),
                    n.Attributes["filter"].Value,
                    n.Attributes["globbing"].Value
                ));
            }

            return res;
        }
        public bool Load()
        {
            try
            {
                //var slz = new XmlSerializer(typeof(XmlReflect));
                //using (var fs = File.OpenRead(_path))
                //{
                //    _store = (XmlReflect)slz.Deserialize(fs);
                //}

                _store = new XmlReflect();
                using (var reader = new System.Xml.XmlTextReader(_path))
                {
                    var doc = new System.Xml.XmlDocument();
                    doc.Load(reader);
                    var list = doc.SelectNodes("XmlPermissions");
                    if (list.Count > 0)
                    {
                        //Support for multiple documents
                        foreach (System.Xml.XmlNode item in list)
                        {
                            foreach (System.Xml.XmlNode node in item)
                            {
                                switch (node.NodeType)
                                {
                                    case System.Xml.XmlNodeType.Element:
                                        switch (node.Name)
                                        {
                                            case "Groups":
                                                foreach (System.Xml.XmlNode child in node)
                                                    ParseGroup(child);
                                                break;
                                            case "Players":
                                                foreach (System.Xml.XmlNode child in node)
                                                    ParsePlayer(child);
                                                break;
                                            default:
                                                PermissionsManager.RequestParse(this, new XmlNodeEventArgs()
                                                {
                                                    Node = node
                                                });
                                                break;
                                        }
                                        break;
                                    case System.Xml.XmlNodeType.None:
                                        break;
                                }
                            }
                        }
                    }
                }

                if (_store.Players != null)
                    foreach (var user in _store.Players)
                    {
                        if (_store.Groups != null && user.Groups != null)
                            user.MatchedGroups = _store.Groups
                                .Where(x =>
                                    user.Groups.Where(y => x.Name != null && y.ToLower() == x.Name.ToLower()).Count() > 0
                                    ||
                                    x.Attributes
                                        .Where(y => y.Key == "ApplyToGuests" && y.Value.ToLower() == "true")
                                        .Count() > 0
                                 )
                                .Distinct()
                                .ToArray();
                    }
                return true;
            }
            catch (Exception e)
            {
                ProgramLog.Log("Failed to load {0}", _path);
                ProgramLog.Log(e);
            }
            Console.Read();
            return false;
        }
Пример #58
0
 /// <summary>
 /// Retrieves list of quotes from specified xml file
 /// </summary>
 /// <param name="xmlPath">path of xml file to read from</param>
 public IList<IList<IIMDbQuote>> ReadQuotes(
     string xmlPath)
 {
     try
     {
         List<IList<IIMDbQuote>> quotes = new List<IList<IIMDbQuote>>();
         if (System.IO.File.Exists(xmlPath))
         {
             System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
             doc.Load(xmlPath);
             System.Xml.XmlNodeList quoteBlockList = doc.SelectNodes("/Quotes/QuoteBlock");
             if (quoteBlockList != null)
                 foreach (System.Xml.XmlNode quoteBlockNode in quoteBlockList)
                 {
                     List<IIMDbQuote> quoteBlock = new List<IIMDbQuote>();
                     foreach (System.Xml.XmlNode quoteNode in quoteBlockNode.ChildNodes)
                     {
                         if (quoteNode["Character"] != null
                             && quoteNode["Character"].InnerText != null
                             && quoteNode["Character"].InnerText.Trim() != ""
                             && quoteNode["QuoteText"] != null
                             && quoteNode["QuoteText"].InnerText != null
                             && quoteNode["QuoteText"].InnerText.Trim() != "")
                         {
                             IMDbQuote quote = new IMDbQuote();
                             quote.Character = quoteNode["Character"].InnerText;
                             quote.Text = quoteNode["QuoteText"].InnerText;
                             quoteBlock.Add(quote);
                         }
                     }
                     if (quoteBlock.Count > 0)
                         quotes.Add(quoteBlock);
                 }
         }
         return quotes;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #59
0
		public static string GetExplicitIndexingInfo(bool fullTable)
		{
			var infoArray = new List<ExplicitPerFieldIndexingInfo>(Current.ContentTypes.Count * 5);
			foreach (var contentType in Current.ContentTypes.Values)
			{
				var xml = new System.Xml.XmlDocument();
				var nsmgr = new System.Xml.XmlNamespaceManager(xml.NameTable);
				var fieldCount = 0;

				nsmgr.AddNamespace("x", ContentType.ContentDefinitionXmlNamespace);
				xml.Load(contentType.Binary.GetStream());
				foreach (System.Xml.XmlElement fieldElement in xml.SelectNodes("/x:ContentType/x:Fields/x:Field", nsmgr))
				{
					var typeAttr = fieldElement.Attributes["type"];
					if (typeAttr == null)
						typeAttr = fieldElement.Attributes["handler"];

					var info = new ExplicitPerFieldIndexingInfo
					{
						ContentTypeName = contentType.Name,
						ContentTypePath = contentType.Path.Replace(Repository.ContentTypesFolderPath + "/", String.Empty),
						FieldName = fieldElement.Attributes["name"].Value,
						FieldType = typeAttr.Value
					};

					var fieldTitleElement = fieldElement.SelectSingleNode("x:DisplayName", nsmgr);
					if (fieldTitleElement != null)
						info.FieldTitle = fieldTitleElement.InnerText;

					var fieldDescElement = fieldElement.SelectSingleNode("x:Description", nsmgr);
					if (fieldDescElement != null)
						info.FieldDescription = fieldDescElement.InnerText;

					var hasIndexing = false;
					foreach (System.Xml.XmlElement element in fieldElement.SelectNodes("x:Indexing/*", nsmgr))
					{
						hasIndexing = true;
						switch (element.LocalName)
						{
							case "Analyzer": info.Analyzer = element.InnerText.Replace("Lucene.Net.Analysis", "."); break;
							case "IndexHandler": info.IndexHandler = element.InnerText.Replace("SenseNet.Search", "."); break;
							case "Mode": info.IndexingMode = element.InnerText; break;
							case "Store": info.IndexStoringMode = element.InnerText; break;
							case "TermVector": info.TermVectorStoringMode = element.InnerText; break;
						}
					}

					fieldCount++;

					if(hasIndexing || fullTable)
						infoArray.Add(info);
				}

				//hack: content type without fields
				if (fieldCount == 0 && fullTable)
				{
					var info = new ExplicitPerFieldIndexingInfo
					{
						ContentTypeName = contentType.Name,
						ContentTypePath = contentType.Path.Replace(Repository.ContentTypesFolderPath + "/", String.Empty),
					};

					infoArray.Add(info);
				}
			}

			var sb = new StringBuilder();
			sb.AppendLine("TypePath\tType\tField\tFieldTitle\tFieldDescription\tFieldType\tMode\tStore\tTVect\tHandler\tAnalyzer");
			foreach (var info in infoArray)
			{
				sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}",
					info.ContentTypePath,
					info.ContentTypeName,
					info.FieldName,
					info.FieldTitle,
					info.FieldDescription,
					info.FieldType,
					info.IndexingMode,
					info.IndexStoringMode,
					info.TermVectorStoringMode,
					info.IndexHandler,
					info.Analyzer);
				sb.AppendLine();
			}
			return sb.ToString();
		}
Пример #60
0
        void _OpenRIndex()
        {
            try
            {
                if (state == ConnectionState.Open)
                {
                    throw new Exception("Connnection is already open.");
                }

                if (connstr.RIndex == QaConnectionString.RIndexType.POOLED)
                {
                    string[] hosts = connstr.DataSource;
                    Random rnd = new Random(unchecked(System.DateTime.Now.Millisecond + System.Threading.Thread.CurrentThread.ManagedThreadId));
                    for (int hi = 0; hi < hosts.Length; hi++)
                    {
                        int swapindex = rnd.Next() % hosts.Length;
                        string oval = hosts[hi];
                        hosts[hi] = hosts[swapindex];
                        hosts[swapindex] = oval;
                    }
                    for (int hi = 0; hi < hosts.Length; hi++)
                    {
                        _OpenSocketRIndex(hosts[hi]);
                    }                 
                }
                else
                {
                    _OpenSocketRIndex(null);
                }
  
                netstm.WriteByte((byte)'i'); //get all master indexes.

                sysindexes = new Dictionary<string, Index>();                
                {
                    string xml = XContent.ReceiveXString(netstm, buf);
                    if (xml.Length > 0)
                    {
                        System.Xml.XmlDocument xi = new System.Xml.XmlDocument();
                        xi.LoadXml(xml);
                        System.Xml.XmlNodeList xnIndexes = xi.SelectNodes("/indexes/index");
                        foreach (System.Xml.XmlNode xnIndex in xnIndexes)
                        {
                            string indName = xnIndex["name"].InnerText;
                            System.Xml.XmlNode xnUpdatememoryonly = xnIndex.SelectSingleNode("updatememoryonly");
                            System.Xml.XmlElement xePinHash = xnIndex["pinHash"];  
                            System.Xml.XmlElement xeTable = xnIndex["table"];
                            System.Xml.XmlNodeList xnCols = xeTable.SelectNodes("column");

                            Column[] cols = new Column[xnCols.Count];
                            for (int ci = 0; ci < xnCols.Count; ci++)
                            {
                                System.Xml.XmlNode xnCol = xnCols[ci];
                                cols[ci].Name = xnCol["name"].InnerText;
                                cols[ci].Type = xnCol["type"].InnerText;
                                cols[ci].Bytes = Int32.Parse(xnCol["bytes"].InnerText);
                            }

                            Table tab;
                            tab.Name = xeTable["name"].InnerText;
                            tab.Columns = cols;

                            Index ind;
                            ind.Name = indName;
                            ind.Ordinal = Int32.Parse(xnIndex["ordinal"].InnerText);
                            ind.Table = tab;
                            ind.UpdateMemoryOnly = (xnUpdatememoryonly != null && xnUpdatememoryonly.InnerText == "1");
                            ind.PinHash = (xePinHash != null && xePinHash.InnerText == "1");
                            ind.Hash = ind.PinHash ? new Position[256 * 256] : null;
                            ind.MaxKey = new byte[tab.Columns[ind.Ordinal].Bytes];
                            sysindexes.Add(indName.ToLower(), ind);
                        }
                    }
                }

                int micnt = 0;
                XContent.ReceiveXBytes(netstm, out micnt, buf);
                micnt = Utils.BytesToInt(buf, 0);
                mindexes = new Dictionary<string, List<KeyValuePair<byte[], string>>>(micnt);
                for (int mi = 0; mi < micnt; mi++)
                {
                    string indexname = XContent.ReceiveXString(netstm, buf).ToLower();
                    List<KeyValuePair<byte[], string>> lines = new List<KeyValuePair<byte[], string>>();
                    int keylen = 9;
                    bool pinhash = false;
                    Position[] hash = null;
                    byte[] maxkey = null;
                    if (sysindexes.ContainsKey(indexname))
                    {
                        Index thisindex = sysindexes[indexname];
                        int ordinal = thisindex.Ordinal;
                        keylen = thisindex.Table.Columns[ordinal].Bytes;
                        pinhash = thisindex.PinHash;
                        hash = thisindex.Hash;
                        maxkey = thisindex.MaxKey;
                    }
                    else
                    {
                        throw new Exception("Index version conflict, need to recreate indexes");
                    }

                    byte[] lastkeybuf = new byte[3];
                    int filelen = 0;
                    XContent.ReceiveXBytesNoCap(netstm, out filelen, ref buf);
                    if (filelen > 0)
                    {
                        int pos = 0;
                        int hoffset = 0;
                        int hlen = 0;
                        
                        for (int ki = 0; ki < keylen; ki++)
                        {
                            maxkey[ki] = buf[pos++];
                        }                        

                        while (pos < filelen)
                        {
                            byte[] keybuf = new byte[keylen];
                            for (int ki = 0; ki < keylen; ki++)
                            {
                                keybuf[ki] = buf[pos++];
                            }

                            /*bool samekey = true;
                            for (int ki = 0; ki < keybuf.Length; ki++)
                            {
                                if (lastkeybuf[ki] != keybuf[ki])
                                {
                                    samekey = false;
                                    break;
                                }
                            }*/

                            int chunknamestartpos = pos;
                            while (buf[pos++] != (byte)'\0')
                            {
                            }

                            //samekey = false;
                            //if (!samekey)
                            {
                                string chunkname = System.Text.Encoding.UTF8.GetString(buf, chunknamestartpos, pos - chunknamestartpos - 1);

                                if (pinhash)
                                {
                                    if (lines.Count > 0)
                                    {
                                        if (keybuf[1] != lastkeybuf[1] || keybuf[2] != lastkeybuf[2])
                                        {
                                            int shortkey = TwoBytesToInt(lastkeybuf[1], lastkeybuf[2]);
                                            hash[shortkey].Offset = hoffset;
                                            hash[shortkey].Length = hlen;
                                            hoffset = lines.Count;
                                            hlen = 0;
                                        }
                                    }
                                    hlen++;
                                }

                                lines.Add(new KeyValuePair<byte[], string>(keybuf, chunkname));
                                Buffer.BlockCopy(keybuf, 0, lastkeybuf, 0, 3);
                            }
                        }

                        if (pinhash)
                        {
                            //last flush
                            if (hlen > 0)
                            {
                                int shortkey = TwoBytesToInt(lastkeybuf[1], lastkeybuf[2]);
                                hash[shortkey].Offset = hoffset;
                                hash[shortkey].Length = hlen;
                            }

                            //fill in the gap
                            int prevoffset = 0;
                            int prevlen = 0;
                            for (int hi = 0; hi < hash.Length; hi++)
                            {
                                Position thispos = hash[hi];
                                if (thispos.Length == 0)
                                {
                                    thispos.Length = prevlen;
                                    thispos.Offset = prevoffset;
                                    hash[hi] = thispos;
                                }
                                else
                                {
                                    prevoffset = thispos.Offset;
                                    prevlen = thispos.Length;
                                }
                            }
                        }
                    }
                    mindexes.Add(indexname, lines);
                }                

                if (connstr.RIndex == QaConnectionString.RIndexType.NOPOOL)
                {
                    _CloseSocketRIndex(); 
                }                
                state = ConnectionState.Open;
            }
            catch
            {
                Cleanup();
                throw;
            }
        }