[gnome-subtitles] Improved methods to add and get text lines.
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Improved methods to add and get text lines.
- Date: Sat, 11 Jun 2011 18:44:06 +0000 (UTC)
commit 1ec764cb819f025bd6e5e7a3e8e1ae81547bf909
Author: Pedro Castro <mail pedrocastro org>
Date: Sat Jun 11 19:42:28 2011 +0100
Improved methods to add and get text lines.
src/SubLib/Core/Domain/SubtitleText.cs | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/SubLib/Core/Domain/SubtitleText.cs b/src/SubLib/Core/Domain/SubtitleText.cs
index 9e8712d..7bcb0e1 100644
--- a/src/SubLib/Core/Domain/SubtitleText.cs
+++ b/src/SubLib/Core/Domain/SubtitleText.cs
@@ -1,6 +1,6 @@
/*
* This file is part of SubLib.
- * Copyright (C) 2005-2010 Pedro Castro
+ * Copyright (C) 2005-2011 Pedro Castro
*
* SubLib is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -157,6 +157,10 @@ public class SubtitleText : ICloneable {
return GetTrimLines("\n");
}
+ public string[] GetLines () {
+ return (string[])lines.ToArray(typeof(String));
+ }
+
/// <summary>Sets the subtitle text using the specified line break and trimming option.</summary>
/// <param name="text">The subtitle text.</param>
/// <param name="lineBreak">The text substring used to split the text in lines.</param>
@@ -181,6 +185,14 @@ public class SubtitleText : ICloneable {
Set(text, "\n", false);
}
+ public void Add (string[] newLines) {
+ foreach (string newLine in newLines) {
+ string trimmedLine = newLine.Trim();
+ if (trimmedLine != String.Empty)
+ lines.Add(trimmedLine);
+ }
+ }
+
public override string ToString() {
string result = String.Empty;
int lineNumber = 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]