Click here to Skip to main content
15,887,822 members
Home / Discussions / C#
   

C#

 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:02
Nishant.Chauhan8011-Jun-14 23:02 
GeneralRe: (Nishant)plz solve this issue Pin
Pete O'Hanlon11-Jun-14 23:12
mvePete O'Hanlon11-Jun-14 23:12 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:21
Nishant.Chauhan8011-Jun-14 23:21 
GeneralRe: (Nishant)plz solve this issue Pin
OriginalGriff11-Jun-14 23:48
mveOriginalGriff11-Jun-14 23:48 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:54
Nishant.Chauhan8011-Jun-14 23:54 
GeneralRe:plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:57
Nishant.Chauhan8011-Jun-14 23:57 
QuestionGetExternalLoginInfoAsync return null on server in google-plus auth in mvc5 Pin
aree21411-Jun-14 19:44
aree21411-Jun-14 19:44 
QuestionLoad .srt file into datagrid Pin
ZinusMero11-Jun-14 15:43
ZinusMero11-Jun-14 15:43 
Hi,

This has been driving me mad all week, so finally I gave in an am posting for some help. I am a budding c# programmer and have made lots of simple programs. Every time I decide to try something new, something crops up that I can't yet solve.

I am trying to make an editor for syncing srt subtitle files. I can load the subtitle file, I can send it to a textbox if i want to, i can trim and split the time line and send them to different places, but I am having difficulty processing it as a whole.

I practiced splitting and trimming the time line when i had the text string in a textbox just to make it simple. The srt file is structured like:

1
00:00:01,151 --> 00:00:03,432
Subtitle Line 1

2
00:00:05,651 --> 00:00:07,238
Subtitle Line 1 sub 2
Subtitle Line 2 sub 2

3
00:00:08,751 --> 00:00:10,065
Subtitle Line 1 sub 3
etc etc etc

I placed the "00:00:01,151 --> 00:00:03,432" line in textBox1 and using the code:

C#
//splits the string and keeps the text before the -->
string startTime = textBox1.Text;
string result = startTime.Substring(0, theString.IndexOf("-->")).Trim();
textBox4.Text = result;

//takes the text after the delimiter
int index = textBox1.Text.IndexOf('>');
string result2 = textBox1.Text.Substring(index + 2); 
textBox5.Text = result2;


This code puts each part into separate text boxes and works as i want.

I have a good handle on logic code and can understand what i need to do, but not how to do it.

-I need to read the line and if it contains only an integer, send it to column 1.
-I need to read the line and if it contains '-->' use the above code and send it to cols 2 and 3.
-I need to read the next line and send it to col 4 (1st subtitle text line, will always contain text)
-I need to read the line and if it is blank, make a new row, else append the text to the text in column 4 and then make new row. Then start over.

Logically, i know what to do, but i am having trouble with looping through and processing each line.

Does anyone have any tips that could help me? Thanks
> Load "Stumped",8,1

AnswerRe: Load .srt file into datagrid Pin
Richard MacCutchan11-Jun-14 21:45
mveRichard MacCutchan11-Jun-14 21:45 
GeneralRe: Load .srt file into datagrid Pin
ZinusMero15-Jun-14 15:19
ZinusMero15-Jun-14 15:19 
AnswerRe: Load .srt file into datagrid Pin
joost.versteegen11-Jun-14 21:50
joost.versteegen11-Jun-14 21:50 
GeneralRe: Load .srt file into datagrid Pin
ZinusMero15-Jun-14 15:20
ZinusMero15-Jun-14 15:20 
Questioninline conditional asp.net c# Pin
greyhawk11-Jun-14 10:38
greyhawk11-Jun-14 10:38 
AnswerRe: inline conditional asp.net c# Pin
OriginalGriff11-Jun-14 21:37
mveOriginalGriff11-Jun-14 21:37 
AnswerRe: inline conditional asp.net c# Pin
Swinkaran12-Jun-14 15:51
professionalSwinkaran12-Jun-14 15:51 
QuestionObserver pattern for real time scenario Pin
Suraj Rai11-Jun-14 8:52
Suraj Rai11-Jun-14 8:52 
AnswerRe: Observer pattern for real time scenario Pin
Pete O'Hanlon11-Jun-14 10:04
mvePete O'Hanlon11-Jun-14 10:04 
Questionabstract class Pin
Member 1087879011-Jun-14 8:37
Member 1087879011-Jun-14 8:37 
AnswerRe: abstract class Pin
Pete O'Hanlon11-Jun-14 8:55
mvePete O'Hanlon11-Jun-14 8:55 
SuggestionRe: abstract class Pin
Richard Deeming11-Jun-14 9:15
mveRichard Deeming11-Jun-14 9:15 
GeneralRe: abstract class Pin
Pete O'Hanlon11-Jun-14 9:18
mvePete O'Hanlon11-Jun-14 9:18 
AnswerRe: abstract class Pin
PIEBALDconsult11-Jun-14 9:43
mvePIEBALDconsult11-Jun-14 9:43 
QuestionShowing timezone along with time Pin
nitin_ion11-Jun-14 7:59
nitin_ion11-Jun-14 7:59 
AnswerRe: Showing timezone along with time Pin
Pete O'Hanlon11-Jun-14 9:09
mvePete O'Hanlon11-Jun-14 9:09 
QuestionOutput to Promotion LCD from a PC Pin
Jassim Rahma11-Jun-14 4:19
Jassim Rahma11-Jun-14 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.