Skip to content

Instantly share code, notes, and snippets.

@rasoulian
Created January 29, 2016 15:41
Show Gist options
  • Save rasoulian/5f9ba199863433fa1f65 to your computer and use it in GitHub Desktop.
Save rasoulian/5f9ba199863433fa1f65 to your computer and use it in GitHub Desktop.
class SubtitleTools{
string _filePath = string.Empty;
public PersianSubtitle(string filePath){
if (Path.GetExtension(filePath) != ".srt"){
Console.WriteLine("Unknown file type!");
}
}
public void ToPersian(){
var reader = new StreamReader(_filePath, Encoding.GetEncoding("Windows-1256"));
string str2 = reader.ReadToEnd();
reader.Close();
var writer = new StreamWriter(path.Substring(0, _filePath.Length - 4) + ".edited.srt", false, Encoding.UTF8);
writer.Write(str2);
writer.Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment