Merge branch 'develop' into feature/642-read-tags
This commit is contained in:
84 files changed
+1000
-131
No files matched your search
@@ -368,7 +368,9 @@ namespace VocaluxeLib
|
||||
{
|
||||
Normal,
|
||||
Golden,
|
||||
Freestyle
|
||||
Freestyle,
|
||||
Rap,
|
||||
RapGolden
|
||||
}
|
||||
|
||||
public enum EMusicType
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
_Flares.Clear();
|
||||
_PerfectNoteEffect.Clear();
|
||||
|
||||
foreach (CSongNote note in _Lines[_CurrentLine].Notes.Where(note => note.Type == ENoteType.Golden))
|
||||
foreach (CSongNote note in _Lines[_CurrentLine].Notes.Where(note => (note.IsGoldenNote)))
|
||||
_AddGoldenNote(_GetNoteRect(note));
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
SRectF rect = _GetNoteRect(note);
|
||||
|
||||
_DrawNoteBG(rect, color);
|
||||
_DrawNoteBase(rect, new SColorF(_NoteBaseColor, _NoteBaseColor.A * Alpha), 1f);
|
||||
_DrawNoteBG(rect, color, note.IsRapNote);
|
||||
_DrawNoteBase(rect, new SColorF(_NoteBaseColor, _NoteBaseColor.A * Alpha), 1f, note.IsRapNote);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +128,9 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
float factor = (note.Hit) ? 1f : 0.6f;
|
||||
|
||||
_DrawNoteFill(rect, color, factor);
|
||||
_DrawNoteFill(rect, color, factor, note.IsRapNote);
|
||||
|
||||
if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && note.HitNote.Type == ENoteType.Golden)
|
||||
if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && note.IsGoldenNote)
|
||||
{
|
||||
SRectF re = rect;
|
||||
re.W = (CBase.Game.GetMidRecordedBeat() - note.StartBeat) / beats * Rect.W;
|
||||
@@ -175,14 +175,22 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
CSongLine line = _Lines[_CurrentLine];
|
||||
float beats = line.LastNoteBeat - line.FirstNoteBeat + 1;
|
||||
bool isRapNote = note.IsRapNote;
|
||||
|
||||
float width = note.Duration * Rect.W / beats;
|
||||
float y = Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - line.BaseLine) / 2f) * _NoteLineHeight - _AddNoteHeight / 2;
|
||||
float height = _NoteLineHeight + _AddNoteHeight;
|
||||
|
||||
if (isRapNote) {
|
||||
y = Rect.Y;
|
||||
height = Rect.H;
|
||||
}
|
||||
|
||||
var noteRect = new SRectF(
|
||||
Rect.X + (note.StartBeat - line.FirstNoteBeat) * Rect.W / beats,
|
||||
Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - line.BaseLine) / 2f) * _NoteLineHeight - _AddNoteHeight / 2,
|
||||
y,
|
||||
width,
|
||||
_NoteLineHeight + _AddNoteHeight,
|
||||
height,
|
||||
Rect.Z
|
||||
);
|
||||
return noteRect;
|
||||
@@ -267,26 +275,26 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color, false);
|
||||
}
|
||||
|
||||
private void _DrawNoteBase(SRectF rect, SColorF color, float factor)
|
||||
private void _DrawNoteBase(SRectF rect, SColorF color, float factor, bool isRapNote = false)
|
||||
{
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinRight, _PartyModeID);
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapLeft : _Theme.SkinLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapMiddle : _Theme.SkinMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapRight : _Theme.SkinRight, _PartyModeID);
|
||||
|
||||
_DrawNote(rect, color, noteBegin, noteMiddle, noteEnd, factor);
|
||||
}
|
||||
|
||||
private void _DrawNoteFill(SRectF rect, SColorF color, float factor)
|
||||
private void _DrawNoteFill(SRectF rect, SColorF color, float factor, bool isRapNote = false)
|
||||
{
|
||||
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinFillLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinFillMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinFillRight, _PartyModeID);
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapFillLeft : _Theme.SkinFillLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapFillMiddle : _Theme.SkinFillMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapFillRight : _Theme.SkinFillRight, _PartyModeID);
|
||||
|
||||
_DrawNote(rect, color, noteBegin, noteMiddle, noteEnd, factor);
|
||||
}
|
||||
|
||||
private void _DrawNoteBG(SRectF rect, SColorF color)
|
||||
private void _DrawNoteBG(SRectF rect, SColorF color, bool isRapNote = false)
|
||||
{
|
||||
const float period = 1500; //[ms]
|
||||
|
||||
@@ -300,9 +308,9 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
var col = new SColorF(color, color.A * alpha);
|
||||
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundRight, _PartyModeID);
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapBackgroundLeft : _Theme.SkinBackgroundLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapBackgroundMiddle : _Theme.SkinBackgroundMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(isRapNote ? _Theme.SkinRapBackgroundRight : _Theme.SkinBackgroundRight, _PartyModeID);
|
||||
|
||||
_DrawNote(rect, col, noteBegin, noteMiddle, noteEnd, 1f);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,18 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
public string SkinBackgroundMiddle;
|
||||
public string SkinBackgroundRight;
|
||||
|
||||
public string SkinRapLeft;
|
||||
public string SkinRapMiddle;
|
||||
public string SkinRapRight;
|
||||
|
||||
public string SkinRapFillLeft;
|
||||
public string SkinRapFillMiddle;
|
||||
public string SkinRapFillRight;
|
||||
|
||||
public string SkinRapBackgroundLeft;
|
||||
public string SkinRapBackgroundMiddle;
|
||||
public string SkinRapBackgroundRight;
|
||||
|
||||
public string SkinGoldenStar;
|
||||
public string SkinToneHelper;
|
||||
public string SkinPerfectNoteStart;
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public string CoverBackground;
|
||||
public string CoverBigBackground;
|
||||
public string DuetIcon;
|
||||
public string RapIcon;
|
||||
public string VideoIcon;
|
||||
public string MedleyCalcIcon;
|
||||
public string MedleyTagIcon;
|
||||
@@ -68,6 +69,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public SThemeStatic StaticCoverBig;
|
||||
public SThemeStatic StaticTextBG;
|
||||
public SThemeStatic StaticDuetIcon;
|
||||
public SThemeStatic StaticRapIcon;
|
||||
public SThemeStatic StaticVideoIcon;
|
||||
public SThemeStatic StaticMedleyCalcIcon;
|
||||
public SThemeStatic StaticMedleyTagIcon;
|
||||
@@ -117,6 +119,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public SThemeStatic StaticCoverBig;
|
||||
public SThemeStatic StaticTextBG;
|
||||
public SThemeStatic StaticDuetIcon;
|
||||
public SThemeStatic StaticRapIcon;
|
||||
public SThemeStatic StaticVideoIcon;
|
||||
public SThemeStatic StaticMedleyCalcIcon;
|
||||
public SThemeStatic StaticMedleyTagIcon;
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private readonly CStatic _CoverBig;
|
||||
private readonly CStatic _TextBG;
|
||||
private readonly CStatic _DuetIcon;
|
||||
private readonly CStatic _RapIcon;
|
||||
private readonly CStatic _VideoIcon;
|
||||
private readonly CStatic _MedleyCalcIcon;
|
||||
private readonly CStatic _MedleyTagIcon;
|
||||
@@ -123,10 +124,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_CoverBig = new CStatic(_Theme.SongMenuList.StaticCoverBig, _PartyModeID);
|
||||
_TextBG = new CStatic(_Theme.SongMenuList.StaticTextBG, _PartyModeID);
|
||||
_DuetIcon = new CStatic(_Theme.SongMenuList.StaticDuetIcon, _PartyModeID);
|
||||
_RapIcon = new CStatic(_Theme.SongMenuList.StaticRapIcon, _PartyModeID);
|
||||
_VideoIcon = new CStatic(_Theme.SongMenuList.StaticVideoIcon, _PartyModeID);
|
||||
_MedleyCalcIcon = new CStatic(_Theme.SongMenuList.StaticMedleyCalcIcon, _PartyModeID);
|
||||
_MedleyTagIcon = new CStatic(_Theme.SongMenuList.StaticMedleyTagIcon, _PartyModeID);
|
||||
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _SongYear, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
|
||||
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _SongYear, _DuetIcon, _RapIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
|
||||
}
|
||||
|
||||
private void _ReadSubTheme()
|
||||
@@ -137,6 +139,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme.SongMenuList.TextTitle = (SThemeText)_Title.GetTheme();
|
||||
_Theme.SongMenuList.StaticCoverBig = (SThemeStatic)_CoverBig.GetTheme();
|
||||
_Theme.SongMenuList.StaticDuetIcon = (SThemeStatic)_DuetIcon.GetTheme();
|
||||
_Theme.SongMenuList.StaticRapIcon = (SThemeStatic)_RapIcon.GetTheme();
|
||||
_Theme.SongMenuList.StaticMedleyCalcIcon = (SThemeStatic)_MedleyCalcIcon.GetTheme();
|
||||
_Theme.SongMenuList.StaticMedleyTagIcon = (SThemeStatic)_MedleyTagIcon.GetTheme();
|
||||
_Theme.SongMenuList.StaticTextBG = (SThemeStatic)_TextBG.GetTheme();
|
||||
@@ -222,6 +225,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SongLength.Text = String.Empty;
|
||||
_SongYear.Text = String.Empty;
|
||||
_DuetIcon.Visible = false;
|
||||
_RapIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
@@ -251,6 +255,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Title.Text = song.Title;
|
||||
_SongYear.Text = song.Year;
|
||||
_DuetIcon.Visible = song.IsDuet;
|
||||
_RapIcon.Visible = song.IsRap;
|
||||
_VideoIcon.Visible = song.VideoFileName != "";
|
||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private CStatic _CoverBig;
|
||||
private CStatic _TextBG;
|
||||
private CStatic _DuetIcon;
|
||||
private CStatic _RapIcon;
|
||||
private CStatic _VideoIcon;
|
||||
private CStatic _MedleyCalcIcon;
|
||||
private CStatic _MedleyTagIcon;
|
||||
@@ -118,10 +119,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_CoverBig = new CStatic(_Theme.SongMenuTileBoard.StaticCoverBig, _PartyModeID);
|
||||
_TextBG = new CStatic(_Theme.SongMenuTileBoard.StaticTextBG, _PartyModeID);
|
||||
_DuetIcon = new CStatic(_Theme.SongMenuTileBoard.StaticDuetIcon, _PartyModeID);
|
||||
_RapIcon = new CStatic(_Theme.SongMenuTileBoard.StaticRapIcon, _PartyModeID);
|
||||
_VideoIcon = new CStatic(_Theme.SongMenuTileBoard.StaticVideoIcon, _PartyModeID);
|
||||
_MedleyCalcIcon = new CStatic(_Theme.SongMenuTileBoard.StaticMedleyCalcIcon, _PartyModeID);
|
||||
_MedleyTagIcon = new CStatic(_Theme.SongMenuTileBoard.StaticMedleyTagIcon, _PartyModeID);
|
||||
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _SongYear, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
|
||||
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _SongYear, _DuetIcon, _RapIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
|
||||
}
|
||||
|
||||
private void _UpdateTileSelection()
|
||||
@@ -141,6 +143,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme.SongMenuTileBoard.TextTitle = (SThemeText)_Title.GetTheme();
|
||||
_Theme.SongMenuTileBoard.StaticCoverBig = (SThemeStatic)_CoverBig.GetTheme();
|
||||
_Theme.SongMenuTileBoard.StaticDuetIcon = (SThemeStatic)_DuetIcon.GetTheme();
|
||||
_Theme.SongMenuTileBoard.StaticRapIcon = (SThemeStatic)_RapIcon.GetTheme();
|
||||
_Theme.SongMenuTileBoard.StaticMedleyCalcIcon = (SThemeStatic)_MedleyCalcIcon.GetTheme();
|
||||
_Theme.SongMenuTileBoard.StaticMedleyTagIcon = (SThemeStatic)_MedleyTagIcon.GetTheme();
|
||||
_Theme.SongMenuTileBoard.StaticTextBG = (SThemeStatic)_TextBG.GetTheme();
|
||||
@@ -213,6 +216,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SongLength.Text = String.Empty;
|
||||
_SongYear.Text = String.Empty;
|
||||
_DuetIcon.Visible = false;
|
||||
_RapIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
@@ -242,6 +246,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Title.Text = song.Title;
|
||||
_SongYear.Text = song.Year;
|
||||
_DuetIcon.Visible = song.IsDuet;
|
||||
_RapIcon.Visible = song.IsRap;
|
||||
_VideoIcon.Visible = song.VideoFileName != "";
|
||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||
|
||||
@@ -82,6 +82,20 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
|
||||
public abstract int PointsForBeat { get; }
|
||||
|
||||
public bool IsRapNote
|
||||
{
|
||||
get { return IsNoteType(ENoteType.Rap, ENoteType.RapGolden); }
|
||||
}
|
||||
|
||||
public bool IsGoldenNote
|
||||
{
|
||||
get { return IsNoteType(ENoteType.Golden, ENoteType.RapGolden); }
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
public abstract bool IsNoteType(params ENoteType[] noteTypes);
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
@@ -165,6 +165,7 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
get { return Notes.VoiceCount > 1; }
|
||||
}
|
||||
public bool IsRap = false;
|
||||
|
||||
public readonly List<string> Editions = new List<string>();
|
||||
public readonly List<string> Genres = new List<string>();
|
||||
|
||||
@@ -576,9 +576,9 @@ namespace VocaluxeLib.Songs
|
||||
break;
|
||||
case ':':
|
||||
case '*':
|
||||
case 'R':
|
||||
case 'G':
|
||||
case 'F':
|
||||
case 'R': // Read R (RAP) and G (Golden RAP) notes as Freestyle notes currently. Final implementation needed!
|
||||
case 'G': // Read R (RAP) and G (Golden RAP) notes as Freestyle notes currently. Final implementation needed!
|
||||
string[] noteData = line.Split(splitChars, 4);
|
||||
if (noteData.Length < 4)
|
||||
{
|
||||
@@ -628,6 +628,16 @@ namespace VocaluxeLib.Songs
|
||||
noteType = ENoteType.Golden;
|
||||
else if (tag.Equals('F') || tag.Equals('R') || tag.Equals('G')) // Read R (RAP) and G (Golden RAP) notes as Freestyle notes currently. Final implementation needed!
|
||||
noteType = ENoteType.Freestyle;
|
||||
else if (tag.Equals('R'))
|
||||
{
|
||||
noteType = ENoteType.Rap;
|
||||
_Song.IsRap = true;
|
||||
}
|
||||
else if (tag.Equals('G'))
|
||||
{
|
||||
noteType = ENoteType.RapGolden;
|
||||
_Song.IsRap = true;
|
||||
}
|
||||
else
|
||||
noteType = ENoteType.Normal;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace VocaluxeLib.Songs
|
||||
{
|
||||
/// <summary>
|
||||
@@ -37,6 +39,13 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
#endregion Constructors
|
||||
|
||||
#region Methods
|
||||
public override bool IsNoteType(params ENoteType[] noteTypes)
|
||||
{
|
||||
return noteTypes.Contains(Type);
|
||||
}
|
||||
#endregion Method
|
||||
|
||||
#region Properties
|
||||
public ENoteType Type { get; set; }
|
||||
|
||||
@@ -49,8 +58,10 @@ namespace VocaluxeLib.Songs
|
||||
switch (Type)
|
||||
{
|
||||
case ENoteType.Normal:
|
||||
case ENoteType.Rap:
|
||||
return 1;
|
||||
case ENoteType.Golden:
|
||||
case ENoteType.RapGolden:
|
||||
return 2;
|
||||
case ENoteType.Freestyle:
|
||||
return 0;
|
||||
|
||||
@@ -188,6 +188,12 @@ namespace VocaluxeLib.Songs
|
||||
case ENoteType.Freestyle:
|
||||
tag = "F";
|
||||
break;
|
||||
case ENoteType.Rap:
|
||||
tag = "R";
|
||||
break;
|
||||
case ENoteType.RapGolden:
|
||||
tag = "G";
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException("Note type " + note.Type);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace VocaluxeLib.Songs
|
||||
{
|
||||
/// <summary>
|
||||
@@ -74,6 +76,10 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
Perfect = result;
|
||||
}
|
||||
public override bool IsNoteType(params ENoteType[] noteTypes)
|
||||
{
|
||||
return HitNote != null && noteTypes.Contains(HitNote.Type);
|
||||
}
|
||||
#endregion Methods
|
||||
|
||||
public override int PointsForBeat
|
||||
|
||||
@@ -23,6 +23,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
@@ -179,14 +180,28 @@ namespace VocaluxeLib.Xml
|
||||
}
|
||||
|
||||
private readonly IXmlErrorHandler _ErrorHandler;
|
||||
private readonly bool _UnescapeStringValues;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new XmlDeserializer
|
||||
/// </summary>
|
||||
/// <param name="unescapeStringValues">Set to true if string values should be unescaped during reading</param>
|
||||
public CXmlDeserializer(bool unescapeStringValues)
|
||||
{
|
||||
_ErrorHandler = new CXmlDefaultErrorHandler();
|
||||
_UnescapeStringValues = unescapeStringValues;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new XmlDeserializer
|
||||
/// </summary>
|
||||
/// <param name="errorHandler">Class to be used for error callbacks, if not given a default handler will be used which throws errors and logs warnings</param>
|
||||
public CXmlDeserializer(IXmlErrorHandler errorHandler = null)
|
||||
/// <param name="unescapeStringValues">Set to true if string values should be unescaped during reading</param>
|
||||
public CXmlDeserializer(IXmlErrorHandler errorHandler = null, bool unescapeStringValues = false)
|
||||
{
|
||||
_ErrorHandler = errorHandler ?? new CXmlDefaultErrorHandler();
|
||||
_UnescapeStringValues = unescapeStringValues;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -216,8 +231,15 @@ namespace VocaluxeLib.Xml
|
||||
}
|
||||
if (type == typeof(Guid))
|
||||
return Guid.Parse(node.InnerText);
|
||||
if (type == typeof(string))
|
||||
return node == null ? null : node.InnerText;
|
||||
if (type == typeof(string)) {
|
||||
if(node == null) {
|
||||
return null;
|
||||
} else if(_UnescapeStringValues) {
|
||||
return Regex.Unescape(node.InnerText);
|
||||
} else {
|
||||
return node.InnerText;
|
||||
}
|
||||
}
|
||||
if (type.IsPrimitive)
|
||||
return _GetPrimitiveValue(node, type) ?? value;
|
||||
if (type.IsNullable())
|
||||
|
||||
Reference in new issue
Block a user