-
Notifications
You must be signed in to change notification settings - Fork 3
/
CtrlCmdDef.cs
1865 lines (1805 loc) · 61.9 KB
/
CtrlCmdDef.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.IO;
namespace EpgTimer
{
// 【StructDef.hから自動生成→型と変数名を調整】
// sed s/BYTE/byte/g StructDef.h |
// sed s/DWORD/uint/g |
// sed s/WORD/ushort/g |
// sed s/INT/int/g |
// sed s/BOOL/int/g |
// sed s/FALSE/0/g |
// sed s/TRUE/1/g |
// sed 's/L""/""/g' |
// sed s/__int64/long/g |
// sed s/wstring/string/g |
// sed s/SYSTEMTIME/DateTime/g |
// sed s/vector/List/g |
// tr -d '*' |
// sed 's/}.*$/}/' |
// sed 's/^\t\([A-Za-z].*;\)/\tpublic \1/' |
// sed 's#^\(\t[A-Za-z].*;\)\t*//\(.*\)$#\t/// <summary>\2</summary>\n\1#' |
// sed 's/typedef struct _/public class /' |
// sed 's/_\(.*\)(void){$/public \1(){/' |
// sed 's/\t/ /g'
/// <summary>EpgTimerSrv側ではandKeyへの装飾で処理しているので、ここで吸収する</summary>
public class SearchAndKey : ICtrlCmdReadWrite
{
/// <summary>純粋なキー</summary>
public string andKey;
//ほかのフラグに合わせ、byte型にしておく。
/// <summary>大文字小文字を区別する</summary>
public byte caseFlag;
/// <summary>自動登録を無効にする</summary>
public byte keyDisabledFlag;
public SearchAndKey()
{
andKey = "";
caseFlag = 0;
keyDisabledFlag = 0;
}
public void Write(MemoryStream s, ushort version)
{
//andKey装飾のフラグをここで処理
string andKey_Send = (caseFlag == 1 ? "C!{999}" : "") + andKey;
andKey_Send = (keyDisabledFlag == 1 ? "^!{999}" : "") + andKey_Send;
var w = new CtrlCmdWriter(s, version);
w.Write(andKey_Send);
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Read(ref andKey);
//andKey装飾のフラグをここで処理
if (andKey.StartsWith("^!{999}") == true)//"^!{999}"が前
{
keyDisabledFlag = 1;
andKey = andKey.Substring(7);
}
if (andKey.StartsWith("C!{999}") == true)
{
caseFlag = 1;
andKey = andKey.Substring(7);
}
}
}
/// <summary>転送ファイルデータ</summary>
public class FileData : ICtrlCmdReadWrite
{
public string Name = "";
public uint Size = 0;
public uint Status = 0;
public byte[] Data = null;
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref Name);
r.Read(ref Size);
r.Read(ref Status);
Data = null;
if (Size != 0) Data = r.ReadBytes((int)Size);
r.End();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(Name);
w.Write(Size);
w.Write(Status);
if (Size != 0) w.Stream.Write(Data, 0, (int)Size);
w.End();
}
}
/// <summary>録画フォルダ情報</summary>
public class RecFileSetInfo : ICtrlCmdReadWrite
{
/// <summary>録画フォルダ</summary>
public string RecFolder;
/// <summary>出力PlugIn</summary>
public string WritePlugIn;
/// <summary>ファイル名変換PlugInの使用</summary>
public string RecNamePlugIn;
/// <summary>ファイル名個別対応 録画開始処理時に内部で使用。予約情報としては必要なし</summary>
public string RecFileName;
public RecFileSetInfo()
{
RecFolder = "";
WritePlugIn = "";
RecNamePlugIn = "";
RecFileName = "";
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(RecFolder);
w.Write(WritePlugIn);
w.Write(RecNamePlugIn);
w.Write(RecFileName);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref RecFolder);
r.Read(ref WritePlugIn);
r.Read(ref RecNamePlugIn);
r.Read(ref RecFileName);
r.End();
}
}
/// <summary>録画設定情報</summary>
public partial class RecSettingData : ICtrlCmdReadWrite
{
/// <summary>BatFilePathとTagを結合/分離する際のセパレーターキャラクター</summary>
private static readonly char SEPARATOR = '*';
/// <summary>録画モード</summary>
public byte RecMode;
/// <summary>優先度</summary>
public byte Priority;
/// <summary>イベントリレー追従するかどうか</summary>
public byte TuijyuuFlag;
/// <summary>処理対象データモード</summary>
public uint ServiceMode;
/// <summary>ぴったり?録画</summary>
public byte PittariFlag;
/// <summary>録画後BATファイルパス</summary>
public string BatFilePath;
/// <summary>録画タグ</summary>
public string RecTag;
/// <summary>録画フォルダパス</summary>
public List<RecFileSetInfo> RecFolderList;
/// <summary>休止モード</summary>
public byte SuspendMode;
/// <summary>録画後再起動する</summary>
public byte RebootFlag;
/// <summary>録画マージンを個別指定</summary>
public byte UseMargineFlag;
/// <summary>録画開始時のマージン</summary>
public int StartMargine;
/// <summary>録画終了時のマージン</summary>
public int EndMargine;
/// <summary>後続同一サービス時、同一ファイルで録画</summary>
public byte ContinueRecFlag;
/// <summary>物理CHに部分受信サービスがある場合、同時録画するかどうか</summary>
public byte PartialRecFlag;
/// <summary>強制的に使用Tunerを固定</summary>
public uint TunerID;
/// <summary>部分受信サービス録画のフォルダ</summary>
public List<RecFileSetInfo> PartialRecFolder;
public RecSettingData()
{
RecMode = 1;
Priority = 1;
TuijyuuFlag = 1;
ServiceMode = 0;
PittariFlag = 0;
BatFilePath = "";
RecTag = "";
RecFolderList = new List<RecFileSetInfo>();
SuspendMode = 0;
RebootFlag = 0;
UseMargineFlag = 0;
StartMargine = 10;
EndMargine = 5;
ContinueRecFlag = 0;
PartialRecFlag = 0;
TunerID = 0;
PartialRecFolder = new List<RecFileSetInfo>();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(RecMode);
w.Write(Priority);
w.Write(TuijyuuFlag);
w.Write(ServiceMode);
w.Write(PittariFlag);
// versionを上げてbatFilePathとrecTagを別々に書き込んだ方が良いのだけど
// versionを上げたときの影響が把握できなかったためbatFilePathにrecTagを埋め込む
w.Write(GetBatFilePathAndRecTag());
w.Write(RecFolderList);
w.Write(SuspendMode);
w.Write(RebootFlag);
w.Write(UseMargineFlag);
w.Write(StartMargine);
w.Write(EndMargine);
w.Write(ContinueRecFlag);
w.Write(PartialRecFlag);
w.Write(TunerID);
if (version >= 2)
{
w.Write(PartialRecFolder);
}
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref RecMode);
r.Read(ref Priority);
r.Read(ref TuijyuuFlag);
r.Read(ref ServiceMode);
r.Read(ref PittariFlag);
{
// versionを上げてbatFilePathとrecTagを別々に読み込んだ方が良いのだけど
// versionを上げたときの影響が把握できなかったためbatFilePathからrecTagを分離する
string batFilePathAndRecTag = "";
r.Read(ref batFilePathAndRecTag);
SetBatFilePathAndRecTag(batFilePathAndRecTag);
}
r.Read(ref RecFolderList);
r.Read(ref SuspendMode);
r.Read(ref RebootFlag);
r.Read(ref UseMargineFlag);
r.Read(ref StartMargine);
r.Read(ref EndMargine);
r.Read(ref ContinueRecFlag);
r.Read(ref PartialRecFlag);
r.Read(ref TunerID);
if (version >= 2)
{
r.Read(ref PartialRecFolder);
}
r.End();
}
/// <summary>
/// batFilePathとrecTagを合成した文字列を分離してbatFilePathとrecTagに設定する
/// </summary>
/// <param name="val">batFilePathとrecTagを合成したもの</param>
public void SetBatFilePathAndRecTag(string val)
{
int pos = val.IndexOf(SEPARATOR);
if (pos < 0)
{
BatFilePath = val;
RecTag = "";
}
else
{
BatFilePath = val.Substring(0, pos);
RecTag = val.Substring(pos + 1);
}
}
/// <summary>
/// batFilePathとrecTagを合成した文字列を返す
/// </summary>
/// <returns>batFilePathとrecTagを合成した文字列</returns>
public string GetBatFilePathAndRecTag()
{
return (RecTag.Length == 0) ? BatFilePath : BatFilePath + SEPARATOR + RecTag;
}
}
/// <summary>登録予約基本情報</summary>
public class ReserveBasicData : ICtrlCmdReadWrite
{
/// <summary>番組名</summary>
public string Title;
/// <summary>録画開始時間</summary>
public DateTime StartTime;
/// <summary>録画総時間</summary>
public uint DurationSecond;
/// <summary>ONID</summary>
public ushort OriginalNetworkID;
/// <summary>TSID</summary>
public ushort TransportStreamID;
/// <summary>SID</summary>
public ushort ServiceID;
/// <summary>EventID</summary>
public ushort EventID;
/// <summary>予約識別ID 予約登録時は0</summary>
public uint ReserveID;
public ReserveBasicData()
{
Title = "";
StartTime = new DateTime();
DurationSecond = 0;
OriginalNetworkID = 0;
TransportStreamID = 0;
ServiceID = 0;
EventID = 0;
ReserveID = 0;
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(Title);
w.Write(StartTime);
w.Write(DurationSecond);
w.Write(OriginalNetworkID);
w.Write(TransportStreamID);
w.Write(ServiceID);
w.Write(EventID);
w.Write(ReserveID);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref Title);
r.Read(ref StartTime);
r.Read(ref DurationSecond);
r.Read(ref OriginalNetworkID);
r.Read(ref TransportStreamID);
r.Read(ref ServiceID);
r.Read(ref EventID);
r.Read(ref ReserveID);
r.End();
}
}
/// <summary>登録予約情報</summary>
public partial class ReserveData : ICtrlCmdReadWrite
{
/// <summary>番組名</summary>
public string Title;
/// <summary>録画開始時間</summary>
public DateTime StartTime;
/// <summary>録画総時間</summary>
public uint DurationSecond;
/// <summary>サービス名</summary>
public string StationName;
/// <summary>ONID</summary>
public ushort OriginalNetworkID;
/// <summary>TSID</summary>
public ushort TransportStreamID;
/// <summary>SID</summary>
public ushort ServiceID;
/// <summary>EventID</summary>
public ushort EventID;
/// <summary>コメント</summary>
public string Comment;
/// <summary>予約識別ID 予約登録時は0</summary>
public uint ReserveID;
/// <summary>予約待機入った? 内部で使用(廃止)</summary>
private byte UnusedRecWaitFlag;
/// <summary>かぶり状態 1:かぶってチューナー足りない予約あり 2:チューナー足りなくて予約できない</summary>
public byte OverlapMode;
/// <summary>録画ファイルパス 旧バージョン互換用 未使用(廃止)</summary>
private string UnusedRecFilePath;
/// <summary>予約時の開始時間</summary>
public DateTime StartTimeEpg;
/// <summary>録画設定</summary>
public RecSettingData RecSetting;
/// <summary>予約追加状態 内部で使用</summary>
public uint ReserveStatus;
/// <summary>録画予定ファイル名</summary>
public List<string> RecFileNameList;
/// <summary>将来用</summary>
private uint UnusedParam1;
/// <summary>該当自動予約登録</summary>
public List<EpgAutoAddBasicInfo> AutoAddInfo;
public ReserveData()
{
Title = "";
StartTime = new DateTime();
DurationSecond = 0;
StationName = "";
OriginalNetworkID = 0;
TransportStreamID = 0;
ServiceID = 0;
EventID = 0;
Comment = "";
ReserveID = 0;
UnusedRecWaitFlag = 0;
OverlapMode = 0;
UnusedRecFilePath = "";
StartTimeEpg = new DateTime();
RecSetting = new RecSettingData();
ReserveStatus = 0;
RecFileNameList = new List<string>();
UnusedParam1 = 0;
AutoAddInfo = new List<EpgAutoAddBasicInfo>();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(Title);
w.Write(StartTime);
w.Write(DurationSecond);
w.Write(StationName);
w.Write(OriginalNetworkID);
w.Write(TransportStreamID);
w.Write(ServiceID);
w.Write(EventID);
w.Write(Comment);
w.Write(ReserveID);
w.Write(UnusedRecWaitFlag);
w.Write(OverlapMode);
w.Write(UnusedRecFilePath);
w.Write(StartTimeEpg);
w.Write(RecSetting);
w.Write(ReserveStatus);
if (version >= 5)
{
w.Write(RecFileNameList);
w.Write(UnusedParam1);
}
if (version >= 6)
{
w.Write(AutoAddInfo);
}
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref Title);
r.Read(ref StartTime);
r.Read(ref DurationSecond);
r.Read(ref StationName);
r.Read(ref OriginalNetworkID);
r.Read(ref TransportStreamID);
r.Read(ref ServiceID);
r.Read(ref EventID);
r.Read(ref Comment);
r.Read(ref ReserveID);
r.Read(ref UnusedRecWaitFlag);
r.Read(ref OverlapMode);
r.Read(ref UnusedRecFilePath);
r.Read(ref StartTimeEpg);
r.Read(ref RecSetting);
r.Read(ref ReserveStatus);
if (version >= 5)
{
r.Read(ref RecFileNameList);
r.Read(ref UnusedParam1);
}
if (version >= 6 && r.RemainSize() > 0)
{
r.Read(ref AutoAddInfo);
}
r.End();
}
}
public class EpgAutoAddBasicInfo : ICtrlCmdReadWrite
{
/// <summary>dataID</summary>
public uint dataID;
private SearchAndKey andKey_;
/// <summary>検索キー</summary>
public string andKey
{
get { return andKey_.andKey; }
set { andKey_.andKey = value; }
}
/// <summary>大文字小文字を区別する</summary>
public byte caseFlag
{
get { return andKey_.caseFlag; }
set { andKey_.caseFlag = value; }
}
/// <summary>自動登録を無効にする</summary>
public byte keyDisabledFlag
{
get { return andKey_.keyDisabledFlag; }
set { andKey_.keyDisabledFlag = value; }
}
public EpgAutoAddBasicInfo()
{
dataID = 0;
andKey_ = new SearchAndKey();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(dataID);
w.Write(andKey_);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref dataID);
r.Read(ref andKey_);
r.End();
}
}
public class RecFileBasicInfo : ICtrlCmdReadWrite
{
/// <summary>ID</summary>
public uint ID;
/// <summary>録画ファイルパス</summary>
public string RecFilePath;
/// <summary>番組名</summary>
public string Title;
/// <summary>開始時間</summary>
public DateTime StartTime;
/// <summary>録画時間</summary>
public uint DurationSecond;
public RecFileBasicInfo()
{
ID = 0;
RecFilePath = "";
Title = "";
StartTime = new DateTime();
DurationSecond = 0;
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(ID);
w.Write(RecFilePath);
w.Write(Title);
w.Write(StartTime);
w.Write(DurationSecond);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref ID);
r.Read(ref RecFilePath);
r.Read(ref Title);
r.Read(ref StartTime);
r.Read(ref DurationSecond);
r.End();
}
}
public partial class RecFileInfo : ICtrlCmdReadWrite
{
/// <summary>ID</summary>
public uint ID;
/// <summary>録画ファイルパス</summary>
public string RecFilePath;
/// <summary>番組名</summary>
public string Title;
/// <summary>開始時間</summary>
public DateTime StartTime;
/// <summary>録画時間</summary>
public uint DurationSecond;
/// <summary>サービス名</summary>
public string ServiceName;
/// <summary>ONID</summary>
public ushort OriginalNetworkID;
/// <summary>TSID</summary>
public ushort TransportStreamID;
/// <summary>SID</summary>
public ushort ServiceID;
/// <summary>EventID</summary>
public ushort EventID;
/// <summary>ドロップ数</summary>
public long Drops;
/// <summary>スクランブル数</summary>
public long Scrambles;
/// <summary>録画結果のステータス</summary>
public uint RecStatus;
/// <summary>予約時の開始時間</summary>
public DateTime StartTimeEpg;
/// <summary>コメント</summary>
public string Comment;
/// <summary>.program.txtファイルの内容</summary>
public string _ProgramInfo;
/// <summary>.errファイルの内容</summary>
public string _ErrInfo;
public byte ProtectFlag;
public byte FileExist;
public byte AutoAddInfoFlag;
public List<EpgAutoAddBasicInfo> AutoAddInfo;
public RecFileInfo()
{
ID = 0;
RecFilePath = "";
Title = "";
StartTime = new DateTime();
DurationSecond = 0;
ServiceName = "";
OriginalNetworkID = 0;
TransportStreamID = 0;
ServiceID = 0;
EventID = 0;
Drops = 0;
Scrambles = 0;
RecStatus = 0;
StartTimeEpg = new DateTime();
Comment = "";
_ProgramInfo = "";
_ErrInfo = "";
ProtectFlag = 0;
FileExist = 0;
AutoAddInfoFlag = 0;
AutoAddInfo = new List<EpgAutoAddBasicInfo>();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(ID);
w.Write(RecFilePath);
w.Write(Title);
w.Write(StartTime);
w.Write(DurationSecond);
w.Write(ServiceName);
w.Write(OriginalNetworkID);
w.Write(TransportStreamID);
w.Write(ServiceID);
w.Write(EventID);
w.Write(Drops);
w.Write(Scrambles);
w.Write(RecStatus);
w.Write(StartTimeEpg);
w.Write(Comment);
w.Write(_ProgramInfo);
w.Write(_ErrInfo);
if (version >= 4)
{
w.Write(ProtectFlag);
}
if (version >= 6)
{
w.Write(FileExist);
w.Write(AutoAddInfoFlag);
w.Write(AutoAddInfo);
}
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref ID);
r.Read(ref RecFilePath);
r.Read(ref Title);
r.Read(ref StartTime);
r.Read(ref DurationSecond);
r.Read(ref ServiceName);
r.Read(ref OriginalNetworkID);
r.Read(ref TransportStreamID);
r.Read(ref ServiceID);
r.Read(ref EventID);
r.Read(ref Drops);
r.Read(ref Scrambles);
r.Read(ref RecStatus);
r.Read(ref StartTimeEpg);
r.Read(ref Comment);
r.Read(ref _ProgramInfo);
r.Read(ref _ErrInfo);
if (version >= 4)
{
r.Read(ref ProtectFlag);
}
if (version >= 6 && r.RemainSize() > 2)
{
r.Read(ref FileExist);
r.Read(ref AutoAddInfoFlag);
r.Read(ref AutoAddInfo);
}
r.End();
}
}
public class RecFolderInfo : ICtrlCmdReadWrite
{
public string recFolder;
public UInt64 freeBytes;
public UInt64 totalBytes;
public RecFolderInfo()
{
recFolder = "";
freeBytes = 0;
totalBytes = 0;
}
public RecFolderInfo(string path)
{
recFolder = path;
freeBytes = 0;
totalBytes = 0;
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref recFolder);
r.Read(ref freeBytes);
r.Read(ref totalBytes);
r.End();
}
public void Write(MemoryStream s, ushort version)
{
throw new NotImplementedException();
}
}
public class TunerReserveInfo : ICtrlCmdReadWrite
{
public uint tunerID;
public string tunerName;
public List<uint> reserveList;
public TunerReserveInfo()
{
tunerID = 0;
tunerName = "";
reserveList = new List<uint>();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(tunerID);
w.Write(tunerName);
w.Write(reserveList);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref tunerID);
r.Read(ref tunerName);
r.Read(ref reserveList);
r.End();
}
}
/// <summary>EPG基本情報</summary>
public class EpgShortEventInfo : ICtrlCmdReadWrite
{
/// <summary>イベント名</summary>
public string event_name;
/// <summary>情報</summary>
public string text_char;
public EpgShortEventInfo()
{
event_name = "";
text_char = "";
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(event_name);
w.Write(text_char);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref event_name);
r.Read(ref text_char);
r.End();
}
}
/// <summary>EPG拡張情報</summary>
public class EpgExtendedEventInfo : ICtrlCmdReadWrite
{
/// <summary>詳細情報</summary>
public string text_char;
public EpgExtendedEventInfo()
{
text_char = "";
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(text_char);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref text_char);
r.End();
}
}
/// <summary>EPGジャンルデータ</summary>
public class EpgContentData : ICtrlCmdReadWrite
{
public byte content_nibble_level_1;
public byte content_nibble_level_2;
public byte user_nibble_1;
public byte user_nibble_2;
public EpgContentData()
{
content_nibble_level_1 = 0;
content_nibble_level_2 = 0;
user_nibble_1 = 0;
user_nibble_2 = 0;
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(content_nibble_level_1);
w.Write(content_nibble_level_2);
w.Write(user_nibble_1);
w.Write(user_nibble_2);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref content_nibble_level_1);
r.Read(ref content_nibble_level_2);
r.Read(ref user_nibble_1);
r.Read(ref user_nibble_2);
r.End();
}
}
/// <summary>EPGジャンル情報</summary>
public class EpgContentInfo : ICtrlCmdReadWrite
{
public List<EpgContentData> nibbleList;
public EpgContentInfo()
{
nibbleList = new List<EpgContentData>();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(nibbleList);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref nibbleList);
r.End();
}
}
/// <summary>EPG映像情報</summary>
public class EpgComponentInfo : ICtrlCmdReadWrite
{
public byte stream_content;
public byte component_type;
public byte component_tag;
/// <summary>情報</summary>
public string text_char;
public EpgComponentInfo()
{
stream_content = 0;
component_type = 0;
component_tag = 0;
text_char = "";
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(stream_content);
w.Write(component_type);
w.Write(component_tag);
w.Write(text_char);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref stream_content);
r.Read(ref component_type);
r.Read(ref component_tag);
r.Read(ref text_char);
r.End();
}
}
/// <summary>EPG音声情報データ</summary>
public class EpgAudioComponentInfoData : ICtrlCmdReadWrite
{
public byte stream_content;
public byte component_type;
public byte component_tag;
public byte stream_type;
public byte simulcast_group_tag;
public byte ES_multi_lingual_flag;
public byte main_component_flag;
public byte quality_indicator;
public byte sampling_rate;
/// <summary>詳細情報</summary>
public string text_char;
public EpgAudioComponentInfoData()
{
stream_content = 0;
component_type = 0;
component_tag = 0;
stream_type = 0;
simulcast_group_tag = 0;
ES_multi_lingual_flag = 0;
main_component_flag = 0;
quality_indicator = 0;
sampling_rate = 0;
text_char = "";
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(stream_content);
w.Write(component_type);
w.Write(component_tag);
w.Write(stream_type);
w.Write(simulcast_group_tag);
w.Write(ES_multi_lingual_flag);
w.Write(main_component_flag);
w.Write(quality_indicator);
w.Write(sampling_rate);
w.Write(text_char);
w.End();
}
public void Read(MemoryStream s, ushort version)
{
var r = new CtrlCmdReader(s, version);
r.Begin();
r.Read(ref stream_content);
r.Read(ref component_type);
r.Read(ref component_tag);
r.Read(ref stream_type);
r.Read(ref simulcast_group_tag);
r.Read(ref ES_multi_lingual_flag);
r.Read(ref main_component_flag);
r.Read(ref quality_indicator);
r.Read(ref sampling_rate);
r.Read(ref text_char);
r.End();
}
}
/// <summary>EPG音声情報</summary>
public class EpgAudioComponentInfo : ICtrlCmdReadWrite
{
public List<EpgAudioComponentInfoData> componentList;
public EpgAudioComponentInfo()
{
componentList = new List<EpgAudioComponentInfoData>();
}
public void Write(MemoryStream s, ushort version)
{
var w = new CtrlCmdWriter(s, version);
w.Begin();
w.Write(componentList);
w.End();
}