特定のパラメーターの調整を容易にするために、シミュレーションプログラムの保存ファイルを編集するWPFプログラムを作成しています。その(txt)ファイルの構造は次のようになります
{Verdieping 1}
A bunch of data
'Max'
15
20
10
]);
More data
{Verdieping 2}
A bunch of data
'Max'
25
10
40
20
]);
More data
{Verdieping 3}
etc.
必要なリストの名前は常に「Max」Replace("Old_Value", "New_Value");
なので使用できません。ヘッダー{Verdieping1}を見つけて、「Max」を探し、「]);」に達するまで値を書き留める必要があります。終了します。このようなものでアップ:
Verdieping_1[0] = 15
Verdieping_1[1] = 20
Verdieping_1[0] = 10
Verdieping_2[0] = 25
Verdieping_2[1] = 10
Verdieping_2[2] = 40
Verdieping_2[3] = 20
次に、これらの値を変更するときに、ファイルの正しい場所に書き戻す必要があります。現在、新しいファイルの読み取りと最終的な書き込みを行うために、このコードを使用しています。
var Model = System.IO.File.ReadAllText(@"C:\Base_Model.txt");
//format code here...
System.IO.File.WriteAllText(@"C:\New_Model.txt", Model);
誰かが私にこれを最もよく解決する方法についていくつかのヒントや助けを与えることができますか?
編集 これは私が編集したいファイルの実際のファイル構造です:
{Atom: Verdieping 2}
int015(0, 64, [
1
2
3
]);
int015(1, 64, [`ActivityID`
20
21
33
]);
int015(2, 64, [`vtp`
139830296
189540320
169919424
]);
int015(3, 64, [`%`
100
100
100
]);
int015(4, 64, [`Max`
15
5
20
]);
int015(5, 64, [`Fill (1 = fill, 0 = empty)`
1
1
0
]);
SetStatus(0);
int018;
{Atom: Verdieping 2}
int015(0, 64, [
1
2
3
]);
int015(1, 64, [`ActivityID`
22
23
24
]);
int015(2, 64, [`vtp`
166058172
165557860
155960564
]);
int015(3, 64, [`%`
100
100
100
]);
int015(4, 64, [`Max`
15
20
10
]);
int015(5, 64, [`Fill (1 = fill, 0 = empty)`
0
1
1
]);
SetStatus(0);
int018;
私が以前に話していた「マックス」は実際には次のように呼ばれます:int015(4、64、[Max
また、名前がレイヤー外で同じであることがわかるように、変数の量は異なります。
これまでの助けに感謝します!