mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
'Stage' auto-generated language class
This commit is contained in:
parent
212c2f8912
commit
f5b3be226c
@ -1,54 +1,54 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
// !!! THIS FILE IS AUTO-GENERATED!!!
|
||||
// !!! THIS FILE IS AUTO-GENERATED!!!
|
||||
// !!! THIS FILE IS AUTO-GENERATED!!!
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
|
||||
public class LanguageDeserializer // NOTE: This class is AUTO-GENERATED!!!!
|
||||
{
|
||||
|
||||
public static Language CustomDeserializeLanguage(string fileName)
|
||||
{
|
||||
var name = new StringBuilder(100, 1000);
|
||||
var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
var language = new Language();
|
||||
|
||||
using (XmlReader reader = XmlReader.Create(stream, new XmlReaderSettings {
|
||||
IgnoreWhitespace = true, IgnoreProcessingInstructions = true, IgnoreComments = true,
|
||||
DtdProcessing = DtdProcessing.Ignore, CheckCharacters = false, CloseInput = true }))
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
if (!reader.IsEmptyElement && reader.Depth > 0)
|
||||
name.Append('/').Append(reader.Name);
|
||||
else if (reader.Depth == 0)
|
||||
language.Name = reader["Name"];
|
||||
}
|
||||
else if (reader.NodeType == XmlNodeType.EndElement)
|
||||
{
|
||||
if (name.Length > 0)
|
||||
name.Length -= reader.Name.Length + 1;
|
||||
}
|
||||
else if (reader.NodeType == XmlNodeType.Text)
|
||||
{
|
||||
SetValue(language, reader, name.ToString(1, name.Length - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
private static void SetValue(Language language, XmlReader reader, string name)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
// !!! THIS FILE IS AUTO-GENERATED!!!
|
||||
// !!! THIS FILE IS AUTO-GENERATED!!!
|
||||
// !!! THIS FILE IS AUTO-GENERATED!!!
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
|
||||
public class LanguageDeserializer // NOTE: This class is AUTO-GENERATED!!!!
|
||||
{
|
||||
|
||||
public static Language CustomDeserializeLanguage(string fileName)
|
||||
{
|
||||
var name = new StringBuilder(100, 1000);
|
||||
var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
var language = new Language();
|
||||
|
||||
using (XmlReader reader = XmlReader.Create(stream, new XmlReaderSettings {
|
||||
IgnoreWhitespace = true, IgnoreProcessingInstructions = true, IgnoreComments = true,
|
||||
DtdProcessing = DtdProcessing.Ignore, CheckCharacters = false, CloseInput = true }))
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
if (!reader.IsEmptyElement && reader.Depth > 0)
|
||||
name.Append('/').Append(reader.Name);
|
||||
else if (reader.Depth == 0)
|
||||
language.Name = reader["Name"];
|
||||
}
|
||||
else if (reader.NodeType == XmlNodeType.EndElement)
|
||||
{
|
||||
if (name.Length > 0)
|
||||
name.Length -= reader.Name.Length + 1;
|
||||
}
|
||||
else if (reader.NodeType == XmlNodeType.Text)
|
||||
{
|
||||
SetValue(language, reader, name.ToString(1, name.Length - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
private static void SetValue(Language language, XmlReader reader, string name)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Name":
|
||||
language.Name = reader.Value;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user