当前位置: 首页>>代码示例>>C#>>正文


C# XElement.GetString方法代码示例

本文整理汇总了C#中XElement.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# XElement.GetString方法的具体用法?C# XElement.GetString怎么用?C# XElement.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XElement的用法示例。


在下文中一共展示了XElement.GetString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Reload

        public void Reload(XElement element)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            BrowserSourceSettings = AbstractSettings.DeepClone(BrowserSettings.Instance.SourceSettings);
            BrowserInstanceSettings = AbstractSettings.DeepClone(BrowserSettings.Instance.InstanceSettings);

            String instanceSettingsString = element.GetString("instanceSettings");
            String sourceSettingsString = element.GetString("sourceSettings");

            if (sourceSettingsString != null && sourceSettingsString.Count() > 0)
            {
                try
                {
                    BrowserSourceSettings = serializer.Deserialize<BrowserSourceSettings>(sourceSettingsString);
                }
                catch (ArgumentException e)
                {
                    API.Instance.Log("Failed to deserialized source settings and forced to recreate; {0}", e.Message);
                }
            }

            if (instanceSettingsString != null && instanceSettingsString.Count() > 0)
            {
                BrowserInstanceSettings.MergeWith(serializer.Deserialize<BrowserInstanceSettings>(instanceSettingsString));
            }
        }
开发者ID:jameshearn,项目名称:CLRBrowserSourcePlugin,代码行数:27,代码来源:BrowserConfig.cs

示例2: SampleConfigurationDialog

        public SampleConfigurationDialog(XElement config)
        {
            InitializeComponent();
            this.config = config;

            String file = config.GetString("file");
            if (File.Exists(file))
            {
                LoadImage(new Uri(config.GetString("file")));
            }
        }
开发者ID:OrthoLabs,项目名称:CLRHostPlugin,代码行数:11,代码来源:SampleConfiguration.xaml.cs

示例3: ShowConfiguration

        public override bool ShowConfiguration(XElement config)
        {
            var dialog = new LiveSplitConfigurationDialog(config);
            if (dialog.ShowDialog().GetValueOrDefault(false))
            {
                if (config.Parent.GetInt("cx") == 0 || config.Parent.GetInt("cy") == 0)
                {
                    try
                    {
                        using (var layoutStream = System.IO.File.OpenRead(config.GetString("layoutpath")))
                        {
                            var xmlDoc = new System.Xml.XmlDocument();
                            xmlDoc.Load(layoutStream);

                            var parent = xmlDoc["Layout"];
                            var width = parent["VerticalWidth"];
                            config.Parent.SetInt("cx", int.Parse(width.InnerText));
                            var height = parent["VerticalHeight"];
                            config.Parent.SetInt("cy", int.Parse(height.InnerText)); //TODO Will break with horizontal
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                    }
                }

                return true;
            }
            return false;
        }
开发者ID:PrototypeAlpha,项目名称:LiveSplit,代码行数:31,代码来源:LiveSplitImageSourceFactory.cs

示例4: LiveSplitConfigurationDialog

        public LiveSplitConfigurationDialog(XElement config)
        {
            this.config = config;
            InitializeComponent();

            txtSplitsPath.Text = config.GetString("splitspath");
            txtLayoutPath.Text = config.GetString("layoutpath");
            var anchorRight = config.GetInt("anchorright") == 1;
            var anchorBottom = config.GetInt("anchorbottom") == 1;
            if (anchorRight)
            {
                if (anchorBottom)
                    rdoBottomRight.IsChecked = true;
                else
                    rdoTopRight.IsChecked = true;
            }
            else
            {
                if (anchorBottom)
                    rdoBottomLeft.IsChecked = true;
                else
                    rdoTopLeft.IsChecked = true;
            }
        }
开发者ID:xarrez,项目名称:LiveSplit,代码行数:24,代码来源:LiveSplitConfigurationDialog.xaml.cs


注:本文中的XElement.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。