بســم الله الـرحمــن الرحيــم
السلام عليكــم ورحمـة الله وبركاتــه ،،
كيف حالك إن شاء الله دائمــاً بخير ؟
أولاً احب اباركم بقدوم الشهر الفضيل
أعاده الله علينا وعليكم
:)
في الحقيقة يا اخواني الاعزاء
صادفتني مشكلة في التعامل مع ملفات نصية من فئة
ass
لقد تعاملت مع الكثير من الملفات النصية لكن لم اجد ملفاً صعب التعامل معه كهذا
:S
الرجاء المساعدة
هذا هو محتوى الملف
اقتباس[script Info]Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
PlayResX: 640
PlayResY: 480
ScaledBorderAndShadow: yes
Last Style Storage: Default
Audio File: ?video
Video File: D:\Naruto\Naruto 1.avi
Video Aspect Ratio: 0
Video Zoom: 8
Video Position: 125
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: kookoo,Arial,40,&H00FFFFFF,&H006FEED8,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,kookoo,,0000,0000,0000,,{\K286}koo {\K214}koo
Dialogue: 0,0:00:00.00,0:00:05.00,kookoo,,0000,0000,0000,,{\K286}koo {\K214}koo
اريد تغير الاشياء الموجودة بين القوسين }{
وهذا الملف بسيط جداً... فماذا لو كان لدي آلاف الاقواس غير هذه
حاولت استخدام string.format();
لكنها لم تنجح
وهذا هو الكود الذي اقرأ منه الملف واكتب
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace _filestream
{
class Program
{
static void Main(string[] args)
{
FileStream f = null;
string fn = "C://test.ass";
try
{
f = new FileStream(fn, FileMode.Open, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(f);
StreamReader sr = new StreamReader(f);
string sr1 = sr.ReadToEnd();
Console.WriteLine(sr1);
Console.ReadLine();
sw.Close();
sr.Close();
f.Close();
}
catch (IOException ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
if (f != null)
{
f.Close();
}
}
}
}
}
الرجاء المساعدة