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


C# IRun.IsAutoSplitterActive方法代码示例

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


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

示例1: Save

        public void Save(IRun run, Stream stream)
        {
            var document = new XmlDocument();

            XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null);
            document.AppendChild(docNode);

            var parent = document.CreateElement("Run");
            parent.Attributes.Append(SettingsHelper.ToAttribute(document, "version", "1.5.0"));
            document.AppendChild(parent);

            parent.AppendChild(SettingsHelper.CreateImageElement(document, "GameIcon", run.GameIcon));
            parent.AppendChild(SettingsHelper.ToElement(document, "GameName", run.GameName));
            parent.AppendChild(SettingsHelper.ToElement(document, "CategoryName", run.CategoryName));
            parent.AppendChild(SettingsHelper.ToElement(document, "Offset", run.Offset));
            parent.AppendChild(SettingsHelper.ToElement(document, "AttemptCount", run.AttemptCount));

            var runHistory = document.CreateElement("AttemptHistory");
            foreach (var attempt in run.AttemptHistory)
            {
                runHistory.AppendChild(attempt.ToXml(document));
            }
            parent.AppendChild(runHistory);

            var segmentElement = document.CreateElement("Segments");
            parent.AppendChild(segmentElement);

            var bf = new BinaryFormatter();

            foreach (var segment in run)
            {
                var splitElement = document.CreateElement("Segment");
                segmentElement.AppendChild(splitElement);

                splitElement.AppendChild(SettingsHelper.ToElement(document, "Name", segment.Name));
                splitElement.AppendChild(SettingsHelper.CreateImageElement(document, "Icon", segment.Icon));

                var splitTimes = document.CreateElement("SplitTimes");
                foreach (var comparison in run.CustomComparisons)
                {
                    var splitTime = segment.Comparisons[comparison].ToXml(document, "SplitTime");
                    splitTime.Attributes.Append(SettingsHelper.ToAttribute(document, "name", comparison));
                    splitTimes.AppendChild(splitTime);
                }
                splitElement.AppendChild(splitTimes);

                splitElement.AppendChild(segment.BestSegmentTime.ToXml(document, "BestSegmentTime"));

                var history = document.CreateElement("SegmentHistory");
                foreach (var historySegment in segment.SegmentHistory)
                {
                    history.AppendChild(historySegment.ToXml(document));
                }
                splitElement.AppendChild(history);
            }

            var autoSplitterSettings = document.CreateElement("AutoSplitterSettings");
            if (run.IsAutoSplitterActive())
                autoSplitterSettings.InnerXml = run.AutoSplitter.Component.GetSettings(document).InnerXml;
            parent.AppendChild(autoSplitterSettings);

            document.Save(stream);
        }
开发者ID:lietu,项目名称:LiveSplit,代码行数:63,代码来源:XMLRunSaver.cs

示例2: Save

        public void Save(IRun run, Stream stream)
        {
            var document = new XmlDocument();

            XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null);
            document.AppendChild(docNode);

            var parent = document.CreateElement("Run");
            parent.Attributes.Append(SettingsHelper.ToAttribute(document, "version", "1.6.0"));
            document.AppendChild(parent);

            parent.AppendChild(SettingsHelper.CreateImageElement(document, "GameIcon", run.GameIcon));
            parent.AppendChild(SettingsHelper.ToElement(document, "GameName", run.GameName));
            parent.AppendChild(SettingsHelper.ToElement(document, "CategoryName", run.CategoryName));
            parent.AppendChild(SettingsHelper.ToElement(document, "Offset", run.Offset));
            parent.AppendChild(SettingsHelper.ToElement(document, "AttemptCount", run.AttemptCount));

            var runHistory = document.CreateElement("AttemptHistory");
            foreach (var attempt in run.AttemptHistory)
            {
                runHistory.AppendChild(attempt.ToXml(document));
            }
            parent.AppendChild(runHistory);

            var segmentElement = document.CreateElement("Segments");
            parent.AppendChild(segmentElement);

            var bf = new BinaryFormatter();

            foreach (var segment in run)
            {
                var splitElement = document.CreateElement("Segment");
                segmentElement.AppendChild(splitElement);

                splitElement.AppendChild(SettingsHelper.ToElement(document, "Name", segment.Name));
                splitElement.AppendChild(SettingsHelper.CreateImageElement(document, "Icon", segment.Icon));

                var splitTimes = document.CreateElement("SplitTimes");
                foreach (var comparison in run.CustomComparisons)
                {
                    var splitTime = segment.Comparisons[comparison].ToXml(document, "SplitTime");
                    splitTime.Attributes.Append(SettingsHelper.ToAttribute(document, "name", comparison));
                    splitTimes.AppendChild(splitTime);
                }
                splitElement.AppendChild(splitTimes);

                splitElement.AppendChild(segment.BestSegmentTime.ToXml(document, "BestSegmentTime"));

                var history = document.CreateElement("SegmentHistory");
                foreach (var historySegment in segment.SegmentHistory)
                {
                    history.AppendChild(historySegment.ToXml(document));
                }
                splitElement.AppendChild(history);
            }

            var autoSplitterSettings = document.CreateElement("AutoSplitterSettings");
            if (run.IsAutoSplitterActive())
                autoSplitterSettings.InnerXml = run.AutoSplitter.Component.GetSettings(document).InnerXml;
            parent.AppendChild(autoSplitterSettings);

            var metadata = document.CreateElement("Metadata");

            var runElement = document.CreateElement("Run");
            runElement.Attributes.Append(SettingsHelper.ToAttribute(document, "id", run.Metadata.RunID ?? string.Empty));
            metadata.AppendChild(runElement);

            var platform = SettingsHelper.ToElement(document, "Platform", run.Metadata.PlatformName ?? string.Empty);
            platform.Attributes.Append(SettingsHelper.ToAttribute(document, "usesEmulator", run.Metadata.UsesEmulator));
            metadata.AppendChild(platform);

            metadata.AppendChild(SettingsHelper.ToElement(document, "Region", run.Metadata.RegionName ?? string.Empty));

            var variables = document.CreateElement("Variables");
            foreach (var variable in run.Metadata.VariableValueNames)
            {
                var variableElement = SettingsHelper.ToElement(document, "Variable", variable.Value ?? string.Empty);
                variableElement.Attributes.Append(SettingsHelper.ToAttribute(document, "name", variable.Key ?? string.Empty));
                variables.AppendChild(variableElement);
            }
            metadata.AppendChild(variables);
            parent.AppendChild(metadata);

            document.Save(stream);
        }
开发者ID:kugelrund,项目名称:LiveSplit,代码行数:85,代码来源:XMLRunSaver.cs

示例3: Save

        public void Save(IRun run, Stream stream)
        {
            var document = new XmlDocument();

            XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null);
            document.AppendChild(docNode);

            var parent = document.CreateElement("Run");
            var version = document.CreateAttribute("version");
            version.Value = "1.5.0";
            parent.Attributes.Append(version);
            document.AppendChild(parent);

            var gameIcon = CreateImageElement(document, "GameIcon", run.GameIcon);
            parent.AppendChild(gameIcon);

            var gameName = document.CreateElement("GameName");
            gameName.InnerText = run.GameName;
            parent.AppendChild(gameName);

            var categoryName = document.CreateElement("CategoryName");
            categoryName.InnerText = run.CategoryName;
            parent.AppendChild(categoryName);

            var offset = document.CreateElement("Offset");
            offset.InnerText = run.Offset.ToString();
            parent.AppendChild(offset);

            var attemptCount = document.CreateElement("AttemptCount");
            attemptCount.InnerText = run.AttemptCount.ToString();
            parent.AppendChild(attemptCount);

            var runHistory = document.CreateElement("AttemptHistory");
            foreach (var attempt in run.AttemptHistory)
            {
                runHistory.AppendChild(attempt.ToXml(document));
            }
            parent.AppendChild(runHistory);

            var segmentElement = document.CreateElement("Segments");
            parent.AppendChild(segmentElement);

            var bf = new BinaryFormatter();

            foreach (var segment in run)
            {
                var splitElement = document.CreateElement("Segment");
                segmentElement.AppendChild(splitElement);

                var name = document.CreateElement("Name");
                name.InnerText = segment.Name;
                splitElement.AppendChild(name);

                var icon = CreateImageElement(document, "Icon", segment.Icon);
                splitElement.AppendChild(icon);

                var splitTimes = document.CreateElement("SplitTimes");
                foreach (var comparison in run.CustomComparisons)
                {
                    var splitTime = segment.Comparisons[comparison].ToXml(document, "SplitTime");
                    var comparisonName = document.CreateAttribute("name");
                    comparisonName.Value = comparison;
                    splitTime.Attributes.Append(comparisonName);
                    splitTimes.AppendChild(splitTime);
                }
                splitElement.AppendChild(splitTimes);

                var goldSplit = segment.BestSegmentTime.ToXml(document, "BestSegmentTime");
                splitElement.AppendChild(goldSplit);

                var history = document.CreateElement("SegmentHistory");
                foreach (var historySegment in segment.SegmentHistory)
                {
                    history.AppendChild(historySegment.ToXml(document));
                }
                splitElement.AppendChild(history);
            }

            var autoSplitterSettings = document.CreateElement("AutoSplitterSettings");
            if (run.IsAutoSplitterActive())
                autoSplitterSettings.InnerXml = run.AutoSplitter.Component.GetSettings(document).InnerXml;
            parent.AppendChild(autoSplitterSettings);

            document.Save(stream);
        }
开发者ID:xarrez,项目名称:LiveSplit,代码行数:85,代码来源:XMLRunSaver.cs


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