Unified · Split
| @@ -696,7 +696,7 @@ namespace NAudioWpfDemo · 695 unmodified lines | ||
| 696 | 696 | |
| 697 | 697 | // Assuming 16-bit integer samples for WAV files |
| 698 | 698 | if (sample[i] != null) |
| 699 | − channelValue = EndianOrder.LittleEndian.GetBytes((short)sample[i].Value); | |
| 699 | + channelValue = LittleEndian.GetBytes((short)sample[i].Value); | |
| 700 | 700 | else |
| 701 | 701 | channelValue = new byte[2]; |
| 702 | 702 | |
| @@ -737,7 +737,7 @@ namespace NAudioWpfDemo · 34 unmodified lines | ||
| 737 | 737 | } |
| 738 | 738 | finally |
| 739 | 739 | { |
| 740 | − if (buffer != null) | |
| 740 | + if ((object)buffer != null) | |
| 741 | 741 | BufferPool.ReturnBuffer(buffer); |
| 742 | 742 | } |
| 743 | 743 | } |
| @@ -259,6 +259,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Database", "Database", "{06 · 258 unmodified lines | ||
| 259 | 259 | EndProject |
| 260 | 260 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "File", "File", "{198CE128-2E28-4591-91C1-C83176C3BE51}" |
| 261 | 261 | EndProject |
| 262 | +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Structured Data Encoding", "Structured Data Encoding", "{E4120DD8-64F7-4D60-8B41-F2FDC27CC708}" | |
| 263 | +EndProject | |
| 262 | 264 | Global |
| 263 | 265 | GlobalSection(TeamFoundationVersionControl) = preSolution |
| 264 | 266 | SccNumberOfProjects = 81 |
| @@ -1451,6 +1453,7 @@ Global · 1186 unmodified lines | ||
| 1451 | 1453 | {00B924AB-0DC8-4826-8A63-3263E39C2EBF} = {13006BBE-434A-4027-940B-EAD752844137} |
| 1452 | 1454 | {6DCB8ABF-D899-41A9-BBCD-556590754175} = {13006BBE-434A-4027-940B-EAD752844137} |
| 1453 | 1455 | {D429E017-FC8B-4077-8CEB-CCA277008091} = {13006BBE-434A-4027-940B-EAD752844137} |
| 1456 | + {B3986636-8741-4D97-AE46-2A5BA1338B41} = {D7805B20-D771-4546-90DD-CD98C4BA4436} | |
| 1454 | 1457 | {FF3FCBA6-F01A-4EC2-BC3F-6BA832AFCF88} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1455 | 1458 | {2B2EB9BE-E6A9-406F-BFE6-FF46DD6BD264} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1456 | 1459 | {4060E729-EFFD-4E50-A0D5-99C0990EF7DA} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| @@ -1459,15 +1462,30 @@ Global · 2 unmodified lines | ||
| 1459 | 1462 | {2E23E926-CF64-4607-BDE1-1B2FC76F4919} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1460 | 1463 | {0501C2DC-3428-4413-AE92-F0D82FF3DBBC} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1461 | 1464 | {EA70C8AA-60DE-4FFD-B1D9-B5406395B1AF} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1465 | + {99F344EA-D35D-42C8-882B-B495527B5F40} = {D7805B20-D771-4546-90DD-CD98C4BA4436} | |
| 1462 | 1466 | {0F8E8EFC-E7C7-4843-8EE6-8C7C7353892A} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1463 | 1467 | {72713097-3BE3-4FA7-97B5-7EC3A2BA8316} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1464 | − {DE23EEF6-EE66-42DE-81B0-890B3A77B83C} = {D7805B20-D771-4546-90DD-CD98C4BA4436} | |
| 1465 | 1468 | {78C67B09-D6EB-4A79-A591-47146025A277} = {D7805B20-D771-4546-90DD-CD98C4BA4436} |
| 1466 | − {99F344EA-D35D-42C8-882B-B495527B5F40} = {D7805B20-D771-4546-90DD-CD98C4BA4436} | |
| 1467 | − {B3986636-8741-4D97-AE46-2A5BA1338B41} = {D7805B20-D771-4546-90DD-CD98C4BA4436} | |
| 1468 | − {6BFB4BFD-6906-4E92-8078-3AB5641AAFAB} = {1C4124EF-0F9C-47B9-B1CB-B2CA39AB0E57} | |
| 1469 | + {DE23EEF6-EE66-42DE-81B0-890B3A77B83C} = {D7805B20-D771-4546-90DD-CD98C4BA4436} | |
| 1470 | + {1B63485E-46C7-4185-B968-216A02396B88} = {0C19430B-01AC-4184-ACDA-6DE690649CD8} | |
| 1471 | + {7C825A52-3ADB-40BD-8D49-1519A4D534A1} = {0C19430B-01AC-4184-ACDA-6DE690649CD8} | |
| 1472 | + {B48642A1-1163-4E1D-948A-50EE19DCD38D} = {0C19430B-01AC-4184-ACDA-6DE690649CD8} | |
| 1473 | + {B15B1BEF-7631-43C0-B048-AD51692FD0C7} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1474 | + {129F9272-157F-4A37-B0A4-0F9E5E4A0FE6} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1475 | + {933BE44C-B124-4ACC-8BE8-A6A22AAC4413} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1476 | + {07016E6A-01B1-4B3D-B1D6-F9131A1BEB6E} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1477 | + {2E9DA7CC-960A-40A6-BC90-1FBD7B7994F0} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1478 | + {E349DD08-3707-4542-8ED3-BB9E106FE6FB} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1479 | + {7D81CF8E-6F49-4AF8-B039-9C3210140194} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1480 | + {1B3CA936-9D8A-4B40-8B08-E98AA2375E69} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1481 | + {252A5667-C00C-4427-A5E8-2EB4886877C4} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1482 | + {3029C3DC-E302-46E5-8126-8082B6EC1C1A} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1483 | + {35027A69-1A76-4312-B57B-F5826F0B87AF} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1484 | + {1C4124EF-0F9C-47B9-B1CB-B2CA39AB0E57} = {B15B1BEF-7631-43C0-B048-AD51692FD0C7} | |
| 1485 | + {C00E78E4-081D-409A-ABB2-EA9FC50EE51E} = {B15B1BEF-7631-43C0-B048-AD51692FD0C7} | |
| 1469 | 1486 | {216C7D13-CB2B-4E98-87D5-D8CA53FE97F7} = {1C4124EF-0F9C-47B9-B1CB-B2CA39AB0E57} |
| 1470 | 1487 | {D04BF4AB-96CB-4671-B1D3-41700F554C78} = {1C4124EF-0F9C-47B9-B1CB-B2CA39AB0E57} |
| 1488 | + {6BFB4BFD-6906-4E92-8078-3AB5641AAFAB} = {1C4124EF-0F9C-47B9-B1CB-B2CA39AB0E57} | |
| 1471 | 1489 | {10184FDE-42E4-4BC5-ADDC-F211D25FD94C} = {F06A2E20-D5DD-4B88-9ABC-CEE7245829E3} |
| 1472 | 1490 | {044C17D3-DEC9-4A57-9B4F-3664393C888E} = {F06A2E20-D5DD-4B88-9ABC-CEE7245829E3} |
| 1473 | 1491 | {CC2B0A07-3D70-4261-A96E-D5A747A7B74F} = {F06A2E20-D5DD-4B88-9ABC-CEE7245829E3} |
| @@ -1479,77 +1497,62 @@ Global · 5 unmodified lines | ||
| 1479 | 1497 | {D405B0BE-88EE-4224-AA8C-4A6817481C17} = {F06A2E20-D5DD-4B88-9ABC-CEE7245829E3} |
| 1480 | 1498 | {4093E2B8-2948-468F-94B2-B2EF815E1A1B} = {C00E78E4-081D-409A-ABB2-EA9FC50EE51E} |
| 1481 | 1499 | {9512CFD3-76D7-4C42-8DB6-B848600303C3} = {C00E78E4-081D-409A-ABB2-EA9FC50EE51E} |
| 1500 | + {2E8D7CE0-8816-4893-848B-05E2A38FE898} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1501 | + {412F9F59-D9B9-4C8E-96D2-20492644198C} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1502 | + {F3B5720A-27E0-46C7-A9E1-A91B9D18F59A} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1503 | + {2A542BE8-8D17-44C3-BCD2-768DF480FF82} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1482 | 1504 | {BB0CAA29-229E-4648-80A0-1474B3A0FACF} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} |
| 1505 | + {198CE128-2E28-4591-91C1-C83176C3BE51} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1506 | + {51797AFD-D313-4E14-A3E9-531F28C698C2} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1483 | 1507 | {A04A48C2-112D-4EE3-A6B0-3784A1315BCF} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} |
| 1484 | 1508 | {374F5805-28DB-4BCA-8062-BF802793BD4F} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} |
| 1509 | + {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1485 | 1510 | {69846364-E3F5-4086-B9FE-D447BB7E56C3} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} |
| 1486 | − {51797AFD-D313-4E14-A3E9-531F28C698C2} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1487 | − {CD3C7F74-B7F2-422F-8417-1E9045155352} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1488 | 1511 | {917EA50B-D09B-4B96-B8DD-5D91C7DFBF38} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} |
| 1489 | − {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1490 | − {198CE128-2E28-4591-91C1-C83176C3BE51} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1491 | − {7C825A52-3ADB-40BD-8D49-1519A4D534A1} = {0C19430B-01AC-4184-ACDA-6DE690649CD8} | |
| 1492 | − {1B63485E-46C7-4185-B968-216A02396B88} = {0C19430B-01AC-4184-ACDA-6DE690649CD8} | |
| 1493 | − {B48642A1-1163-4E1D-948A-50EE19DCD38D} = {0C19430B-01AC-4184-ACDA-6DE690649CD8} | |
| 1512 | + {CD3C7F74-B7F2-422F-8417-1E9045155352} = {2E8D7CE0-8816-4893-848B-05E2A38FE898} | |
| 1513 | + {40FACE0F-06DF-474C-A87C-59C8EAC0B3F8} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1514 | + {08F5CCE4-10C4-477C-B5C9-37F7D49748BC} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1515 | + {43A322EE-37D2-4B13-BA16-023E88772F8D} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1516 | + {7B0EEB2B-6F25-4D59-A15D-F39EA9DC94D3} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1517 | + {A8861372-0FE2-45E5-9DED-73B55AC4196C} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1518 | + {AF33B063-D523-493E-951A-29C930A49002} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1519 | + {5E1CD41C-6CB0-45D1-AA73-191A36028CE7} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1520 | + {B74CF4DA-2972-489B-AF08-419560EE57EF} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1521 | + {C4F3C41D-D76A-4283-8732-681B67B7AD74} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1522 | + {AD054F7A-C944-4BA3-8CD8-CA275184BD33} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1523 | + {1FEC4033-C80F-4CF1-835C-BBEE0E7F6803} = {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} | |
| 1524 | + {C4145EB5-FEF9-4419-AC5E-31D4F23AD311} = {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} | |
| 1525 | + {383F4F83-8228-4B9A-9757-250043B6E30B} = {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} | |
| 1526 | + {26F261F8-8660-46D3-8090-BCDA9EFF5427} = {917EA50B-D09B-4B96-B8DD-5D91C7DFBF38} | |
| 1527 | + {3F0B62F6-99B8-4F57-8C58-0B4B862358EA} = {917EA50B-D09B-4B96-B8DD-5D91C7DFBF38} | |
| 1494 | 1528 | {5E75D20E-228E-4ACC-B73D-E9471D9E0852} = {7C825A52-3ADB-40BD-8D49-1519A4D534A1} |
| 1495 | 1529 | {D78C3B1B-F673-45EB-86CB-93DCB4572905} = {7C825A52-3ADB-40BD-8D49-1519A4D534A1} |
| 1496 | − {7E1ABF87-8936-44E5-85C0-37044E0D3877} = {F3B5720A-27E0-46C7-A9E1-A91B9D18F59A} | |
| 1497 | − {B561487F-79CC-4982-848E-C12F44B4669C} = {F3B5720A-27E0-46C7-A9E1-A91B9D18F59A} | |
| 1498 | − {F68BED5B-410C-4D02-87C0-8AC74E374821} = {78C67B09-D6EB-4A79-A591-47146025A277} | |
| 1499 | − {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} = {78C67B09-D6EB-4A79-A591-47146025A277} | |
| 1500 | − {9B93C212-786C-45C9-9B90-8CEFD24EF19D} = {F68BED5B-410C-4D02-87C0-8AC74E374821} | |
| 1501 | − {B4B5A12E-412E-4382-B991-3B67653F533C} = {F68BED5B-410C-4D02-87C0-8AC74E374821} | |
| 1502 | − {2C42B95F-A58A-413D-97E2-1968C087C472} = {F68BED5B-410C-4D02-87C0-8AC74E374821} | |
| 1503 | − {B3FBA8D6-7C89-4FE9-8E90-F617604A7C3C} = {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} | |
| 1504 | − {74B3264B-4740-4C2F-9DCB-373FDCD3A848} = {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} | |
| 1505 | − {54CA98CC-2F0A-41F2-879D-0E42B17E8544} = {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} | |
| 1506 | − {4F46CF24-163D-4541-9EBF-C291053C0948} = {99F344EA-D35D-42C8-882B-B495527B5F40} | |
| 1530 | + {DEAE7327-1628-4D6D-B682-257335B86B22} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1531 | + {FC5B2769-89FD-420B-9722-D6E0B029ABDD} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1532 | + {DCFB7880-2C6B-41D0-B603-661BCE089DD7} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1533 | + {C6631FD6-24F9-402D-BFE3-FEB3F780BA6A} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1534 | + {4508009C-7011-4981-B35F-594F42CC0D1F} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1507 | 1535 | {AEB62271-270D-4F3E-B596-2297B382A95F} = {99F344EA-D35D-42C8-882B-B495527B5F40} |
| 1508 | − {A818C4B5-52B5-4E12-917E-4854C9AB4EF3} = {4F46CF24-163D-4541-9EBF-C291053C0948} | |
| 1509 | − {57261E91-7636-4F92-8D93-744A4AAD7EB0} = {4F46CF24-163D-4541-9EBF-C291053C0948} | |
| 1536 | + {4F46CF24-163D-4541-9EBF-C291053C0948} = {99F344EA-D35D-42C8-882B-B495527B5F40} | |
| 1510 | 1537 | {94F36768-E9A0-4783-BB0F-8C2C1771352E} = {AEB62271-270D-4F3E-B596-2297B382A95F} |
| 1511 | 1538 | {134819C5-C1BB-4ED1-BE23-49AB5FB33744} = {AEB62271-270D-4F3E-B596-2297B382A95F} |
| 1512 | 1539 | {7ED01B57-DD71-4A38-BB29-65D629224A12} = {AEB62271-270D-4F3E-B596-2297B382A95F} |
| 1513 | 1540 | {5AF0D55A-30BF-46A5-8A47-FA885F56BFEF} = {AEB62271-270D-4F3E-B596-2297B382A95F} |
| 1514 | − {35027A69-1A76-4312-B57B-F5826F0B87AF} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1515 | − {129F9272-157F-4A37-B0A4-0F9E5E4A0FE6} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1516 | − {E349DD08-3707-4542-8ED3-BB9E106FE6FB} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1517 | − {933BE44C-B124-4ACC-8BE8-A6A22AAC4413} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1518 | − {3029C3DC-E302-46E5-8126-8082B6EC1C1A} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1519 | − {07016E6A-01B1-4B3D-B1D6-F9131A1BEB6E} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1520 | − {2E9DA7CC-960A-40A6-BC90-1FBD7B7994F0} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1521 | − {1B3CA936-9D8A-4B40-8B08-E98AA2375E69} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1522 | − {252A5667-C00C-4427-A5E8-2EB4886877C4} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1523 | − {7D81CF8E-6F49-4AF8-B039-9C3210140194} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1524 | − {B15B1BEF-7631-43C0-B048-AD51692FD0C7} = {1B63485E-46C7-4185-B968-216A02396B88} | |
| 1525 | − {DCFB7880-2C6B-41D0-B603-661BCE089DD7} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1526 | − {4508009C-7011-4981-B35F-594F42CC0D1F} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1527 | − {DEAE7327-1628-4D6D-B682-257335B86B22} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1528 | − {C6631FD6-24F9-402D-BFE3-FEB3F780BA6A} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1529 | − {FC5B2769-89FD-420B-9722-D6E0B029ABDD} = {B48642A1-1163-4E1D-948A-50EE19DCD38D} | |
| 1530 | − {C00E78E4-081D-409A-ABB2-EA9FC50EE51E} = {B15B1BEF-7631-43C0-B048-AD51692FD0C7} | |
| 1531 | − {1C4124EF-0F9C-47B9-B1CB-B2CA39AB0E57} = {B15B1BEF-7631-43C0-B048-AD51692FD0C7} | |
| 1532 | − {412F9F59-D9B9-4C8E-96D2-20492644198C} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1533 | − {F3B5720A-27E0-46C7-A9E1-A91B9D18F59A} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1534 | − {2E8D7CE0-8816-4893-848B-05E2A38FE898} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1535 | − {2A542BE8-8D17-44C3-BCD2-768DF480FF82} = {B3986636-8741-4D97-AE46-2A5BA1338B41} | |
| 1536 | − {C4F3C41D-D76A-4283-8732-681B67B7AD74} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1537 | − {B74CF4DA-2972-489B-AF08-419560EE57EF} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1538 | − {AF33B063-D523-493E-951A-29C930A49002} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1539 | − {5E1CD41C-6CB0-45D1-AA73-191A36028CE7} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1540 | − {AD054F7A-C944-4BA3-8CD8-CA275184BD33} = {51797AFD-D313-4E14-A3E9-531F28C698C2} | |
| 1541 | + {B561487F-79CC-4982-848E-C12F44B4669C} = {F3B5720A-27E0-46C7-A9E1-A91B9D18F59A} | |
| 1542 | + {7E1ABF87-8936-44E5-85C0-37044E0D3877} = {F3B5720A-27E0-46C7-A9E1-A91B9D18F59A} | |
| 1541 | 1543 | {8A1BCFAA-19E8-408A-8C72-170B1211DC27} = {CD3C7F74-B7F2-422F-8417-1E9045155352} |
| 1542 | 1544 | {8BDA86DB-B944-4880-9D97-E4FF04577C03} = {CD3C7F74-B7F2-422F-8417-1E9045155352} |
| 1543 | 1545 | {3FD4D092-3E0F-41C1-BE8A-E0A924E76039} = {CD3C7F74-B7F2-422F-8417-1E9045155352} |
| 1544 | − {26F261F8-8660-46D3-8090-BCDA9EFF5427} = {917EA50B-D09B-4B96-B8DD-5D91C7DFBF38} | |
| 1545 | − {3F0B62F6-99B8-4F57-8C58-0B4B862358EA} = {917EA50B-D09B-4B96-B8DD-5D91C7DFBF38} | |
| 1546 | − {1FEC4033-C80F-4CF1-835C-BBEE0E7F6803} = {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} | |
| 1547 | − {383F4F83-8228-4B9A-9757-250043B6E30B} = {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} | |
| 1548 | − {C4145EB5-FEF9-4419-AC5E-31D4F23AD311} = {06BCB1F6-1992-4B1B-A98F-4F4EA04441B5} | |
| 1549 | − {7B0EEB2B-6F25-4D59-A15D-F39EA9DC94D3} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1550 | − {A8861372-0FE2-45E5-9DED-73B55AC4196C} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1551 | − {08F5CCE4-10C4-477C-B5C9-37F7D49748BC} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1552 | − {43A322EE-37D2-4B13-BA16-023E88772F8D} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1553 | − {40FACE0F-06DF-474C-A87C-59C8EAC0B3F8} = {198CE128-2E28-4591-91C1-C83176C3BE51} | |
| 1546 | + {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} = {78C67B09-D6EB-4A79-A591-47146025A277} | |
| 1547 | + {F68BED5B-410C-4D02-87C0-8AC74E374821} = {78C67B09-D6EB-4A79-A591-47146025A277} | |
| 1548 | + {E4120DD8-64F7-4D60-8B41-F2FDC27CC708} = {78C67B09-D6EB-4A79-A591-47146025A277} | |
| 1549 | + {74B3264B-4740-4C2F-9DCB-373FDCD3A848} = {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} | |
| 1550 | + {54CA98CC-2F0A-41F2-879D-0E42B17E8544} = {7FB89A9F-D6FD-46CD-960A-7A9E90D82C2C} | |
| 1551 | + {57261E91-7636-4F92-8D93-744A4AAD7EB0} = {4F46CF24-163D-4541-9EBF-C291053C0948} | |
| 1552 | + {A818C4B5-52B5-4E12-917E-4854C9AB4EF3} = {4F46CF24-163D-4541-9EBF-C291053C0948} | |
| 1553 | + {2C42B95F-A58A-413D-97E2-1968C087C472} = {F68BED5B-410C-4D02-87C0-8AC74E374821} | |
| 1554 | + {B4B5A12E-412E-4382-B991-3B67653F533C} = {F68BED5B-410C-4D02-87C0-8AC74E374821} | |
| 1555 | + {9B93C212-786C-45C9-9B90-8CEFD24EF19D} = {F68BED5B-410C-4D02-87C0-8AC74E374821} | |
| 1556 | + {B3FBA8D6-7C89-4FE9-8E90-F617604A7C3C} = {E4120DD8-64F7-4D60-8B41-F2FDC27CC708} | |
| 1554 | 1557 | EndGlobalSection |
| 1555 | 1558 | EndGlobal |
| @@ -403,7 +403,7 @@ namespace AdoAdapters · 402 unmodified lines | ||
| 403 | 403 | if (data.Read(buffer, 0, 4) != 4) |
| 404 | 404 | throw new EndOfStreamException(); |
| 405 | 405 | |
| 406 | − signalIndexCacheImageSize = EndianOrder.LittleEndian.ToInt32(buffer, 0); | |
| 406 | + signalIndexCacheImageSize = LittleEndian.ToInt32(buffer, 0); | |
| 407 | 407 | |
| 408 | 408 | // Resize buffer to accomodate exact signal index cache |
| 409 | 409 | buffer = new byte[signalIndexCacheImageSize]; |
| @@ -419,13 +419,13 @@ namespace AdoAdapters · 9 unmodified lines | ||
| 419 | 419 | if (data.Read(buffer, 0, 4) != 4) |
| 420 | 420 | throw new EndOfStreamException(); |
| 421 | 421 | |
| 422 | − compactMeasurementSize = EndianOrder.LittleEndian.ToInt32(buffer, 0); | |
| 422 | + compactMeasurementSize = LittleEndian.ToInt32(buffer, 0); | |
| 423 | 423 | |
| 424 | 424 | // Read the total number of compact measurements from the file |
| 425 | 425 | if (data.Read(buffer, 0, 4) != 4) |
| 426 | 426 | throw new EndOfStreamException(); |
| 427 | 427 | |
| 428 | − totalMeasurements = EndianOrder.LittleEndian.ToInt32(buffer, 0); | |
| 428 | + totalMeasurements = LittleEndian.ToInt32(buffer, 0); | |
| 429 | 429 | |
| 430 | 430 | // Resize buffer to accomodate compact measurement if needed (not likely) |
| 431 | 431 | if (buffer.Length < compactMeasurementSize) |
| @@ -608,16 +608,16 @@ namespace AdoAdapters · 176 unmodified lines | ||
| 608 | 608 | int compactMeasurementSize = (new CompactMeasurement(signalIndexCache)).BinaryLength; |
| 609 | 609 | |
| 610 | 610 | // Write the signal index cache image size to the file |
| 611 | − data.Write(EndianOrder.LittleEndian.GetBytes(signalIndexCacheImage.Length), 0, 4); | |
| 611 | + data.Write(LittleEndian.GetBytes(signalIndexCacheImage.Length), 0, 4); | |
| 612 | 612 | |
| 613 | 613 | // Write the signal index cache image to the file |
| 614 | 614 | data.Write(signalIndexCacheImage, 0, signalIndexCacheImage.Length); |
| 615 | 615 | |
| 616 | 616 | // Write the size of each compact measurement to the file |
| 617 | − data.Write(EndianOrder.LittleEndian.GetBytes(compactMeasurementSize), 0, 4); | |
| 617 | + data.Write(LittleEndian.GetBytes(compactMeasurementSize), 0, 4); | |
| 618 | 618 | |
| 619 | 619 | // Write the total number of compact measurements to the file |
| 620 | − data.Write(EndianOrder.LittleEndian.GetBytes(m_dbMeasurements.Count), 0, 4); | |
| 620 | + data.Write(LittleEndian.GetBytes(m_dbMeasurements.Count), 0, 4); | |
| 621 | 621 | |
| 622 | 622 | // Write each compact measurement image to the file |
| 623 | 623 | for (int i = 0; i < m_dbMeasurements.Count; i++) |
| @@ -266,7 +266,7 @@ namespace AdoAdapters · 265 unmodified lines | ||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // Get bulk insert limit |
| 269 | − if(settings.TryGetValue("bulkInsertLimit", out setting)) | |
| 269 | + if (settings.TryGetValue("bulkInsertLimit", out setting)) | |
| 270 | 270 | m_bulkInsertLimit = int.Parse(setting); |
| 271 | 271 | else |
| 272 | 272 | m_bulkInsertLimit = 1024; |
| @@ -407,7 +407,7 @@ namespace AdoAdapters · 134 unmodified lines | ||
| 407 | 407 | if (valuesBuilder.Length > 0) |
| 408 | 408 | valuesBuilder.Append(','); |
| 409 | 409 | |
| 410 | − if (value == null) | |
| 410 | + if ((object)value == null) | |
| 411 | 411 | { |
| 412 | 412 | valuesBuilder.Append("NULL"); |
| 413 | 413 | continue; |
| @@ -72,7 +72,7 @@ namespace DataQualityMonitoring.Services · 71 unmodified lines | ||
| 72 | 72 | } |
| 73 | 73 | set |
| 74 | 74 | { |
| 75 | − if (value == null) | |
| 75 | + if ((object)value == null) | |
| 76 | 76 | throw new ArgumentNullException("value"); |
| 77 | 77 | |
| 78 | 78 | m_alarmAdapter = value; |
| @@ -635,9 +635,9 @@ namespace FileAdapters · 634 unmodified lines | ||
| 635 | 635 | |
| 636 | 636 | // Copy file info into the buffer |
| 637 | 637 | fileNameByteLength = Encoding.Unicode.GetByteCount(fileInfo.Name); |
| 638 | − EndianOrder.BigEndian.CopyBytes(fileNameByteLength, buffer, 1); | |
| 638 | + BigEndian.CopyBytes(fileNameByteLength, buffer, 1); | |
| 639 | 639 | Encoding.Unicode.GetBytes(fileInfo.Name, 0, fileInfo.Name.Length, buffer, 5); |
| 640 | − EndianOrder.BigEndian.CopyBytes(fileInfo.Length, buffer, 5 + fileNameByteLength); | |
| 640 | + BigEndian.CopyBytes(fileInfo.Length, buffer, 5 + fileNameByteLength); | |
| 641 | 641 | bytesRead = 1 + 4 + fileNameByteLength + 8; |
| 642 | 642 | |
| 643 | 643 | // Wait for lock to open the file |
| @@ -180,9 +180,9 @@ namespace FileAdapters · 179 unmodified lines | ||
| 180 | 180 | if (bufferBlock[0] != 0) |
| 181 | 181 | { |
| 182 | 182 | // Start of a new file - read file info |
| 183 | − int fileNameByteLength = EndianOrder.BigEndian.ToInt32(bufferBlock, 1); | |
| 183 | + int fileNameByteLength = BigEndian.ToInt32(bufferBlock, 1); | |
| 184 | 184 | string fileName = Encoding.Unicode.GetString(bufferBlock, 5, fileNameByteLength); |
| 185 | − long fileSize = EndianOrder.BigEndian.ToInt64(bufferBlock, 5 + fileNameByteLength); | |
| 185 | + long fileSize = BigEndian.ToInt64(bufferBlock, 5 + fileNameByteLength); | |
| 186 | 186 | |
| 187 | 187 | // Notify of new file creation |
| 188 | 188 | OnStatusMessage("Now writing to file {0}...", fileName); |
| @@ -122,7 +122,7 @@ namespace PIAdapters · 121 unmodified lines | ||
| 122 | 122 | { |
| 123 | 123 | base.RequestedOutputMeasurementKeys = value; |
| 124 | 124 | |
| 125 | − if (value != null) | |
| 125 | + if ((object)value != null) | |
| 126 | 126 | HandleNewMeasurementsRequest(value); |
| 127 | 127 | } |
| 128 | 128 | } |
| @@ -160,7 +160,7 @@ namespace PIAdapters · 159 unmodified lines | ||
| 160 | 160 | set |
| 161 | 161 | { |
| 162 | 162 | base.RequestedOutputMeasurementKeys = value; |
| 163 | − if (value != null && value.Any()) | |
| 163 | + if ((object)value != null && value.Any()) | |
| 164 | 164 | HandleNewMeasurementsRequest(value); |
| 165 | 165 | } |
| 166 | 166 | } |
| @@ -355,7 +355,7 @@ namespace GSF.COMTRADE · 354 unmodified lines | ||
| 355 | 355 | int index = 0; |
| 356 | 356 | |
| 357 | 357 | // Read sample index |
| 358 | − uint sample = EndianOrder.LittleEndian.ToUInt32(buffer, index); | |
| 358 | + uint sample = LittleEndian.ToUInt32(buffer, index); | |
| 359 | 359 | index += 4; |
| 360 | 360 | |
| 361 | 361 | // Get timestamp of this record |
| @@ -372,7 +372,7 @@ namespace GSF.COMTRADE · 10 unmodified lines | ||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // Read microsecond timestamp |
| 375 | − uint microseconds = EndianOrder.LittleEndian.ToUInt32(buffer, index); | |
| 375 | + uint microseconds = LittleEndian.ToUInt32(buffer, index); | |
| 376 | 376 | index += 4; |
| 377 | 377 | |
| 378 | 378 | // Fall back on specified microsecond time |
| @@ -383,7 +383,7 @@ namespace GSF.COMTRADE · 4 unmodified lines | ||
| 383 | 383 | for (int i = 0; i < m_schema.AnalogChannels.Length; i++) |
| 384 | 384 | { |
| 385 | 385 | // Read next value |
| 386 | − m_values[i] = EndianOrder.LittleEndian.ToInt16(buffer, index) * m_schema.AnalogChannels[i].Multiplier + m_schema.AnalogChannels[i].Adder; | |
| 386 | + m_values[i] = LittleEndian.ToInt16(buffer, index) * m_schema.AnalogChannels[i].Multiplier + m_schema.AnalogChannels[i].Adder; | |
| 387 | 387 | index += 2; |
| 388 | 388 | } |
| 389 | 389 | |
| @@ -394,7 +394,7 @@ namespace GSF.COMTRADE · 4 unmodified lines | ||
| 394 | 394 | for (int i = 0; i < digitalWords; i++) |
| 395 | 395 | { |
| 396 | 396 | // Read next digital word |
| 397 | − digitalWord = EndianOrder.LittleEndian.ToUInt16(buffer, index); | |
| 397 | + digitalWord = LittleEndian.ToUInt16(buffer, index); | |
| 398 | 398 | index += 2; |
| 399 | 399 | |
| 400 | 400 | // Distribute each bit of digital word through next 16 digital values |
| @@ -412,8 +412,8 @@ namespace GSF.COMTRADE · 411 unmodified lines | ||
| 412 | 412 | double value; |
| 413 | 413 | bool isFirstDigital = true; |
| 414 | 414 | |
| 415 | − output.Write(EndianOrder.LittleEndian.GetBytes(sample), 0, 4); | |
| 416 | − output.Write(EndianOrder.LittleEndian.GetBytes(microseconds), 0, 4); | |
| 415 | + output.Write(LittleEndian.GetBytes(sample), 0, 4); | |
| 416 | + output.Write(LittleEndian.GetBytes(microseconds), 0, 4); | |
| 417 | 417 | |
| 418 | 418 | for (int i = 0; i < values.Length; i++) |
| 419 | 419 | { |
| @@ -430,15 +430,15 @@ namespace GSF.COMTRADE · 10 unmodified lines | ||
| 430 | 430 | isFirstDigital = false; |
| 431 | 431 | |
| 432 | 432 | if (injectFracSecValue) |
| 433 | − output.Write(EndianOrder.LittleEndian.GetBytes(fracSecValue), 0, 2); | |
| 433 | + output.Write(LittleEndian.GetBytes(fracSecValue), 0, 2); | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | − output.Write(EndianOrder.LittleEndian.GetBytes((ushort)value), 0, 2); | |
| 436 | + output.Write(LittleEndian.GetBytes((ushort)value), 0, 2); | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | // Make sure FRACSEC values are injected |
| 440 | 440 | if (isFirstDigital && injectFracSecValue) |
| 441 | − output.Write(EndianOrder.LittleEndian.GetBytes(fracSecValue), 0, 2); | |
| 441 | + output.Write(LittleEndian.GetBytes(fracSecValue), 0, 2); | |
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | } |
| @@ -73,7 +73,7 @@ namespace GSF.Communication · 72 unmodified lines | ||
| 73 | 73 | Buffer.BlockCopy(marker, 0, result, 0, marker.Length); |
| 74 | 74 | |
| 75 | 75 | // Then, copy the payload's size to the buffer after the payload marker |
| 76 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(length), 0, result, marker.Length, LengthSegment); | |
| 76 | + Buffer.BlockCopy(LittleEndian.GetBytes(length), 0, result, marker.Length, LengthSegment); | |
| 77 | 77 | |
| 78 | 78 | // At last, copy the payload after the payload marker and payload size |
| 79 | 79 | Buffer.BlockCopy(buffer, offset, result, marker.Length + LengthSegment, length); |
| @@ -208,10 +208,10 @@ namespace GSF.Communication.Radius · 207 unmodified lines | ||
| 208 | 208 | } |
| 209 | 209 | set |
| 210 | 210 | { |
| 211 | − if (value == null) | |
| 211 | + if ((object)value == null) | |
| 212 | 212 | throw new ArgumentNullException("value"); |
| 213 | 213 | |
| 214 | − if (value == null || value.Length != 16) | |
| 214 | + if ((object)value == null || value.Length != 16) | |
| 215 | 215 | throw new ArgumentException("Value must 16-byte long."); |
| 216 | 216 | |
| 217 | 217 | m_authenticator = value; |
| @@ -263,7 +263,7 @@ namespace GSF.Communication.Radius · 45 unmodified lines | ||
| 263 | 263 | /// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception> |
| 264 | 264 | public int ParseBinaryImage(byte[] buffer, int startIndex, int length) |
| 265 | 265 | { |
| 266 | − if (buffer == null) | |
| 266 | + if ((object)buffer == null) | |
| 267 | 267 | throw new ArgumentNullException("buffer"); |
| 268 | 268 | |
| 269 | 269 | int imageLength = BinaryLength; |
| @@ -289,11 +289,9 @@ namespace GSF.Communication.Radius · 19 unmodified lines | ||
| 289 | 289 | |
| 290 | 290 | return imageLength; |
| 291 | 291 | } |
| 292 | − else | |
| 293 | − { | |
| 294 | − // Binary image does not have sufficient data. | |
| 295 | − return 0; | |
| 296 | − } | |
| 292 | + | |
| 293 | + // Binary image does not have sufficient data. | |
| 294 | + return 0; | |
| 297 | 295 | } |
| 298 | 296 | |
| 299 | 297 | /// <summary> |
| @@ -393,7 +391,7 @@ namespace GSF.Communication.Radius · 93 unmodified lines | ||
| 393 | 391 | // where: |
| 394 | 392 | // Code, Identifier, Length & Attributes are from the response RADIUS packet |
| 395 | 393 | // Request Authenticator is from the request RADIUS packet |
| 396 | − // Shared Secret is the shared secret ket | |
| 394 | + // Shared Secret is the shared secret key | |
| 397 | 395 | int length = responsePacket.BinaryLength; |
| 398 | 396 | byte[] sharedSecretBytes = Encoding.GetBytes(sharedSecret); |
| 399 | 397 | byte[] buffer = BufferPool.TakeBuffer(length + sharedSecretBytes.Length); |
| @@ -408,7 +406,7 @@ namespace GSF.Communication.Radius · 8 unmodified lines | ||
| 408 | 406 | } |
| 409 | 407 | finally |
| 410 | 408 | { |
| 411 | − if (buffer != null) | |
| 409 | + if ((object)buffer != null) | |
| 412 | 410 | BufferPool.ReturnBuffer(buffer); |
| 413 | 411 | } |
| 414 | 412 | } |
| @@ -423,21 +421,15 @@ namespace GSF.Communication.Radius · 8 unmodified lines | ||
| 423 | 421 | public static byte[] EncryptPassword(string password, string sharedSecret, byte[] requestAuthenticator) |
| 424 | 422 | { |
| 425 | 423 | // Avoiding Null Dereferences |
| 426 | − if ((string.IsNullOrEmpty(sharedSecret))) | |
| 427 | − { | |
| 428 | − throw new ArgumentException("Shared secret cannot be null or empty."); | |
| 429 | − } | |
| 424 | + if (string.IsNullOrEmpty(sharedSecret)) | |
| 425 | + throw new ArgumentException("Shared secret cannot be null or empty."); | |
| 430 | 426 | |
| 431 | − if ((string.IsNullOrEmpty(password))) | |
| 432 | − { | |
| 427 | + if (string.IsNullOrEmpty(password)) | |
| 433 | 428 | throw new ArgumentException("Password cannot be null or empty."); |
| 434 | − } | |
| 435 | 429 | |
| 436 | 430 | if ((object)requestAuthenticator == null) |
| 437 | − { | |
| 438 | 431 | throw new ArgumentException("Request authenticator cannot be null."); |
| 439 | − } | |
| 440 | − | |
| 432 | + | |
| 441 | 433 | // Max length of the password can be 130 according to RFC 2865. Since 128 is the closest multiple |
| 442 | 434 | // of 16 (password segment length), we allow the password to be no longer than 128 characters. |
| 443 | 435 | if (password.Length <= 128) |
| @@ -479,8 +471,10 @@ namespace GSF.Communication.Radius · 35 unmodified lines | ||
| 479 | 471 | // For passwords that are more than 16 characters in length, each consecutive 16-byte |
| 480 | 472 | // segment of the password is XORed with MD5 hash value that's computed as follows: |
| 481 | 473 | // MD5(Shared secret key + XOR bytes used in the previous segment) |
| 474 | + // ReSharper disable once PossibleNullReferenceException | |
| 482 | 475 | Buffer.BlockCopy(xorBytes, 0, md5HashInputBytes, sharedSecretBytes.Length, xorBytes.Length); |
| 483 | 476 | } |
| 477 | + | |
| 484 | 478 | xorBytes = md5Provider.ComputeHash(md5HashInputBytes); |
| 485 | 479 | |
| 486 | 480 | // XOR the password bytes in the current segment with the XOR bytes. |
| @@ -492,10 +486,8 @@ namespace GSF.Communication.Radius · 5 unmodified lines | ||
| 492 | 486 | |
| 493 | 487 | return result; |
| 494 | 488 | } |
| 495 | − else | |
| 496 | − { | |
| 497 | − throw new ArgumentException("Password can be a maximum of 128 characters in length."); | |
| 498 | − } | |
| 489 | + | |
| 490 | + throw new ArgumentException("Password can be a maximum of 128 characters in length."); | |
| 499 | 491 | } |
| 500 | 492 | |
| 501 | 493 | #endregion |
| @@ -323,7 +323,7 @@ namespace GSF.Communication.Radius · 322 unmodified lines | ||
| 323 | 323 | set |
| 324 | 324 | { |
| 325 | 325 | // By definition, attribute value cannot be null or zero-length. |
| 326 | − if (value == null || value.Length == 0) | |
| 326 | + if ((object)value == null || value.Length == 0) | |
| 327 | 327 | throw new ArgumentNullException("value"); |
| 328 | 328 | |
| 329 | 329 | m_value = value; |
| @@ -359,7 +359,7 @@ namespace GSF.Communication.Radius · 29 unmodified lines | ||
| 359 | 359 | /// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception> |
| 360 | 360 | public int ParseBinaryImage(byte[] buffer, int startIndex, int length) |
| 361 | 361 | { |
| 362 | − if (buffer == null) | |
| 362 | + if ((object)buffer == null) | |
| 363 | 363 | throw new ArgumentNullException("buffer"); |
| 364 | 364 | |
| 365 | 365 | int imageLength = BinaryLength; |
| @@ -301,7 +301,7 @@ namespace GSF.Communication · 300 unmodified lines | ||
| 301 | 301 | } |
| 302 | 302 | set |
| 303 | 303 | { |
| 304 | − if (value == null || value.Length == 0) | |
| 304 | + if ((object)value == null || value.Length == 0) | |
| 305 | 305 | throw new ArgumentNullException("value"); |
| 306 | 306 | |
| 307 | 307 | m_payloadMarker = value; |
| @@ -301,7 +301,7 @@ namespace GSF.Communication · 300 unmodified lines | ||
| 301 | 301 | } |
| 302 | 302 | set |
| 303 | 303 | { |
| 304 | − if (value == null || value.Length == 0) | |
| 304 | + if ((object)value == null || value.Length == 0) | |
| 305 | 305 | throw new ArgumentNullException("value"); |
| 306 | 306 | |
| 307 | 307 | m_payloadMarker = value; |
| @@ -23,9 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | // |
| 24 | 24 | //****************************************************************************************************** |
| 25 | 25 | |
| 26 | −using GSF.Configuration; | |
| 27 | −using GSF.IO; | |
| 28 | −using GSF.Net.Security; | |
| 29 | 26 | using System; |
| 30 | 27 | using System.Collections.Concurrent; |
| 31 | 28 | using System.Collections.Generic; |
| @@ -39,6 +36,9 @@ using System.Security.Authentication; · 7 unmodified lines | ||
| 39 | 36 | using System.Security.Cryptography.X509Certificates; |
| 40 | 37 | using System.Text.RegularExpressions; |
| 41 | 38 | using System.Threading; |
| 39 | +using GSF.Configuration; | |
| 40 | +using GSF.IO; | |
| 41 | +using GSF.Net.Security; | |
| 42 | 42 | |
| 43 | 43 | namespace GSF.Communication |
| 44 | 44 | { |
| @@ -215,7 +215,7 @@ namespace GSF.Communication · 170 unmodified lines | ||
| 215 | 215 | } |
| 216 | 216 | set |
| 217 | 217 | { |
| 218 | − if (value == null || value.Length == 0) | |
| 218 | + if ((object)value == null || value.Length == 0) | |
| 219 | 219 | throw new ArgumentNullException("value"); |
| 220 | 220 | |
| 221 | 221 | m_payloadMarker = value; |
| @@ -23,9 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | // |
| 24 | 24 | //****************************************************************************************************** |
| 25 | 25 | |
| 26 | −using GSF.Configuration; | |
| 27 | −using GSF.IO; | |
| 28 | −using GSF.Net.Security; | |
| 29 | 26 | using System; |
| 30 | 27 | using System.Collections.Concurrent; |
| 31 | 28 | using System.Collections.Generic; |
| @@ -39,6 +36,9 @@ using System.Security.Authentication; · 7 unmodified lines | ||
| 39 | 36 | using System.Security.Cryptography.X509Certificates; |
| 40 | 37 | using System.Security.Principal; |
| 41 | 38 | using System.Threading; |
| 39 | +using GSF.Configuration; | |
| 40 | +using GSF.IO; | |
| 41 | +using GSF.Net.Security; | |
| 42 | 42 | |
| 43 | 43 | #if MONO |
| 44 | 44 | #pragma warning disable 649 |
| @@ -251,7 +251,7 @@ namespace GSF.Communication · 206 unmodified lines | ||
| 251 | 251 | } |
| 252 | 252 | set |
| 253 | 253 | { |
| 254 | − if (value == null || value.Length == 0) | |
| 254 | + if ((object)value == null || value.Length == 0) | |
| 255 | 255 | throw new ArgumentNullException("value"); |
| 256 | 256 | |
| 257 | 257 | m_payloadMarker = value; |
| @@ -22,40 +22,48 @@ · 21 unmodified lines | ||
| 22 | 22 | //****************************************************************************************************** |
| 23 | 23 | |
| 24 | 24 | using System; |
| 25 | −using System.Collections; | |
| 26 | 25 | using System.Collections.Generic; |
| 27 | 26 | using System.Collections.ObjectModel; |
| 28 | 27 | |
| 29 | 28 | namespace GSF.Collections |
| 30 | 29 | { |
| 31 | 30 | /// <summary> |
| 32 | − /// An faster and functionally equivalent implementation of <see cref="Collection{T}"/> | |
| 31 | + /// A faster and functionally equivalent implementation of <see cref="Collection{T}"/> | |
| 33 | 32 | /// </summary> |
| 34 | 33 | /// <typeparam name="T">The type of the element in the collection</typeparam> |
| 35 | 34 | /// <remarks> |
| 35 | + /// <para> | |
| 36 | 36 | /// <see cref="Collection{T}"/> is based upon an <see cref="IList{T}"/>. This means any simple call |
| 37 | − /// to the class is a function call that cannot be inlined. This implementation forces the underlying | |
| 37 | + /// to the class is a function call that cannot be in-lined. This implementation forces the underlying | |
| 38 | 38 | /// item to be <see cref="List{T}"/> and shadows many of the methods to call <see cref="List{T}"/> |
| 39 | 39 | /// instead of <see cref="IList{T}"/>. |
| 40 | − /// | |
| 40 | + /// </para> | |
| 41 | + /// <para> | |
| 41 | 42 | /// Since this class references the same underlying <see cref="List{T}"/> object, it can be |
| 42 | 43 | /// successfully implemented as a <see cref="ListCollection{T}"/> or casted it its underlying type |
| 43 | 44 | /// <see cref="Collection{T}"/>. |
| 44 | − /// | |
| 45 | + /// </para> | |
| 46 | + /// <para> | |
| 45 | 47 | /// Profiling this class yield a ForEach loop and For loop that executes between |
| 46 | 48 | /// 2-4 times faster than <see cref="Collection{T}"/>. This depends on the number of items in the |
| 47 | 49 | /// list. The fewer the faster. Other operations such as Add/Insert/Remove are closer to 50% faster. |
| 48 | − /// Count is now inlined (~20 times faster). | |
| 49 | − /// | |
| 50 | + /// Count is now in-lined (~20 times faster). | |
| 51 | + /// </para> | |
| 52 | + /// <para> | |
| 50 | 53 | /// This performance is negated if accessing this class via the IList interface. When possible, use |
| 51 | 54 | /// only strongly typed names. |
| 55 | + /// </para> | |
| 52 | 56 | /// </remarks> |
| 53 | − public class ListCollection<T> : Collection<T>, IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable | |
| 57 | + public class ListCollection<T> : Collection<T> | |
| 54 | 58 | { |
| 55 | − /// <summary> | |
| 56 | − /// A strongly typed reference of <see cref="Item"/> | |
| 57 | − /// </summary> | |
| 58 | − private readonly List<T> m_list; | |
| 59 | + #region [ Members ] | |
| 60 | + | |
| 61 | + // Fields | |
| 62 | + private readonly List<T> m_list; // Strongly typed reference to Items collection | |
| 63 | + | |
| 64 | + #endregion | |
| 65 | + | |
| 66 | + #region [ Constructors ] | |
| 59 | 67 | |
| 60 | 68 | /// <summary> |
| 61 | 69 | /// Creates a <see cref="ListCollection{T}"/> |
| @@ -75,12 +83,15 @@ namespace GSF.Collections · 13 unmodified lines | ||
| 75 | 83 | { |
| 76 | 84 | } |
| 77 | 85 | |
| 86 | + #endregion | |
| 87 | + | |
| 88 | + #region [ Properties ] | |
| 78 | 89 | |
| 79 | 90 | /// <summary> |
| 80 | − /// Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 91 | + /// Gets the number of elements contained in the <see cref="ICollection{T}"/>. | |
| 81 | 92 | /// </summary> |
| 82 | 93 | /// <returns> |
| 83 | − /// The number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 94 | + /// The number of elements contained in the <see cref="ICollection{T}"/>. | |
| 84 | 95 | /// </returns> |
| 85 | 96 | public new int Count |
| 86 | 97 | { |
| @@ -97,10 +108,8 @@ namespace GSF.Collections · 10 unmodified lines | ||
| 97 | 108 | /// The element at the specified index. |
| 98 | 109 | /// </returns> |
| 99 | 110 | /// <param name="index">The zero-based index of the element to get or set.</param> |
| 100 | − /// <exception cref="T:System.ArgumentOutOfRangeException"> | |
| 101 | − /// <paramref name="index"/> is not a valid index in the <see cref="T:System.Collections.Generic.IList`1"/>. </exception> | |
| 102 | − /// <exception cref="T:System.NotSupportedException"> | |
| 103 | − /// The property is set and the <see cref="T:System.Collections.Generic.IList`1"/> is read-only. </exception> | |
| 111 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the <see cref="IList{T}"/>.</exception> | |
| 112 | + /// <exception cref="NotSupportedException">The property is set and the <see cref="IList{T}"/> is read-only.</exception> | |
| 104 | 113 | public new T this[int index] |
| 105 | 114 | { |
| 106 | 115 | get |
| @@ -111,16 +120,16 @@ namespace GSF.Collections · 4 unmodified lines | ||
| 111 | 120 | { |
| 112 | 121 | if (index < 0 || index >= m_list.Count) |
| 113 | 122 | ThrowOutOfRangeException(); |
| 123 | + | |
| 114 | 124 | SetItem(index, value); |
| 115 | 125 | } |
| 116 | 126 | } |
| 117 | 127 | |
| 118 | 128 | /// <summary> |
| 119 | − /// Gets a <see cref="T:System.Collections.Generic.IList`1"/> wrapper around the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 129 | + /// Gets a <see cref="IList{T}"/> wrapper around the <see cref="Collection{T}"/>. | |
| 120 | 130 | /// </summary> |
| 121 | − /// | |
| 122 | 131 | /// <returns> |
| 123 | − /// A <see cref="T:System.Collections.Generic.IList`1"/> wrapper around the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 132 | + /// A <see cref="IList{T}"/> wrapper around the <see cref="Collection{T}"/>. | |
| 124 | 133 | /// </returns> |
| 125 | 134 | protected new List<T> Items |
| 126 | 135 | { |
| @@ -130,28 +139,31 @@ namespace GSF.Collections · 3 unmodified lines | ||
| 130 | 139 | } |
| 131 | 140 | } |
| 132 | 141 | |
| 142 | + #endregion | |
| 143 | + | |
| 144 | + #region [ Methods ] | |
| 133 | 145 | |
| 134 | 146 | /// <summary> |
| 135 | − /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 147 | + /// Adds an item to the <see cref="ICollection{T}"/>. | |
| 136 | 148 | /// </summary> |
| 137 | − /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param> | |
| 138 | − /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception> | |
| 149 | + /// <param name="item">The object to add to the <see cref="ICollection{T}"/>.</param> | |
| 150 | + /// <exception cref="NotSupportedException">The <see cref="ICollection{T}"/> is read-only.</exception> | |
| 139 | 151 | public new void Add(T item) |
| 140 | 152 | { |
| 141 | 153 | InsertItem(m_list.Count, item); |
| 142 | 154 | } |
| 143 | 155 | |
| 144 | 156 | /// <summary> |
| 145 | − /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 157 | + /// Removes all items from the <see cref="ICollection{T}"/>. | |
| 146 | 158 | /// </summary> |
| 147 | − /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only. </exception> | |
| 159 | + /// <exception cref="NotSupportedException">The <see cref="ICollection{T}"/> is read-only. </exception> | |
| 148 | 160 | public new void Clear() |
| 149 | 161 | { |
| 150 | 162 | ClearItems(); |
| 151 | 163 | } |
| 152 | 164 | |
| 153 | 165 | /// <summary> |
| 154 | − /// Removes all elements from the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 166 | + /// Removes all elements from the <see cref="Collection{T}"/>. | |
| 155 | 167 | /// </summary> |
| 156 | 168 | protected override void ClearItems() |
| 157 | 169 | { |
| @@ -159,33 +171,37 @@ namespace GSF.Collections · 1 unmodified line | ||
| 159 | 171 | } |
| 160 | 172 | |
| 161 | 173 | /// <summary> |
| 162 | − /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"/> contains a specific value. | |
| 174 | + /// Determines whether the <see cref="ICollection{T}"/> contains a specific value. | |
| 163 | 175 | /// </summary> |
| 164 | 176 | /// <returns> |
| 165 | − /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. | |
| 177 | + /// true if <paramref name="item"/> is found in the <see cref="ICollection{T}"/>; otherwise, false. | |
| 166 | 178 | /// </returns> |
| 167 | − /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param> | |
| 179 | + /// <param name="item">The object to locate in the <see cref="ICollection{T}"/>.</param> | |
| 168 | 180 | public new bool Contains(T item) |
| 169 | 181 | { |
| 170 | 182 | return m_list.Contains(item); |
| 171 | 183 | } |
| 172 | 184 | |
| 173 | 185 | /// <summary> |
| 174 | − /// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index. | |
| 186 | + /// Copies the elements of the <see cref="ICollection{T}"/> to an <see cref="Array"/>, starting at a particular <see cref="Array"/> index. | |
| 175 | 187 | /// </summary> |
| 176 | − /// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 177 | − /// The <see cref="T:System.Array"/> must have zero-based indexing.</param><param name="index">The zero-based index in | |
| 178 | − /// <paramref name="array"/> at which copying begins.</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than 0.</exception><exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>.</exception> | |
| 188 | + /// <param name="array"> | |
| 189 | + /// The one-dimensional <see cref="Array"/> that is the destination of the elements copied from <see cref="ICollection{T}"/>. | |
| 190 | + /// The <see cref="Array"/> must have zero-based indexing.</param><param name="index">The zero-based index in <paramref name="array"/> at which copying begins. | |
| 191 | + /// </param> | |
| 192 | + /// <exception cref="ArgumentNullException"><paramref name="array"/> is null.</exception> | |
| 193 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than 0.</exception> | |
| 194 | + /// <exception cref="ArgumentException">The number of elements in the source <see cref="ICollection{T}"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>.</exception> | |
| 179 | 195 | public new void CopyTo(T[] array, int index) |
| 180 | 196 | { |
| 181 | 197 | m_list.CopyTo(array, index); |
| 182 | 198 | } |
| 183 | 199 | |
| 184 | 200 | /// <summary> |
| 185 | − /// Returns an enumerator that iterates through the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 201 | + /// Returns an enumerator that iterates through the <see cref="Collection{T}"/>. | |
| 186 | 202 | /// </summary> |
| 187 | 203 | /// <returns> |
| 188 | − /// An <see cref="T:System.Collections.Generic.IEnumerator`1"/> for the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 204 | + /// An <see cref="IEnumerator{T}"/> for the <see cref="Collection{T}"/>. | |
| 189 | 205 | /// </returns> |
| 190 | 206 | public new List<T>.Enumerator GetEnumerator() |
| 191 | 207 | { |
| @@ -193,70 +209,81 @@ namespace GSF.Collections · 1 unmodified line | ||
| 193 | 209 | } |
| 194 | 210 | |
| 195 | 211 | /// <summary> |
| 196 | − /// Determines the index of a specific item in the <see cref="T:System.Collections.Generic.IList`1"/>. | |
| 212 | + /// Determines the index of a specific item in the <see cref="IList{T}"/>. | |
| 197 | 213 | /// </summary> |
| 198 | 214 | /// <returns> |
| 199 | 215 | /// The index of <paramref name="item"/> if found in the list; otherwise, -1. |
| 200 | 216 | /// </returns> |
| 201 | − /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.IList`1"/>.</param> | |
| 217 | + /// <param name="item">The object to locate in the <see cref="IList{T}"/>.</param> | |
| 202 | 218 | public new int IndexOf(T item) |
| 203 | 219 | { |
| 204 | 220 | return m_list.IndexOf(item); |
| 205 | 221 | } |
| 206 | 222 | |
| 207 | 223 | /// <summary> |
| 208 | − /// Inserts an item to the <see cref="T:System.Collections.Generic.IList`1"/> at the specified index. | |
| 224 | + /// Inserts an item to the <see cref="IList{T}"/> at the specified index. | |
| 209 | 225 | /// </summary> |
| 210 | − /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param><param name="item">The object to insert into the <see cref="T:System.Collections.Generic.IList`1"/>.</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the <see cref="T:System.Collections.Generic.IList`1"/>.</exception><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IList`1"/> is read-only.</exception> | |
| 226 | + /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param> | |
| 227 | + /// <param name="item">The object to insert into the <see cref="IList{T}"/>.</param> | |
| 228 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the <see cref="IList{T}"/>.</exception> | |
| 229 | + /// <exception cref="NotSupportedException">The <see cref="IList{T}"/> is read-only.</exception> | |
| 211 | 230 | public new void Insert(int index, T item) |
| 212 | 231 | { |
| 213 | 232 | if (index < 0 || index > m_list.Count) |
| 214 | 233 | ThrowOutOfRangeException(); |
| 234 | + | |
| 215 | 235 | InsertItem(index, item); |
| 216 | 236 | } |
| 217 | 237 | |
| 218 | 238 | /// <summary> |
| 219 | − /// Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1"/> at the specified index. | |
| 239 | + /// Inserts an element into the <see cref="Collection{T}"/> at the specified index. | |
| 220 | 240 | /// </summary> |
| 221 | − /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param><param name="item">The object to insert. The value can be null for reference types.</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.</exception> | |
| 241 | + /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param> | |
| 242 | + /// <param name="item">The object to insert. The value can be null for reference types.</param> | |
| 243 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is greater than <see cref="Collection{T}.Count"/>.</exception> | |
| 222 | 244 | protected override void InsertItem(int index, T item) |
| 223 | 245 | { |
| 224 | 246 | m_list.Insert(index, item); |
| 225 | 247 | } |
| 226 | 248 | |
| 227 | 249 | /// <summary> |
| 228 | − /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 250 | + /// Removes the first occurrence of a specific object from the <see cref="ICollection{T}"/>. | |
| 229 | 251 | /// </summary> |
| 230 | 252 | /// <returns> |
| 231 | − /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>. | |
| 253 | + /// true if <paramref name="item"/> was successfully removed from the <see cref="ICollection{T}"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="ICollection{T}"/>. | |
| 232 | 254 | /// </returns> |
| 233 | − /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception> | |
| 255 | + /// <param name="item">The object to remove from the <see cref="ICollection{T}"/>.</param> | |
| 256 | + /// <exception cref="NotSupportedException">The <see cref="ICollection{T}"/> is read-only.</exception> | |
| 234 | 257 | public new bool Remove(T item) |
| 235 | 258 | { |
| 236 | 259 | int index = m_list.IndexOf(item); |
| 260 | + | |
| 237 | 261 | if (index < 0) |
| 238 | − { | |
| 239 | 262 | return false; |
| 240 | − } | |
| 263 | + | |
| 241 | 264 | RemoveItem(index); |
| 265 | + | |
| 242 | 266 | return true; |
| 243 | 267 | } |
| 244 | 268 | |
| 245 | 269 | /// <summary> |
| 246 | − /// Removes the element at the specified index of the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 270 | + /// Removes the element at the specified index of the <see cref="Collection{T}"/>. | |
| 247 | 271 | /// </summary> |
| 248 | − /// <param name="index">The zero-based index of the element to remove.</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is equal to or greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.</exception> | |
| 272 | + /// <param name="index">The zero-based index of the element to remove.</param> | |
| 273 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is equal to or greater than <see cref="Collection{T}.Count"/>.</exception> | |
| 249 | 274 | public new void RemoveAt(int index) |
| 250 | 275 | { |
| 251 | 276 | if (index < 0 || index >= m_list.Count) |
| 252 | 277 | ThrowOutOfRangeException(); |
| 278 | + | |
| 253 | 279 | RemoveItem(index); |
| 254 | 280 | } |
| 255 | 281 | |
| 256 | 282 | /// <summary> |
| 257 | − /// Removes the element at the specified index of the <see cref="T:System.Collections.ObjectModel.Collection`1"/>. | |
| 283 | + /// Removes the element at the specified index of the <see cref="Collection{T}"/>. | |
| 258 | 284 | /// </summary> |
| 259 | − /// <param name="index">The zero-based index of the element to remove.</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is equal to or greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.</exception> | |
| 285 | + /// <param name="index">The zero-based index of the element to remove.</param> | |
| 286 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is equal to or greater than <see cref="Collection{T}.Count"/>.</exception> | |
| 260 | 287 | protected override void RemoveItem(int index) |
| 261 | 288 | { |
| 262 | 289 | m_list.RemoveAt(index); |
| @@ -265,18 +292,20 @@ namespace GSF.Collections · 2 unmodified lines | ||
| 265 | 292 | /// <summary> |
| 266 | 293 | /// Replaces the element at the specified index. |
| 267 | 294 | /// </summary> |
| 268 | − /// <param name="index">The zero-based index of the element to replace.</param><param name="item">The new value for the element at the specified index. The value can be null for reference types.</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.</exception> | |
| 295 | + /// <param name="index">The zero-based index of the element to replace.</param> | |
| 296 | + /// <param name="item">The new value for the element at the specified index. The value can be null for reference types.</param> | |
| 297 | + /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.-or-<paramref name="index"/> is greater than <see cref="Collection{T}.Count"/>.</exception> | |
| 269 | 298 | protected override void SetItem(int index, T item) |
| 270 | 299 | { |
| 271 | 300 | m_list[index] = item; |
| 272 | 301 | } |
| 273 | 302 | |
| 274 | − | |
| 275 | − void ThrowOutOfRangeException() | |
| 303 | + private static void ThrowOutOfRangeException() | |
| 276 | 304 | { |
| 305 | + // ReSharper disable once NotResolvedInText | |
| 277 | 306 | throw new ArgumentOutOfRangeException("index"); |
| 278 | 307 | } |
| 279 | 308 | |
| 309 | + #endregion | |
| 280 | 310 | } |
| 281 | − | |
| 282 | 311 | } |
| @@ -62,7 +62,7 @@ namespace GSF.Configuration · 61 unmodified lines | ||
| 62 | 62 | /// The name of the property as it appears in the connection string. |
| 63 | 63 | /// </summary> |
| 64 | 64 | public string[] Names; |
| 65 | − | |
| 65 | + | |
| 66 | 66 | /// <summary> |
| 67 | 67 | /// The default value of the property if its value |
| 68 | 68 | /// is not explicitly specified in the connection string. |
| @@ -275,7 +275,7 @@ namespace GSF.Configuration · 206 unmodified lines | ||
| 275 | 275 | Dictionary<string, string> settings; |
| 276 | 276 | |
| 277 | 277 | // Null objects don't have properties |
| 278 | − if (settingsObject == null) | |
| 278 | + if ((object)settingsObject == null) | |
| 279 | 279 | return string.Empty; |
| 280 | 280 | |
| 281 | 281 | // Get the set of properties which are part of the connection string |
| @@ -307,7 +307,7 @@ namespace GSF.Configuration · 25 unmodified lines | ||
| 307 | 307 | string value; |
| 308 | 308 | |
| 309 | 309 | // Null objects don't have properties |
| 310 | − if (settingsObject == null) | |
| 310 | + if ((object)settingsObject == null) | |
| 311 | 311 | throw new ArgumentNullException("settingsObject", "Unable to parse connection string because settings object is invalid."); |
| 312 | 312 | |
| 313 | 313 | // Get the set of properties which are part of the connection string |
| @@ -71,6 +71,7 @@ · 70 unmodified lines | ||
| 71 | 71 | //#define ForceBigEndianTesting |
| 72 | 72 | |
| 73 | 73 | using System; |
| 74 | +using System.ComponentModel; | |
| 74 | 75 | using System.Diagnostics.CodeAnalysis; |
| 75 | 76 | |
| 76 | 77 | namespace GSF |
| @@ -388,7 +389,7 @@ namespace GSF · 311 unmodified lines | ||
| 388 | 389 | [SuppressMessage("Microsoft.Performance", "CA1822")] |
| 389 | 390 | public bool ToBoolean(byte[] value, int startIndex) |
| 390 | 391 | { |
| 391 | − if (value == null) | |
| 392 | + if ((object)value == null) | |
| 392 | 393 | throw new ArgumentNullException("value"); |
| 393 | 394 | |
| 394 | 395 | return value[startIndex] != 0; |
| @@ -431,7 +432,7 @@ namespace GSF · 36 unmodified lines | ||
| 431 | 432 | /// <exception cref="ArgumentOutOfRangeException">startIndex is less than zero or greater than the length of value minus 1.</exception> |
| 432 | 433 | public short ToInt16(byte[] value, int startIndex) |
| 433 | 434 | { |
| 434 | − if (value == null) | |
| 435 | + if ((object)value == null) | |
| 435 | 436 | throw new ArgumentNullException("value"); |
| 436 | 437 | |
| 437 | 438 | if (m_targetIsLittleEndian) |
| @@ -467,7 +468,7 @@ namespace GSF · 29 unmodified lines | ||
| 467 | 468 | /// <exception cref="ArgumentOutOfRangeException">startIndex is less than zero or greater than the length of value minus 1.</exception> |
| 468 | 469 | public unsafe int ToInt32(byte[] value, int startIndex) |
| 469 | 470 | { |
| 470 | − if (value == null) | |
| 471 | + if ((object)value == null) | |
| 471 | 472 | throw new ArgumentNullException("value"); |
| 472 | 473 | |
| 473 | 474 | if (startIndex < 0) |
| @@ -504,7 +505,7 @@ namespace GSF · 30 unmodified lines | ||
| 504 | 505 | /// <exception cref="ArgumentOutOfRangeException">startIndex is less than zero or greater than the length of value minus 1.</exception> |
| 505 | 506 | public unsafe long ToInt64(byte[] value, int startIndex) |
| 506 | 507 | { |
| 507 | − if (value == null) | |
| 508 | + if ((object)value == null) | |
| 508 | 509 | throw new ArgumentNullException("value"); |
| 509 | 510 | |
| 510 | 511 | if (startIndex < 0) |
| @@ -618,6 +619,7 @@ namespace GSF · 107 unmodified lines | ||
| 618 | 619 | /// <exception cref="ArgumentNullException">value is null.</exception> |
| 619 | 620 | /// <exception cref="ArgumentOutOfRangeException">startIndex is less than zero or greater than the length of value minus 1.</exception> |
| 620 | 621 | [Obsolete("This method may be removed from future builds", false)] |
| 622 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 621 | 623 | public Guid ToGuid(byte[] value, int startIndex) |
| 622 | 624 | { |
| 623 | 625 | if (TargetEndianness == Endianness.BigEndian) |
| @@ -849,12 +851,13 @@ namespace GSF · 225 unmodified lines | ||
| 849 | 851 | /// <param name="value">The number to convert.</param> |
| 850 | 852 | /// <returns>An array of bytes with length 16.</returns> |
| 851 | 853 | [Obsolete("This method may be removed from future builds", false)] |
| 854 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 852 | 855 | public byte[] GetBytes(Guid value) |
| 853 | 856 | { |
| 854 | 857 | if (TargetEndianness == Endianness.BigEndian) |
| 855 | 858 | return GuidExtensions.__ToBigEndianOrderBytes(value); |
| 856 | − else | |
| 857 | − return GuidExtensions.__ToLittleEndianOrderBytes(value); | |
| 859 | + | |
| 860 | + return GuidExtensions.__ToLittleEndianOrderBytes(value); | |
| 858 | 861 | } |
| 859 | 862 | |
| 860 | 863 | /// <summary> |
| @@ -910,7 +913,7 @@ namespace GSF · 49 unmodified lines | ||
| 910 | 913 | /// <returns>Length of bytes copied into array based on size of <paramref name="value"/>.</returns> |
| 911 | 914 | public int CopyBytes(bool value, byte[] destinationArray, int destinationIndex) |
| 912 | 915 | { |
| 913 | − if (destinationArray == null) | |
| 916 | + if ((object)destinationArray == null) | |
| 914 | 917 | throw new ArgumentNullException("destinationArray"); |
| 915 | 918 | |
| 916 | 919 | if (value) |
| @@ -954,7 +957,7 @@ namespace GSF · 37 unmodified lines | ||
| 954 | 957 | /// <returns>Length of bytes copied into array based on size of <paramref name="value"/>.</returns> |
| 955 | 958 | public int CopyBytes(short value, byte[] destinationArray, int destinationIndex) |
| 956 | 959 | { |
| 957 | − if (destinationArray == null) | |
| 960 | + if ((object)destinationArray == null) | |
| 958 | 961 | throw new ArgumentNullException("destinationArray"); |
| 959 | 962 | |
| 960 | 963 | if (m_targetIsLittleEndian) |
| @@ -993,7 +996,7 @@ namespace GSF · 32 unmodified lines | ||
| 993 | 996 | /// <returns>Length of bytes copied into array based on size of <paramref name="value"/>.</returns> |
| 994 | 997 | public unsafe int CopyBytes(int value, byte[] destinationArray, int destinationIndex) |
| 995 | 998 | { |
| 996 | − if (destinationArray == null) | |
| 999 | + if ((object)destinationArray == null) | |
| 997 | 1000 | throw new ArgumentNullException("destinationArray"); |
| 998 | 1001 | |
| 999 | 1002 | if (destinationIndex < 0) |
| @@ -1036,7 +1039,7 @@ namespace GSF · 36 unmodified lines | ||
| 1036 | 1039 | /// <returns>Length of bytes copied into array based on size of <paramref name="value"/>.</returns> |
| 1037 | 1040 | public unsafe int CopyBytes(long value, byte[] destinationArray, int destinationIndex) |
| 1038 | 1041 | { |
| 1039 | − if (destinationArray == null) | |
| 1042 | + if ((object)destinationArray == null) | |
| 1040 | 1043 | throw new ArgumentNullException("destinationArray"); |
| 1041 | 1044 | |
| 1042 | 1045 | if (destinationIndex < 0) |
| @@ -1147,6 +1150,7 @@ namespace GSF · 104 unmodified lines | ||
| 1147 | 1150 | /// <param name="destinationIndex">The byte offset into <paramref name="destinationArray"/>.</param> |
| 1148 | 1151 | /// <returns>Length of bytes copied into array based on size of <paramref name="value"/>.</returns> |
| 1149 | 1152 | [Obsolete("This method may be removed from future builds", false)] |
| 1153 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 1150 | 1154 | public int CopyBytes(Guid value, byte[] destinationArray, int destinationIndex) |
| 1151 | 1155 | { |
| 1152 | 1156 | if (TargetEndianness == Endianness.BigEndian) |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | //****************************************************************************************************** |
| 23 | 23 | |
| 24 | 24 | using System; |
| 25 | +using System.ComponentModel; | |
| 25 | 26 | |
| 26 | 27 | namespace GSF |
| 27 | 28 | { |
| @@ -30,44 +31,46 @@ namespace GSF · 2 unmodified lines | ||
| 30 | 31 | /// </summary> |
| 31 | 32 | public unsafe static class GuidExtensions |
| 32 | 33 | { |
| 33 | − | |
| 34 | 34 | /// <summary> |
| 35 | 35 | /// Encodes a <see cref="Guid"/> following RFC 4122. |
| 36 | 36 | /// </summary> |
| 37 | − /// <param name="guid">the <see cref="Guid"/> to serialize</param> | |
| 38 | − /// <param name="buffer">where to store the <see cref="guid"/></param> | |
| 39 | − /// <param name="startingIndex">the starting index in <see cref="buffer"/></param> | |
| 37 | + /// <param name="guid">The <see cref="Guid"/> to serialize.</param> | |
| 38 | + /// <param name="buffer">Destination buffer to hold serialized <paramref name="guid"/>.</param> | |
| 39 | + /// <param name="startingIndex">Starting index in <paramref name="buffer"/>.</param> | |
| 40 | 40 | public static int ToRfcBytes(this Guid guid, byte[] buffer, int startingIndex) |
| 41 | 41 | { |
| 42 | − //Since Microsoft is not very clear how Guid.ToByteArray() performs on big endian processors | |
| 43 | − //we are assuming that the internal structure of a Guid will always be the same. Reviewing mono source code | |
| 44 | − //the internal stucture is also the same. | |
| 45 | − | |
| 42 | + // Since Microsoft is not very clear how Guid.ToByteArray() performs on big endian processors | |
| 43 | + // we are assuming that the internal structure of a Guid will always be the same. Reviewing | |
| 44 | + // mono source code the internal structure is also the same. | |
| 46 | 45 | buffer.ValidateParameters(startingIndex, 16); |
| 47 | 46 | |
| 48 | 47 | byte* src = (byte*)&guid; |
| 48 | + | |
| 49 | 49 | fixed (byte* dst = &buffer[startingIndex]) |
| 50 | 50 | { |
| 51 | 51 | if (BitConverter.IsLittleEndian) |
| 52 | 52 | { |
| 53 | − //Guid._a (int) | |
| 53 | + // Guid._a (int) | |
| 54 | 54 | dst[0] = src[3]; |
| 55 | 55 | dst[1] = src[2]; |
| 56 | 56 | dst[2] = src[1]; |
| 57 | 57 | dst[3] = src[0]; |
| 58 | − //Guid._b (short) | |
| 58 | + | |
| 59 | + // Guid._b (short) | |
| 59 | 60 | dst[4] = src[5]; |
| 60 | 61 | dst[5] = src[4]; |
| 61 | − //Guid._c (short) | |
| 62 | + | |
| 63 | + // Guid._c (short) | |
| 62 | 64 | dst[6] = src[7]; |
| 63 | 65 | dst[7] = src[6]; |
| 64 | − //Guid._d - Guid._k (8 bytes) | |
| 65 | − //Since already encoded as big endian, just copy the data. | |
| 66 | + | |
| 67 | + // Guid._d - Guid._k (8 bytes) | |
| 68 | + // Since already encoded as big endian, just copy the data | |
| 66 | 69 | *(long*)(dst + 8) = *(long*)(src + 8); |
| 67 | 70 | } |
| 68 | 71 | else |
| 69 | 72 | { |
| 70 | − //all fields are encoded big-endian. Just copy. | |
| 73 | + // All fields are encoded big-endian, just copy | |
| 71 | 74 | *(long*)(dst + 0) = *(long*)(src + 0); |
| 72 | 75 | *(long*)(dst + 8) = *(long*)(src + 8); |
| 73 | 76 | } |
| @@ -78,8 +81,8 @@ namespace GSF · 4 unmodified lines | ||
| 78 | 81 | /// <summary> |
| 79 | 82 | /// Encodes a <see cref="Guid"/> following RFC 4122. |
| 80 | 83 | /// </summary> |
| 81 | − /// <param name="guid">the <see cref="Guid"/> to serialize</param> | |
| 82 | − /// <returns>A <see cref="byte"/>[] that represents a big endian encoded Guid.</returns> | |
| 84 | + /// <param name="guid"><see cref="Guid"/> to serialize.</param> | |
| 85 | + /// <returns>A <see cref="byte"/> array that represents a big-endian encoded <see cref="Guid"/>.</returns> | |
| 83 | 86 | public static byte[] ToRfcBytes(this Guid guid) |
| 84 | 87 | { |
| 85 | 88 | byte[] rv = new byte[16]; |
| @@ -90,8 +93,8 @@ namespace GSF · 4 unmodified lines | ||
| 90 | 93 | /// <summary> |
| 91 | 94 | /// Decodes a <see cref="Guid"/> following RFC 4122 |
| 92 | 95 | /// </summary> |
| 93 | − /// <param name="buffer">where to read the <see cref="Guid"/>.</param> | |
| 94 | − /// <returns></returns> | |
| 96 | + /// <param name="buffer">Buffer containing a serialized big-endian encoded <see cref="Guid"/>.</param> | |
| 97 | + /// <returns><see cref="Guid"/> deserialized from <paramref name="buffer"/>.</returns> | |
| 95 | 98 | public static Guid ToRfcGuid(this byte[] buffer) |
| 96 | 99 | { |
| 97 | 100 | return buffer.ToRfcGuid(0); |
| @@ -100,40 +103,44 @@ namespace GSF · 2 unmodified lines | ||
| 100 | 103 | /// <summary> |
| 101 | 104 | /// Decodes a <see cref="Guid"/> following RFC 4122 |
| 102 | 105 | /// </summary> |
| 103 | − /// <param name="buffer">where to read the <see cref="Guid"/>.</param> | |
| 104 | − /// <param name="startingIndex">the starting index in <see cref="buffer"/>.</param> | |
| 105 | − /// <returns></returns> | |
| 106 | + /// <param name="buffer">Buffer containing a serialized big-endian encoded <see cref="Guid"/>.</param> | |
| 107 | + /// <param name="startingIndex">Starting index in <paramref name="buffer"/>.</param> | |
| 108 | + /// <returns><see cref="Guid"/> deserialized from <paramref name="buffer"/>.</returns> | |
| 106 | 109 | public static Guid ToRfcGuid(this byte[] buffer, int startingIndex) |
| 107 | 110 | { |
| 108 | 111 | buffer.ValidateParameters(startingIndex, 16); |
| 109 | 112 | |
| 110 | − //Since Microsoft is not very clear how Guid.ToByteArray() performs on big endian processors | |
| 111 | − //we are assuming that the internal structure of a Guid will always be the same. Reviewing mono source code | |
| 112 | − //the internal stucture is also the same. | |
| 113 | + // Since Microsoft is not very clear how Guid.ToByteArray() performs on big endian processors | |
| 114 | + // we are assuming that the internal structure of a Guid will always be the same. Reviewing | |
| 115 | + // mono source code the internal structure is also the same. | |
| 113 | 116 | Guid rv; |
| 114 | 117 | byte* dst = (byte*)&rv; |
| 118 | + | |
| 115 | 119 | fixed (byte* src = &buffer[startingIndex]) |
| 116 | 120 | { |
| 117 | 121 | if (BitConverter.IsLittleEndian) |
| 118 | 122 | { |
| 119 | − //Guid._a (int) | |
| 123 | + // Guid._a (int) | |
| 120 | 124 | dst[0] = src[3]; |
| 121 | 125 | dst[1] = src[2]; |
| 122 | 126 | dst[2] = src[1]; |
| 123 | 127 | dst[3] = src[0]; |
| 124 | − //Guid._b (short) | |
| 128 | + | |
| 129 | + // Guid._b (short) | |
| 125 | 130 | dst[4] = src[5]; |
| 126 | 131 | dst[5] = src[4]; |
| 127 | − //Guid._c (short) | |
| 132 | + | |
| 133 | + // Guid._c (short) | |
| 128 | 134 | dst[6] = src[7]; |
| 129 | 135 | dst[7] = src[6]; |
| 130 | − //Guid._d - Guid._k (8 bytes) | |
| 131 | − //Since already encoded as big endian, just copy the data. | |
| 136 | + | |
| 137 | + // Guid._d - Guid._k (8 bytes) | |
| 138 | + // Since already encoded as big endian, just copy the data | |
| 132 | 139 | *(long*)(dst + 8) = *(long*)(src + 8); |
| 133 | 140 | } |
| 134 | 141 | else |
| 135 | 142 | { |
| 136 | − //all fields are encoded big-endian. Just copy. | |
| 143 | + // All fields are encoded big-endian, just copy | |
| 137 | 144 | *(long*)(dst + 0) = *(long*)(src + 0); |
| 138 | 145 | *(long*)(dst + 8) = *(long*)(src + 8); |
| 139 | 146 | } |
| @@ -143,7 +150,7 @@ namespace GSF · 3 unmodified lines | ||
| 143 | 150 | } |
| 144 | 151 | |
| 145 | 152 | //--------------------------------------------------------------------------------------------------------- |
| 146 | − // Obsolete methods to support backwards compatibility with a bug that existed in EndianOrder's Guid methods | |
| 153 | + // Obsolete methods for compatibility with incorrectly implemented old code in EndianOrder's Guid methods | |
| 147 | 154 | //--------------------------------------------------------------------------------------------------------- |
| 148 | 155 | |
| 149 | 156 | /// <summary> |
| @@ -152,6 +159,7 @@ namespace GSF · 2 unmodified lines | ||
| 152 | 159 | /// <param name="guid">the <see cref="Guid"/> to serialize</param> |
| 153 | 160 | /// <returns>A <see cref="byte"/>[] that represents a big endian encoded Guid.</returns> |
| 154 | 161 | [Obsolete("This method is for backwards compatibility only. Use ToRfcBytes from now on.", false)] |
| 162 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 155 | 163 | public static byte[] __ToBigEndianOrderBytes(Guid guid) |
| 156 | 164 | { |
| 157 | 165 | byte[] rv = new byte[16]; |
| @@ -163,15 +171,12 @@ namespace GSF · 5 unmodified lines | ||
| 163 | 171 | /// Mimicks the encoding that was present in BigEndianOrder. |
| 164 | 172 | /// </summary> |
| 165 | 173 | /// <param name="guid">the <see cref="Guid"/> to serialize</param> |
| 166 | − /// <param name="buffer">where to store the <see cref="guid"/></param> | |
| 167 | − /// <param name="startingIndex">the starting index in <see cref="buffer"/></param> | |
| 174 | + /// <param name="buffer">where to store the <paramref name="guid"/></param> | |
| 175 | + /// <param name="startingIndex">the starting index in <paramref name="buffer"/></param> | |
| 168 | 176 | [Obsolete("This method is for backwards compatibility only. Use ToRfcBytes from now on.", false)] |
| 177 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 169 | 178 | public static int __ToBigEndianOrderBytes(Guid guid, byte[] buffer, int startingIndex) |
| 170 | 179 | { |
| 171 | − //Since Microsoft is not very clear how Guid.ToByteArray() performs on big endian processors | |
| 172 | − //we are assuming that the internal structure of a Guid will always be the same. Reviewing mono source code | |
| 173 | − //the internal stucture is also the same. | |
| 174 | − | |
| 175 | 180 | buffer.ValidateParameters(startingIndex, 16); |
| 176 | 181 | |
| 177 | 182 | byte* src = (byte*)&guid; |
| @@ -198,8 +203,6 @@ namespace GSF · 20 unmodified lines | ||
| 198 | 203 | } |
| 199 | 204 | else |
| 200 | 205 | { |
| 201 | − //ToDo: Test this on a big endian architecture. | |
| 202 | − | |
| 203 | 206 | //Guid._a (int) //swap endian |
| 204 | 207 | dst[15] = src[3]; |
| 205 | 208 | dst[14] = src[2]; |
| @@ -231,6 +234,7 @@ namespace GSF · 25 unmodified lines | ||
| 231 | 234 | /// <param name="buffer">where to read the <see cref="Guid"/>.</param> |
| 232 | 235 | /// <returns></returns> |
| 233 | 236 | [Obsolete("This method is for backwards compatibility only. Use ToRfcGuid from now on.", false)] |
| 237 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 234 | 238 | public static Guid __ToBigEndianOrderGuid(byte[] buffer) |
| 235 | 239 | { |
| 236 | 240 | return __ToBigEndianOrderGuid(buffer, 0); |
| @@ -240,15 +244,14 @@ namespace GSF · 3 unmodified lines | ||
| 240 | 244 | /// Mimicks the encoding that was present in BigEndianOrder. |
| 241 | 245 | /// </summary> |
| 242 | 246 | /// <param name="buffer">where to read the <see cref="Guid"/>.</param> |
| 243 | − /// <param name="startingIndex">the starting index in <see cref="buffer"/>.</param> | |
| 247 | + /// <param name="startingIndex">the starting index in <paramref name="buffer"/></param> | |
| 244 | 248 | /// <returns></returns> |
| 245 | 249 | [Obsolete("This method is for backwards compatibility only. Use ToRfcGuid from now on.", false)] |
| 250 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 246 | 251 | public static Guid __ToBigEndianOrderGuid(byte[] buffer, int startingIndex) |
| 247 | 252 | { |
| 248 | 253 | buffer.ValidateParameters(startingIndex, 16); |
| 249 | 254 | |
| 250 | − //BigEndianOrder was a reverse of byte ordering that microsoft used. | |
| 251 | − | |
| 252 | 255 | Guid rv; |
| 253 | 256 | byte* dst = (byte*)&rv; |
| 254 | 257 | fixed (byte* src = &buffer[startingIndex]) |
| @@ -301,14 +304,13 @@ namespace GSF · 46 unmodified lines | ||
| 301 | 304 | } |
| 302 | 305 | } |
| 303 | 306 | |
| 304 | − | |
| 305 | − | |
| 306 | 307 | /// <summary> |
| 307 | 308 | /// Mimicks the encoding that was present in BigEndianOrder. |
| 308 | 309 | /// </summary> |
| 309 | 310 | /// <param name="guid">the <see cref="Guid"/> to serialize</param> |
| 310 | 311 | /// <returns>A <see cref="byte"/>[] that represents a big endian encoded Guid.</returns> |
| 311 | 312 | [Obsolete("This method is for backwards compatibility only. Use ToRfcBytes from now on.", false)] |
| 313 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 312 | 314 | public static byte[] __ToLittleEndianOrderBytes(Guid guid) |
| 313 | 315 | { |
| 314 | 316 | byte[] rv = new byte[16]; |
| @@ -320,14 +322,12 @@ namespace GSF · 5 unmodified lines | ||
| 320 | 322 | /// Mimicks the encoding that was present in BigEndianOrder. |
| 321 | 323 | /// </summary> |
| 322 | 324 | /// <param name="guid">the <see cref="Guid"/> to serialize</param> |
| 323 | − /// <param name="buffer">where to store the <see cref="guid"/></param> | |
| 324 | − /// <param name="startingIndex">the starting index in <see cref="buffer"/></param> | |
| 325 | + /// <param name="buffer">where to store the <paramref name="guid"/></param> | |
| 326 | + /// <param name="startingIndex">the starting index in <paramref name="buffer"/></param> | |
| 325 | 327 | [Obsolete("This method is for backwards compatibility only. Use ToRfcBytes from now on.", false)] |
| 328 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 326 | 329 | public static int __ToLittleEndianOrderBytes(Guid guid, byte[] buffer, int startingIndex) |
| 327 | 330 | { |
| 328 | − //This encoding is the same as the default microsoft encoding. | |
| 329 | − //Which is each internal word of the guid is stored little endian. | |
| 330 | − | |
| 331 | 331 | buffer.ValidateParameters(startingIndex, 16); |
| 332 | 332 | |
| 333 | 333 | byte* src = (byte*)&guid; |
| @@ -341,8 +341,6 @@ namespace GSF · 7 unmodified lines | ||
| 341 | 341 | } |
| 342 | 342 | else |
| 343 | 343 | { |
| 344 | − //ToDo: Test this on a big endian architecture. | |
| 345 | − | |
| 346 | 344 | //Guid._a (int) //swap endian |
| 347 | 345 | dst[0] = src[3]; |
| 348 | 346 | dst[1] = src[2]; |
| @@ -367,6 +365,7 @@ namespace GSF · 18 unmodified lines | ||
| 367 | 365 | /// <param name="buffer">where to read the <see cref="Guid"/>.</param> |
| 368 | 366 | /// <returns></returns> |
| 369 | 367 | [Obsolete("This method is for backwards compatibility only. Use ToRfcGuid from now on.", false)] |
| 368 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 370 | 369 | public static Guid __ToLittleEndianOrderGuid(byte[] buffer) |
| 371 | 370 | { |
| 372 | 371 | return __ToLittleEndianOrderGuid(buffer, 0); |
| @@ -376,16 +375,14 @@ namespace GSF · 3 unmodified lines | ||
| 376 | 375 | /// Mimicks the encoding that was present in BigEndianOrder. |
| 377 | 376 | /// </summary> |
| 378 | 377 | /// <param name="buffer">where to read the <see cref="Guid"/>.</param> |
| 379 | − /// <param name="startingIndex">the starting index in <see cref="buffer"/>.</param> | |
| 378 | + /// <param name="startingIndex">the starting index in <paramref name="buffer"/></param> | |
| 380 | 379 | /// <returns></returns> |
| 381 | 380 | [Obsolete("This method is for backwards compatibility only. Use ToRfcGuid from now on.", false)] |
| 381 | + [EditorBrowsable(EditorBrowsableState.Never)] | |
| 382 | 382 | public static Guid __ToLittleEndianOrderGuid(byte[] buffer, int startingIndex) |
| 383 | 383 | { |
| 384 | 384 | buffer.ValidateParameters(startingIndex, 16); |
| 385 | 385 | |
| 386 | − //Since Microsoft is not very clear how Guid.ToByteArray() performs on big endian processors | |
| 387 | − //we are assuming that the internal structure of a Guid will always be the same. Reviewing mono source code | |
| 388 | − //the internal stucture is also the same. | |
| 389 | 386 | Guid rv; |
| 390 | 387 | byte* dst = (byte*)&rv; |
| 391 | 388 | fixed (byte* src = &buffer[startingIndex]) |
| @@ -398,8 +395,6 @@ namespace GSF · 6 unmodified lines | ||
| 398 | 395 | } |
| 399 | 396 | else |
| 400 | 397 | { |
| 401 | − //ToDo: Test this on a big endian architecture. | |
| 402 | − | |
| 403 | 398 | //Guid._a (int) //swap endian |
| 404 | 399 | dst[0] = src[3]; |
| 405 | 400 | dst[1] = src[2]; |
| @@ -418,6 +413,5 @@ namespace GSF · 12 unmodified lines | ||
| 418 | 413 | return rv; |
| 419 | 414 | } |
| 420 | 415 | } |
| 421 | − | |
| 422 | 416 | } |
| 423 | 417 | } |
| @@ -172,7 +172,7 @@ namespace GSF.IO.Compression · 171 unmodified lines | ||
| 172 | 172 | int compressedSize = 0; |
| 173 | 173 | byte* iter, end; |
| 174 | 174 | |
| 175 | − if (value == null) | |
| 175 | + if ((object)value == null) | |
| 176 | 176 | throw new ArgumentNullException("value cannot be null", "value"); |
| 177 | 177 | |
| 178 | 178 | bufferLength = value.BinaryLength.AlignDoubleWord(); |
| @@ -235,7 +235,7 @@ namespace GSF.IO.Compression · 56 unmodified lines | ||
| 235 | 235 | int compressedSize = 0; |
| 236 | 236 | byte* start, iter, end; |
| 237 | 237 | |
| 238 | − if (buffer == null) | |
| 238 | + if ((object)buffer == null) | |
| 239 | 239 | throw new ArgumentNullException("buffer", "Cannot write data to null buffer"); |
| 240 | 240 | |
| 241 | 241 | if (length % SizeOf32Bits != 0) |
| @@ -727,7 +727,7 @@ namespace GSF.IO.Compression · 485 unmodified lines | ||
| 727 | 727 | finally |
| 728 | 728 | { |
| 729 | 729 | // Return buffer to queue so it can be reused |
| 730 | − if (buffer != null) | |
| 730 | + if ((object)buffer != null) | |
| 731 | 731 | BufferPool.ReturnBuffer(buffer); |
| 732 | 732 | } |
| 733 | 733 | |
| @@ -917,7 +917,7 @@ namespace GSF.IO.Compression · 183 unmodified lines | ||
| 917 | 917 | // finally |
| 918 | 918 | // { |
| 919 | 919 | // // Return buffer to queue so it can be reused |
| 920 | − // if (buffer != null) | |
| 920 | + // if ((object)buffer != null) | |
| 921 | 921 | // BufferPool.ReturnBuffer(buffer); |
| 922 | 922 | // } |
| 923 | 923 | |
| @@ -210,7 +210,7 @@ namespace GSF.IO.Compression · 209 unmodified lines | ||
| 210 | 210 | const int SizeOf32Bits = sizeof(uint); |
| 211 | 211 | byte* start, iter, end; |
| 212 | 212 | |
| 213 | − if (buffer == null) | |
| 213 | + if ((object)buffer == null) | |
| 214 | 214 | throw new ArgumentNullException("buffer", "Cannot write data to null buffer"); |
| 215 | 215 | |
| 216 | 216 | if (length % SizeOf32Bits != 0) |
| @@ -663,7 +663,7 @@ namespace GSF.IO.Compression · 446 unmodified lines | ||
| 663 | 663 | finally |
| 664 | 664 | { |
| 665 | 665 | // Return buffer to queue so it can be reused |
| 666 | − if (buffer != null) | |
| 666 | + if ((object)buffer != null) | |
| 667 | 667 | BufferPool.ReturnBuffer(buffer); |
| 668 | 668 | } |
| 669 | 669 | |
| @@ -63,7 +63,7 @@ namespace GSF.IO · 62 unmodified lines | ||
| 63 | 63 | } |
| 64 | 64 | finally |
| 65 | 65 | { |
| 66 | − if (buffer != null) | |
| 66 | + if ((object)buffer != null) | |
| 67 | 67 | BufferPool.ReturnBuffer(buffer); |
| 68 | 68 | } |
| 69 | 69 | } |
| @@ -207,7 +207,7 @@ namespace GSF.Identity · 206 unmodified lines | ||
| 207 | 207 | { |
| 208 | 208 | object value = key.GetValue(UacRegistryValue); |
| 209 | 209 | |
| 210 | − if (value != null) | |
| 210 | + if ((object)value != null) | |
| 211 | 211 | return value.Equals(1); |
| 212 | 212 | } |
| 213 | 213 | |
| @@ -334,7 +334,7 @@ namespace GSF.Parsing · 333 unmodified lines | ||
| 334 | 334 | } |
| 335 | 335 | finally |
| 336 | 336 | { |
| 337 | − if (buffer != null) | |
| 337 | + if ((object)buffer != null) | |
| 338 | 338 | BufferPool.ReturnBuffer(buffer); |
| 339 | 339 | } |
| 340 | 340 | } |
| @@ -507,10 +507,14 @@ namespace GSF.Parsing · 166 unmodified lines | ||
| 507 | 507 | OnParsingException(ex); |
| 508 | 508 | } |
| 509 | 509 | else |
| 510 | + { | |
| 510 | 511 | throw; |
| 512 | + } | |
| 511 | 513 | } |
| 512 | 514 | else |
| 515 | + { | |
| 513 | 516 | throw; |
| 517 | + } | |
| 514 | 518 | } |
| 515 | 519 | |
| 516 | 520 | // Returned value represents total bytes of data in the buffer image that were |
| @@ -40,7 +40,7 @@ namespace GSF.Parsing · 39 unmodified lines | ||
| 40 | 40 | /// { |
| 41 | 41 | /// if (length > 3) |
| 42 | 42 | /// { |
| 43 | − /// TypeID = EndianOrder.LittleEndian.ToInt32(binaryImage, startIndex); | |
| 43 | + /// TypeID = LittleEndian.ToInt32(binaryImage, startIndex); | |
| 44 | 44 | /// State = state; |
| 45 | 45 | /// } |
| 46 | 46 | /// else |
| @@ -35,7 +35,7 @@ namespace GSF.Parsing · 34 unmodified lines | ||
| 35 | 35 | public interface IBinaryImageParser : IProvideStatus |
| 36 | 36 | { |
| 37 | 37 | /// <summary> |
| 38 | − /// Occurs when data image fails deserialized due to an exception. | |
| 38 | + /// Occurs when data image fails deserialization due to an exception. | |
| 39 | 39 | /// </summary> |
| 40 | 40 | /// <remarks> |
| 41 | 41 | /// <see cref="EventArgs{T}.Argument"/> is the remaining portion of the binary image that failed to parse. |
| @@ -63,12 +63,19 @@ namespace GSF.Parsing · 21 unmodified lines | ||
| 63 | 63 | /// <summary> |
| 64 | 64 | /// Gets or sets a boolean value that indicates whether the data parser is currently enabled. |
| 65 | 65 | /// </summary> |
| 66 | − bool Enabled { get; set; } | |
| 66 | + bool Enabled | |
| 67 | + { | |
| 68 | + get; | |
| 69 | + set; | |
| 70 | + } | |
| 67 | 71 | |
| 68 | 72 | /// <summary> |
| 69 | 73 | /// Gets the total number of buffer images processed so far. |
| 70 | 74 | /// </summary> |
| 71 | − long TotalProcessedBuffers { get; } | |
| 75 | + long TotalProcessedBuffers | |
| 76 | + { | |
| 77 | + get; | |
| 78 | + } | |
| 72 | 79 | |
| 73 | 80 | /// <summary> |
| 74 | 81 | /// Writes a sequence of bytes onto the <see cref="IBinaryImageParser"/> stream for parsing. |
| @@ -123,7 +123,7 @@ namespace GSF.Parsing · 122 unmodified lines | ||
| 123 | 123 | } |
| 124 | 124 | finally |
| 125 | 125 | { |
| 126 | − if (buffer != null) | |
| 126 | + if ((object)buffer != null) | |
| 127 | 127 | BufferPool.ReturnBuffer(buffer); |
| 128 | 128 | } |
| 129 | 129 | } |
| @@ -153,7 +153,7 @@ namespace GSF.Parsing · 23 unmodified lines | ||
| 153 | 153 | } |
| 154 | 154 | finally |
| 155 | 155 | { |
| 156 | − if (buffer != null) | |
| 156 | + if ((object)buffer != null) | |
| 157 | 157 | BufferPool.ReturnBuffer(buffer); |
| 158 | 158 | } |
| 159 | 159 | } |
| @@ -26,11 +26,12 @@ · 25 unmodified lines | ||
| 26 | 26 | namespace GSF.Parsing |
| 27 | 27 | { |
| 28 | 28 | /// <summary> |
| 29 | − /// Specifies that this <see cref="System.Type"/> can produce or consume a frame of data represented as a source identifiable binary image. | |
| 29 | + /// Specifies that this <see cref="System.Type"/> can produce or consume a frame of data represented as a binary image | |
| 30 | + /// that can be identified by its data source. | |
| 30 | 31 | /// </summary> |
| 31 | 32 | /// <remarks> |
| 32 | 33 | /// Related types of protocol data that occur as frames in a stream can implement this interface for automated parsing |
| 33 | − /// via the <see cref="MultiSourceFrameImageParserBase{TSourceIdentifier,TTypeIdentifier,TOutputType}"/> class. | |
| 34 | + /// via the <see cref="MultiSourceFrameImageParserBase{TSourceIdentifier, TTypeIdentifier, TOutputType}"/> class. | |
| 34 | 35 | /// </remarks> |
| 35 | 36 | /// <typeparam name="TSourceIdentifier">Type of identifier for the data source.</typeparam> |
| 36 | 37 | /// <typeparam name="TTypeIdentifier">Type of the frame identifier.</typeparam> |
| @@ -37,7 +37,6 @@ using System; · 36 unmodified lines | ||
| 37 | 37 | using System.Collections.Concurrent; |
| 38 | 38 | using System.Collections.Generic; |
| 39 | 39 | using System.ComponentModel; |
| 40 | −using System.Threading; | |
| 41 | 40 | using GSF.Collections; |
| 42 | 41 | |
| 43 | 42 | namespace GSF.Parsing |
| @@ -54,7 +53,7 @@ namespace GSF.Parsing · 10 unmodified lines | ||
| 54 | 53 | /// This class is more specific than the <see cref="BinaryImageParserBase"/> in that it can automate the parsing of a |
| 55 | 54 | /// particular protocol that is formatted as a series of frames that have a common method of identification. |
| 56 | 55 | /// Automation of type creation occurs by loading implementations of common types that implement the |
| 57 | − /// <see cref="ISupportSourceIdentifiableFrameImage{TSourceIdentifier,TTypeIdentifier}"/> interface. The common method of | |
| 56 | + /// <see cref="ISupportSourceIdentifiableFrameImage{TSourceIdentifier, TTypeIdentifier}"/> interface. The common method of | |
| 58 | 57 | /// identification is handled by creating a class derived from the <see cref="ICommonHeader{TTypeIdentifier}"/> which primarily |
| 59 | 58 | /// includes a TypeID property, but also should include any state information needed to parse a particular frame if necessary. |
| 60 | 59 | /// Derived classes override the <see cref="FrameImageParserBase{TTypeIdentifier, TOutputType}.ParseCommonHeader"/> |
| @@ -334,8 +333,10 @@ namespace GSF.Parsing · 273 unmodified lines | ||
| 334 | 333 | // Copy buffer data for processing (destination buffer pre-allocated from buffer pool) |
| 335 | 334 | Buffer.BlockCopy(buffer, offset, identifiableBuffer.Buffer, 0, count); |
| 336 | 335 | |
| 337 | − // Add buffer to the queue for parsing | |
| 338 | − m_bufferQueue.Enqueue(new SourceIdentifiableBuffer[] { identifiableBuffer }); | |
| 336 | + // Add buffer to the queue for parsing. Note that buffer is queued for parsing instead | |
| 337 | + // of handling parse on this thread - this has become necessary to reduce UDP data loss | |
| 338 | + // that can happen in-process when system has UDP buffers building up for processing. | |
| 339 | + m_bufferQueue.Enqueue(new[] { identifiableBuffer }); | |
| 339 | 340 | } |
| 340 | 341 | } |
| 341 | 342 | catch |
| @@ -398,7 +399,7 @@ namespace GSF.Parsing · 56 unmodified lines | ||
| 398 | 399 | throw new NotImplementedException("This method should not be called directly, call the Parse(TSourceIdentifier,byte[],int,int) method to queue data for parsing instead."); |
| 399 | 400 | } |
| 400 | 401 | |
| 401 | − // This method is used by the internal <see cref="ProcessQueue{T}"/> to process all queued data buffers. | |
| 402 | + // This method is used to process all queued data buffers. | |
| 402 | 403 | private void ParseQueuedBuffers(IList<SourceIdentifiableBuffer> buffers) |
| 403 | 404 | { |
| 404 | 405 | if (Enabled) |
| @@ -427,6 +428,16 @@ namespace GSF.Parsing · 22 unmodified lines | ||
| 427 | 428 | } |
| 428 | 429 | finally |
| 429 | 430 | { |
| 431 | + // Dispose of source buffers - this returns buffers to pool | |
| 432 | + if ((object)buffers != null) | |
| 433 | + { | |
| 434 | + foreach (SourceIdentifiableBuffer buffer in buffers) | |
| 435 | + { | |
| 436 | + if ((object)buffer != null) | |
| 437 | + buffer.Dispose(); | |
| 438 | + } | |
| 439 | + } | |
| 440 | + | |
| 430 | 441 | // If user has attached to SourceDataParsed event, expose list of parsed data per source |
| 431 | 442 | if ((object)SourceDataParsed != null) |
| 432 | 443 | { |
| @@ -435,28 +446,10 @@ namespace GSF.Parsing · 2 unmodified lines | ||
| 435 | 446 | OnSourceDataParsed(parsedData.Key, parsedData.Value); |
| 436 | 447 | } |
| 437 | 448 | |
| 438 | − // Clear parsed data dictionary for next pass | |
| 449 | + // Clear parsed data dictionary for next pass - note that this does not contend with | |
| 450 | + // OnDataParsed override since the event called synchronously via base.Write above. | |
| 439 | 451 | m_parsedSourceData.Clear(); |
| 440 | 452 | } |
| 441 | − | |
| 442 | − } | |
| 443 | − } | |
| 444 | − | |
| 445 | − // Dispose of source buffers - no rush | |
| 446 | − ThreadPool.QueueUserWorkItem(DisposeSourceBuffers, buffers); | |
| 447 | − } | |
| 448 | − | |
| 449 | − // Handle disposing of source buffers (this will return items to the reusable object pool) | |
| 450 | − private void DisposeSourceBuffers(object state) | |
| 451 | − { | |
| 452 | − SourceIdentifiableBuffer[] buffers = state as SourceIdentifiableBuffer[]; | |
| 453 | − | |
| 454 | − if ((object)buffers != null) | |
| 455 | − { | |
| 456 | − foreach (SourceIdentifiableBuffer buffer in buffers) | |
| 457 | − { | |
| 458 | − if ((object)buffer != null) | |
| 459 | − buffer.Dispose(); | |
| 460 | 453 | } |
| 461 | 454 | } |
| 462 | 455 | } |
| @@ -32,6 +32,8 @@ using System; · 31 unmodified lines | ||
| 32 | 32 | using System.Runtime.CompilerServices; |
| 33 | 33 | using System.Threading; |
| 34 | 34 | |
| 35 | +#pragma warning disable 420 | |
| 36 | + | |
| 35 | 37 | namespace GSF.Threading |
| 36 | 38 | { |
| 37 | 39 | internal abstract class ThreadContainerBase |
| @@ -188,7 +188,7 @@ namespace GSF.Historian.DataServices · 187 unmodified lines | ||
| 188 | 188 | while (true) |
| 189 | 189 | { |
| 190 | 190 | buffer = Archive.ReadMetaData(++id); |
| 191 | − if (buffer == null) | |
| 191 | + if ((object)buffer == null) | |
| 192 | 192 | // No more records. |
| 193 | 193 | break; |
| 194 | 194 | else |
| @@ -227,7 +227,7 @@ namespace GSF.Historian.DataServices · 32 unmodified lines | ||
| 227 | 227 | foreach (string singleID in idList.Split(',', ';')) |
| 228 | 228 | { |
| 229 | 229 | buffer = Archive.ReadMetaData(id = int.Parse(singleID)); |
| 230 | − if (buffer == null) | |
| 230 | + if ((object)buffer == null) | |
| 231 | 231 | // ID is invalid. |
| 232 | 232 | continue; |
| 233 | 233 | else |
| @@ -265,7 +265,7 @@ namespace GSF.Historian.DataServices · 31 unmodified lines | ||
| 265 | 265 | for (int id = int.Parse(fromID); id <= int.Parse(toID); id++) |
| 266 | 266 | { |
| 267 | 267 | buffer = Archive.ReadMetaData(id); |
| 268 | − if (buffer == null) | |
| 268 | + if ((object)buffer == null) | |
| 269 | 269 | // ID is invalid. |
| 270 | 270 | continue; |
| 271 | 271 | else |
| @@ -242,7 +242,7 @@ namespace GSF.Historian.DataServices · 241 unmodified lines | ||
| 242 | 242 | foreach (string singleID in idList.Split(',', ';')) |
| 243 | 243 | { |
| 244 | 244 | buffer = Archive.ReadStateData(id = int.Parse(singleID)); |
| 245 | − if (buffer == null) | |
| 245 | + if ((object)buffer == null) | |
| 246 | 246 | { |
| 247 | 247 | // ID is invalid. |
| 248 | 248 | continue; |
| @@ -286,7 +286,7 @@ namespace GSF.Historian.DataServices · 37 unmodified lines | ||
| 286 | 286 | for (int id = int.Parse(fromID); id <= int.Parse(toID); id++) |
| 287 | 287 | { |
| 288 | 288 | buffer = Archive.ReadStateData(id); |
| 289 | − if (buffer == null) | |
| 289 | + if ((object)buffer == null) | |
| 290 | 290 | { |
| 291 | 291 | // ID is invalid. |
| 292 | 292 | continue; |
| @@ -211,8 +211,8 @@ namespace GSF.Historian.Files · 210 unmodified lines | ||
| 211 | 211 | if (length >= FixedLength) |
| 212 | 212 | { |
| 213 | 213 | // Binary image has sufficient data. |
| 214 | − HistorianID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex); | |
| 215 | − StartTime = new TimeTag(EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 4)); | |
| 214 | + HistorianID = LittleEndian.ToInt32(buffer, startIndex); | |
| 215 | + StartTime = new TimeTag(LittleEndian.ToDouble(buffer, startIndex + 4)); | |
| 216 | 216 | |
| 217 | 217 | return FixedLength; |
| 218 | 218 | } |
| @@ -238,8 +238,8 @@ namespace GSF.Historian.Files · 19 unmodified lines | ||
| 238 | 238 | |
| 239 | 239 | buffer.ValidateParameters(startIndex, length); |
| 240 | 240 | |
| 241 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex, 4); | |
| 242 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_startTime.Value), 0, buffer, startIndex + 4, 8); | |
| 241 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex, 4); | |
| 242 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_startTime.Value), 0, buffer, startIndex + 4, 8); | |
| 243 | 243 | |
| 244 | 244 | return length; |
| 245 | 245 | } |
| @@ -306,9 +306,9 @@ namespace GSF.Historian.Files · 305 unmodified lines | ||
| 306 | 306 | if (length >= FixedLength) |
| 307 | 307 | { |
| 308 | 308 | // Binary image has sufficient data. |
| 309 | − Flags = EndianOrder.LittleEndian.ToInt16(buffer, startIndex + 4); | |
| 310 | − Value = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 6); | |
| 311 | − Time = new TimeTag(EndianOrder.LittleEndian.ToInt32(buffer, startIndex) + // Seconds | |
| 309 | + Flags = LittleEndian.ToInt16(buffer, startIndex + 4); | |
| 310 | + Value = LittleEndian.ToSingle(buffer, startIndex + 6); | |
| 311 | + Time = new TimeTag(LittleEndian.ToInt32(buffer, startIndex) + // Seconds | |
| 312 | 312 | ((double)(m_flags.GetMaskedValue(MillisecondMask) >> 5) / 1000)); // Milliseconds |
| 313 | 313 | |
| 314 | 314 | return FixedLength; |
| @@ -337,9 +337,9 @@ namespace GSF.Historian.Files · 22 unmodified lines | ||
| 337 | 337 | |
| 338 | 338 | buffer.ValidateParameters(startIndex, length); |
| 339 | 339 | |
| 340 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes((int)m_time.Value), 0, buffer, startIndex, 4); | |
| 341 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes((short)m_flags), 0, buffer, startIndex + 4, 2); | |
| 342 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_value), 0, buffer, startIndex + 6, 4); | |
| 340 | + Buffer.BlockCopy(LittleEndian.GetBytes((int)m_time.Value), 0, buffer, startIndex, 4); | |
| 341 | + Buffer.BlockCopy(LittleEndian.GetBytes((short)m_flags), 0, buffer, startIndex + 4, 2); | |
| 342 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_value), 0, buffer, startIndex + 6, 4); | |
| 343 | 343 | |
| 344 | 344 | return length; |
| 345 | 345 | } |
| @@ -133,8 +133,8 @@ namespace GSF.Historian.Files · 132 unmodified lines | ||
| 133 | 133 | { |
| 134 | 134 | buffer.ValidateParameters(startIndex, length); |
| 135 | 135 | |
| 136 | − double startTime = EndianOrder.LittleEndian.ToDouble(buffer, startIndex); | |
| 137 | − double stopTime = EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 8); | |
| 136 | + double startTime = LittleEndian.ToDouble(buffer, startIndex); | |
| 137 | + double stopTime = LittleEndian.ToDouble(buffer, startIndex + 8); | |
| 138 | 138 | |
| 139 | 139 | // Validate file time tags |
| 140 | 140 | if (startTime < TimeTag.MinValue.Value || startTime > TimeTag.MaxValue.Value) |
| @@ -145,10 +145,10 @@ namespace GSF.Historian.Files · 4 unmodified lines | ||
| 145 | 145 | |
| 146 | 146 | m_parent.FileStartTime = new TimeTag(startTime); |
| 147 | 147 | m_parent.FileEndTime = new TimeTag(stopTime); |
| 148 | − m_parent.DataPointsReceived = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 16); | |
| 149 | − m_parent.DataPointsArchived = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 20); | |
| 150 | − m_parent.DataBlockSize = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 24); | |
| 151 | − m_parent.DataBlockCount = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 28); | |
| 148 | + m_parent.DataPointsReceived = LittleEndian.ToInt32(buffer, startIndex + 16); | |
| 149 | + m_parent.DataPointsArchived = LittleEndian.ToInt32(buffer, startIndex + 20); | |
| 150 | + m_parent.DataBlockSize = LittleEndian.ToInt32(buffer, startIndex + 24); | |
| 151 | + m_parent.DataBlockCount = LittleEndian.ToInt32(buffer, startIndex + 28); | |
| 152 | 152 | |
| 153 | 153 | return FixedLength; |
| 154 | 154 | } |
| @@ -170,12 +170,12 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 170 | 170 | |
| 171 | 171 | buffer.ValidateParameters(startIndex, length); |
| 172 | 172 | |
| 173 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_parent.m_fileStartTime.Value), 0, buffer, startIndex, 8); | |
| 174 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_parent.m_fileEndTime.Value), 0, buffer, startIndex + 8, 8); | |
| 175 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_parent.m_dataPointsReceived), 0, buffer, startIndex + 16, 4); | |
| 176 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_parent.m_dataPointsArchived), 0, buffer, startIndex + 20, 4); | |
| 177 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_parent.m_dataBlockSize), 0, buffer, startIndex + 24, 4); | |
| 178 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_parent.m_dataBlockCount), 0, buffer, startIndex + 28, 4); | |
| 173 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_parent.m_fileStartTime.Value), 0, buffer, startIndex, 8); | |
| 174 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_parent.m_fileEndTime.Value), 0, buffer, startIndex + 8, 8); | |
| 175 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_parent.m_dataPointsReceived), 0, buffer, startIndex + 16, 4); | |
| 176 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_parent.m_dataPointsArchived), 0, buffer, startIndex + 20, 4); | |
| 177 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_parent.m_dataBlockSize), 0, buffer, startIndex + 24, 4); | |
| 178 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_parent.m_dataBlockCount), 0, buffer, startIndex + 28, 4); | |
| 179 | 179 | |
| 180 | 180 | return length; |
| 181 | 181 | } |
| @@ -489,7 +489,7 @@ namespace GSF.Historian.Files · 307 unmodified lines | ||
| 489 | 489 | { |
| 490 | 490 | ArchiveDataBlock unusedDataBlock = FindDataBlock(-1); |
| 491 | 491 | |
| 492 | − if (unusedDataBlock != null) | |
| 492 | + if ((object)unusedDataBlock != null) | |
| 493 | 493 | return m_dataBlockCount - unusedDataBlock.Index; |
| 494 | 494 | |
| 495 | 495 | return 0; |
| @@ -772,18 +772,18 @@ namespace GSF.Historian.Files · 276 unmodified lines | ||
| 772 | 772 | // Negative data block index is specified indicating a search must be performed for a data block. |
| 773 | 773 | dataBlock = FindLastDataBlock(historianID); |
| 774 | 774 | |
| 775 | − if (dataBlock != null && dataBlock.SlotsAvailable == 0) | |
| 775 | + if ((object)dataBlock != null && dataBlock.SlotsAvailable == 0) | |
| 776 | 776 | { |
| 777 | 777 | // Previously used data block is full. |
| 778 | 778 | dataBlock = null; |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | − if (dataBlock == null) | |
| 781 | + if ((object)dataBlock == null) | |
| 782 | 782 | { |
| 783 | 783 | // Look for the first unallocated data block. |
| 784 | 784 | dataBlock = FindDataBlock(-1); |
| 785 | 785 | |
| 786 | − if (dataBlock == null) | |
| 786 | + if ((object)dataBlock == null) | |
| 787 | 787 | { |
| 788 | 788 | // Extend the file for historic writes only. |
| 789 | 789 | if (m_parent.FileType == ArchiveFileType.Historic) |
| @@ -801,7 +801,7 @@ namespace GSF.Historian.Files · 11 unmodified lines | ||
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | // Get the pointer to the data block so that its information can be updated if necessary. |
| 804 | − if (dataBlock == null) | |
| 804 | + if ((object)dataBlock == null) | |
| 805 | 805 | { |
| 806 | 806 | dataBlockPointer = null; |
| 807 | 807 | } |
| @@ -814,7 +814,7 @@ namespace GSF.Historian.Files · 6 unmodified lines | ||
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | − if (dataBlockPointer != null && !dataBlockPointer.IsAllocated) | |
| 817 | + if ((object)dataBlockPointer != null && !dataBlockPointer.IsAllocated) | |
| 818 | 818 | { |
| 819 | 819 | // Mark the data block as allocated. |
| 820 | 820 | dataBlockPointer.HistorianID = historianID; |
| @@ -238,14 +238,14 @@ namespace GSF.Historian.Files · 237 unmodified lines | ||
| 238 | 238 | if (length >= FixedLength) |
| 239 | 239 | { |
| 240 | 240 | // Binary image has sufficient data. |
| 241 | − DataBlocksUsed = EndianOrder.LittleEndian.ToInt32(buffer, startIndex); | |
| 242 | − RolloverInProgress = EndianOrder.LittleEndian.ToBoolean(buffer, startIndex + 4); | |
| 243 | − LatestDataTime = new TimeTag(EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 8)); | |
| 244 | − LatestDataID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 16); | |
| 241 | + DataBlocksUsed = LittleEndian.ToInt32(buffer, startIndex); | |
| 242 | + RolloverInProgress = LittleEndian.ToBoolean(buffer, startIndex + 4); | |
| 243 | + LatestDataTime = new TimeTag(LittleEndian.ToDouble(buffer, startIndex + 8)); | |
| 244 | + LatestDataID = LittleEndian.ToInt32(buffer, startIndex + 16); | |
| 245 | 245 | |
| 246 | 246 | for (int i = 0; i < m_sourceLatestDataTime.Count; i++) |
| 247 | 247 | { |
| 248 | − m_sourceLatestDataTime[i] = new TimeTag(EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 20 + (i * 8))); | |
| 248 | + m_sourceLatestDataTime[i] = new TimeTag(LittleEndian.ToDouble(buffer, startIndex + 20 + (i * 8))); | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return FixedLength; |
| @@ -276,14 +276,14 @@ namespace GSF.Historian.Files · 24 unmodified lines | ||
| 276 | 276 | |
| 277 | 277 | lock (this) |
| 278 | 278 | { |
| 279 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_dataBlocksUsed), 0, buffer, startIndex, 4); | |
| 280 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(Convert.ToInt32(m_rolloverInProgress)), 0, buffer, startIndex + 4, 4); | |
| 281 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_latestDataTime.Value), 0, buffer, startIndex + 8, 8); | |
| 282 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_latestDataID), 0, buffer, startIndex + 16, 4); | |
| 279 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_dataBlocksUsed), 0, buffer, startIndex, 4); | |
| 280 | + Buffer.BlockCopy(LittleEndian.GetBytes(Convert.ToInt32(m_rolloverInProgress)), 0, buffer, startIndex + 4, 4); | |
| 281 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_latestDataTime.Value), 0, buffer, startIndex + 8, 8); | |
| 282 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_latestDataID), 0, buffer, startIndex + 16, 4); | |
| 283 | 283 | |
| 284 | 284 | for (int i = 0; i < m_sourceLatestDataTime.Count; i++) |
| 285 | 285 | { |
| 286 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_sourceLatestDataTime[i].Value), 0, buffer, startIndex + 20 + (i * 8), 8); | |
| 286 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_sourceLatestDataTime[i].Value), 0, buffer, startIndex + 20 + (i * 8), 8); | |
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| @@ -191,7 +191,7 @@ namespace GSF.Historian.Files · 190 unmodified lines | ||
| 191 | 191 | } |
| 192 | 192 | set |
| 193 | 193 | { |
| 194 | − if (value == null) | |
| 194 | + if ((object)value == null) | |
| 195 | 195 | throw new ArgumentNullException("value"); |
| 196 | 196 | |
| 197 | 197 | m_remarks = value.TruncateRight(512); |
| @@ -213,7 +213,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 213 | 213 | } |
| 214 | 214 | set |
| 215 | 215 | { |
| 216 | − if (value == null) | |
| 216 | + if ((object)value == null) | |
| 217 | 217 | throw new ArgumentNullException("value"); |
| 218 | 218 | |
| 219 | 219 | m_hardwareInfo = value.TruncateRight(512); |
| @@ -236,7 +236,7 @@ namespace GSF.Historian.Files · 16 unmodified lines | ||
| 236 | 236 | } |
| 237 | 237 | set |
| 238 | 238 | { |
| 239 | − if (value == null) | |
| 239 | + if ((object)value == null) | |
| 240 | 240 | throw new ArgumentNullException("value"); |
| 241 | 241 | |
| 242 | 242 | m_emailAddresses = value.TruncateRight(512); |
| @@ -258,7 +258,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 258 | 258 | } |
| 259 | 259 | set |
| 260 | 260 | { |
| 261 | − if (value == null) | |
| 261 | + if ((object)value == null) | |
| 262 | 262 | throw new ArgumentNullException("value"); |
| 263 | 263 | |
| 264 | 264 | m_description = value.TruncateRight(80); |
| @@ -280,7 +280,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 280 | 280 | } |
| 281 | 281 | set |
| 282 | 282 | { |
| 283 | − if (value == null) | |
| 283 | + if ((object)value == null) | |
| 284 | 284 | throw new ArgumentNullException("value"); |
| 285 | 285 | |
| 286 | 286 | m_currentData = value.TruncateRight(80); |
| @@ -302,7 +302,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 302 | 302 | } |
| 303 | 303 | set |
| 304 | 304 | { |
| 305 | − if (value == null) | |
| 305 | + if ((object)value == null) | |
| 306 | 306 | throw new ArgumentNullException("value"); |
| 307 | 307 | |
| 308 | 308 | m_name = value.TruncateRight(40); |
| @@ -324,7 +324,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 324 | 324 | } |
| 325 | 325 | set |
| 326 | 326 | { |
| 327 | − if (value == null) | |
| 327 | + if ((object)value == null) | |
| 328 | 328 | throw new ArgumentNullException("value"); |
| 329 | 329 | |
| 330 | 330 | m_synonym1 = value.TruncateRight(40); |
| @@ -346,7 +346,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 346 | 346 | } |
| 347 | 347 | set |
| 348 | 348 | { |
| 349 | − if (value == null) | |
| 349 | + if ((object)value == null) | |
| 350 | 350 | throw new ArgumentNullException("value"); |
| 351 | 351 | |
| 352 | 352 | m_synonym2 = value.TruncateRight(40); |
| @@ -368,7 +368,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 368 | 368 | } |
| 369 | 369 | set |
| 370 | 370 | { |
| 371 | − if (value == null) | |
| 371 | + if ((object)value == null) | |
| 372 | 372 | throw new ArgumentNullException("value"); |
| 373 | 373 | |
| 374 | 374 | m_synonym3 = value.TruncateRight(40); |
| @@ -391,7 +391,7 @@ namespace GSF.Historian.Files · 16 unmodified lines | ||
| 391 | 391 | } |
| 392 | 392 | set |
| 393 | 393 | { |
| 394 | − if (value == null) | |
| 394 | + if ((object)value == null) | |
| 395 | 395 | throw new ArgumentNullException("value"); |
| 396 | 396 | |
| 397 | 397 | m_pagerNumbers = value.TruncateRight(40); |
| @@ -414,7 +414,7 @@ namespace GSF.Historian.Files · 16 unmodified lines | ||
| 414 | 414 | } |
| 415 | 415 | set |
| 416 | 416 | { |
| 417 | − if (value == null) | |
| 417 | + if ((object)value == null) | |
| 418 | 418 | throw new ArgumentNullException("value"); |
| 419 | 419 | |
| 420 | 420 | m_phoneNumbers = value.TruncateRight(40); |
| @@ -436,7 +436,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 436 | 436 | } |
| 437 | 437 | set |
| 438 | 438 | { |
| 439 | − if (value == null) | |
| 439 | + if ((object)value == null) | |
| 440 | 440 | throw new ArgumentNullException("value"); |
| 441 | 441 | |
| 442 | 442 | m_plantCode = value.TruncateRight(24); |
| @@ -458,7 +458,7 @@ namespace GSF.Historian.Files · 15 unmodified lines | ||
| 458 | 458 | } |
| 459 | 459 | set |
| 460 | 460 | { |
| 461 | − if (value == null) | |
| 461 | + if ((object)value == null) | |
| 462 | 462 | throw new ArgumentNullException("value"); |
| 463 | 463 | |
| 464 | 464 | m_system = value.TruncateRight(24); |
| @@ -529,7 +529,7 @@ namespace GSF.Historian.Files · 64 unmodified lines | ||
| 529 | 529 | } |
| 530 | 530 | set |
| 531 | 531 | { |
| 532 | − if (value == null) | |
| 532 | + if ((object)value == null) | |
| 533 | 533 | throw new ArgumentNullException("value"); |
| 534 | 534 | |
| 535 | 535 | m_securityFlags = value; |
| @@ -548,7 +548,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 548 | 548 | } |
| 549 | 549 | set |
| 550 | 550 | { |
| 551 | − if (value == null) | |
| 551 | + if ((object)value == null) | |
| 552 | 552 | throw new ArgumentNullException("value"); |
| 553 | 553 | |
| 554 | 554 | m_generalFlags = value; |
| @@ -567,7 +567,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 567 | 567 | } |
| 568 | 568 | set |
| 569 | 569 | { |
| 570 | − if (value == null) | |
| 570 | + if ((object)value == null) | |
| 571 | 571 | throw new ArgumentNullException("value"); |
| 572 | 572 | |
| 573 | 573 | m_alarmFlags = value; |
| @@ -647,7 +647,7 @@ namespace GSF.Historian.Files · 73 unmodified lines | ||
| 647 | 647 | } |
| 648 | 648 | set |
| 649 | 649 | { |
| 650 | − if (value == null) | |
| 650 | + if ((object)value == null) | |
| 651 | 651 | throw new ArgumentNullException("value"); |
| 652 | 652 | |
| 653 | 653 | m_analogFields = value; |
| @@ -666,7 +666,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 666 | 666 | } |
| 667 | 667 | set |
| 668 | 668 | { |
| 669 | − if (value == null) | |
| 669 | + if ((object)value == null) | |
| 670 | 670 | throw new ArgumentNullException("value"); |
| 671 | 671 | |
| 672 | 672 | m_digitalFields = value; |
| @@ -685,7 +685,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 685 | 685 | } |
| 686 | 686 | set |
| 687 | 687 | { |
| 688 | − if (value == null) | |
| 688 | + if ((object)value == null) | |
| 689 | 689 | throw new ArgumentNullException("value"); |
| 690 | 690 | |
| 691 | 691 | m_composedFields = value; |
| @@ -704,7 +704,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 704 | 704 | } |
| 705 | 705 | set |
| 706 | 706 | { |
| 707 | − if (value == null) | |
| 707 | + if ((object)value == null) | |
| 708 | 708 | throw new ArgumentNullException("value"); |
| 709 | 709 | |
| 710 | 710 | m_constantFields = value; |
| @@ -774,14 +774,14 @@ namespace GSF.Historian.Files · 63 unmodified lines | ||
| 774 | 774 | PlantCode = Encoding.ASCII.GetString(buffer, startIndex + 1936, 24).Trim(); |
| 775 | 775 | SystemName = Encoding.ASCII.GetString(buffer, startIndex + 1960, 24).Trim(); |
| 776 | 776 | EmailTime = Encoding.ASCII.GetString(buffer, startIndex + 1984, 40).Trim(); |
| 777 | − ScanRate = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 2104); | |
| 778 | − UnitNumber = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2108); | |
| 779 | − SecurityFlags.Value = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2112); | |
| 780 | − GeneralFlags.Value = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2116); | |
| 781 | − AlarmFlags.Value = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2120); | |
| 782 | − CompressionMinTime = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2124); | |
| 783 | − CompressionMaxTime = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2128); | |
| 784 | − SourceID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2132); | |
| 777 | + ScanRate = LittleEndian.ToSingle(buffer, startIndex + 2104); | |
| 778 | + UnitNumber = LittleEndian.ToInt32(buffer, startIndex + 2108); | |
| 779 | + SecurityFlags.Value = LittleEndian.ToInt32(buffer, startIndex + 2112); | |
| 780 | + GeneralFlags.Value = LittleEndian.ToInt32(buffer, startIndex + 2116); | |
| 781 | + AlarmFlags.Value = LittleEndian.ToInt32(buffer, startIndex + 2120); | |
| 782 | + CompressionMinTime = LittleEndian.ToInt32(buffer, startIndex + 2124); | |
| 783 | + CompressionMaxTime = LittleEndian.ToInt32(buffer, startIndex + 2128); | |
| 784 | + SourceID = LittleEndian.ToInt32(buffer, startIndex + 2132); | |
| 785 | 785 | switch (GeneralFlags.DataType) |
| 786 | 786 | { |
| 787 | 787 | case DataType.Analog: |
| @@ -839,14 +839,14 @@ namespace GSF.Historian.Files · 51 unmodified lines | ||
| 839 | 839 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_plantCode.PadRight(24)), 0, buffer, startIndex + 1936, 24); |
| 840 | 840 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_system.PadRight(24)), 0, buffer, startIndex + 1960, 24); |
| 841 | 841 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_emailTime.PadRight(40)), 0, buffer, startIndex + 1984, 40); |
| 842 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_scanRate), 0, buffer, startIndex + 2104, 4); | |
| 843 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_unitNumber), 0, buffer, startIndex + 2108, 4); | |
| 844 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_securityFlags.Value), 0, buffer, startIndex + 2112, 4); | |
| 845 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_generalFlags.Value), 0, buffer, startIndex + 2116, 4); | |
| 846 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_alarmFlags.Value), 0, buffer, startIndex + 2120, 4); | |
| 847 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_compressionMinTime), 0, buffer, startIndex + 2124, 4); | |
| 848 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_compressionMaxTime), 0, buffer, startIndex + 2128, 4); | |
| 849 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_sourceID), 0, buffer, startIndex + 2132, 4); | |
| 842 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_scanRate), 0, buffer, startIndex + 2104, 4); | |
| 843 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_unitNumber), 0, buffer, startIndex + 2108, 4); | |
| 844 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_securityFlags.Value), 0, buffer, startIndex + 2112, 4); | |
| 845 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_generalFlags.Value), 0, buffer, startIndex + 2116, 4); | |
| 846 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_alarmFlags.Value), 0, buffer, startIndex + 2120, 4); | |
| 847 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_compressionMinTime), 0, buffer, startIndex + 2124, 4); | |
| 848 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_compressionMaxTime), 0, buffer, startIndex + 2128, 4); | |
| 849 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_sourceID), 0, buffer, startIndex + 2132, 4); | |
| 850 | 850 | switch (m_generalFlags.DataType) |
| 851 | 851 | { |
| 852 | 852 | case DataType.Analog: |
| @@ -116,7 +116,7 @@ namespace GSF.Historian.Files · 115 unmodified lines | ||
| 116 | 116 | } |
| 117 | 117 | set |
| 118 | 118 | { |
| 119 | − if (value == null) | |
| 119 | + if ((object)value == null) | |
| 120 | 120 | throw new ArgumentNullException("value"); |
| 121 | 121 | |
| 122 | 122 | m_engineeringUnits = value.TruncateRight(24); |
| @@ -301,16 +301,16 @@ namespace GSF.Historian.Files · 178 unmodified lines | ||
| 301 | 301 | { |
| 302 | 302 | // Binary image has sufficient data. |
| 303 | 303 | EngineeringUnits = Encoding.ASCII.GetString(buffer, startIndex, 24).Trim(); |
| 304 | − HighAlarm = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 24); | |
| 305 | − LowAlarm = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 28); | |
| 306 | − HighRange = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 32); | |
| 307 | − LowRange = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 36); | |
| 308 | − HighWarning = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 40); | |
| 309 | − LowWarning = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 44); | |
| 310 | − ExceptionLimit = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 48); | |
| 311 | − CompressionLimit = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 52); | |
| 312 | − AlarmDelay = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 56); | |
| 313 | − DisplayDigits = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 60); | |
| 304 | + HighAlarm = LittleEndian.ToSingle(buffer, startIndex + 24); | |
| 305 | + LowAlarm = LittleEndian.ToSingle(buffer, startIndex + 28); | |
| 306 | + HighRange = LittleEndian.ToSingle(buffer, startIndex + 32); | |
| 307 | + LowRange = LittleEndian.ToSingle(buffer, startIndex + 36); | |
| 308 | + HighWarning = LittleEndian.ToSingle(buffer, startIndex + 40); | |
| 309 | + LowWarning = LittleEndian.ToSingle(buffer, startIndex + 44); | |
| 310 | + ExceptionLimit = LittleEndian.ToSingle(buffer, startIndex + 48); | |
| 311 | + CompressionLimit = LittleEndian.ToSingle(buffer, startIndex + 52); | |
| 312 | + AlarmDelay = LittleEndian.ToSingle(buffer, startIndex + 56); | |
| 313 | + DisplayDigits = LittleEndian.ToInt32(buffer, startIndex + 60); | |
| 314 | 314 | |
| 315 | 315 | return FixedLength; |
| 316 | 316 | } |
| @@ -339,16 +339,16 @@ namespace GSF.Historian.Files · 22 unmodified lines | ||
| 339 | 339 | buffer.ValidateParameters(startIndex, length); |
| 340 | 340 | |
| 341 | 341 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_engineeringUnits.PadRight(24)), 0, buffer, startIndex, 24); |
| 342 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highAlarm), 0, buffer, startIndex + 24, 4); | |
| 343 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowAlarm), 0, buffer, startIndex + 28, 4); | |
| 344 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highRange), 0, buffer, startIndex + 32, 4); | |
| 345 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowRange), 0, buffer, startIndex + 36, 4); | |
| 346 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highWarning), 0, buffer, startIndex + 40, 4); | |
| 347 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowWarning), 0, buffer, startIndex + 44, 4); | |
| 348 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_exceptionLimit), 0, buffer, startIndex + 48, 4); | |
| 349 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_compressionLimit), 0, buffer, startIndex + 52, 4); | |
| 350 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_alarmDelay), 0, buffer, startIndex + 56, 4); | |
| 351 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_displayDigits), 0, buffer, startIndex + 60, 4); | |
| 342 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highAlarm), 0, buffer, startIndex + 24, 4); | |
| 343 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowAlarm), 0, buffer, startIndex + 28, 4); | |
| 344 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highRange), 0, buffer, startIndex + 32, 4); | |
| 345 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowRange), 0, buffer, startIndex + 36, 4); | |
| 346 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highWarning), 0, buffer, startIndex + 40, 4); | |
| 347 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowWarning), 0, buffer, startIndex + 44, 4); | |
| 348 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_exceptionLimit), 0, buffer, startIndex + 48, 4); | |
| 349 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_compressionLimit), 0, buffer, startIndex + 52, 4); | |
| 350 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_alarmDelay), 0, buffer, startIndex + 56, 4); | |
| 351 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_displayDigits), 0, buffer, startIndex + 60, 4); | |
| 352 | 352 | |
| 353 | 353 | return length; |
| 354 | 354 | } |
| @@ -234,7 +234,7 @@ namespace GSF.Historian.Files · 233 unmodified lines | ||
| 234 | 234 | } |
| 235 | 235 | set |
| 236 | 236 | { |
| 237 | − if (value == null) | |
| 237 | + if ((object)value == null) | |
| 238 | 238 | throw new ArgumentNullException("value"); |
| 239 | 239 | |
| 240 | 240 | m_engineeringUnits = value.TruncateRight(24); |
| @@ -253,7 +253,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 253 | 253 | } |
| 254 | 254 | set |
| 255 | 255 | { |
| 256 | − if (value == null) | |
| 256 | + if ((object)value == null) | |
| 257 | 257 | throw new ArgumentNullException("value"); |
| 258 | 258 | |
| 259 | 259 | m_equation = value.TruncateRight(256); |
| @@ -302,20 +302,20 @@ namespace GSF.Historian.Files · 42 unmodified lines | ||
| 302 | 302 | if (length >= FixedLength) |
| 303 | 303 | { |
| 304 | 304 | // Binary image has sufficient data. |
| 305 | − HighAlarm = EndianOrder.LittleEndian.ToSingle(buffer, startIndex); | |
| 306 | − LowAlarm = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 4); | |
| 307 | − HighRange = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 8); | |
| 308 | − LowRange = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 12); | |
| 309 | − LowWarning = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 16); | |
| 310 | − HighWarning = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 20); | |
| 311 | − DisplayDigits = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 24); | |
| 305 | + HighAlarm = LittleEndian.ToSingle(buffer, startIndex); | |
| 306 | + LowAlarm = LittleEndian.ToSingle(buffer, startIndex + 4); | |
| 307 | + HighRange = LittleEndian.ToSingle(buffer, startIndex + 8); | |
| 308 | + LowRange = LittleEndian.ToSingle(buffer, startIndex + 12); | |
| 309 | + LowWarning = LittleEndian.ToSingle(buffer, startIndex + 16); | |
| 310 | + HighWarning = LittleEndian.ToSingle(buffer, startIndex + 20); | |
| 311 | + DisplayDigits = LittleEndian.ToInt32(buffer, startIndex + 24); | |
| 312 | 312 | for (int i = 0; i < m_inputPointers.Count; i++) |
| 313 | 313 | { |
| 314 | − m_inputPointers[i] = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 28 + (i * 4)); | |
| 314 | + m_inputPointers[i] = LittleEndian.ToInt32(buffer, startIndex + 28 + (i * 4)); | |
| 315 | 315 | } |
| 316 | 316 | EngineeringUnits = Encoding.ASCII.GetString(buffer, startIndex + 76, 24).Trim(); |
| 317 | 317 | Equation = Encoding.ASCII.GetString(buffer, startIndex + 100, 256).Trim(); |
| 318 | − CompressionLimit = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 356); | |
| 318 | + CompressionLimit = LittleEndian.ToSingle(buffer, startIndex + 356); | |
| 319 | 319 | |
| 320 | 320 | return FixedLength; |
| 321 | 321 | } |
| @@ -343,20 +343,20 @@ namespace GSF.Historian.Files · 21 unmodified lines | ||
| 343 | 343 | |
| 344 | 344 | buffer.ValidateParameters(startIndex, length); |
| 345 | 345 | |
| 346 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highAlarm), 0, buffer, startIndex, 4); | |
| 347 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowAlarm), 0, buffer, startIndex + 4, 4); | |
| 348 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highRange), 0, buffer, startIndex + 8, 4); | |
| 349 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowRange), 0, buffer, startIndex + 12, 4); | |
| 350 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowWarning), 0, buffer, startIndex + 16, 4); | |
| 351 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highWarning), 0, buffer, startIndex + 20, 4); | |
| 352 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_displayDigits), 0, buffer, startIndex + 24, 4); | |
| 346 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highAlarm), 0, buffer, startIndex, 4); | |
| 347 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowAlarm), 0, buffer, startIndex + 4, 4); | |
| 348 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highRange), 0, buffer, startIndex + 8, 4); | |
| 349 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowRange), 0, buffer, startIndex + 12, 4); | |
| 350 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowWarning), 0, buffer, startIndex + 16, 4); | |
| 351 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highWarning), 0, buffer, startIndex + 20, 4); | |
| 352 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_displayDigits), 0, buffer, startIndex + 24, 4); | |
| 353 | 353 | for (int i = 0; i < m_inputPointers.Count; i++) |
| 354 | 354 | { |
| 355 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_inputPointers[i]), 0, buffer, startIndex + 28 + (i * 4), 4); | |
| 355 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_inputPointers[i]), 0, buffer, startIndex + 28 + (i * 4), 4); | |
| 356 | 356 | } |
| 357 | 357 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_engineeringUnits.PadRight(24)), 0, buffer, startIndex + 76, 24); |
| 358 | 358 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_equation.PadRight(256)), 0, buffer, startIndex + 100, 256); |
| 359 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_compressionLimit), 0, buffer, startIndex + 356, 4); | |
| 359 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_compressionLimit), 0, buffer, startIndex + 356, 4); | |
| 360 | 360 | |
| 361 | 361 | return length; |
| 362 | 362 | } |
| @@ -136,8 +136,8 @@ namespace GSF.Historian.Files · 135 unmodified lines | ||
| 136 | 136 | if (length >= FixedLength) |
| 137 | 137 | { |
| 138 | 138 | // Binary image has sufficient data. |
| 139 | − Value = EndianOrder.LittleEndian.ToSingle(buffer, startIndex); | |
| 140 | − DisplayDigits = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 4); | |
| 139 | + Value = LittleEndian.ToSingle(buffer, startIndex); | |
| 140 | + DisplayDigits = LittleEndian.ToInt32(buffer, startIndex + 4); | |
| 141 | 141 | |
| 142 | 142 | return FixedLength; |
| 143 | 143 | } |
| @@ -165,8 +165,8 @@ namespace GSF.Historian.Files · 21 unmodified lines | ||
| 165 | 165 | |
| 166 | 166 | buffer.ValidateParameters(startIndex, length); |
| 167 | 167 | |
| 168 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_value), 0, buffer, startIndex, 4); | |
| 169 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_displayDigits), 0, buffer, startIndex + 4, 4); | |
| 168 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_value), 0, buffer, startIndex, 4); | |
| 169 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_displayDigits), 0, buffer, startIndex + 4, 4); | |
| 170 | 170 | |
| 171 | 171 | return length; |
| 172 | 172 | } |
| @@ -188,8 +188,8 @@ namespace GSF.Historian.Files · 187 unmodified lines | ||
| 188 | 188 | // Binary image has sufficient data. |
| 189 | 189 | SetDescription = Encoding.ASCII.GetString(buffer, startIndex, 24).Trim(); |
| 190 | 190 | ClearDescription = Encoding.ASCII.GetString(buffer, startIndex + 24, 24).Trim(); |
| 191 | − AlarmState = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 48); | |
| 192 | − AlarmDelay = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 52); | |
| 191 | + AlarmState = LittleEndian.ToInt32(buffer, startIndex + 48); | |
| 192 | + AlarmDelay = LittleEndian.ToSingle(buffer, startIndex + 52); | |
| 193 | 193 | |
| 194 | 194 | return FixedLength; |
| 195 | 195 | } |
| @@ -219,8 +219,8 @@ namespace GSF.Historian.Files · 23 unmodified lines | ||
| 219 | 219 | |
| 220 | 220 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_setDescription.PadRight(24)), 0, buffer, startIndex, 24); |
| 221 | 221 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(m_clearDescription.PadRight(24)), 0, buffer, startIndex + 24, 24); |
| 222 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_alarmState), 0, buffer, startIndex + 48, 4); | |
| 223 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_alarmDelay), 0, buffer, startIndex + 52, 4); | |
| 222 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_alarmState), 0, buffer, startIndex + 48, 4); | |
| 223 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_alarmDelay), 0, buffer, startIndex + 52, 4); | |
| 224 | 224 | |
| 225 | 225 | return length; |
| 226 | 226 | } |
| @@ -282,15 +282,15 @@ namespace GSF.Historian.Files · 281 unmodified lines | ||
| 282 | 282 | if (length >= FixedLength) |
| 283 | 283 | { |
| 284 | 284 | // Binary image has sufficient data. |
| 285 | − HistorianID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 0); | |
| 286 | − ExceptionLimit = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 4); | |
| 287 | − Enabled = Convert.ToBoolean(EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 8)); | |
| 288 | − HighWarning = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 12); | |
| 289 | − LowWarning = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 16); | |
| 290 | − HighAlarm = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 20); | |
| 291 | − LowAlarm = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 24); | |
| 292 | − HighRange = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 28); | |
| 293 | − LowRange = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 32); | |
| 285 | + HistorianID = LittleEndian.ToInt32(buffer, startIndex + 0); | |
| 286 | + ExceptionLimit = LittleEndian.ToSingle(buffer, startIndex + 4); | |
| 287 | + Enabled = Convert.ToBoolean(LittleEndian.ToInt32(buffer, startIndex + 8)); | |
| 288 | + HighWarning = LittleEndian.ToSingle(buffer, startIndex + 12); | |
| 289 | + LowWarning = LittleEndian.ToSingle(buffer, startIndex + 16); | |
| 290 | + HighAlarm = LittleEndian.ToSingle(buffer, startIndex + 20); | |
| 291 | + LowAlarm = LittleEndian.ToSingle(buffer, startIndex + 24); | |
| 292 | + HighRange = LittleEndian.ToSingle(buffer, startIndex + 28); | |
| 293 | + LowRange = LittleEndian.ToSingle(buffer, startIndex + 32); | |
| 294 | 294 | |
| 295 | 295 | return FixedLength; |
| 296 | 296 | } |
| @@ -318,15 +318,15 @@ namespace GSF.Historian.Files · 21 unmodified lines | ||
| 318 | 318 | |
| 319 | 319 | buffer.ValidateParameters(startIndex, length); |
| 320 | 320 | |
| 321 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex, 4); | |
| 322 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_exceptionLimit), 0, buffer, startIndex + 4, 4); | |
| 323 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(Convert.ToInt32(m_enabled)), 0, buffer, startIndex + 8, 4); | |
| 324 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highWarning), 0, buffer, startIndex + 12, 4); | |
| 325 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowWarning), 0, buffer, startIndex + 16, 4); | |
| 326 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highAlarm), 0, buffer, startIndex + 20, 4); | |
| 327 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowAlarm), 0, buffer, startIndex + 24, 4); | |
| 328 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_highRange), 0, buffer, startIndex + 28, 4); | |
| 329 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_lowRange), 0, buffer, startIndex + 32, 4); | |
| 321 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex, 4); | |
| 322 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_exceptionLimit), 0, buffer, startIndex + 4, 4); | |
| 323 | + Buffer.BlockCopy(LittleEndian.GetBytes(Convert.ToInt32(m_enabled)), 0, buffer, startIndex + 8, 4); | |
| 324 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highWarning), 0, buffer, startIndex + 12, 4); | |
| 325 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowWarning), 0, buffer, startIndex + 16, 4); | |
| 326 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highAlarm), 0, buffer, startIndex + 20, 4); | |
| 327 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowAlarm), 0, buffer, startIndex + 24, 4); | |
| 328 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_highRange), 0, buffer, startIndex + 28, 4); | |
| 329 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_lowRange), 0, buffer, startIndex + 32, 4); | |
| 330 | 330 | |
| 331 | 331 | return length; |
| 332 | 332 | } |
| @@ -128,7 +128,7 @@ namespace GSF.Historian.Files · 127 unmodified lines | ||
| 128 | 128 | } |
| 129 | 129 | set |
| 130 | 130 | { |
| 131 | − if (value == null) | |
| 131 | + if ((object)value == null) | |
| 132 | 132 | throw new ArgumentNullException("value"); |
| 133 | 133 | |
| 134 | 134 | m_archivedData = value; |
| @@ -147,7 +147,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 147 | 147 | } |
| 148 | 148 | set |
| 149 | 149 | { |
| 150 | − if (value == null) | |
| 150 | + if ((object)value == null) | |
| 151 | 151 | throw new ArgumentNullException("value"); |
| 152 | 152 | |
| 153 | 153 | m_previousData = value; |
| @@ -166,7 +166,7 @@ namespace GSF.Historian.Files · 12 unmodified lines | ||
| 166 | 166 | } |
| 167 | 167 | set |
| 168 | 168 | { |
| 169 | − if (value == null) | |
| 169 | + if ((object)value == null) | |
| 170 | 170 | throw new ArgumentNullException("value"); |
| 171 | 171 | |
| 172 | 172 | m_currentData = value; |
| @@ -295,10 +295,10 @@ namespace GSF.Historian.Files · 122 unmodified lines | ||
| 295 | 295 | m_archivedData.ParseBinaryImage(buffer, startIndex, length); |
| 296 | 296 | m_previousData.ParseBinaryImage(buffer, startIndex + 16, length - 16); |
| 297 | 297 | m_currentData.ParseBinaryImage(buffer, startIndex + 32, length - 32); |
| 298 | − ActiveDataBlockIndex = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 48) - 1; | |
| 299 | − ActiveDataBlockSlot = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 52); | |
| 300 | − Slope1 = EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 56); | |
| 301 | − Slope2 = EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 64); | |
| 298 | + ActiveDataBlockIndex = LittleEndian.ToInt32(buffer, startIndex + 48) - 1; | |
| 299 | + ActiveDataBlockSlot = LittleEndian.ToInt32(buffer, startIndex + 52); | |
| 300 | + Slope1 = LittleEndian.ToDouble(buffer, startIndex + 56); | |
| 301 | + Slope2 = LittleEndian.ToDouble(buffer, startIndex + 64); | |
| 302 | 302 | |
| 303 | 303 | return FixedLength; |
| 304 | 304 | } |
| @@ -200,9 +200,9 @@ namespace GSF.Historian.Files · 199 unmodified lines | ||
| 200 | 200 | if (length >= FixedLength) |
| 201 | 201 | { |
| 202 | 202 | // Binary image has sufficient data. |
| 203 | − Time = new TimeTag(EndianOrder.LittleEndian.ToDouble(buffer, startIndex)); | |
| 204 | − Flags = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 8); | |
| 205 | − Value = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 12); | |
| 203 | + Time = new TimeTag(LittleEndian.ToDouble(buffer, startIndex)); | |
| 204 | + Flags = LittleEndian.ToInt32(buffer, startIndex + 8); | |
| 205 | + Value = LittleEndian.ToSingle(buffer, startIndex + 12); | |
| 206 | 206 | |
| 207 | 207 | return FixedLength; |
| 208 | 208 | } |
| @@ -126,7 +126,7 @@ namespace GSF.Historian.Files · 125 unmodified lines | ||
| 126 | 126 | } |
| 127 | 127 | private set |
| 128 | 128 | { |
| 129 | − if (value == null) | |
| 129 | + if ((object)value == null) | |
| 130 | 130 | throw new ArgumentNullException("value"); |
| 131 | 131 | |
| 132 | 132 | m_currentData = value; |
| @@ -160,7 +160,7 @@ namespace GSF.Historian.Files · 27 unmodified lines | ||
| 160 | 160 | if (length >= FixedLength) |
| 161 | 161 | { |
| 162 | 162 | // Binary image has sufficient data. |
| 163 | − HistorianID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex); | |
| 163 | + HistorianID = LittleEndian.ToInt32(buffer, startIndex); | |
| 164 | 164 | CurrentData = new StateRecordDataPoint(HistorianID, buffer, startIndex + 4, length - 4); |
| 165 | 165 | |
| 166 | 166 | return FixedLength; |
| @@ -189,7 +189,7 @@ namespace GSF.Historian.Files · 22 unmodified lines | ||
| 189 | 189 | |
| 190 | 190 | buffer.ValidateParameters(startIndex, length); |
| 191 | 191 | |
| 192 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex, 4); | |
| 192 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex, 4); | |
| 193 | 193 | m_currentData.GenerateBinaryImage(buffer, startIndex + 4); |
| 194 | 194 | |
| 195 | 195 | return length; |
| @@ -49,7 +49,7 @@ namespace GSF.Historian.Packets · 48 unmodified lines | ||
| 49 | 49 | public PacketCommonHeader(byte[] buffer, int startIndex, int length) |
| 50 | 50 | { |
| 51 | 51 | if (length > 1) |
| 52 | − TypeID = EndianOrder.LittleEndian.ToInt16(buffer, startIndex); | |
| 52 | + TypeID = LittleEndian.ToInt16(buffer, startIndex); | |
| 53 | 53 | else |
| 54 | 54 | throw new InvalidOperationException("Not enough length available to parse common header"); |
| 55 | 55 | } |
| @@ -234,15 +234,15 @@ namespace GSF.Historian.Packets · 233 unmodified lines | ||
| 234 | 234 | if (length >= FixedLength) |
| 235 | 235 | { |
| 236 | 236 | // Binary image has sufficient data. |
| 237 | − short packetID = EndianOrder.LittleEndian.ToInt16(buffer, startIndex); | |
| 237 | + short packetID = LittleEndian.ToInt16(buffer, startIndex); | |
| 238 | 238 | if (packetID != TypeID) |
| 239 | 239 | throw new ArgumentException(string.Format("Unexpected packet id '{0}' (expected '{1}')", packetID, TypeID)); |
| 240 | 240 | |
| 241 | 241 | // We have a binary image with the correct packet id. |
| 242 | − HistorianID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 243 | − Time = new TimeTag(EndianOrder.LittleEndian.ToDouble(buffer, startIndex + 6)); | |
| 244 | − Quality = (Quality)(EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 14)); | |
| 245 | − Value = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 18); | |
| 242 | + HistorianID = LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 243 | + Time = new TimeTag(LittleEndian.ToDouble(buffer, startIndex + 6)); | |
| 244 | + Quality = (Quality)(LittleEndian.ToInt32(buffer, startIndex + 14)); | |
| 245 | + Value = LittleEndian.ToSingle(buffer, startIndex + 18); | |
| 246 | 246 | |
| 247 | 247 | // We'll send an "ACK" to the sender if this is the last packet in the transmission. |
| 248 | 248 | if (length == FixedLength) |
| @@ -274,11 +274,11 @@ namespace GSF.Historian.Packets · 25 unmodified lines | ||
| 274 | 274 | |
| 275 | 275 | buffer.ValidateParameters(startIndex, length); |
| 276 | 276 | |
| 277 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 278 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex + 2, 4); | |
| 279 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_time.Value), 0, buffer, startIndex + 6, 8); | |
| 280 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes((int)m_quality), 0, buffer, startIndex + 14, 4); | |
| 281 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_value), 0, buffer, startIndex + 18, 4); | |
| 277 | + Buffer.BlockCopy(LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 278 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex + 2, 4); | |
| 279 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_time.Value), 0, buffer, startIndex + 6, 8); | |
| 280 | + Buffer.BlockCopy(LittleEndian.GetBytes((int)m_quality), 0, buffer, startIndex + 14, 4); | |
| 281 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_value), 0, buffer, startIndex + 18, 4); | |
| 282 | 282 | |
| 283 | 283 | return length; |
| 284 | 284 | } |
| @@ -166,12 +166,12 @@ namespace GSF.Historian.Packets · 165 unmodified lines | ||
| 166 | 166 | if (length >= 6) |
| 167 | 167 | { |
| 168 | 168 | // Binary image has sufficient data. |
| 169 | − short packetID = EndianOrder.LittleEndian.ToInt16(buffer, startIndex); | |
| 169 | + short packetID = LittleEndian.ToInt16(buffer, startIndex); | |
| 170 | 170 | if (packetID != TypeID) |
| 171 | 171 | throw new ArgumentException(string.Format("Unexpected packet id '{0}' (expected '{1}')", packetID, TypeID)); |
| 172 | 172 | |
| 173 | 173 | // Ensure that the binary image is complete |
| 174 | − int dataCount = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 174 | + int dataCount = LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 175 | 175 | if (length < 6 + dataCount * PacketType101DataPoint.FixedLength) |
| 176 | 176 | return 0; |
| 177 | 177 | |
| @@ -210,8 +210,8 @@ namespace GSF.Historian.Packets · 32 unmodified lines | ||
| 210 | 210 | |
| 211 | 211 | buffer.ValidateParameters(startIndex, length); |
| 212 | 212 | |
| 213 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 214 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_data.Count), 0, buffer, startIndex + 2, 4); | |
| 213 | + Buffer.BlockCopy(LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 214 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_data.Count), 0, buffer, startIndex + 2, 4); | |
| 215 | 215 | for (int i = 0; i < m_data.Count; i++) |
| 216 | 216 | { |
| 217 | 217 | m_data[i].GenerateBinaryImage(buffer, startIndex + 6 + (i * PacketType101DataPoint.FixedLength)); |
| @@ -135,10 +135,10 @@ namespace GSF.Historian.Packets · 134 unmodified lines | ||
| 135 | 135 | if (length >= FixedLength) |
| 136 | 136 | { |
| 137 | 137 | // Binary image has sufficient data. |
| 138 | − HistorianID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex); | |
| 139 | − Flags = EndianOrder.LittleEndian.ToInt16(buffer, startIndex + 8); | |
| 140 | − Value = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 10); | |
| 141 | − Time = new TimeTag(EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 4) + // Seconds | |
| 138 | + HistorianID = LittleEndian.ToInt32(buffer, startIndex); | |
| 139 | + Flags = LittleEndian.ToInt16(buffer, startIndex + 8); | |
| 140 | + Value = LittleEndian.ToSingle(buffer, startIndex + 10); | |
| 141 | + Time = new TimeTag(LittleEndian.ToInt32(buffer, startIndex + 4) + // Seconds | |
| 142 | 142 | ((double)(Flags.GetMaskedValue(MillisecondMask) >> 5) / 1000)); // Milliseconds |
| 143 | 143 | |
| 144 | 144 | return FixedLength; |
| @@ -167,10 +167,10 @@ namespace GSF.Historian.Packets · 22 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | buffer.ValidateParameters(startIndex, length); |
| 169 | 169 | |
| 170 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(HistorianID), 0, buffer, startIndex, 4); | |
| 171 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes((int)Time.Value), 0, buffer, startIndex + 4, 4); | |
| 172 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes((short)Flags), 0, buffer, startIndex + 8, 2); | |
| 173 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(Value), 0, buffer, startIndex + 10, 4); | |
| 170 | + Buffer.BlockCopy(LittleEndian.GetBytes(HistorianID), 0, buffer, startIndex, 4); | |
| 171 | + Buffer.BlockCopy(LittleEndian.GetBytes((int)Time.Value), 0, buffer, startIndex + 4, 4); | |
| 172 | + Buffer.BlockCopy(LittleEndian.GetBytes((short)Flags), 0, buffer, startIndex + 8, 2); | |
| 173 | + Buffer.BlockCopy(LittleEndian.GetBytes(Value), 0, buffer, startIndex + 10, 4); | |
| 174 | 174 | |
| 175 | 175 | return length; |
| 176 | 176 | } |
| @@ -339,22 +339,22 @@ namespace GSF.Historian.Packets · 338 unmodified lines | ||
| 339 | 339 | if (length >= FixedLength) |
| 340 | 340 | { |
| 341 | 341 | // Binary image has sufficient data. |
| 342 | − short packetID = EndianOrder.LittleEndian.ToInt16(buffer, startIndex); | |
| 342 | + short packetID = LittleEndian.ToInt16(buffer, startIndex); | |
| 343 | 343 | if (packetID != TypeID) |
| 344 | 344 | throw new ArgumentException(string.Format("Unexpected packet id '{0}' (expected '{1}')", packetID, TypeID)); |
| 345 | 345 | |
| 346 | 346 | // We have a binary image with the correct packet id. |
| 347 | − HistorianID = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 348 | − Year = EndianOrder.LittleEndian.ToInt16(buffer, startIndex + 6); | |
| 347 | + HistorianID = LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 348 | + Year = LittleEndian.ToInt16(buffer, startIndex + 6); | |
| 349 | 349 | Month = Convert.ToInt16(buffer[startIndex + 8]); |
| 350 | 350 | Day = Convert.ToInt16(buffer[startIndex + 9]); |
| 351 | 351 | Hour = Convert.ToInt16(buffer[startIndex + 10]); |
| 352 | 352 | Minute = Convert.ToInt16(buffer[startIndex + 11]); |
| 353 | 353 | Second = Convert.ToInt16(buffer[startIndex + 12]); |
| 354 | 354 | Quality = (Quality)(buffer[startIndex + 13]); |
| 355 | − Millisecond = EndianOrder.LittleEndian.ToInt16(buffer, startIndex + 14); | |
| 356 | − GmtOffset = EndianOrder.LittleEndian.ToInt16(buffer, startIndex + 16); | |
| 357 | − Value = EndianOrder.LittleEndian.ToSingle(buffer, startIndex + 18); | |
| 355 | + Millisecond = LittleEndian.ToInt16(buffer, startIndex + 14); | |
| 356 | + GmtOffset = LittleEndian.ToInt16(buffer, startIndex + 16); | |
| 357 | + Value = LittleEndian.ToSingle(buffer, startIndex + 18); | |
| 358 | 358 | |
| 359 | 359 | // We'll send an "ACK" to the sender if this is the last packet in the transmission. |
| 360 | 360 | if (length == FixedLength) |
| @@ -386,18 +386,18 @@ namespace GSF.Historian.Packets · 25 unmodified lines | ||
| 386 | 386 | |
| 387 | 387 | buffer.ValidateParameters(startIndex, length); |
| 388 | 388 | |
| 389 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 390 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex + 2, 4); | |
| 391 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_year), 0, buffer, startIndex + 6, 2); | |
| 392 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_month), 0, buffer, startIndex + 8, 1); | |
| 393 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_day), 0, buffer, startIndex + 9, 1); | |
| 394 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_hour), 0, buffer, startIndex + 10, 1); | |
| 395 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_minute), 0, buffer, startIndex + 11, 1); | |
| 396 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_second), 0, buffer, startIndex + 12, 1); | |
| 397 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes((int)m_quality), 0, buffer, startIndex + 13, 1); | |
| 398 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_millisecond), 0, buffer, startIndex + 14, 2); | |
| 399 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_gmtOffset), 0, buffer, startIndex + 16, 2); | |
| 400 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_value), 0, buffer, startIndex + 18, 4); | |
| 389 | + Buffer.BlockCopy(LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 390 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_historianID), 0, buffer, startIndex + 2, 4); | |
| 391 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_year), 0, buffer, startIndex + 6, 2); | |
| 392 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_month), 0, buffer, startIndex + 8, 1); | |
| 393 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_day), 0, buffer, startIndex + 9, 1); | |
| 394 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_hour), 0, buffer, startIndex + 10, 1); | |
| 395 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_minute), 0, buffer, startIndex + 11, 1); | |
| 396 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_second), 0, buffer, startIndex + 12, 1); | |
| 397 | + Buffer.BlockCopy(LittleEndian.GetBytes((int)m_quality), 0, buffer, startIndex + 13, 1); | |
| 398 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_millisecond), 0, buffer, startIndex + 14, 2); | |
| 399 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_gmtOffset), 0, buffer, startIndex + 16, 2); | |
| 400 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_value), 0, buffer, startIndex + 18, 4); | |
| 401 | 401 | |
| 402 | 402 | return length; |
| 403 | 403 | } |
| @@ -113,7 +113,7 @@ namespace GSF.Historian.Packets · 112 unmodified lines | ||
| 113 | 113 | if (length >= FixedLength) |
| 114 | 114 | { |
| 115 | 115 | // Binary image has sufficient data. |
| 116 | − short packetID = EndianOrder.LittleEndian.ToInt16(buffer, startIndex); | |
| 116 | + short packetID = LittleEndian.ToInt16(buffer, startIndex); | |
| 117 | 117 | if (packetID != TypeID) |
| 118 | 118 | throw new ArgumentException(string.Format("Unexpected packet id '{0}' (expected '{1}')", packetID, TypeID)); |
| 119 | 119 | |
| @@ -143,7 +143,7 @@ namespace GSF.Historian.Packets · 23 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | buffer.ValidateParameters(startIndex, length); |
| 145 | 145 | |
| 146 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 146 | + Buffer.BlockCopy(LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 147 | 147 | |
| 148 | 148 | return length; |
| 149 | 149 | } |
| @@ -114,12 +114,12 @@ namespace GSF.Historian.Packets · 113 unmodified lines | ||
| 114 | 114 | if (length >= 6) |
| 115 | 115 | { |
| 116 | 116 | // Binary image has sufficient data. |
| 117 | − short packetID = EndianOrder.LittleEndian.ToInt16(buffer, startIndex); | |
| 117 | + short packetID = LittleEndian.ToInt16(buffer, startIndex); | |
| 118 | 118 | if (packetID != TypeID) |
| 119 | 119 | throw new ArgumentException(string.Format("Unexpected packet id '{0}' (expected '{1}')", packetID, TypeID)); |
| 120 | 120 | |
| 121 | 121 | // Ensure that the binary image is complete |
| 122 | − int requestIDCount = EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 122 | + int requestIDCount = LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 123 | 123 | if (length < 6 + requestIDCount * 4) |
| 124 | 124 | return 0; |
| 125 | 125 | |
| @@ -127,7 +127,7 @@ namespace GSF.Historian.Packets · 1 unmodified line | ||
| 127 | 127 | m_requestIDs.Clear(); |
| 128 | 128 | for (int i = 0; i < requestIDCount; i++) |
| 129 | 129 | { |
| 130 | − m_requestIDs.Add(EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 6 + (i * 4))); | |
| 130 | + m_requestIDs.Add(LittleEndian.ToInt32(buffer, startIndex + 6 + (i * 4))); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return BinaryLength; |
| @@ -156,11 +156,11 @@ namespace GSF.Historian.Packets · 22 unmodified lines | ||
| 156 | 156 | |
| 157 | 157 | buffer.ValidateParameters(startIndex, length); |
| 158 | 158 | |
| 159 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 160 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_requestIDs.Count), 0, buffer, startIndex + 2, 4); | |
| 159 | + Buffer.BlockCopy(LittleEndian.GetBytes(TypeID), 0, buffer, startIndex, 2); | |
| 160 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_requestIDs.Count), 0, buffer, startIndex + 2, 4); | |
| 161 | 161 | for (int i = 0; i < m_requestIDs.Count; i++) |
| 162 | 162 | { |
| 163 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(m_requestIDs[i]), 0, buffer, startIndex + 6 + (i * 4), 4); | |
| 163 | + Buffer.BlockCopy(LittleEndian.GetBytes(m_requestIDs[i]), 0, buffer, startIndex + 6 + (i * 4), 4); | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return length; |
| @@ -225,7 +225,7 @@ namespace GSF.Media · 224 unmodified lines | ||
| 225 | 225 | buffer.ValidateParameters(startIndex, FixedLength); |
| 226 | 226 | |
| 227 | 227 | Buffer.BlockCopy(Encoding.ASCII.GetBytes(TypeID), 0, buffer, 0, 4); |
| 228 | − Buffer.BlockCopy(EndianOrder.LittleEndian.GetBytes(ChunkSize), 0, buffer, 4, 4); | |
| 228 | + Buffer.BlockCopy(LittleEndian.GetBytes(ChunkSize), 0, buffer, 4, 4); | |
| 229 | 229 | |
| 230 | 230 | return FixedLength; |
| 231 | 231 | } |
| @@ -274,13 +274,13 @@ namespace GSF.Media · 42 unmodified lines | ||
| 274 | 274 | throw new InvalidOperationException("RIFF chunk too small, media file corrupted"); |
| 275 | 275 | |
| 276 | 276 | riffChunk.TypeID = Encoding.ASCII.GetString(buffer, 0, 4); |
| 277 | − riffChunk.ChunkSize = EndianOrder.LittleEndian.ToInt32(buffer, 4); | |
| 277 | + riffChunk.ChunkSize = LittleEndian.ToInt32(buffer, 4); | |
| 278 | 278 | |
| 279 | 279 | return riffChunk; |
| 280 | 280 | } |
| 281 | 281 | finally |
| 282 | 282 | { |
| 283 | − if (buffer != null) | |
| 283 | + if ((object)buffer != null) | |
| 284 | 284 | BufferPool.ReturnBuffer(buffer); |
| 285 | 285 | } |
| 286 | 286 | } |
| @@ -140,7 +140,7 @@ namespace GSF.Media · 139 unmodified lines | ||
| 140 | 140 | } |
| 141 | 141 | finally |
| 142 | 142 | { |
| 143 | − if (buffer != null) | |
| 143 | + if ((object)buffer != null) | |
| 144 | 144 | BufferPool.ReturnBuffer(buffer); |
| 145 | 145 | } |
| 146 | 146 | } |
| @@ -141,7 +141,7 @@ namespace GSF.Media · 140 unmodified lines | ||
| 141 | 141 | } |
| 142 | 142 | finally |
| 143 | 143 | { |
| 144 | − if (buffer != null) | |
| 144 | + if ((object)buffer != null) | |
| 145 | 145 | BufferPool.ReturnBuffer(buffer); |
| 146 | 146 | } |
| 147 | 147 | } |
| @@ -147,7 +147,7 @@ namespace GSF.Media · 146 unmodified lines | ||
| 147 | 147 | } |
| 148 | 148 | finally |
| 149 | 149 | { |
| 150 | − if (buffer != null) | |
| 150 | + if ((object)buffer != null) | |
| 151 | 151 | BufferPool.ReturnBuffer(buffer); |
| 152 | 152 | } |
| 153 | 153 | } |
| @@ -382,19 +382,19 @@ namespace GSF.Media · 228 unmodified lines | ||
| 382 | 382 | if (length < ChunkSize) |
| 383 | 383 | throw new InvalidOperationException("WAVE format section too small, wave file corrupted"); |
| 384 | 384 | |
| 385 | − m_audioFormat = EndianOrder.LittleEndian.ToUInt16(buffer, 0); | |
| 386 | − m_channels = EndianOrder.LittleEndian.ToInt16(buffer, 2); | |
| 387 | − m_sampleRate = EndianOrder.LittleEndian.ToInt32(buffer, 4); | |
| 388 | − m_byteRate = EndianOrder.LittleEndian.ToInt32(buffer, 8); | |
| 389 | − m_blockAlignment = EndianOrder.LittleEndian.ToInt16(buffer, 12); | |
| 390 | − m_bitsPerSample = EndianOrder.LittleEndian.ToInt16(buffer, 14); | |
| 385 | + m_audioFormat = LittleEndian.ToUInt16(buffer, 0); | |
| 386 | + m_channels = LittleEndian.ToInt16(buffer, 2); | |
| 387 | + m_sampleRate = LittleEndian.ToInt32(buffer, 4); | |
| 388 | + m_byteRate = LittleEndian.ToInt32(buffer, 8); | |
| 389 | + m_blockAlignment = LittleEndian.ToInt16(buffer, 12); | |
| 390 | + m_bitsPerSample = LittleEndian.ToInt16(buffer, 14); | |
| 391 | 391 | |
| 392 | 392 | if (m_bitsPerSample % 8 != 0) |
| 393 | 393 | throw new InvalidDataException("Invalid bit rate encountered - wave file bit rates must be a multiple of 8"); |
| 394 | 394 | |
| 395 | 395 | if (length > 16) |
| 396 | 396 | { |
| 397 | − m_extraParametersSize = EndianOrder.LittleEndian.ToInt16(buffer, 16); | |
| 397 | + m_extraParametersSize = LittleEndian.ToInt16(buffer, 16); | |
| 398 | 398 | return 18; |
| 399 | 399 | } |
| 400 | 400 | |
| @@ -419,17 +419,17 @@ namespace GSF.Media · 18 unmodified lines | ||
| 419 | 419 | buffer.ValidateParameters(startIndex, length); |
| 420 | 420 | |
| 421 | 421 | startIndex += base.GenerateBinaryImage(buffer, startIndex); |
| 422 | − EndianOrder.LittleEndian.CopyBytes(m_audioFormat, buffer, startIndex); | |
| 423 | − EndianOrder.LittleEndian.CopyBytes(m_channels, buffer, startIndex + 2); | |
| 424 | − EndianOrder.LittleEndian.CopyBytes(m_sampleRate, buffer, startIndex + 4); | |
| 425 | − EndianOrder.LittleEndian.CopyBytes(m_byteRate, buffer, startIndex + 8); | |
| 426 | − EndianOrder.LittleEndian.CopyBytes(m_blockAlignment, buffer, startIndex + 12); | |
| 427 | − EndianOrder.LittleEndian.CopyBytes(m_bitsPerSample, buffer, startIndex + 14); | |
| 422 | + LittleEndian.CopyBytes(m_audioFormat, buffer, startIndex); | |
| 423 | + LittleEndian.CopyBytes(m_channels, buffer, startIndex + 2); | |
| 424 | + LittleEndian.CopyBytes(m_sampleRate, buffer, startIndex + 4); | |
| 425 | + LittleEndian.CopyBytes(m_byteRate, buffer, startIndex + 8); | |
| 426 | + LittleEndian.CopyBytes(m_blockAlignment, buffer, startIndex + 12); | |
| 427 | + LittleEndian.CopyBytes(m_bitsPerSample, buffer, startIndex + 14); | |
| 428 | 428 | startIndex += 16; |
| 429 | 429 | |
| 430 | 430 | if (m_extraParametersSize > 0) |
| 431 | 431 | { |
| 432 | − EndianOrder.LittleEndian.CopyBytes(m_extraParametersSize, buffer, startIndex); | |
| 432 | + LittleEndian.CopyBytes(m_extraParametersSize, buffer, startIndex); | |
| 433 | 433 | startIndex += 2; |
| 434 | 434 | |
| 435 | 435 | if (m_extraParametersSize > 0 && (object)m_extraParameters != null) |
| @@ -317,9 +317,9 @@ namespace GSF.Media · 316 unmodified lines | ||
| 317 | 317 | { |
| 318 | 318 | buffer.ValidateParameters(startIndex, length); |
| 319 | 319 | |
| 320 | − m_sampleValue = EndianOrder.LittleEndian.ToUInt16(buffer, startIndex); | |
| 321 | − m_channelMask = (Speakers)EndianOrder.LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 322 | − m_subFormat = EndianOrder.LittleEndian.ToGuid(buffer, startIndex + 6); | |
| 320 | + m_sampleValue = LittleEndian.ToUInt16(buffer, startIndex); | |
| 321 | + m_channelMask = (Speakers)LittleEndian.ToInt32(buffer, startIndex + 2); | |
| 322 | + m_subFormat = new Guid(buffer.BlockCopy(startIndex + 6, 8)); | |
| 323 | 323 | |
| 324 | 324 | return BinaryLength; |
| 325 | 325 | } |
| @@ -339,9 +339,9 @@ namespace GSF.Media · 13 unmodified lines | ||
| 339 | 339 | { |
| 340 | 340 | buffer.ValidateParameters(startIndex, FixedLength); |
| 341 | 341 | |
| 342 | − EndianOrder.LittleEndian.CopyBytes(m_sampleValue, buffer, 0); | |
| 343 | − EndianOrder.LittleEndian.CopyBytes((int)m_channelMask, buffer, 2); | |
| 344 | − EndianOrder.LittleEndian.CopyBytes(m_subFormat, buffer, 6); | |
| 342 | + LittleEndian.CopyBytes(m_sampleValue, buffer, 0); | |
| 343 | + LittleEndian.CopyBytes((int)m_channelMask, buffer, 2); | |
| 344 | + m_subFormat.ToByteArray().CopyTo(buffer, 6); | |
| 345 | 345 | |
| 346 | 346 | return FixedLength; |
| 347 | 347 | } |
| @@ -145,7 +145,7 @@ namespace GSF.PQDIF.Physical · 144 unmodified lines | ||
| 145 | 145 | /// <returns>The value as a 16-bit unsigned integer.</returns> |
| 146 | 146 | public ushort GetUInt2() |
| 147 | 147 | { |
| 148 | − return EndianOrder.LittleEndian.ToUInt16(m_value, 0); | |
| 148 | + return LittleEndian.ToUInt16(m_value, 0); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /// <summary> |
| @@ -154,7 +154,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 154 | 154 | /// <param name="value">The new value as a 16-bit unsigned integer.</param> |
| 155 | 155 | public void SetUInt2(ushort value) |
| 156 | 156 | { |
| 157 | − EndianOrder.LittleEndian.CopyBytes(value, m_value, 0); | |
| 157 | + LittleEndian.CopyBytes(value, m_value, 0); | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /// <summary> |
| @@ -163,7 +163,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 163 | 163 | /// <returns>The value as a 16-bit signed integer.</returns> |
| 164 | 164 | public short GetInt2() |
| 165 | 165 | { |
| 166 | − return EndianOrder.LittleEndian.ToInt16(m_value, 0); | |
| 166 | + return LittleEndian.ToInt16(m_value, 0); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /// <summary> |
| @@ -172,7 +172,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 172 | 172 | /// <param name="value">The new value as a 16-bit signed integer.</param> |
| 173 | 173 | public void SetInt2(short value) |
| 174 | 174 | { |
| 175 | − EndianOrder.LittleEndian.CopyBytes(value, m_value, 0); | |
| 175 | + LittleEndian.CopyBytes(value, m_value, 0); | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /// <summary> |
| @@ -181,7 +181,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 181 | 181 | /// <returns>The value as a 32-bit unsigned integer.</returns> |
| 182 | 182 | public uint GetUInt4() |
| 183 | 183 | { |
| 184 | − return EndianOrder.LittleEndian.ToUInt32(m_value, 0); | |
| 184 | + return LittleEndian.ToUInt32(m_value, 0); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /// <summary> |
| @@ -190,7 +190,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 190 | 190 | /// <param name="value">The new value as a 32-bit unsigned integer.</param> |
| 191 | 191 | public void SetUInt4(uint value) |
| 192 | 192 | { |
| 193 | − EndianOrder.LittleEndian.CopyBytes(value, m_value, 0); | |
| 193 | + LittleEndian.CopyBytes(value, m_value, 0); | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /// <summary> |
| @@ -199,7 +199,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 199 | 199 | /// <returns>The value as a 32-bit signed integer.</returns> |
| 200 | 200 | public int GetInt4() |
| 201 | 201 | { |
| 202 | − return EndianOrder.LittleEndian.ToInt32(m_value, 0); | |
| 202 | + return LittleEndian.ToInt32(m_value, 0); | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /// <summary> |
| @@ -208,7 +208,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 208 | 208 | /// <param name="value">The new value as a 32-bit signed integer.</param> |
| 209 | 209 | public void SetInt4(int value) |
| 210 | 210 | { |
| 211 | − EndianOrder.LittleEndian.CopyBytes(value, m_value, 0); | |
| 211 | + LittleEndian.CopyBytes(value, m_value, 0); | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /// <summary> |
| @@ -217,7 +217,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 217 | 217 | /// <returns>The value as a 4-byte boolean.</returns> |
| 218 | 218 | public bool GetBool4() |
| 219 | 219 | { |
| 220 | − return EndianOrder.LittleEndian.ToInt32(m_value, 0) != 0; | |
| 220 | + return LittleEndian.ToInt32(m_value, 0) != 0; | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /// <summary> |
| @@ -226,7 +226,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 226 | 226 | /// <param name="value">The new value as a 4-byte boolean.</param> |
| 227 | 227 | public void SetBool4(bool value) |
| 228 | 228 | { |
| 229 | − EndianOrder.LittleEndian.CopyBytes(value ? 1 : 0, m_value, 0); | |
| 229 | + LittleEndian.CopyBytes(value ? 1 : 0, m_value, 0); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /// <summary> |
| @@ -235,7 +235,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 235 | 235 | /// <returns>The value as a 32-bit floating point number.</returns> |
| 236 | 236 | public float GetReal4() |
| 237 | 237 | { |
| 238 | − return EndianOrder.LittleEndian.ToSingle(m_value, 0); | |
| 238 | + return LittleEndian.ToSingle(m_value, 0); | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /// <summary> |
| @@ -244,7 +244,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 244 | 244 | /// <param name="value">The new value as a 32-bit floating point number.</param> |
| 245 | 245 | public void SetReal4(float value) |
| 246 | 246 | { |
| 247 | − EndianOrder.LittleEndian.CopyBytes(value, m_value, 0); | |
| 247 | + LittleEndian.CopyBytes(value, m_value, 0); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /// <summary> |
| @@ -253,7 +253,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 253 | 253 | /// <returns>The value as a 64-bit floating point number.</returns> |
| 254 | 254 | public double GetReal8() |
| 255 | 255 | { |
| 256 | − return EndianOrder.LittleEndian.ToDouble(m_value, 0); | |
| 256 | + return LittleEndian.ToDouble(m_value, 0); | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /// <summary> |
| @@ -262,7 +262,7 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 262 | 262 | /// <param name="value">The new value as a 64-bit floating point number.</param> |
| 263 | 263 | public void SetReal8(double value) |
| 264 | 264 | { |
| 265 | − EndianOrder.LittleEndian.CopyBytes(value, m_value, 0); | |
| 265 | + LittleEndian.CopyBytes(value, m_value, 0); | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /// <summary> |
| @@ -271,8 +271,8 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 271 | 271 | /// <returns>The value as an 8-byte complex number.</returns> |
| 272 | 272 | public ComplexNumber GetComplex8() |
| 273 | 273 | { |
| 274 | − double real = EndianOrder.LittleEndian.ToSingle(m_value, 0); | |
| 275 | − double imaginary = EndianOrder.LittleEndian.ToSingle(m_value, 4); | |
| 274 | + double real = LittleEndian.ToSingle(m_value, 0); | |
| 275 | + double imaginary = LittleEndian.ToSingle(m_value, 4); | |
| 276 | 276 | return new ComplexNumber(real, imaginary); |
| 277 | 277 | } |
| 278 | 278 | |
| @@ -282,8 +282,8 @@ namespace GSF.PQDIF.Physical · 3 unmodified lines | ||
| 282 | 282 | /// <param name="value">The new value as an 8-byte complex number.</param> |
| 283 | 283 | public void SetComplex8(ComplexNumber value) |
| 284 | 284 | { |
| 285 | − EndianOrder.LittleEndian.CopyBytes((float)value.Real, m_value, 0); | |
| 286 | − EndianOrder.LittleEndian.CopyBytes((float)value.Imaginary, m_value, 4); | |
| 285 | + LittleEndian.CopyBytes((float)value.Real, m_value, 0); | |
| 286 | + LittleEndian.CopyBytes((float)value.Imaginary, m_value, 4); | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /// <summary> |
| @@ -292,8 +292,8 @@ namespace GSF.PQDIF.Physical · 2 unmodified lines | ||
| 292 | 292 | /// <returns>The value as a 16-byte complex number.</returns> |
| 293 | 293 | public ComplexNumber GetComplex16() |
| 294 | 294 | { |
| 295 | − double real = EndianOrder.LittleEndian.ToDouble(m_value, 0); | |
| 296 | − double imaginary = EndianOrder.LittleEndian.ToDouble(m_value, 8); | |
| 295 | + double real = LittleEndian.ToDouble(m_value, 0); | |
| 296 | + double imaginary = LittleEndian.ToDouble(m_value, 8); | |
| 297 | 297 | return new ComplexNumber(real, imaginary); |
| 298 | 298 | } |
| 299 | 299 | |
| @@ -303,8 +303,8 @@ namespace GSF.PQDIF.Physical · 3 unmodified lines | ||
| 303 | 303 | /// <param name="value">The new value as a 16-byte complex number.</param> |
| 304 | 304 | public void SetComplex16(ComplexNumber value) |
| 305 | 305 | { |
| 306 | − EndianOrder.LittleEndian.CopyBytes(value.Real, m_value, 0); | |
| 307 | − EndianOrder.LittleEndian.CopyBytes(value.Imaginary, m_value, 0); | |
| 306 | + LittleEndian.CopyBytes(value.Real, m_value, 0); | |
| 307 | + LittleEndian.CopyBytes(value.Imaginary, m_value, 0); | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /// <summary> |
| @@ -332,8 +332,8 @@ namespace GSF.PQDIF.Physical · 21 unmodified lines | ||
| 332 | 332 | public DateTime GetTimestamp() |
| 333 | 333 | { |
| 334 | 334 | DateTime epoch = new DateTime(1900, 1, 1); |
| 335 | − uint days = EndianOrder.LittleEndian.ToUInt32(m_value, 0); | |
| 336 | − double seconds = EndianOrder.LittleEndian.ToDouble(m_value, 4); | |
| 335 | + uint days = LittleEndian.ToUInt32(m_value, 0); | |
| 336 | + double seconds = LittleEndian.ToDouble(m_value, 4); | |
| 337 | 337 | |
| 338 | 338 | return DateTime.SpecifyKind(epoch.AddDays(days).AddSeconds(seconds), DateTimeKind.Utc); |
| 339 | 339 | } |
| @@ -349,8 +349,8 @@ namespace GSF.PQDIF.Physical · 9 unmodified lines | ||
| 349 | 349 | TimeSpan daySpan = TimeSpan.FromDays(Math.Floor(sinceEpoch.TotalDays)); |
| 350 | 350 | TimeSpan secondSpan = sinceEpoch - daySpan; |
| 351 | 351 | |
| 352 | − EndianOrder.LittleEndian.CopyBytes((uint)daySpan.TotalDays, m_value, 0); | |
| 353 | − EndianOrder.LittleEndian.CopyBytes(secondSpan.TotalSeconds, m_value, 0); | |
| 352 | + LittleEndian.CopyBytes((uint)daySpan.TotalDays, m_value, 0); | |
| 353 | + LittleEndian.CopyBytes(secondSpan.TotalSeconds, m_value, 0); | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /// <summary> |
| @@ -211,7 +211,7 @@ namespace GSF.PQDIF.Physical · 210 unmodified lines | ||
| 211 | 211 | throw new InvalidOperationException("Unable to retrieve values from uninitialized vector; set the size and physical type of the vector first"); |
| 212 | 212 | |
| 213 | 213 | int byteIndex = index * 2; |
| 214 | − return EndianOrder.LittleEndian.ToInt16(m_values, byteIndex); | |
| 214 | + return LittleEndian.ToInt16(m_values, byteIndex); | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /// <summary> |
| @@ -225,7 +225,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 225 | 225 | throw new InvalidOperationException("Unable to insert values into uninitialized vector; set the size and physical type of the vector first"); |
| 226 | 226 | |
| 227 | 227 | int byteIndex = index * 2; |
| 228 | − EndianOrder.LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 228 | + LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /// <summary> |
| @@ -239,7 +239,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 239 | 239 | throw new InvalidOperationException("Unable to retrieve values from uninitialized vector; set the size and physical type of the vector first"); |
| 240 | 240 | |
| 241 | 241 | int byteIndex = index * 4; |
| 242 | − return EndianOrder.LittleEndian.ToInt32(m_values, byteIndex); | |
| 242 | + return LittleEndian.ToInt32(m_values, byteIndex); | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /// <summary> |
| @@ -253,7 +253,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 253 | 253 | throw new InvalidOperationException("Unable to insert values into uninitialized vector; set the size and physical type of the vector first"); |
| 254 | 254 | |
| 255 | 255 | int byteIndex = index * 4; |
| 256 | − EndianOrder.LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 256 | + LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /// <summary> |
| @@ -267,7 +267,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 267 | 267 | throw new InvalidOperationException("Unable to retrieve values from uninitialized vector; set the size and physical type of the vector first"); |
| 268 | 268 | |
| 269 | 269 | int byteIndex = index * 4; |
| 270 | − return EndianOrder.LittleEndian.ToUInt32(m_values, byteIndex); | |
| 270 | + return LittleEndian.ToUInt32(m_values, byteIndex); | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /// <summary> |
| @@ -281,7 +281,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 281 | 281 | throw new InvalidOperationException("Unable to insert values into uninitialized vector; set the size and physical type of the vector first"); |
| 282 | 282 | |
| 283 | 283 | int byteIndex = index * 4; |
| 284 | − EndianOrder.LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 284 | + LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /// <summary> |
| @@ -295,7 +295,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 295 | 295 | throw new InvalidOperationException("Unable to retrieve values from uninitialized vector; set the size and physical type of the vector first"); |
| 296 | 296 | |
| 297 | 297 | int byteIndex = index * 4; |
| 298 | − return EndianOrder.LittleEndian.ToSingle(m_values, byteIndex); | |
| 298 | + return LittleEndian.ToSingle(m_values, byteIndex); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /// <summary> |
| @@ -309,7 +309,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 309 | 309 | throw new InvalidOperationException("Unable to insert values into uninitialized vector; set the size and physical type of the vector first"); |
| 310 | 310 | |
| 311 | 311 | int byteIndex = index * 4; |
| 312 | − EndianOrder.LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 312 | + LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /// <summary> |
| @@ -323,7 +323,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 323 | 323 | throw new InvalidOperationException("Unable to retrieve values from uninitialized vector; set the size and physical type of the vector first"); |
| 324 | 324 | |
| 325 | 325 | int byteIndex = index * 8; |
| 326 | − return EndianOrder.LittleEndian.ToDouble(m_values, byteIndex); | |
| 326 | + return LittleEndian.ToDouble(m_values, byteIndex); | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /// <summary> |
| @@ -337,7 +337,7 @@ namespace GSF.PQDIF.Physical · 7 unmodified lines | ||
| 337 | 337 | throw new InvalidOperationException("Unable to insert values into uninitialized vector; set the size and physical type of the vector first"); |
| 338 | 338 | |
| 339 | 339 | int byteIndex = index * 8; |
| 340 | − EndianOrder.LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 340 | + LittleEndian.CopyBytes(value, m_values, byteIndex); | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /// <summary> |
| @@ -353,8 +353,8 @@ namespace GSF.PQDIF.Physical · 9 unmodified lines | ||
| 353 | 353 | int byteIndex = index * 12; |
| 354 | 354 | |
| 355 | 355 | DateTime epoch = new DateTime(1900, 1, 1); |
| 356 | − uint days = EndianOrder.LittleEndian.ToUInt32(m_values, byteIndex); | |
| 357 | − double seconds = EndianOrder.LittleEndian.ToDouble(m_values, byteIndex + 4); | |
| 356 | + uint days = LittleEndian.ToUInt32(m_values, byteIndex); | |
| 357 | + double seconds = LittleEndian.ToDouble(m_values, byteIndex + 4); | |
| 358 | 358 | |
| 359 | 359 | return DateTime.SpecifyKind(epoch.AddDays(days).AddSeconds(seconds), DateTimeKind.Utc); |
| 360 | 360 | } |
| @@ -376,8 +376,8 @@ namespace GSF.PQDIF.Physical · 15 unmodified lines | ||
| 376 | 376 | TimeSpan daySpan = TimeSpan.FromDays(Math.Floor(sinceEpoch.TotalDays)); |
| 377 | 377 | TimeSpan secondSpan = sinceEpoch - daySpan; |
| 378 | 378 | |
| 379 | − EndianOrder.LittleEndian.CopyBytes((uint)daySpan.TotalDays, m_values, byteIndex); | |
| 380 | − EndianOrder.LittleEndian.CopyBytes(secondSpan.TotalSeconds, m_values, byteIndex + 4); | |
| 379 | + LittleEndian.CopyBytes((uint)daySpan.TotalDays, m_values, byteIndex); | |
| 380 | + LittleEndian.CopyBytes(secondSpan.TotalSeconds, m_values, byteIndex + 4); | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /// <summary> |
| @@ -122,8 +122,8 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 121 unmodified lines | ||
| 122 | 122 | m_fileType = (FileType)buffer[startIndex + 2]; |
| 123 | 123 | m_fileVersion = (FileVersion)buffer[startIndex + 3]; |
| 124 | 124 | m_sourceID = Encoding.ASCII.GetString(buffer, startIndex + 4, 4); |
| 125 | − headerLength = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 8); | |
| 126 | − secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 12); | |
| 125 | + headerLength = BigEndian.ToUInt32(buffer, startIndex + 8); | |
| 126 | + secondOfCentury = BigEndian.ToUInt32(buffer, startIndex + 12); | |
| 127 | 127 | |
| 128 | 128 | switch (m_fileType) |
| 129 | 129 | { |
| @@ -138,12 +138,12 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 8 unmodified lines | ||
| 138 | 138 | break; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | − m_startSample = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 16); | |
| 142 | − m_sampleInterval = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 20); | |
| 143 | − m_sampleRate = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 22); | |
| 144 | − m_rowLength = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 24); | |
| 145 | − m_totalRows = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 28); | |
| 146 | − secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 32); | |
| 141 | + m_startSample = BigEndian.ToUInt32(buffer, startIndex + 16); | |
| 142 | + m_sampleInterval = BigEndian.ToUInt16(buffer, startIndex + 20); | |
| 143 | + m_sampleRate = BigEndian.ToUInt16(buffer, startIndex + 22); | |
| 144 | + m_rowLength = BigEndian.ToUInt32(buffer, startIndex + 24); | |
| 145 | + m_totalRows = BigEndian.ToUInt32(buffer, startIndex + 28); | |
| 146 | + secondOfCentury = BigEndian.ToUInt32(buffer, startIndex + 32); | |
| 147 | 147 | |
| 148 | 148 | switch (m_fileType) |
| 149 | 149 | { |
| @@ -158,12 +158,12 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 8 unmodified lines | ||
| 158 | 158 | break; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | − m_triggerSample = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 36); | |
| 162 | − m_preTriggerRows = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 40); | |
| 163 | − m_triggerPMU = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 44); | |
| 164 | − m_triggerType = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 46); | |
| 161 | + m_triggerSample = BigEndian.ToUInt32(buffer, startIndex + 36); | |
| 162 | + m_preTriggerRows = BigEndian.ToUInt32(buffer, startIndex + 40); | |
| 163 | + m_triggerPMU = BigEndian.ToUInt16(buffer, startIndex + 44); | |
| 164 | + m_triggerType = BigEndian.ToUInt16(buffer, startIndex + 46); | |
| 165 | 165 | m_userInformation = Encoding.ASCII.GetString(buffer, startIndex + 48, 80).Trim(); |
| 166 | − m_pmuCount = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 128); | |
| 166 | + m_pmuCount = BigEndian.ToUInt32(buffer, startIndex + 128); | |
| 167 | 167 | FrameLength = unchecked((ushort)headerLength); |
| 168 | 168 | } |
| 169 | 169 | } |
| @@ -173,7 +173,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 3 unmodified lines | ||
| 173 | 173 | CommonFrameHeader configFrameHeader; |
| 174 | 174 | |
| 175 | 175 | m_packetNumber = (byte)BPAPDCstream.FrameType.DataFrame; |
| 176 | − m_rowFlags = EndianOrder.BigEndian.ToUInt32(buffer, startIndex); | |
| 176 | + m_rowFlags = BigEndian.ToUInt32(buffer, startIndex); | |
| 177 | 177 | |
| 178 | 178 | if (configFrame != null) |
| 179 | 179 | { |
| @@ -217,13 +217,13 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 37 unmodified lines | ||
| 217 | 217 | if (parseWordCountFromByte) |
| 218 | 218 | m_wordCount = buffer[startIndex + 3]; |
| 219 | 219 | else |
| 220 | − m_wordCount = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 220 | + m_wordCount = BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 221 | 221 | |
| 222 | 222 | // If this is a data frame get a rough timestamp down to the second (full parse will get accurate timestamp), this way |
| 223 | 223 | // data frames that don't get fully parsed because configuration hasn't been received will still show a timestamp |
| 224 | 224 | if (m_packetNumber > 0 && length > 8) |
| 225 | 225 | { |
| 226 | − secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 4); | |
| 226 | + secondOfCentury = BigEndian.ToUInt32(buffer, startIndex + 4); | |
| 227 | 227 | |
| 228 | 228 | // Until configuration is available, we make a guess at time tag type - this will just be |
| 229 | 229 | // used for display purposes until a configuration frame arrives. If second of century |
| @@ -713,7 +713,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 483 unmodified lines | ||
| 713 | 713 | |
| 714 | 714 | buffer[0] = PhasorProtocols.Common.SyncByte; |
| 715 | 715 | buffer[1] = m_packetNumber; |
| 716 | − EndianOrder.BigEndian.CopyBytes(m_wordCount, buffer, 2); | |
| 716 | + BigEndian.CopyBytes(m_wordCount, buffer, 2); | |
| 717 | 717 | |
| 718 | 718 | return buffer; |
| 719 | 719 | } |
| @@ -489,8 +489,8 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 488 unmodified lines | ||
| 489 | 489 | int index = 0; |
| 490 | 490 | |
| 491 | 491 | IDLabelImage.CopyImage(buffer, ref index, IDLabelLength); // PMUID |
| 492 | − EndianOrder.BigEndian.CopyBytes(Reserved, buffer, index); // Reserved | |
| 493 | − EndianOrder.BigEndian.CopyBytes(Offset, buffer, index + 2); // Offset | |
| 492 | + BigEndian.CopyBytes(Reserved, buffer, index); // Reserved | |
| 493 | + BigEndian.CopyBytes(Offset, buffer, index + 2); // Offset | |
| 494 | 494 | |
| 495 | 495 | return buffer; |
| 496 | 496 | } |
| @@ -562,8 +562,8 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 65 unmodified lines | ||
| 562 | 562 | protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) |
| 563 | 563 | { |
| 564 | 564 | IDLabel = Encoding.ASCII.GetString(buffer, startIndex, 4); |
| 565 | − Reserved = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 566 | − Offset = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 6); | |
| 565 | + Reserved = BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 566 | + Offset = BigEndian.ToUInt16(buffer, startIndex + 6); | |
| 567 | 567 | |
| 568 | 568 | return FixedBodyLength; |
| 569 | 569 | } |
| @@ -392,10 +392,10 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 391 unmodified lines | ||
| 392 | 392 | CommonHeader.BinaryImage.CopyImage(buffer, ref index, CommonFrameHeader.FixedLength); |
| 393 | 393 | buffer[4] = (byte)StreamType; |
| 394 | 394 | buffer[5] = (byte)RevisionNumber; |
| 395 | − EndianOrder.BigEndian.CopyBytes(FrameRate, buffer, 6); | |
| 396 | − EndianOrder.BigEndian.CopyBytes(RowLength(true), buffer, 8); // <-- Important: This step calculates all PMU row offsets! | |
| 397 | − EndianOrder.BigEndian.CopyBytes(PacketsPerSample, buffer, 12); | |
| 398 | − EndianOrder.BigEndian.CopyBytes((ushort)Cells.Count, buffer, 14); | |
| 395 | + BigEndian.CopyBytes(FrameRate, buffer, 6); | |
| 396 | + BigEndian.CopyBytes(RowLength(true), buffer, 8); // <-- Important: This step calculates all PMU row offsets! | |
| 397 | + BigEndian.CopyBytes(PacketsPerSample, buffer, 12); | |
| 398 | + BigEndian.CopyBytes((ushort)Cells.Count, buffer, 14); | |
| 399 | 399 | |
| 400 | 400 | return buffer; |
| 401 | 401 | } |
| @@ -456,10 +456,10 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 54 unmodified lines | ||
| 456 | 456 | // Only need to parse what wan't already parsed in common frame header |
| 457 | 457 | m_streamType = (StreamType)buffer[startIndex]; |
| 458 | 458 | m_revisionNumber = (RevisionNumber)buffer[startIndex + 1]; |
| 459 | − FrameRate = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 460 | − m_rowLength = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 4); | |
| 461 | − m_packetsPerSample = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 8); | |
| 462 | − State.CellCount = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 10); | |
| 459 | + FrameRate = BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 460 | + m_rowLength = BigEndian.ToUInt32(buffer, startIndex + 4); | |
| 461 | + m_packetsPerSample = BigEndian.ToUInt16(buffer, startIndex + 8); | |
| 462 | + State.CellCount = BigEndian.ToUInt16(buffer, startIndex + 10); | |
| 463 | 463 | |
| 464 | 464 | // The data that's in the data stream will take precedence over what's in the |
| 465 | 465 | // in the configuration file. The configuration file may define more PMU's than |
| @@ -724,7 +724,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 258 unmodified lines | ||
| 724 | 724 | protected override void AppendChecksum(byte[] buffer, int startIndex) |
| 725 | 725 | { |
| 726 | 726 | // Oddly enough, check sum for frames in BPA PDC stream is little-endian |
| 727 | − EndianOrder.LittleEndian.CopyBytes(CalculateChecksum(buffer, 0, startIndex), buffer, startIndex); | |
| 727 | + LittleEndian.CopyBytes(CalculateChecksum(buffer, 0, startIndex), buffer, startIndex); | |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | /// <summary> |
| @@ -746,7 +746,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 15 unmodified lines | ||
| 746 | 746 | else |
| 747 | 747 | { |
| 748 | 748 | int sumLength = BinaryLength - 2; |
| 749 | − return EndianOrder.LittleEndian.ToUInt16(buffer, startIndex + sumLength) == CalculateChecksum(buffer, startIndex, sumLength); | |
| 749 | + return LittleEndian.ToUInt16(buffer, startIndex + sumLength) == CalculateChecksum(buffer, startIndex, sumLength); | |
| 750 | 750 | } |
| 751 | 751 | } |
| 752 | 752 | |
| @@ -521,7 +521,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 520 unmodified lines | ||
| 521 | 521 | buffer[3] = (byte)PhasorValues.Count; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | − EndianOrder.BigEndian.CopyBytes(m_sampleNumber, buffer, 4); | |
| 524 | + BigEndian.CopyBytes(m_sampleNumber, buffer, 4); | |
| 525 | 525 | |
| 526 | 526 | return buffer; |
| 527 | 527 | } |
| @@ -586,7 +586,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 58 unmodified lines | ||
| 586 | 586 | // Read data buffer if using phasor data file format |
| 587 | 587 | if (UsePhasorDataFileFormat && frameState.RemainingPdcBlockPmus == 0) |
| 588 | 588 | { |
| 589 | − m_dataBuffer = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 589 | + m_dataBuffer = BigEndian.ToUInt32(buffer, index); | |
| 590 | 590 | index += 4; |
| 591 | 591 | } |
| 592 | 592 | |
| @@ -659,7 +659,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 66 unmodified lines | ||
| 659 | 659 | else |
| 660 | 660 | { |
| 661 | 661 | // Parse PMU's sample number |
| 662 | − m_sampleNumber = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 662 | + m_sampleNumber = BigEndian.ToUInt16(buffer, index); | |
| 663 | 663 | index += 2; |
| 664 | 664 | } |
| 665 | 665 | } |
| @@ -287,12 +287,12 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 286 unmodified lines | ||
| 287 | 287 | CommonHeader.BinaryImage.CopyImage(buffer, ref index, CommonFrameHeader.FixedLength); |
| 288 | 288 | |
| 289 | 289 | if (ConfigurationFrame.RevisionNumber == RevisionNumber.Revision0) |
| 290 | − EndianOrder.BigEndian.CopyBytes((uint)Math.Truncate(NtpTimeTag.Value), buffer, 4); | |
| 290 | + BigEndian.CopyBytes((uint)Math.Truncate(NtpTimeTag.Value), buffer, 4); | |
| 291 | 291 | else |
| 292 | − EndianOrder.BigEndian.CopyBytes((uint)Math.Truncate(TimeTag.Value), buffer, 4); | |
| 292 | + BigEndian.CopyBytes((uint)Math.Truncate(TimeTag.Value), buffer, 4); | |
| 293 | 293 | |
| 294 | − EndianOrder.BigEndian.CopyBytes(m_sampleNumber, buffer, 8); | |
| 295 | − EndianOrder.BigEndian.CopyBytes((ushort)Cells.Count, buffer, 10); | |
| 294 | + BigEndian.CopyBytes(m_sampleNumber, buffer, 8); | |
| 295 | + BigEndian.CopyBytes((ushort)Cells.Count, buffer, 10); | |
| 296 | 296 | |
| 297 | 297 | index += 8; |
| 298 | 298 | |
| @@ -312,7 +312,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 13 unmodified lines | ||
| 312 | 312 | index += 2; |
| 313 | 313 | |
| 314 | 314 | // Add offset to data frame header |
| 315 | − EndianOrder.BigEndian.CopyBytes(offset, buffer, index); | |
| 315 | + BigEndian.CopyBytes(offset, buffer, index); | |
| 316 | 316 | index += 2; |
| 317 | 317 | |
| 318 | 318 | offset += (ushort)dataCell.BinaryLength; |
| @@ -406,8 +406,8 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 87 unmodified lines | ||
| 406 | 406 | int index = startIndex + CommonFrameHeader.FixedLength; |
| 407 | 407 | |
| 408 | 408 | // Parse frame timestamp |
| 409 | − uint secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 410 | − m_sampleNumber = EndianOrder.BigEndian.ToUInt16(buffer, index + 4); | |
| 409 | + uint secondOfCentury = BigEndian.ToUInt32(buffer, index); | |
| 410 | + m_sampleNumber = BigEndian.ToUInt16(buffer, index + 4); | |
| 411 | 411 | index += 6; |
| 412 | 412 | |
| 413 | 413 | if (configurationFrame.RevisionNumber == RevisionNumber.Revision0) |
| @@ -417,7 +417,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 3 unmodified lines | ||
| 417 | 417 | |
| 418 | 418 | // Because in cases where PDCxchng is being used the data cell count will be smaller than the |
| 419 | 419 | // configuration cell count - we save this count to calculate the offsets later |
| 420 | − state.CellCount = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 420 | + state.CellCount = BigEndian.ToUInt16(buffer, index); | |
| 421 | 421 | index += 2; |
| 422 | 422 | |
| 423 | 423 | if (state.CellCount > configurationFrame.Cells.Count) |
| @@ -463,7 +463,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 39 unmodified lines | ||
| 463 | 463 | protected override void AppendChecksum(byte[] buffer, int startIndex) |
| 464 | 464 | { |
| 465 | 465 | // Oddly enough, check sum for frames in BPA PDC stream is little-endian |
| 466 | − EndianOrder.LittleEndian.CopyBytes(CalculateChecksum(buffer, 0, startIndex), buffer, startIndex); | |
| 466 | + LittleEndian.CopyBytes(CalculateChecksum(buffer, 0, startIndex), buffer, startIndex); | |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /// <summary> |
| @@ -482,7 +482,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 12 unmodified lines | ||
| 482 | 482 | return true; |
| 483 | 483 | |
| 484 | 484 | int sumLength = BinaryLength - 2; |
| 485 | − return EndianOrder.LittleEndian.ToUInt16(buffer, startIndex + sumLength) == CalculateChecksum(buffer, startIndex, sumLength); | |
| 485 | + return LittleEndian.ToUInt16(buffer, startIndex + sumLength) == CalculateChecksum(buffer, startIndex, sumLength); | |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /// <summary> |
| @@ -136,7 +136,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 135 unmodified lines | ||
| 136 | 136 | { |
| 137 | 137 | byte[] buffer = new byte[2]; |
| 138 | 138 | |
| 139 | − EndianOrder.BigEndian.CopyBytes((short)UnscaledFrequency, buffer, 0); | |
| 139 | + BigEndian.CopyBytes((short)UnscaledFrequency, buffer, 0); | |
| 140 | 140 | |
| 141 | 141 | return buffer; |
| 142 | 142 | } |
| @@ -161,7 +161,7 @@ namespace GSF.PhasorProtocols.BPAPDCstream · 18 unmodified lines | ||
| 161 | 161 | // PMUs in PDC block do not include Df/Dt |
| 162 | 162 | if (Definition.Parent.IsPdcBlockSection) |
| 163 | 163 | { |
| 164 | − UnscaledFrequency = EndianOrder.BigEndian.ToInt16(buffer, startIndex); | |
| 164 | + UnscaledFrequency = BigEndian.ToInt16(buffer, startIndex); | |
| 165 | 165 | return 2; |
| 166 | 166 | } |
| 167 | 167 | |
| @@ -184,7 +184,7 @@ namespace GSF.PhasorProtocols · 183 unmodified lines | ||
| 184 | 184 | } |
| 185 | 185 | set |
| 186 | 186 | { |
| 187 | − if (value == null) | |
| 187 | + if ((object)value == null) | |
| 188 | 188 | value = ""; |
| 189 | 189 | |
| 190 | 190 | value = value.GetValidLabel(); |
| @@ -165,11 +165,14 @@ namespace GSF.PhasorProtocols · 164 unmodified lines | ||
| 165 | 165 | /// Gets the number of redundant frames in each packet. |
| 166 | 166 | /// </summary> |
| 167 | 167 | /// <remarks> |
| 168 | − /// <para>This value is used when calculating statistics. It is assumed that for each | |
| 168 | + /// <para> | |
| 169 | + /// This value is used when calculating statistics. It is assumed that for each | |
| 169 | 170 | /// frame that is received, that frame will be included in the next <c>n</c> |
| 170 | − /// packets, where <c>n</c> is the number of redundant frames per packet.</para> | |
| 171 | − /// | |
| 172 | − /// <para>This base class returns 0, as most protocols do not support redundant frames.</para> | |
| 171 | + /// packets, where <c>n</c> is the number of redundant frames per packet. | |
| 172 | + /// </para> | |
| 173 | + /// <para> | |
| 174 | + /// This base class returns 0, as most protocols do not support redundant frames. | |
| 175 | + /// </para> | |
| 173 | 176 | /// </remarks> |
| 174 | 177 | public virtual int RedundantFramesPerPacket |
| 175 | 178 | { |
| @@ -183,7 +186,7 @@ namespace GSF.PhasorProtocols · 7 unmodified lines | ||
| 183 | 186 | /// Gets or sets current <see cref="IConfigurationFrame"/> used for parsing <see cref="IDataFrame"/>'s encountered in the data stream from a device. |
| 184 | 187 | /// </summary> |
| 185 | 188 | /// <remarks> |
| 186 | − /// If a <see cref="IConfigurationFrame"/> has been parsed, this will return a reference to the parsed frame. Consumer can manually assign a | |
| 189 | + /// If a <see cref="IConfigurationFrame"/> has been parsed, this will return a reference to the parsed frame. Consumer can manually assign a | |
| 187 | 190 | /// <see cref="IConfigurationFrame"/> to start parsing data if one has not been encountered in the stream. |
| 188 | 191 | /// </remarks> |
| 189 | 192 | public abstract IConfigurationFrame ConfigurationFrame |
| @@ -33,7 +33,7 @@ namespace GSF.PhasorProtocols · 32 unmodified lines | ||
| 33 | 33 | #region [ Enumerations ] |
| 34 | 34 | |
| 35 | 35 | /// <summary> |
| 36 | − /// Source channel, i.e., data or command. | |
| 36 | + /// Source channel, e.g., data or command. | |
| 37 | 37 | /// </summary> |
| 38 | 38 | [Serializable] |
| 39 | 39 | public enum SourceChannel |
| @@ -108,7 +108,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 107 unmodified lines | ||
| 108 | 108 | buffer[0] = (byte)this.AnalogType; |
| 109 | 109 | |
| 110 | 110 | // Store scaling in last three bytes |
| 111 | − EndianOrder.BigEndian.CopyBytes(scalingFactor, buffer, 1); | |
| 111 | + BigEndian.CopyBytes(scalingFactor, buffer, 1); | |
| 112 | 112 | |
| 113 | 113 | return buffer; |
| 114 | 114 | } |
| @@ -129,7 +129,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 14 unmodified lines | ||
| 129 | 129 | this.AnalogType = (AnalogType)buffer[startIndex]; |
| 130 | 130 | |
| 131 | 131 | // Last three bytes represent scaling factor |
| 132 | − ScalingValue = EndianOrder.BigEndian.ToUInt24(buffer, startIndex + 1); | |
| 132 | + ScalingValue = BigEndian.ToUInt24(buffer, startIndex + 1); | |
| 133 | 133 | |
| 134 | 134 | return ConversionFactorLength; |
| 135 | 135 | } |
| @@ -80,7 +80,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 79 unmodified lines | ||
| 80 | 80 | // Validate check-sum |
| 81 | 81 | int sumLength = m_frameHeader.FrameLength - 2; |
| 82 | 82 | |
| 83 | − if (EndianOrder.BigEndian.ToUInt16(buffer, startIndex + sumLength) != CalculateChecksum(buffer, startIndex, sumLength)) | |
| 83 | + if (BigEndian.ToUInt16(buffer, startIndex + sumLength) != CalculateChecksum(buffer, startIndex, sumLength)) | |
| 84 | 84 | throw new InvalidOperationException("Invalid binary image detected - check sum of " + this.GetType().Name + " did not match"); |
| 85 | 85 | |
| 86 | 86 | m_frameHeader.State = new CommandFrameParsingState(m_frameHeader.FrameLength, m_frameHeader.DataLength, true, true); |
| @@ -598,7 +598,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 597 unmodified lines | ||
| 598 | 598 | if (tagLength < 2) |
| 599 | 599 | throw new InvalidOperationException(string.Format("Unexpected length for \"{0}\" tag: {1}", tag, tagLength)); |
| 600 | 600 | |
| 601 | − ushort result = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 601 | + ushort result = BigEndian.ToUInt16(buffer, index); | |
| 602 | 602 | index += tagLength; |
| 603 | 603 | |
| 604 | 604 | return result; |
| @@ -621,7 +621,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 16 unmodified lines | ||
| 621 | 621 | if (tagLength < 3) |
| 622 | 622 | throw new InvalidOperationException(string.Format("Unexpected length for \"{0}\" tag: {1}", tag, tagLength)); |
| 623 | 623 | |
| 624 | − UInt24 result = EndianOrder.BigEndian.ToUInt24(buffer, index); | |
| 624 | + UInt24 result = BigEndian.ToUInt24(buffer, index); | |
| 625 | 625 | index += tagLength; |
| 626 | 626 | |
| 627 | 627 | return result; |
| @@ -644,7 +644,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 16 unmodified lines | ||
| 644 | 644 | if (tagLength < 4) |
| 645 | 645 | throw new InvalidOperationException(string.Format("Unexpected length for \"{0}\" tag: {1}", tag, tagLength)); |
| 646 | 646 | |
| 647 | − uint result = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 647 | + uint result = BigEndian.ToUInt32(buffer, index); | |
| 648 | 648 | index += tagLength; |
| 649 | 649 | |
| 650 | 650 | return result; |
| @@ -667,7 +667,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 16 unmodified lines | ||
| 667 | 667 | if (tagLength < 8) |
| 668 | 668 | throw new InvalidOperationException(string.Format("Unexpected length for \"{0}\" tag: {1}", tag, tagLength)); |
| 669 | 669 | |
| 670 | − ulong result = EndianOrder.BigEndian.ToUInt64(buffer, index); | |
| 670 | + ulong result = BigEndian.ToUInt64(buffer, index); | |
| 671 | 671 | index += tagLength; |
| 672 | 672 | |
| 673 | 673 | return result; |
| @@ -730,7 +730,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 56 unmodified lines | ||
| 730 | 730 | |
| 731 | 731 | buffer[index++] = (byte)tag; |
| 732 | 732 | length.EncodeTagLength(buffer, ref index); |
| 733 | − index += EndianOrder.BigEndian.CopyBytes(value, buffer, index); | |
| 733 | + index += BigEndian.CopyBytes(value, buffer, index); | |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | /// <summary> |
| @@ -179,11 +179,11 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 178 unmodified lines | ||
| 179 | 179 | m_frameType = (FrameType)(buffer[startIndex + 1] & ~VersionNumberMask); |
| 180 | 180 | m_version = (byte)(buffer[startIndex + 1] & VersionNumberMask); |
| 181 | 181 | |
| 182 | − m_frameLength = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 183 | − m_idCode = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 182 | + m_frameLength = BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 183 | + m_idCode = BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 184 | 184 | |
| 185 | − uint secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 6); | |
| 186 | − uint fractionOfSecond = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 10); | |
| 185 | + uint secondOfCentury = BigEndian.ToUInt32(buffer, startIndex + 6); | |
| 186 | + uint fractionOfSecond = BigEndian.ToUInt32(buffer, startIndex + 10); | |
| 187 | 187 | long ticksBeyondSecond; |
| 188 | 188 | |
| 189 | 189 | // Without timebase, the best timestamp you can get is down to the whole second |
| @@ -230,7 +230,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 40 unmodified lines | ||
| 230 | 230 | index += 3; |
| 231 | 231 | |
| 232 | 232 | // Get SPDU length |
| 233 | − m_spduLength = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 233 | + m_spduLength = BigEndian.ToUInt32(buffer, index); | |
| 234 | 234 | index += 4; |
| 235 | 235 | |
| 236 | 236 | // Add SPDU length to total frame length (updated as of 10/3/2012 to accommodate extra 6 bytes) |
| @@ -241,7 +241,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 4 unmodified lines | ||
| 241 | 241 | if (length > m_spduLength + 13) |
| 242 | 242 | { |
| 243 | 243 | // Get SPDU packet number |
| 244 | − m_packetNumber = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 244 | + m_packetNumber = BigEndian.ToUInt32(buffer, index); | |
| 245 | 245 | |
| 246 | 246 | // Get security algorithm type |
| 247 | 247 | m_securityAlgorithm = (SecurityAlgorithm)buffer[index + 12]; |
| @@ -250,7 +250,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 2 unmodified lines | ||
| 250 | 250 | m_signatureAlgorithm = (SignatureAlgorithm)buffer[index + 13]; |
| 251 | 251 | |
| 252 | 252 | // Get current key ID |
| 253 | − m_keyID = EndianOrder.BigEndian.ToUInt32(buffer, index + 14); | |
| 253 | + m_keyID = BigEndian.ToUInt32(buffer, index + 14); | |
| 254 | 254 | |
| 255 | 255 | // Add signature calculation result length to total frame length |
| 256 | 256 | switch (m_signatureAlgorithm) |
| @@ -327,7 +327,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 70 unmodified lines | ||
| 327 | 327 | |
| 328 | 328 | // Get payload length |
| 329 | 329 | index += 18; |
| 330 | − m_dataLength = (ushort)EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 330 | + m_dataLength = (ushort)BigEndian.ToUInt32(buffer, index); | |
| 331 | 331 | index += 4; |
| 332 | 332 | |
| 333 | 333 | // Confirm payload type tag is sampled values |
| @@ -340,11 +340,11 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 6 unmodified lines | ||
| 340 | 340 | m_simulatedData = buffer[index++] != 0; |
| 341 | 341 | |
| 342 | 342 | // Get application ID |
| 343 | − m_applicationID = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 343 | + m_applicationID = BigEndian.ToUInt16(buffer, index); | |
| 344 | 344 | index += 2; |
| 345 | 345 | |
| 346 | 346 | // Get ASDU payload size |
| 347 | − m_payloadSize = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 347 | + m_payloadSize = BigEndian.ToUInt16(buffer, index); | |
| 348 | 348 | index += 2; |
| 349 | 349 | |
| 350 | 350 | // Validate sampled value PDU tag exists and skip past it |
| @@ -974,20 +974,20 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 623 unmodified lines | ||
| 974 | 974 | index = 6; |
| 975 | 975 | |
| 976 | 976 | // Encode SPDU length |
| 977 | − index += EndianOrder.BigEndian.CopyBytes(m_spduLength, buffer, index); | |
| 977 | + index += BigEndian.CopyBytes(m_spduLength, buffer, index); | |
| 978 | 978 | |
| 979 | 979 | // Encode SPDU packet number |
| 980 | − index += EndianOrder.BigEndian.CopyBytes(m_packetNumber, buffer, index); | |
| 980 | + index += BigEndian.CopyBytes(m_packetNumber, buffer, index); | |
| 981 | 981 | |
| 982 | 982 | // Encode SPDU version number (hard coded to version 1) |
| 983 | − index += EndianOrder.BigEndian.CopyBytes((ushort)1, buffer, index); | |
| 983 | + index += BigEndian.CopyBytes((ushort)1, buffer, index); | |
| 984 | 984 | |
| 985 | 985 | // Encode time of current key |
| 986 | 986 | UnixTimeTag time = new UnixTimeTag(DateTime.UtcNow.Ticks); |
| 987 | − index += EndianOrder.BigEndian.CopyBytes((uint)time.Value, buffer, index); | |
| 987 | + index += BigEndian.CopyBytes((uint)time.Value, buffer, index); | |
| 988 | 988 | |
| 989 | 989 | // Encode time to next key (again, TBD once security is actually defined) |
| 990 | − index += EndianOrder.BigEndian.CopyBytes((ushort)100, buffer, index); | |
| 990 | + index += BigEndian.CopyBytes((ushort)100, buffer, index); | |
| 991 | 991 | |
| 992 | 992 | // Encode security algorithm type |
| 993 | 993 | buffer[index++] = (byte)m_securityAlgorithm; |
| @@ -996,10 +996,10 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 2 unmodified lines | ||
| 996 | 996 | buffer[index++] = (byte)m_signatureAlgorithm; |
| 997 | 997 | |
| 998 | 998 | // Encode current key ID |
| 999 | − index += EndianOrder.BigEndian.CopyBytes(m_keyID, buffer, index); | |
| 999 | + index += BigEndian.CopyBytes(m_keyID, buffer, index); | |
| 1000 | 1000 | |
| 1001 | 1001 | // Encode payload length |
| 1002 | − index += EndianOrder.BigEndian.CopyBytes((uint)m_dataLength, buffer, index); | |
| 1002 | + index += BigEndian.CopyBytes((uint)m_dataLength, buffer, index); | |
| 1003 | 1003 | |
| 1004 | 1004 | // Encode payload tag for sampled values |
| 1005 | 1005 | buffer[index++] = 0x82; |
| @@ -1008,10 +1008,10 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 2 unmodified lines | ||
| 1008 | 1008 | buffer[index++] = (byte)(m_simulatedData ? 0x01 : 0x00); |
| 1009 | 1009 | |
| 1010 | 1010 | // Encode the application ID |
| 1011 | − index += EndianOrder.BigEndian.CopyBytes(m_applicationID, buffer, index); | |
| 1011 | + index += BigEndian.CopyBytes(m_applicationID, buffer, index); | |
| 1012 | 1012 | |
| 1013 | 1013 | // Encode ASDU payload size |
| 1014 | − index += EndianOrder.BigEndian.CopyBytes(pduLen, buffer, index); | |
| 1014 | + index += BigEndian.CopyBytes(pduLen, buffer, index); | |
| 1015 | 1015 | |
| 1016 | 1016 | // Encode SV PDU tag |
| 1017 | 1017 | m_payloadSize.EncodeTagLength(SampledValueTag.SvPdu, buffer, ref index); |
| @@ -1029,10 +1029,10 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 11 unmodified lines | ||
| 1029 | 1029 | |
| 1030 | 1030 | buffer[0] = PhasorProtocols.Common.SyncByte; |
| 1031 | 1031 | buffer[1] = (byte)((byte)TypeID | Version); |
| 1032 | − EndianOrder.BigEndian.CopyBytes(FrameLength, buffer, 2); | |
| 1033 | − EndianOrder.BigEndian.CopyBytes(IDCode, buffer, 4); | |
| 1034 | − EndianOrder.BigEndian.CopyBytes(SecondOfCentury, buffer, 6); | |
| 1035 | − EndianOrder.BigEndian.CopyBytes(FractionOfSecond | (int)m_timeQualityFlags, buffer, 10); | |
| 1032 | + BigEndian.CopyBytes(FrameLength, buffer, 2); | |
| 1033 | + BigEndian.CopyBytes(IDCode, buffer, 4); | |
| 1034 | + BigEndian.CopyBytes(SecondOfCentury, buffer, 6); | |
| 1035 | + BigEndian.CopyBytes(FractionOfSecond | (int)m_timeQualityFlags, buffer, 10); | |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | return buffer; |
| @@ -240,11 +240,11 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 239 unmodified lines | ||
| 240 | 240 | int index = 0; |
| 241 | 241 | |
| 242 | 242 | base.HeaderImage.CopyImage(buffer, ref index, base.HeaderLength); |
| 243 | − EndianOrder.BigEndian.CopyBytes(IDCode, buffer, index); | |
| 244 | − EndianOrder.BigEndian.CopyBytes((ushort)m_formatFlags, buffer, index + 2); | |
| 245 | − EndianOrder.BigEndian.CopyBytes((ushort)PhasorDefinitions.Count, buffer, index + 4); | |
| 246 | − EndianOrder.BigEndian.CopyBytes((ushort)AnalogDefinitions.Count, buffer, index + 6); | |
| 247 | − EndianOrder.BigEndian.CopyBytes((ushort)DigitalDefinitions.Count, buffer, index + 8); | |
| 243 | + BigEndian.CopyBytes(IDCode, buffer, index); | |
| 244 | + BigEndian.CopyBytes((ushort)m_formatFlags, buffer, index + 2); | |
| 245 | + BigEndian.CopyBytes((ushort)PhasorDefinitions.Count, buffer, index + 4); | |
| 246 | + BigEndian.CopyBytes((ushort)AnalogDefinitions.Count, buffer, index + 6); | |
| 247 | + BigEndian.CopyBytes((ushort)DigitalDefinitions.Count, buffer, index + 8); | |
| 248 | 248 | |
| 249 | 249 | return buffer; |
| 250 | 250 | } |
| @@ -304,7 +304,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 53 unmodified lines | ||
| 304 | 304 | |
| 305 | 305 | // Include configuration count (new for version 7.0) |
| 306 | 306 | if (Parent.DraftRevision > DraftRevision.Draft6) |
| 307 | − EndianOrder.BigEndian.CopyBytes(RevisionCount, buffer, index); | |
| 307 | + BigEndian.CopyBytes(RevisionCount, buffer, index); | |
| 308 | 308 | |
| 309 | 309 | return buffer; |
| 310 | 310 | } |
| @@ -344,13 +344,13 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 33 unmodified lines | ||
| 344 | 344 | // Parse out station name |
| 345 | 345 | index += base.ParseHeaderImage(buffer, startIndex, length); |
| 346 | 346 | |
| 347 | − IDCode = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 348 | − m_formatFlags = (FormatFlags)EndianOrder.BigEndian.ToUInt16(buffer, index + 2); | |
| 347 | + IDCode = BigEndian.ToUInt16(buffer, index); | |
| 348 | + m_formatFlags = (FormatFlags)BigEndian.ToUInt16(buffer, index + 2); | |
| 349 | 349 | |
| 350 | 350 | // Parse out total phasors, analogs and digitals defined for this device |
| 351 | − state.PhasorCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 4); | |
| 352 | − state.AnalogCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 6); | |
| 353 | − state.DigitalCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 8); | |
| 351 | + state.PhasorCount = BigEndian.ToUInt16(buffer, index + 4); | |
| 352 | + state.AnalogCount = BigEndian.ToUInt16(buffer, index + 6); | |
| 353 | + state.DigitalCount = BigEndian.ToUInt16(buffer, index + 8); | |
| 354 | 354 | index += 10; |
| 355 | 355 | |
| 356 | 356 | return (index - startIndex); |
| @@ -401,7 +401,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 44 unmodified lines | ||
| 401 | 401 | // Parse out configuration count (new for version 7.0) |
| 402 | 402 | if (Parent.DraftRevision > DraftRevision.Draft6) |
| 403 | 403 | { |
| 404 | − RevisionCount = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 404 | + RevisionCount = BigEndian.ToUInt16(buffer, index); | |
| 405 | 405 | index += 2; |
| 406 | 406 | } |
| 407 | 407 | |
| @@ -280,8 +280,8 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 279 unmodified lines | ||
| 280 | 280 | int index = 0; |
| 281 | 281 | |
| 282 | 282 | CommonHeader.BinaryImage.CopyImage(buffer, ref index, CommonFrameHeader.FixedLength); |
| 283 | − EndianOrder.BigEndian.CopyBytes(m_timebase, buffer, index); | |
| 284 | − EndianOrder.BigEndian.CopyBytes((ushort)Cells.Count, buffer, index + 4); | |
| 283 | + BigEndian.CopyBytes(m_timebase, buffer, index); | |
| 284 | + BigEndian.CopyBytes((ushort)Cells.Count, buffer, index + 4); | |
| 285 | 285 | |
| 286 | 286 | return buffer; |
| 287 | 287 | } |
| @@ -307,7 +307,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 19 unmodified lines | ||
| 307 | 307 | { |
| 308 | 308 | byte[] buffer = new byte[2]; |
| 309 | 309 | |
| 310 | − EndianOrder.BigEndian.CopyBytes(FrameRate, buffer, 0); | |
| 310 | + BigEndian.CopyBytes(FrameRate, buffer, 0); | |
| 311 | 311 | |
| 312 | 312 | return buffer; |
| 313 | 313 | } |
| @@ -357,9 +357,9 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 43 unmodified lines | ||
| 357 | 357 | // Skip past header that was already parsed... |
| 358 | 358 | startIndex += CommonFrameHeader.FixedLength; |
| 359 | 359 | |
| 360 | − m_timebase = EndianOrder.BigEndian.ToUInt32(buffer, startIndex); | |
| 360 | + m_timebase = BigEndian.ToUInt32(buffer, startIndex); | |
| 361 | 361 | CommonHeader.Timebase = m_timebase; |
| 362 | − State.CellCount = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 362 | + State.CellCount = BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 363 | 363 | |
| 364 | 364 | return FixedHeaderLength; |
| 365 | 365 | } |
| @@ -373,7 +373,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 7 unmodified lines | ||
| 373 | 373 | /// <returns>The length of the data that was parsed.</returns> |
| 374 | 374 | protected override int ParseFooterImage(byte[] buffer, int startIndex, int length) |
| 375 | 375 | { |
| 376 | − FrameRate = EndianOrder.BigEndian.ToUInt16(buffer, startIndex); | |
| 376 | + FrameRate = BigEndian.ToUInt16(buffer, startIndex); | |
| 377 | 377 | return 2; |
| 378 | 378 | } |
| 379 | 379 | |
| @@ -692,8 +692,8 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 691 unmodified lines | ||
| 692 | 692 | if (tagLength < 8) |
| 693 | 693 | throw new InvalidOperationException(string.Format("Unexpected length for \"{0}\" tag: {1}", SampledValueTag.RefrTm, tagLength)); |
| 694 | 694 | |
| 695 | − uint secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 696 | − UInt24 fractionOfSecond = EndianOrder.BigEndian.ToUInt24(buffer, index + 4); | |
| 695 | + uint secondOfCentury = BigEndian.ToUInt32(buffer, index); | |
| 696 | + UInt24 fractionOfSecond = BigEndian.ToUInt24(buffer, index + 4); | |
| 697 | 697 | index += 7; |
| 698 | 698 | |
| 699 | 699 | // Get whole seconds of timestamp |
| @@ -240,8 +240,8 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 239 unmodified lines | ||
| 240 | 240 | { |
| 241 | 241 | byte[] buffer = new byte[ConversionFactorLength]; |
| 242 | 242 | |
| 243 | − EndianOrder.BigEndian.CopyBytes(m_normalStatus, buffer, 0); | |
| 244 | − EndianOrder.BigEndian.CopyBytes(m_validInputs, buffer, 2); | |
| 243 | + BigEndian.CopyBytes(m_normalStatus, buffer, 0); | |
| 244 | + BigEndian.CopyBytes(m_validInputs, buffer, 2); | |
| 245 | 245 | |
| 246 | 246 | return buffer; |
| 247 | 247 | } |
| @@ -402,8 +402,8 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 154 unmodified lines | ||
| 402 | 402 | /// <param name="startIndex">Start index into <paramref name="buffer"/> to begin parsing.</param> |
| 403 | 403 | internal int ParseConversionFactor(byte[] buffer, int startIndex) |
| 404 | 404 | { |
| 405 | − m_normalStatus = EndianOrder.BigEndian.ToUInt16(buffer, startIndex); | |
| 406 | − m_validInputs = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 405 | + m_normalStatus = BigEndian.ToUInt16(buffer, startIndex); | |
| 406 | + m_validInputs = BigEndian.ToUInt16(buffer, startIndex + 2); | |
| 407 | 407 | |
| 408 | 408 | return ConversionFactorLength; |
| 409 | 409 | } |
| @@ -104,7 +104,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 103 unmodified lines | ||
| 104 | 104 | { |
| 105 | 105 | get |
| 106 | 106 | { |
| 107 | − return EndianOrder.BigEndian.GetBytes((ushort)(Parent.NominalFrequency == LineFrequency.Hz50 ? Bits.Bit00 : Bits.Nil)); | |
| 107 | + return BigEndian.GetBytes((ushort)(Parent.NominalFrequency == LineFrequency.Hz50 ? Bits.Bit00 : Bits.Nil)); | |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| @@ -125,7 +125,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 14 unmodified lines | ||
| 125 | 125 | /// </remarks> |
| 126 | 126 | protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) |
| 127 | 127 | { |
| 128 | − Parent.NominalFrequency = ((EndianOrder.BigEndian.ToUInt16(buffer, startIndex) & (ushort)Bits.Bit00) > 0) ? LineFrequency.Hz50 : LineFrequency.Hz60; | |
| 128 | + Parent.NominalFrequency = ((BigEndian.ToUInt16(buffer, startIndex) & (ushort)Bits.Bit00) > 0) ? LineFrequency.Hz50 : LineFrequency.Hz60; | |
| 129 | 129 | return 2; |
| 130 | 130 | } |
| 131 | 131 | |
| @@ -107,7 +107,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 106 unmodified lines | ||
| 107 | 107 | |
| 108 | 108 | buffer[0] = (byte)PhasorType; |
| 109 | 109 | |
| 110 | − EndianOrder.BigEndian.CopyBytes(scalingFactor, buffer, 1); | |
| 110 | + BigEndian.CopyBytes(scalingFactor, buffer, 1); | |
| 111 | 111 | |
| 112 | 112 | return buffer; |
| 113 | 113 | } |
| @@ -128,7 +128,7 @@ namespace GSF.PhasorProtocols.IEC61850_90_5 · 14 unmodified lines | ||
| 128 | 128 | PhasorType = (buffer[startIndex] == 0) ? PhasorType.Voltage : PhasorType.Current; |
| 129 | 129 | |
| 130 | 130 | // Last three bytes represent scaling factor |
| 131 | − ScalingValue = EndianOrder.BigEndian.ToUInt24(buffer, startIndex + 1); | |
| 131 | + ScalingValue = BigEndian.ToUInt24(buffer, startIndex + 1); | |
| 132 | 132 | |
| 133 | 133 | return ConversionFactorLength; |
| 134 | 134 | } |
| @@ -80,7 +80,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 79 unmodified lines | ||
| 80 | 80 | // Validate check-sum |
| 81 | 81 | int sumLength = FrameLength - 2; |
| 82 | 82 | |
| 83 | − if (EndianOrder.BigEndian.ToUInt16(buffer, startIndex + sumLength) != CalculateChecksum(buffer, startIndex, sumLength)) | |
| 83 | + if (BigEndian.ToUInt16(buffer, startIndex + sumLength) != CalculateChecksum(buffer, startIndex, sumLength)) | |
| 84 | 84 | throw new InvalidOperationException("Invalid binary image detected - check sum of " + this.GetType().Name + " did not match"); |
| 85 | 85 | |
| 86 | 86 | ParseBinaryImage(buffer, startIndex, length); |
| @@ -194,8 +194,8 @@ namespace GSF.PhasorProtocols.IEEE1344 · 107 unmodified lines | ||
| 194 | 194 | { |
| 195 | 195 | byte[] buffer = new byte[HeaderLength]; |
| 196 | 196 | |
| 197 | − EndianOrder.BigEndian.CopyBytes((uint)TimeTag.Value, buffer, 0); | |
| 198 | − EndianOrder.BigEndian.CopyBytes(m_idCode, buffer, 4); | |
| 197 | + BigEndian.CopyBytes((uint)TimeTag.Value, buffer, 0); | |
| 198 | + BigEndian.CopyBytes(m_idCode, buffer, 4); | |
| 199 | 199 | |
| 200 | 200 | return buffer; |
| 201 | 201 | } |
| @@ -229,8 +229,8 @@ namespace GSF.PhasorProtocols.IEEE1344 · 27 unmodified lines | ||
| 229 | 229 | /// <returns>The length of the data that was parsed.</returns> |
| 230 | 230 | protected override int ParseHeaderImage(byte[] buffer, int startIndex, int length) |
| 231 | 231 | { |
| 232 | − Timestamp = (new NtpTimeTag(EndianOrder.BigEndian.ToUInt32(buffer, startIndex), 0)).ToDateTime().Ticks; | |
| 233 | − m_idCode = EndianOrder.BigEndian.ToUInt64(buffer, startIndex + 4); | |
| 232 | + Timestamp = (new NtpTimeTag(BigEndian.ToUInt32(buffer, startIndex), 0)).ToDateTime().Ticks; | |
| 233 | + m_idCode = BigEndian.ToUInt64(buffer, startIndex + 4); | |
| 234 | 234 | return 12; |
| 235 | 235 | } |
| 236 | 236 | |
| @@ -83,13 +83,13 @@ namespace GSF.PhasorProtocols.IEEE1344 · 82 unmodified lines | ||
| 83 | 83 | /// <param name="startIndex">Start index into buffer where valid data begins.</param> |
| 84 | 84 | public CommonFrameHeader(ConfigurationFrame configurationFrame, byte[] buffer, int startIndex) |
| 85 | 85 | { |
| 86 | − uint secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, startIndex); | |
| 87 | − m_sampleCount = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 86 | + uint secondOfCentury = BigEndian.ToUInt32(buffer, startIndex); | |
| 87 | + m_sampleCount = BigEndian.ToUInt16(buffer, startIndex + 4); | |
| 88 | 88 | |
| 89 | 89 | // We go ahead and pre-grab cell's status flags so we can determine framelength - we |
| 90 | 90 | // leave startindex at 6 so that cell will be able to parse flags as needed - note |
| 91 | 91 | // this increases needed common frame header size by 2 (i.e., BinaryLength + 2) |
| 92 | − m_statusFlags = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + FixedLength); | |
| 92 | + m_statusFlags = BigEndian.ToUInt16(buffer, startIndex + FixedLength); | |
| 93 | 93 | |
| 94 | 94 | // NTP timestamps based on NtpTimeTag class are designed to work for dates between |
| 95 | 95 | // 1968-01-20 and 2104-02-26 based on recommended bit interpretation in RFC-2030. |
| @@ -357,8 +357,8 @@ namespace GSF.PhasorProtocols.IEEE1344 · 261 unmodified lines | ||
| 357 | 357 | // Make sure frame length gets included in status flags for generated binary image |
| 358 | 358 | FrameLength = (ushort)FixedLength; |
| 359 | 359 | |
| 360 | − EndianOrder.BigEndian.CopyBytes((uint)TimeTag.Value, buffer, 0); | |
| 361 | − EndianOrder.BigEndian.CopyBytes(m_sampleCount, buffer, 4); | |
| 360 | + BigEndian.CopyBytes((uint)TimeTag.Value, buffer, 0); | |
| 361 | + BigEndian.CopyBytes(m_sampleCount, buffer, 4); | |
| 362 | 362 | |
| 363 | 363 | return buffer; |
| 364 | 364 | } |
| @@ -422,7 +422,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 57 unmodified lines | ||
| 422 | 422 | public static bool ChecksumIsValid(byte[] buffer, int startIndex, int length) |
| 423 | 423 | { |
| 424 | 424 | int sumLength = length - 2; |
| 425 | − return EndianOrder.BigEndian.ToUInt16(buffer, startIndex + sumLength) == buffer.CrcCCITTChecksum(startIndex, sumLength); | |
| 425 | + return BigEndian.ToUInt16(buffer, startIndex + sumLength) == buffer.CrcCCITTChecksum(startIndex, sumLength); | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | #endregion |
| @@ -295,15 +295,15 @@ namespace GSF.PhasorProtocols.IEEE1344 · 294 unmodified lines | ||
| 295 | 295 | byte[] buffer = new byte[HeaderLength]; |
| 296 | 296 | int index = 0; |
| 297 | 297 | |
| 298 | − EndianOrder.BigEndian.CopyBytes(m_statusFlags, buffer, index); | |
| 298 | + BigEndian.CopyBytes(m_statusFlags, buffer, index); | |
| 299 | 299 | |
| 300 | 300 | // Copy in station name |
| 301 | 301 | index += 2; |
| 302 | 302 | base.HeaderImage.CopyImage(buffer, ref index, base.HeaderLength); |
| 303 | 303 | |
| 304 | − EndianOrder.BigEndian.CopyBytes(IDCode, buffer, index); | |
| 305 | − EndianOrder.BigEndian.CopyBytes((ushort)PhasorDefinitions.Count, buffer, index + 8); | |
| 306 | − EndianOrder.BigEndian.CopyBytes((ushort)DigitalDefinitions.Count, buffer, index + 10); | |
| 304 | + BigEndian.CopyBytes(IDCode, buffer, index); | |
| 305 | + BigEndian.CopyBytes((ushort)PhasorDefinitions.Count, buffer, index + 8); | |
| 306 | + BigEndian.CopyBytes((ushort)DigitalDefinitions.Count, buffer, index + 10); | |
| 307 | 307 | |
| 308 | 308 | return buffer; |
| 309 | 309 | } |
| @@ -390,17 +390,17 @@ namespace GSF.PhasorProtocols.IEEE1344 · 80 unmodified lines | ||
| 390 | 390 | IConfigurationCellParsingState state = State; |
| 391 | 391 | int index = startIndex; |
| 392 | 392 | |
| 393 | − m_statusFlags = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 393 | + m_statusFlags = BigEndian.ToUInt16(buffer, index); | |
| 394 | 394 | index += 2; |
| 395 | 395 | |
| 396 | 396 | // Parse out station name |
| 397 | 397 | index += base.ParseHeaderImage(buffer, index, length); |
| 398 | 398 | |
| 399 | − IDCode = EndianOrder.BigEndian.ToUInt64(buffer, index); | |
| 399 | + IDCode = BigEndian.ToUInt64(buffer, index); | |
| 400 | 400 | |
| 401 | 401 | // Parse out total phasors and digitals defined for this device |
| 402 | − state.PhasorCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 8); | |
| 403 | − state.DigitalCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 10); | |
| 402 | + state.PhasorCount = BigEndian.ToUInt16(buffer, index + 8); | |
| 403 | + state.DigitalCount = BigEndian.ToUInt16(buffer, index + 10); | |
| 404 | 404 | index += 12; |
| 405 | 405 | |
| 406 | 406 | return (index - startIndex); |
| @@ -282,7 +282,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 281 unmodified lines | ||
| 282 | 282 | { |
| 283 | 283 | get |
| 284 | 284 | { |
| 285 | − return EndianOrder.BigEndian.GetBytes(Period); | |
| 285 | + return BigEndian.GetBytes(Period); | |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| @@ -380,7 +380,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 91 unmodified lines | ||
| 380 | 380 | // with first (and only) configuration cell, since cell was added during ParseBodyImage |
| 381 | 381 | // of ChannelFrameBase, performing the following succeeds since parsing the footer |
| 382 | 382 | // follows parsing the body :) |
| 383 | − Period = EndianOrder.BigEndian.ToUInt16(buffer, startIndex); | |
| 383 | + Period = BigEndian.ToUInt16(buffer, startIndex); | |
| 384 | 384 | return FixedFooterLength; |
| 385 | 385 | } |
| 386 | 386 | |
| @@ -142,7 +142,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 141 unmodified lines | ||
| 142 | 142 | { |
| 143 | 143 | get |
| 144 | 144 | { |
| 145 | − return EndianOrder.BigEndian.GetBytes(m_statusFlags); | |
| 145 | + return BigEndian.GetBytes(m_statusFlags); | |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| @@ -181,7 +181,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 32 unmodified lines | ||
| 181 | 181 | /// <param name="startIndex">Start index into <paramref name="buffer"/> to begin parsing.</param> |
| 182 | 182 | internal int ParseConversionFactor(byte[] buffer, int startIndex) |
| 183 | 183 | { |
| 184 | − m_statusFlags = EndianOrder.BigEndian.ToUInt16(buffer, startIndex); | |
| 184 | + m_statusFlags = BigEndian.ToUInt16(buffer, startIndex); | |
| 185 | 185 | return ConversionFactorLength; |
| 186 | 186 | } |
| 187 | 187 | |
| @@ -157,7 +157,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 156 unmodified lines | ||
| 157 | 157 | else |
| 158 | 158 | m_statusFlags = (ushort)(m_statusFlags & ~(ushort)Bits.Bit00); |
| 159 | 159 | |
| 160 | − return EndianOrder.BigEndian.GetBytes(m_statusFlags); | |
| 160 | + return BigEndian.GetBytes(m_statusFlags); | |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| @@ -194,7 +194,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 30 unmodified lines | ||
| 194 | 194 | /// </remarks> |
| 195 | 195 | protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) |
| 196 | 196 | { |
| 197 | − m_statusFlags = EndianOrder.BigEndian.ToUInt16(buffer, startIndex); | |
| 197 | + m_statusFlags = BigEndian.ToUInt16(buffer, startIndex); | |
| 198 | 198 | |
| 199 | 199 | Parent.NominalFrequency = ((m_statusFlags & (ushort)Bits.Bit00) > 0) ? LineFrequency.Hz50 : LineFrequency.Hz60; |
| 200 | 200 | |
| @@ -151,12 +151,12 @@ namespace GSF.PhasorProtocols.IEEE1344 · 150 unmodified lines | ||
| 151 | 151 | |
| 152 | 152 | if (definition.FrequencyIsAvailable) |
| 153 | 153 | { |
| 154 | − EndianOrder.BigEndian.CopyBytes((short)UnscaledFrequency, buffer, startIndex); | |
| 154 | + BigEndian.CopyBytes((short)UnscaledFrequency, buffer, startIndex); | |
| 155 | 155 | startIndex += 2; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | if (definition.DfDtIsAvailable) |
| 159 | − EndianOrder.BigEndian.CopyBytes((short)UnscaledDfDt, buffer, startIndex); | |
| 159 | + BigEndian.CopyBytes((short)UnscaledDfDt, buffer, startIndex); | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return buffer; |
| @@ -188,14 +188,14 @@ namespace GSF.PhasorProtocols.IEEE1344 · 25 unmodified lines | ||
| 188 | 188 | // Note that IEEE 1344 only supports scaled integers (no need to worry about floating points) |
| 189 | 189 | if (definition.FrequencyIsAvailable) |
| 190 | 190 | { |
| 191 | − UnscaledFrequency = EndianOrder.BigEndian.ToInt16(buffer, startIndex); | |
| 191 | + UnscaledFrequency = BigEndian.ToInt16(buffer, startIndex); | |
| 192 | 192 | startIndex += 2; |
| 193 | 193 | parsedLength += 2; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (definition.DfDtIsAvailable) |
| 197 | 197 | { |
| 198 | − UnscaledDfDt = EndianOrder.BigEndian.ToInt16(buffer, startIndex); | |
| 198 | + UnscaledDfDt = BigEndian.ToInt16(buffer, startIndex); | |
| 199 | 199 | parsedLength += 2; |
| 200 | 200 | } |
| 201 | 201 | } |
| @@ -109,7 +109,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 108 unmodified lines | ||
| 109 | 109 | |
| 110 | 110 | buffer[0] = (byte)(PhasorType == PhasorType.Voltage ? 0 : 1); |
| 111 | 111 | |
| 112 | − EndianOrder.BigEndian.CopyBytes(scalingFactor, buffer, 1); | |
| 112 | + BigEndian.CopyBytes(scalingFactor, buffer, 1); | |
| 113 | 113 | |
| 114 | 114 | return buffer; |
| 115 | 115 | } |
| @@ -130,7 +130,7 @@ namespace GSF.PhasorProtocols.IEEE1344 · 14 unmodified lines | ||
| 130 | 130 | PhasorType = (buffer[startIndex] == 0) ? PhasorType.Voltage : PhasorType.Current; |
| 131 | 131 | |
| 132 | 132 | // Last three bytes represent scaling factor |
| 133 | − ScalingValue = EndianOrder.BigEndian.ToUInt24(buffer, startIndex + 1); | |
| 133 | + ScalingValue = BigEndian.ToUInt24(buffer, startIndex + 1); | |
| 134 | 134 | |
| 135 | 135 | return ConversionFactorLength; |
| 136 | 136 | } |
| @@ -123,14 +123,14 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 122 unmodified lines | ||
| 123 | 123 | int index = 0; |
| 124 | 124 | |
| 125 | 125 | base.HeaderImage.CopyImage(buffer, ref index, base.HeaderLength); |
| 126 | − EndianOrder.BigEndian.CopyBytes(IDCode, buffer, index); | |
| 127 | − EndianOrder.BigEndian.CopyBytes(StationName.Length, buffer, index); | |
| 128 | − EndianOrder.BigEndian.CopyBytes(StationName, buffer, index); | |
| 129 | − EndianOrder.BigEndian.CopyBytes(State.G_PMU_ID, buffer, index); | |
| 130 | − EndianOrder.BigEndian.CopyBytes((ushort)m_formatFlags, buffer, index + 2); | |
| 131 | − EndianOrder.BigEndian.CopyBytes((ushort)PhasorDefinitions.Count, buffer, index + 4); | |
| 132 | − EndianOrder.BigEndian.CopyBytes((ushort)AnalogDefinitions.Count, buffer, index + 6); | |
| 133 | − EndianOrder.BigEndian.CopyBytes((ushort)DigitalDefinitions.Count, buffer, index + 8); | |
| 126 | + BigEndian.CopyBytes(IDCode, buffer, index); | |
| 127 | + BigEndian.CopyBytes(StationName.Length, buffer, index); | |
| 128 | + BigEndian.CopyBytes(StationName, buffer, index); | |
| 129 | + BigEndian.CopyBytes(State.G_PMU_ID, buffer, index); | |
| 130 | + BigEndian.CopyBytes((ushort)m_formatFlags, buffer, index + 2); | |
| 131 | + BigEndian.CopyBytes((ushort)PhasorDefinitions.Count, buffer, index + 4); | |
| 132 | + BigEndian.CopyBytes((ushort)AnalogDefinitions.Count, buffer, index + 6); | |
| 133 | + BigEndian.CopyBytes((ushort)DigitalDefinitions.Count, buffer, index + 8); | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | return buffer; |
| @@ -191,7 +191,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 54 unmodified lines | ||
| 191 | 191 | |
| 192 | 192 | // Include configuration count (new for version 7.0) |
| 193 | 193 | if (Parent.DraftRevision > DraftRevision.Draft6) |
| 194 | − EndianOrder.BigEndian.CopyBytes(RevisionCount, buffer, index); | |
| 194 | + BigEndian.CopyBytes(RevisionCount, buffer, index); | |
| 195 | 195 | |
| 196 | 196 | return buffer; |
| 197 | 197 | } |
| @@ -218,7 +218,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 20 unmodified lines | ||
| 218 | 218 | |
| 219 | 219 | string getLengthPrependedString(byte[] buffer, int index, out int length) |
| 220 | 220 | { |
| 221 | − length = EndianOrder.BigEndian.ToInt16(buffer, index); | |
| 221 | + length = BigEndian.ToInt16(buffer, index); | |
| 222 | 222 | return ByteEncoding.ASCII.GetString(buffer, index + 2, length); |
| 223 | 223 | } |
| 224 | 224 | |
| @@ -240,13 +240,13 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 15 unmodified lines | ||
| 240 | 240 | int len; |
| 241 | 241 | StationName = getLengthPrependedString(buffer, index, out len); |
| 242 | 242 | index += len + 2; |
| 243 | − IDCode = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 244 | − State.G_PMU_ID = EndianOrder.BigEndian.ToGuid(buffer, index + 2); | |
| 245 | − m_formatFlags = (FormatFlags)EndianOrder.BigEndian.ToUInt16(buffer, index + 16 + 2); //left as 16+x for clarity while editing, FIXME | |
| 243 | + IDCode = BigEndian.ToUInt16(buffer, index); | |
| 244 | + State.G_PMU_ID = BigEndian.ToGuid(buffer, index + 2); | |
| 245 | + m_formatFlags = (FormatFlags)BigEndian.ToUInt16(buffer, index + 16 + 2); //left as 16+x for clarity while editing, FIXME | |
| 246 | 246 | // Parse out total phasors, analogs and digitals defined for this device |
| 247 | − State.PhasorCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 16+4); | |
| 248 | − State.AnalogCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 16+6); | |
| 249 | − State.DigitalCount = EndianOrder.BigEndian.ToUInt16(buffer, index + 16+8); | |
| 247 | + State.PhasorCount = BigEndian.ToUInt16(buffer, index + 16+4); | |
| 248 | + State.AnalogCount = BigEndian.ToUInt16(buffer, index + 16+6); | |
| 249 | + State.DigitalCount = BigEndian.ToUInt16(buffer, index + 16+8); | |
| 250 | 250 | |
| 251 | 251 | |
| 252 | 252 | index += 10+16; //FIXME: merge |
| @@ -305,21 +305,21 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 52 unmodified lines | ||
| 305 | 305 | index += 4; |
| 306 | 306 | } |
| 307 | 307 | //PMU_LAT, 4 bytes, IEEE float, -90.0 to +90.0 |
| 308 | − State.DeviceLatitude = EndianOrder.BigEndian.ToSingle(buffer, index); | |
| 308 | + State.DeviceLatitude = BigEndian.ToSingle(buffer, index); | |
| 309 | 309 | //PMU_LON, 4 bytes, IEEE float, -179.9... to +180 |
| 310 | − State.DeviceLongitude = EndianOrder.BigEndian.ToSingle(buffer, index + 4); | |
| 310 | + State.DeviceLongitude = BigEndian.ToSingle(buffer, index + 4); | |
| 311 | 311 | //PMU_ELEV, 4 bytes, IEEE float, infinity for unknown |
| 312 | − State.DeviceElevation = EndianOrder.BigEndian.ToSingle(buffer, index + 8); | |
| 312 | + State.DeviceElevation = BigEndian.ToSingle(buffer, index + 8); | |
| 313 | 313 | //SVC_CLASS, 1 ASCII char |
| 314 | − State.ServiceClass = EndianOrder.BigEndian.ToChar(buffer, index + 9); | |
| 314 | + State.ServiceClass = BigEndian.ToChar(buffer, index + 9); | |
| 315 | 315 | //WINDOW, 4 bytes, signed int |
| 316 | − State.MeasurementWindow = EndianOrder.BigEndian.ToInt32(buffer, index + 13); | |
| 316 | + State.MeasurementWindow = BigEndian.ToInt32(buffer, index + 13); | |
| 317 | 317 | //GRP_DLY, 4 bytes, signed int |
| 318 | − State.GroupDelay = EndianOrder.BigEndian.ToInt32(buffer, index + 17); | |
| 318 | + State.GroupDelay = BigEndian.ToInt32(buffer, index + 17); | |
| 319 | 319 | //FNOM, 2 bytes, unsigned int, Bit 0 is flag (50/60 hz) |
| 320 | − State.FNOM = EndianOrder.BigEndian.ToUInt16(buffer, index + 19); | |
| 320 | + State.FNOM = BigEndian.ToUInt16(buffer, index + 19); | |
| 321 | 321 | //CFGCNT, 2 bytes |
| 322 | − State.CFGCNT = EndianOrder.BigEndian.ToUInt16(buffer, index + 21); | |
| 322 | + State.CFGCNT = BigEndian.ToUInt16(buffer, index + 21); | |
| 323 | 323 | |
| 324 | 324 | return startIndex; //FIXME |
| 325 | 325 | } |
| @@ -341,7 +341,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 15 unmodified lines | ||
| 341 | 341 | // Parse out configuration count (new for version 7.0) |
| 342 | 342 | if (Parent.DraftRevision > DraftRevision.Draft6) |
| 343 | 343 | { |
| 344 | − RevisionCount = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 344 | + RevisionCount = BigEndian.ToUInt16(buffer, index); | |
| 345 | 345 | index += 2; |
| 346 | 346 | } |
| 347 | 347 | |
| @@ -83,9 +83,9 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 82 unmodified lines | ||
| 83 | 83 | { |
| 84 | 84 | // Skip past header that was already parsed... |
| 85 | 85 | startIndex += CommonFrameHeader.FixedLength; |
| 86 | − // State.CONT_IDX = EndianOrder.BigEndian.ToInt16(buffer, startIndex); FIXME: For now, this is completely ignored | |
| 87 | − m_timebase = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 2) & ~Common.TimeQualityFlagsMask; | |
| 88 | − State.CellCount = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 6); | |
| 86 | + // State.CONT_IDX = BigEndian.ToInt16(buffer, startIndex); FIXME: For now, this is completely ignored | |
| 87 | + m_timebase = BigEndian.ToUInt32(buffer, startIndex + 2) & ~Common.TimeQualityFlagsMask; | |
| 88 | + State.CellCount = BigEndian.ToUInt16(buffer, startIndex + 6); | |
| 89 | 89 | |
| 90 | 90 | return FixedHeaderLength; |
| 91 | 91 | } |
| @@ -305,8 +305,8 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 304 unmodified lines | ||
| 305 | 305 | |
| 306 | 306 | if (configurationFrame2 != null) |
| 307 | 307 | m_configurationFrame2 = configurationFrame2; |
| 308 | − //FIXME: Add cf3 | |
| 309 | 308 | |
| 309 | + // TODO: Add handler for config3 frame | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /// <summary> |
| @@ -138,7 +138,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 137 unmodified lines | ||
| 138 | 138 | { |
| 139 | 139 | byte[] buffer = new byte[BinaryLength]; |
| 140 | 140 | |
| 141 | − EndianOrder.BigEndian.CopyBytes((ushort)Command, buffer, 0); | |
| 141 | + BigEndian.CopyBytes((ushort)Command, buffer, 0); | |
| 142 | 142 | |
| 143 | 143 | return buffer; |
| 144 | 144 | } |
| @@ -99,7 +99,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 98 unmodified lines | ||
| 99 | 99 | } |
| 100 | 100 | else |
| 101 | 101 | { |
| 102 | − switch (EndianOrder.BigEndian.ToUInt16(buffer, startIndex)) | |
| 102 | + switch (BigEndian.ToUInt16(buffer, startIndex)) | |
| 103 | 103 | { |
| 104 | 104 | case (ushort)DeviceCommand.RequestOnlineDataFormat: |
| 105 | 105 | TypeID = Macrodyne.FrameType.ConfigurationFrame; |
| @@ -254,10 +254,10 @@ namespace GSF.PhasorProtocols.Macrodyne · 148 unmodified lines | ||
| 254 | 254 | buffer[1] = (byte)m_statusFlags; |
| 255 | 255 | break; |
| 256 | 256 | case Macrodyne.FrameType.ConfigurationFrame: |
| 257 | − EndianOrder.BigEndian.CopyBytes((ushort)DeviceCommand.RequestOnlineDataFormat, buffer, 0); | |
| 257 | + BigEndian.CopyBytes((ushort)DeviceCommand.RequestOnlineDataFormat, buffer, 0); | |
| 258 | 258 | break; |
| 259 | 259 | case Macrodyne.FrameType.HeaderFrame: |
| 260 | − EndianOrder.BigEndian.CopyBytes((ushort)DeviceCommand.RequestUnitIDBufferValue, buffer, 0); | |
| 260 | + BigEndian.CopyBytes((ushort)DeviceCommand.RequestUnitIDBufferValue, buffer, 0); | |
| 261 | 261 | break; |
| 262 | 262 | } |
| 263 | 263 | |
| @@ -465,7 +465,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 464 unmodified lines | ||
| 465 | 465 | byte[] buffer = new byte[HeaderLength]; |
| 466 | 466 | |
| 467 | 467 | buffer.BlockCopy(0, CommonFrameHeader.FixedLength); |
| 468 | − EndianOrder.BigEndian.CopyBytes((ushort)m_onlineDataFormatFlags, buffer, 2); | |
| 468 | + BigEndian.CopyBytes((ushort)m_onlineDataFormatFlags, buffer, 2); | |
| 469 | 469 | |
| 470 | 470 | return buffer; |
| 471 | 471 | } |
| @@ -644,7 +644,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 172 unmodified lines | ||
| 644 | 644 | startIndex += CommonFrameHeader.FixedLength; |
| 645 | 645 | |
| 646 | 646 | // Parse on -line data format |
| 647 | − m_onlineDataFormatFlags = (OnlineDataFormatFlags)EndianOrder.BigEndian.ToUInt16(buffer, startIndex); | |
| 647 | + m_onlineDataFormatFlags = (OnlineDataFormatFlags)BigEndian.ToUInt16(buffer, startIndex); | |
| 648 | 648 | |
| 649 | 649 | return CommonFrameHeader.FixedLength + 2; |
| 650 | 650 | } |
| @@ -392,7 +392,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 391 unmodified lines | ||
| 392 | 392 | else |
| 393 | 393 | { |
| 394 | 394 | // Read sample number for G protocol |
| 395 | − m_sampleNumber = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 395 | + m_sampleNumber = BigEndian.ToUInt16(buffer, index); | |
| 396 | 396 | index += 2; |
| 397 | 397 | } |
| 398 | 398 | |
| @@ -402,7 +402,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 3 unmodified lines | ||
| 402 | 402 | m_clockStatusFlags = (ClockStatusFlags)buffer[index]; |
| 403 | 403 | index += 1; |
| 404 | 404 | |
| 405 | − ushort day = BinaryCodedDecimal.Decode(EndianOrder.BigEndian.ToUInt16(buffer, index)); | |
| 405 | + ushort day = BinaryCodedDecimal.Decode(BigEndian.ToUInt16(buffer, index)); | |
| 406 | 406 | byte hours = BinaryCodedDecimal.Decode(buffer[index + 2]); |
| 407 | 407 | byte minutes = BinaryCodedDecimal.Decode(buffer[index + 3]); |
| 408 | 408 | byte seconds = BinaryCodedDecimal.Decode(buffer[index + 4]); |
| @@ -412,7 +412,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 3 unmodified lines | ||
| 412 | 412 | // Read sample number for M protocol |
| 413 | 413 | if (protocolVersion == ProtocolVersion.M) |
| 414 | 414 | { |
| 415 | − m_sampleNumber = EndianOrder.BigEndian.ToUInt16(buffer, index + 5); | |
| 415 | + m_sampleNumber = BigEndian.ToUInt16(buffer, index + 5); | |
| 416 | 416 | timebase = 719.0D; |
| 417 | 417 | index += 2; |
| 418 | 418 | } |
| @@ -425,7 +425,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 6 unmodified lines | ||
| 425 | 425 | { |
| 426 | 426 | Parent.Timestamp = DateTime.UtcNow.Ticks; |
| 427 | 427 | SynchronizationIsValid = false; |
| 428 | − m_sampleNumber = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 428 | + m_sampleNumber = BigEndian.ToUInt16(buffer, index); | |
| 429 | 429 | index += 2; |
| 430 | 430 | } |
| 431 | 431 | |
| @@ -479,7 +479,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 47 unmodified lines | ||
| 479 | 479 | // Parse reference phasor information |
| 480 | 480 | if (configFrame.ReferenceIncluded) |
| 481 | 481 | { |
| 482 | − m_referenceSampleNumber = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 482 | + m_referenceSampleNumber = BigEndian.ToUInt16(buffer, index); | |
| 483 | 483 | m_referencePhasor = PhasorValue.CreateNewValue(this, new PhasorDefinition(null, "Reference Phasor", PhasorType.Voltage, null), buffer, index, out parsedLength) as PhasorValue; |
| 484 | 484 | index += 6; |
| 485 | 485 | } |
| @@ -120,7 +120,7 @@ namespace GSF.PhasorProtocols.Macrodyne · 119 unmodified lines | ||
| 120 | 120 | // 1690G protocol currently requires an INI file - as a result this means there will be on dF/dt value in the stream |
| 121 | 121 | if (Parent.Parent.CommonHeader.ProtocolVersion == ProtocolVersion.G) |
| 122 | 122 | { |
| 123 | − UnscaledFrequency = EndianOrder.BigEndian.ToInt16(buffer, startIndex); | |
| 123 | + UnscaledFrequency = BigEndian.ToInt16(buffer, startIndex); | |
| 124 | 124 | return 2; |
| 125 | 125 | } |
| 126 | 126 | |
| @@ -82,12 +82,12 @@ namespace GSF.PhasorProtocols.SelFastMessage · 81 unmodified lines | ||
| 82 | 82 | Command = (DeviceCommand)buffer[startIndex + 9]; |
| 83 | 83 | |
| 84 | 84 | if (Command == DeviceCommand.EnableUnsolicitedMessages) |
| 85 | − m_messagePeriod = (MessagePeriod)EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 14); | |
| 85 | + m_messagePeriod = (MessagePeriod)BigEndian.ToUInt16(buffer, startIndex + 14); | |
| 86 | 86 | |
| 87 | 87 | // Validate check-sum |
| 88 | 88 | int sumLength = FrameSize - 2; |
| 89 | 89 | |
| 90 | − if (EndianOrder.BigEndian.ToUInt16(buffer, startIndex + sumLength) != CalculateChecksum(buffer, startIndex, sumLength)) | |
| 90 | + if (BigEndian.ToUInt16(buffer, startIndex + sumLength) != CalculateChecksum(buffer, startIndex, sumLength)) | |
| 91 | 91 | throw new InvalidOperationException("Invalid binary image detected - check sum of " + this.GetType().Name + " did not match"); |
| 92 | 92 | } |
| 93 | 93 | |
| @@ -240,7 +240,7 @@ namespace GSF.PhasorProtocols.SelFastMessage · 146 unmodified lines | ||
| 240 | 240 | |
| 241 | 241 | // Only add desired message rate for enable command |
| 242 | 242 | if (Command == DeviceCommand.EnableUnsolicitedMessages) |
| 243 | − EndianOrder.BigEndian.CopyBytes((ushort)m_messagePeriod, buffer, 5); | |
| 243 | + BigEndian.CopyBytes((ushort)m_messagePeriod, buffer, 5); | |
| 244 | 244 | |
| 245 | 245 | return buffer; |
| 246 | 246 | } |
| @@ -88,9 +88,9 @@ namespace GSF.PhasorProtocols.SelFastMessage · 87 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | // Parse relevant common header values |
| 90 | 90 | m_frameSize = (FrameSize)buffer[startIndex + 2]; |
| 91 | − m_idCode = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 12); | |
| 92 | − sampleCount = EndianOrder.BigEndian.ToUInt16(buffer, startIndex + 18); | |
| 93 | − secondOfCentury = EndianOrder.BigEndian.ToUInt32(buffer, startIndex + 20); | |
| 91 | + m_idCode = BigEndian.ToUInt32(buffer, startIndex + 12); | |
| 92 | + sampleCount = BigEndian.ToUInt16(buffer, startIndex + 18); | |
| 93 | + secondOfCentury = BigEndian.ToUInt32(buffer, startIndex + 20); | |
| 94 | 94 | |
| 95 | 95 | // We use an NTP time tag since SEL Fast Message SOC also starts at 1/1/1900 |
| 96 | 96 | timetag = new NtpTimeTag(secondOfCentury, 0); |
| @@ -236,16 +236,16 @@ namespace GSF.PhasorProtocols.SelFastMessage · 139 unmodified lines | ||
| 236 | 236 | buffer[10] = 0xC0; // Sequence byte |
| 237 | 237 | |
| 238 | 238 | // Include destination address (PMADDR setting) |
| 239 | − EndianOrder.BigEndian.CopyBytes(m_idCode, buffer, 12); | |
| 239 | + BigEndian.CopyBytes(m_idCode, buffer, 12); | |
| 240 | 240 | |
| 241 | 241 | // Include register count |
| 242 | − EndianOrder.BigEndian.CopyBytes(RegisterCount, buffer, 16); | |
| 242 | + BigEndian.CopyBytes(RegisterCount, buffer, 16); | |
| 243 | 243 | |
| 244 | 244 | // Include sample number |
| 245 | − EndianOrder.BigEndian.CopyBytes(SampleNumber, buffer, 18); | |
| 245 | + BigEndian.CopyBytes(SampleNumber, buffer, 18); | |
| 246 | 246 | |
| 247 | 247 | // Include second of century |
| 248 | − EndianOrder.BigEndian.CopyBytes(SecondOfCentury, buffer, 20); | |
| 248 | + BigEndian.CopyBytes(SecondOfCentury, buffer, 20); | |
| 249 | 249 | |
| 250 | 250 | return buffer; |
| 251 | 251 | } |
| @@ -287,7 +287,7 @@ namespace GSF.PhasorProtocols.SelFastMessage · 286 unmodified lines | ||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Parse out status flags |
| 290 | − StatusFlags = (StatusFlags)EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 290 | + StatusFlags = (StatusFlags)BigEndian.ToUInt16(buffer, index); | |
| 291 | 291 | index += 2; |
| 292 | 292 | |
| 293 | 293 | // Return total parsed length |
| @@ -126,7 +126,7 @@ namespace GSF.PhasorProtocols.SelFastMessage · 125 unmodified lines | ||
| 126 | 126 | { |
| 127 | 127 | get |
| 128 | 128 | { |
| 129 | − return EndianOrder.BigEndian.GetBytes((float)Frequency); | |
| 129 | + return BigEndian.GetBytes((float)Frequency); | |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| @@ -143,7 +143,7 @@ namespace GSF.PhasorProtocols.SelFastMessage · 10 unmodified lines | ||
| 143 | 143 | /// <returns>The length of the data that was parsed.</returns> |
| 144 | 144 | protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) |
| 145 | 145 | { |
| 146 | − Frequency = EndianOrder.BigEndian.ToSingle(buffer, startIndex); | |
| 146 | + Frequency = BigEndian.ToSingle(buffer, startIndex); | |
| 147 | 147 | return 4; |
| 148 | 148 | } |
| 149 | 149 | |
| @@ -136,8 +136,8 @@ namespace GSF.PhasorProtocols.SelFastMessage · 135 unmodified lines | ||
| 136 | 136 | { |
| 137 | 137 | byte[] buffer = new byte[8]; |
| 138 | 138 | |
| 139 | − EndianOrder.BigEndian.CopyBytes((float)Magnitude, buffer, 0); | |
| 140 | − EndianOrder.BigEndian.CopyBytes((float)Angle.ToDegrees(), buffer, 4); | |
| 139 | + BigEndian.CopyBytes((float)Magnitude, buffer, 0); | |
| 140 | + BigEndian.CopyBytes((float)Angle.ToDegrees(), buffer, 4); | |
| 141 | 141 | |
| 142 | 142 | return buffer; |
| 143 | 143 | } |
| @@ -157,8 +157,8 @@ namespace GSF.PhasorProtocols.SelFastMessage · 13 unmodified lines | ||
| 157 | 157 | protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) |
| 158 | 158 | { |
| 159 | 159 | // Parse magnitude and angle in degrees |
| 160 | − Magnitude = EndianOrder.BigEndian.ToSingle(buffer, startIndex); | |
| 161 | − Angle = Angle.FromDegrees(EndianOrder.BigEndian.ToSingle(buffer, startIndex + 4)); | |
| 160 | + Magnitude = BigEndian.ToSingle(buffer, startIndex); | |
| 161 | + Angle = Angle.FromDegrees(BigEndian.ToSingle(buffer, startIndex + 4)); | |
| 162 | 162 | |
| 163 | 163 | return 8; |
| 164 | 164 | } |
| @@ -201,7 +201,7 @@ namespace GSF.PhasorProtocols.UI.DataModels · 200 unmodified lines | ||
| 201 | 201 | } |
| 202 | 202 | set |
| 203 | 203 | { |
| 204 | − if (value == null) | |
| 204 | + if ((object)value == null) | |
| 205 | 205 | m_connectionString = string.Empty; |
| 206 | 206 | else |
| 207 | 207 | m_connectionString = value; |
| @@ -245,7 +245,7 @@ namespace GSF.PhasorProtocols.UI.DataModels · 244 unmodified lines | ||
| 245 | 245 | } |
| 246 | 246 | set |
| 247 | 247 | { |
| 248 | − if (value != null && value.Length > 200) | |
| 248 | + if ((object)value != null && value.Length > 200) | |
| 249 | 249 | m_name = value.Substring(0, 200); |
| 250 | 250 | else |
| 251 | 251 | m_name = value; |
| @@ -96,7 +96,7 @@ namespace GSF.PhasorProtocols.UI.DataModels · 95 unmodified lines | ||
| 96 | 96 | } |
| 97 | 97 | set |
| 98 | 98 | { |
| 99 | − if (value != null && value.Length > 200) | |
| 99 | + if ((object)value != null && value.Length > 200) | |
| 100 | 100 | m_name = value.Substring(0, 200); |
| 101 | 101 | else |
| 102 | 102 | m_name = value; |
| @@ -429,7 +429,7 @@ namespace GSF.PhasorProtocols.UI.DataModels · 326 unmodified lines | ||
| 429 | 429 | } |
| 430 | 430 | set |
| 431 | 431 | { |
| 432 | − if (value != null & value.Length > 200) | |
| 432 | + if ((object)value != null & value.Length > 200) | |
| 433 | 433 | m_label = value.Substring(0, 200); |
| 434 | 434 | else |
| 435 | 435 | m_label = value; |
| @@ -117,7 +117,7 @@ namespace GSF.PhasorProtocols.UI.DataModels · 116 unmodified lines | ||
| 117 | 117 | } |
| 118 | 118 | set |
| 119 | 119 | { |
| 120 | − if (value != null && value.Length > 200) | |
| 120 | + if ((object)value != null && value.Length > 200) | |
| 121 | 121 | m_label = value.Substring(0, 200); |
| 122 | 122 | else |
| 123 | 123 | m_label = value; |
| @@ -207,7 +207,7 @@ namespace GSF.ServiceModel · 206 unmodified lines | ||
| 207 | 207 | return tcpBinding; |
| 208 | 208 | case "net.p2p": |
| 209 | 209 | // Create binding. |
| 210 | − #pragma warning disable 612, 618 | |
| 210 | +#pragma warning disable 612, 618 | |
| 211 | 211 | NetPeerTcpBinding p2pBinding = new NetPeerTcpBinding(); |
| 212 | 212 | |
| 213 | 213 | #if !MONO |
| @@ -285,7 +285,8 @@ namespace GSF.ServiceModel · 71 unmodified lines | ||
| 285 | 285 | { |
| 286 | 286 | // Find contract interface by service type name. |
| 287 | 287 | Type contract = serviceType.GetInterface("I" + serviceType.Name); |
| 288 | − if (contract == null) | |
| 288 | + | |
| 289 | + if ((object)contract == null) | |
| 289 | 290 | { |
| 290 | 291 | // Fall back to the first interface the service implements. |
| 291 | 292 | Type[] interfaces = serviceType.GetInterfaces(); |
| @@ -220,7 +220,7 @@ namespace GSF.ServiceProcess · 219 unmodified lines | ||
| 220 | 220 | /// <param name="user">New <see cref="IPrincipal"/> object to be assigned to <see cref="ClientUser"/>.</param> |
| 221 | 221 | internal void SetClientUser(IPrincipal user) |
| 222 | 222 | { |
| 223 | − if (user == null) | |
| 223 | + if ((object)user == null) | |
| 224 | 224 | throw new ArgumentNullException("user"); |
| 225 | 225 | |
| 226 | 226 | m_clientUser = user; |
| @@ -164,7 +164,7 @@ namespace GSF.ServiceProcess · 163 unmodified lines | ||
| 164 | 164 | public static ClientRequest Parse(string text) |
| 165 | 165 | { |
| 166 | 166 | // Input text can't be null. |
| 167 | − if (text == null) | |
| 167 | + if ((object)text == null) | |
| 168 | 168 | return null; |
| 169 | 169 | |
| 170 | 170 | // Input text can't be empty. |
| @@ -1541,7 +1541,7 @@ namespace GSF.ServiceProcess · 1540 unmodified lines | ||
| 1541 | 1541 | { |
| 1542 | 1542 | processName = processName.Trim(); |
| 1543 | 1543 | |
| 1544 | − if (FindProcess(processName) == null) | |
| 1544 | + if ((object)FindProcess(processName) == null) | |
| 1545 | 1545 | return false; |
| 1546 | 1546 | |
| 1547 | 1547 | // The specified process exists, so we'll schedule it, or update its schedule if it is scheduled already. |
| @@ -1188,7 +1188,7 @@ namespace GSF.TimeSeries.Adapters · 1187 unmodified lines | ||
| 1188 | 1188 | if (sourceIDKeys != null) |
| 1189 | 1189 | { |
| 1190 | 1190 | // Combine input measurement keys for source IDs with any existing input measurement keys and return unique set |
| 1191 | − if (adapter.InputMeasurementKeys == null) | |
| 1191 | + if ((object)adapter.InputMeasurementKeys == null) | |
| 1192 | 1192 | adapter.InputMeasurementKeys = sourceIDKeys; |
| 1193 | 1193 | else |
| 1194 | 1194 | adapter.InputMeasurementKeys = sourceIDKeys.Concat(adapter.InputMeasurementKeys).Distinct().ToArray(); |
| @@ -1281,7 +1281,7 @@ namespace GSF.TimeSeries.Adapters · 86 unmodified lines | ||
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | 1283 | // Combine output measurements for source IDs with any existing output measurements and return unique set |
| 1284 | − if (adapter.OutputMeasurements == null) | |
| 1284 | + if ((object)adapter.OutputMeasurements == null) | |
| 1285 | 1285 | adapter.OutputMeasurements = measurements.ToArray(); |
| 1286 | 1286 | else |
| 1287 | 1287 | adapter.OutputMeasurements = measurements.Concat(adapter.OutputMeasurements).Distinct().ToArray(); |
| @@ -328,7 +328,7 @@ namespace GSF.TimeSeries.Adapters · 327 unmodified lines | ||
| 328 | 328 | |
| 329 | 329 | // If any of the children expects all measurements (i.e., null InputMeasurementKeys) |
| 330 | 330 | // then the parent collection must expect all measurements |
| 331 | − if (inputMeasurementKeys == null) | |
| 331 | + if ((object)inputMeasurementKeys == null) | |
| 332 | 332 | return null; |
| 333 | 333 | |
| 334 | 334 | if (inputMeasurementKeys.Length > 0) |
| @@ -830,7 +830,7 @@ namespace GSF.TimeSeries.Adapters · 495 unmodified lines | ||
| 830 | 830 | /// <exception cref="InvalidOperationException">DataMember is null or empty.</exception> |
| 831 | 831 | public virtual void Initialize() |
| 832 | 832 | { |
| 833 | − if (DataSource == null) | |
| 833 | + if ((object)DataSource == null) | |
| 834 | 834 | throw new NullReferenceException(string.Format("DataSource is null, cannot load {0}", Name)); |
| 835 | 835 | |
| 836 | 836 | if (string.IsNullOrWhiteSpace(DataMember)) |
| @@ -877,7 +877,7 @@ namespace GSF.TimeSeries.Adapters · 40 unmodified lines | ||
| 877 | 877 | /// <exception cref="NullReferenceException"><paramref name="adapterRow"/> is null.</exception> |
| 878 | 878 | public virtual bool TryCreateAdapter(DataRow adapterRow, out T adapter) |
| 879 | 879 | { |
| 880 | − if (adapterRow == null) | |
| 880 | + if ((object)adapterRow == null) | |
| 881 | 881 | throw new NullReferenceException(string.Format("Cannot initialize from null adapter DataRow")); |
| 882 | 882 | |
| 883 | 883 | Assembly assembly; |
| @@ -135,14 +135,14 @@ namespace GSF.TimeSeries.Adapters · 134 unmodified lines | ||
| 135 | 135 | { |
| 136 | 136 | get |
| 137 | 137 | { |
| 138 | − if (m_inputSourceIDs == null) | |
| 138 | + if ((object)m_inputSourceIDs == null) | |
| 139 | 139 | return null; |
| 140 | 140 | |
| 141 | 141 | return m_inputSourceIDs.ToArray(); |
| 142 | 142 | } |
| 143 | 143 | set |
| 144 | 144 | { |
| 145 | − if (value == null) | |
| 145 | + if ((object)value == null) | |
| 146 | 146 | { |
| 147 | 147 | m_inputSourceIDs = null; |
| 148 | 148 | } |
| @@ -175,7 +175,7 @@ namespace GSF.TimeSeries.Adapters · 26 unmodified lines | ||
| 175 | 175 | } |
| 176 | 176 | set |
| 177 | 177 | { |
| 178 | − if (value == null) | |
| 178 | + if ((object)value == null) | |
| 179 | 179 | { |
| 180 | 180 | m_outputSourceIDs = null; |
| 181 | 181 | } |
| @@ -100,14 +100,14 @@ namespace GSF.TimeSeries.Adapters · 99 unmodified lines | ||
| 100 | 100 | { |
| 101 | 101 | get |
| 102 | 102 | { |
| 103 | − if (m_outputSourceIDs == null) | |
| 103 | + if ((object)m_outputSourceIDs == null) | |
| 104 | 104 | return null; |
| 105 | 105 | |
| 106 | 106 | return m_outputSourceIDs.ToArray(); |
| 107 | 107 | } |
| 108 | 108 | set |
| 109 | 109 | { |
| 110 | − if (value == null) | |
| 110 | + if ((object)value == null) | |
| 111 | 111 | { |
| 112 | 112 | m_outputSourceIDs = null; |
| 113 | 113 | } |
| @@ -157,14 +157,14 @@ namespace GSF.TimeSeries.Adapters · 156 unmodified lines | ||
| 157 | 157 | { |
| 158 | 158 | get |
| 159 | 159 | { |
| 160 | − if (m_inputSourceIDs == null) | |
| 160 | + if ((object)m_inputSourceIDs == null) | |
| 161 | 161 | return null; |
| 162 | 162 | |
| 163 | 163 | return m_inputSourceIDs.ToArray(); |
| 164 | 164 | } |
| 165 | 165 | set |
| 166 | 166 | { |
| 167 | − if (value == null) | |
| 167 | + if ((object)value == null) | |
| 168 | 168 | { |
| 169 | 169 | m_inputSourceIDs = null; |
| 170 | 170 | } |
| @@ -369,7 +369,7 @@ namespace GSF.TimeSeries.Adapters · 198 unmodified lines | ||
| 369 | 369 | status.AppendLine(); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | − status.AppendFormat(" Source ID filter list: {0}", (m_inputSourceIDs == null ? "[No filter applied]" : m_inputSourceIDs.ToDelimitedString(','))); | |
| 372 | + status.AppendFormat(" Source ID filter list: {0}", ((object)m_inputSourceIDs == null ? "[No filter applied]" : m_inputSourceIDs.ToDelimitedString(','))); | |
| 373 | 373 | status.AppendLine(); |
| 374 | 374 | status.AppendFormat(" Asynchronous connection: {0}", UseAsyncConnect); |
| 375 | 375 | status.AppendLine(); |
| @@ -1516,7 +1516,7 @@ namespace GSF.TimeSeries · 1515 unmodified lines | ||
| 1516 | 1516 | status.Append("Last discarded measurement: "); |
| 1517 | 1517 | |
| 1518 | 1518 | Interlocked.Exchange(ref lastDiscardedMeasurement, m_lastDiscardedMeasurement); |
| 1519 | − if (lastDiscardedMeasurement == null) | |
| 1519 | + if ((object)lastDiscardedMeasurement == null) | |
| 1520 | 1520 | { |
| 1521 | 1521 | status.Append("<none>"); |
| 1522 | 1522 | } |
| @@ -1581,7 +1581,7 @@ namespace GSF.TimeSeries · 58 unmodified lines | ||
| 1581 | 1581 | status.AppendLine(); |
| 1582 | 1582 | status.Append(" Last published frame: "); |
| 1583 | 1583 | |
| 1584 | − if (lastFrame == null) | |
| 1584 | + if ((object)lastFrame == null) | |
| 1585 | 1585 | { |
| 1586 | 1586 | status.Append("<none>"); |
| 1587 | 1587 | } |
| @@ -1846,7 +1846,7 @@ namespace GSF.TimeSeries · 258 unmodified lines | ||
| 1846 | 1846 | // Get the destination frame for the measurement. Note that groups of parsed measurements will |
| 1847 | 1847 | // typically be coming in from the same source and will have the same ticks. If we have already |
| 1848 | 1848 | // found the destination frame for the same ticks, then there is no need to lookup frame again. |
| 1849 | − if (frame == null || timestamp != lastTimestamp) | |
| 1849 | + if ((object)frame == null || timestamp != lastTimestamp) | |
| 1850 | 1850 | { |
| 1851 | 1851 | if (m_processByReceivedTimestamp) |
| 1852 | 1852 | { |
| @@ -1879,7 +1879,7 @@ namespace GSF.TimeSeries · 26 unmodified lines | ||
| 1879 | 1879 | } |
| 1880 | 1880 | } |
| 1881 | 1881 | |
| 1882 | − if (frame == null) | |
| 1882 | + if ((object)frame == null) | |
| 1883 | 1883 | { |
| 1884 | 1884 | // Measurement is discarded if no bucket (i.e., destination frame) was found for it. |
| 1885 | 1885 | discardMeasurement = true; |
| @@ -1890,7 +1890,7 @@ namespace GSF.TimeSeries · 4 unmodified lines | ||
| 1890 | 1890 | // Derive new measurement value applying any needed down-sampling |
| 1891 | 1891 | derivedMeasurement = frame.DeriveMeasurementValue(measurement); |
| 1892 | 1892 | |
| 1893 | − if (derivedMeasurement == null) | |
| 1893 | + if ((object)derivedMeasurement == null) | |
| 1894 | 1894 | { |
| 1895 | 1895 | // Count this as a discarded measurement if down-sampling derivation was not applied. |
| 1896 | 1896 | discardMeasurement = true; |
| @@ -1949,7 +1949,7 @@ namespace GSF.TimeSeries · 52 unmodified lines | ||
| 1949 | 1949 | Interlocked.Increment(ref m_discardedMeasurements); |
| 1950 | 1950 | |
| 1951 | 1951 | // Make sure discarded measurement collection exists |
| 1952 | − if (discardedMeasurements == null) | |
| 1952 | + if ((object)discardedMeasurements == null) | |
| 1953 | 1953 | discardedMeasurements = new List<IMeasurement>(); |
| 1954 | 1954 | |
| 1955 | 1955 | // Add discarded measurement to local collection |
| @@ -2118,7 +2118,7 @@ namespace GSF.TimeSeries · 162 unmodified lines | ||
| 2118 | 2118 | frame = m_frameQueue.Head; |
| 2119 | 2119 | |
| 2120 | 2120 | // If no frame is ready to publish, exit |
| 2121 | − if (frame == null) | |
| 2121 | + if ((object)frame == null) | |
| 2122 | 2122 | break; |
| 2123 | 2123 | |
| 2124 | 2124 | // Get ticks for this frame |
| @@ -26,6 +26,8 @@ using System.Data; · 25 unmodified lines | ||
| 26 | 26 | using System.IO; |
| 27 | 27 | using GSF.Data; |
| 28 | 28 | |
| 29 | +#pragma warning disable 0067 | |
| 30 | + | |
| 29 | 31 | namespace GSF.TimeSeries.Configuration |
| 30 | 32 | { |
| 31 | 33 | /// <summary> |
| @@ -25,6 +25,8 @@ using System; · 24 unmodified lines | ||
| 25 | 25 | using System.Data; |
| 26 | 26 | using System.Net; |
| 27 | 27 | |
| 28 | +#pragma warning disable 0067 | |
| 29 | + | |
| 28 | 30 | namespace GSF.TimeSeries.Configuration |
| 29 | 31 | { |
| 30 | 32 | /// <summary> |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | ||
| 24 | 24 | using System; |
| 25 | 25 | using System.Data; |
| 26 | 26 | |
| 27 | +#pragma warning disable 0067 | |
| 28 | + | |
| 27 | 29 | namespace GSF.TimeSeries.Configuration |
| 28 | 30 | { |
| 29 | 31 | /// <summary> |
| @@ -260,14 +260,18 @@ namespace GSF.TimeSeries · 259 unmodified lines | ||
| 260 | 260 | else |
| 261 | 261 | frame = null; |
| 262 | 262 | |
| 263 | − if (frame == null) | |
| 263 | + if ((object)frame == null) | |
| 264 | + { | |
| 264 | 265 | status.AppendFormat("Frame {0} @ <null frame>", i.ToString().PadLeft(4, '0')); |
| 266 | + } | |
| 265 | 267 | else |
| 268 | + { | |
| 266 | 269 | status.AppendFormat("Frame {0} @ {1} - {2} measurements, {3} received", |
| 267 | 270 | i.ToString().PadLeft(4, '0'), |
| 268 | 271 | (new DateTime(frame.Timestamp)).ToString("dd-MMM-yyyy HH:mm:ss.fff"), |
| 269 | 272 | frame.Measurements.Count, |
| 270 | 273 | (frame.Measurements.Count / (double)expectedMeasurements).ToString("##0.00%")); |
| 274 | + } | |
| 271 | 275 | |
| 272 | 276 | status.AppendLine(); |
| 273 | 277 | node = node.Next; |
| @@ -359,7 +359,7 @@ namespace GSF.TimeSeries · 358 unmodified lines | ||
| 359 | 359 | /// <returns><see cref="MeasurementKey"/> values of the <see cref="IMeasurement"/> enumeration.</returns> |
| 360 | 360 | public static MeasurementKey[] MeasurementKeys(this IEnumerable<IMeasurement> measurements) |
| 361 | 361 | { |
| 362 | − if (measurements == null) | |
| 362 | + if ((object)measurements == null) | |
| 363 | 363 | return new MeasurementKey[0]; |
| 364 | 364 | |
| 365 | 365 | return measurements.Select(m => m.Key).ToArray(); |
| @@ -561,7 +561,7 @@ namespace GSF.TimeSeries · 560 unmodified lines | ||
| 561 | 561 | /// <returns>A <see cref="String"/> that represents the specified <see cref="IMeasurement"/>.</returns> |
| 562 | 562 | public static string ToString(IMeasurement measurement, bool includeTagName = true) |
| 563 | 563 | { |
| 564 | − if (measurement == null) | |
| 564 | + if ((object)measurement == null) | |
| 565 | 565 | return "Undefined"; |
| 566 | 566 | |
| 567 | 567 | string tagName = measurement.TagName; |
| @@ -207,7 +207,7 @@ namespace GSF.TimeSeries · 206 unmodified lines | ||
| 207 | 207 | /// <param name="key">The measurement key that was created or updated or <see cref="Undefined"/>.</param> |
| 208 | 208 | /// <returns>True if the measurement key was successfully created or updated, false otherwise.</returns> |
| 209 | 209 | /// <exception cref="ArgumentException"><paramref name="signalID"/> cannot be empty.</exception> |
| 210 | − /// <exception cref="ArgumentNullException"><paramref name="source"/> cannot be null.</exception> | |
| 210 | + /// <exception cref="ArgumentNullException">Measurement key Source cannot be null.</exception> | |
| 211 | 211 | public static bool TryCreateOrUpdate(Guid signalID, string value, out MeasurementKey key) |
| 212 | 212 | { |
| 213 | 213 | try |
| @@ -370,7 +370,10 @@ namespace GSF.TimeSeries · 369 unmodified lines | ||
| 370 | 370 | m_allowRemoteRestart = systemSettings["AllowRemoteRestart"].ValueAsBoolean(true); |
| 371 | 371 | m_preferCachedConfiguration = systemSettings["PreferCachedConfiguration"].ValueAsBoolean(false); |
| 372 | 372 | m_reloadConfigQueue = ProcessQueue<Tuple<string, Action<bool>>>.CreateSynchronousQueue(ExecuteReloadConfig, 500.0D, Timeout.Infinite, false, false); |
| 373 | − m_configurationCacheOperation = new LongSynchronizedOperation(ExecuteConfigurationCache) { IsBackground = true }; | |
| 373 | + m_configurationCacheOperation = new LongSynchronizedOperation(ExecuteConfigurationCache) | |
| 374 | + { | |
| 375 | + IsBackground = true | |
| 376 | + }; | |
| 374 | 377 | |
| 375 | 378 | // Setup default thread pool size |
| 376 | 379 | try |
| @@ -437,8 +440,14 @@ namespace GSF.TimeSeries · 60 unmodified lines | ||
| 437 | 440 | break; |
| 438 | 441 | } |
| 439 | 442 | |
| 440 | − m_binaryCacheConfigurationLoader = new BinaryFileConfigurationLoader() { FilePath = m_cachedBinaryConfigurationFile }; | |
| 441 | − m_xmlCacheConfigurationLoader = new XMLConfigurationLoader() { FilePath = m_cachedXmlConfigurationFile }; | |
| 443 | + m_binaryCacheConfigurationLoader = new BinaryFileConfigurationLoader() | |
| 444 | + { | |
| 445 | + FilePath = m_cachedBinaryConfigurationFile | |
| 446 | + }; | |
| 447 | + m_xmlCacheConfigurationLoader = new XMLConfigurationLoader() | |
| 448 | + { | |
| 449 | + FilePath = m_cachedXmlConfigurationFile | |
| 450 | + }; | |
| 442 | 451 | |
| 443 | 452 | m_configurationLoader.StatusMessage += (o, args) => DisplayStatusMessage(args.Argument, UpdateType.Information); |
| 444 | 453 | m_binaryCacheConfigurationLoader.StatusMessage += (o, args) => DisplayStatusMessage(args.Argument, UpdateType.Information); |
| @@ -1415,7 +1424,9 @@ namespace GSF.TimeSeries · 970 unmodified lines | ||
| 1415 | 1424 | /// </remarks> |
| 1416 | 1425 | private void m_iaonSession_ConfigurationChanged(object sender, EventArgs e) |
| 1417 | 1426 | { |
| 1418 | − m_reloadConfigQueue.Add(Tuple.Create("System", new Action<bool>(success => { }))); | |
| 1427 | + m_reloadConfigQueue.Add(Tuple.Create("System", new Action<bool>(success => | |
| 1428 | + { | |
| 1429 | + }))); | |
| 1419 | 1430 | } |
| 1420 | 1431 | |
| 1421 | 1432 | // Handle task scheduler exceptions |
| @@ -1874,7 +1885,7 @@ namespace GSF.TimeSeries · 452 unmodified lines | ||
| 1874 | 1885 | if (success) |
| 1875 | 1886 | { |
| 1876 | 1887 | // Return value, if any, will be returned to requesting client as a response attachment |
| 1877 | − if (returnValue == null) | |
| 1888 | + if ((object)returnValue == null) | |
| 1878 | 1889 | SendResponse(requestInfo, true, "Command \"{0}\" successfully invoked.", command); |
| 1879 | 1890 | else |
| 1880 | 1891 | SendResponseWithAttachment(requestInfo, true, returnValue, "Command \"{0}\" successfully invoked, return value = {1}", command, returnValue.ToNonNullString("null")); |
| @@ -2889,7 +2900,7 @@ namespace GSF.TimeSeries · 1008 unmodified lines | ||
| 2889 | 2900 | else if (addSetting) |
| 2890 | 2901 | { |
| 2891 | 2902 | // Add new setting. |
| 2892 | − if (setting == null) | |
| 2903 | + if ((object)setting == null) | |
| 2893 | 2904 | { |
| 2894 | 2905 | settings.Add(settingName, settingValue); |
| 2895 | 2906 | config.Save(); |
| @@ -188,7 +188,7 @@ namespace GSF.TimeSeries · 187 unmodified lines | ||
| 188 | 188 | MeasurementValueFilterFunction measurementValueFilter = derivedMeasurement.MeasurementValueFilter; |
| 189 | 189 | |
| 190 | 190 | // Default to average value filter if none is specified |
| 191 | − if (measurementValueFilter == null) | |
| 191 | + if ((object)measurementValueFilter == null) | |
| 192 | 192 | measurementValueFilter = Measurement.AverageValueFilter; |
| 193 | 193 | |
| 194 | 194 | // Add new measurement to tracking collection |
| @@ -711,22 +711,22 @@ namespace GSF.TimeSeries.Transport · 710 unmodified lines | ||
| 711 | 711 | using (BlockAllocatedMemoryStream buffer = new BlockAllocatedMemoryStream()) |
| 712 | 712 | { |
| 713 | 713 | // Write even key |
| 714 | − bufferLen = EndianOrder.BigEndian.GetBytes(m_keyIVs[EvenKey][KeyIndex].Length); | |
| 714 | + bufferLen = BigEndian.GetBytes(m_keyIVs[EvenKey][KeyIndex].Length); | |
| 715 | 715 | buffer.Write(bufferLen, 0, bufferLen.Length); |
| 716 | 716 | buffer.Write(m_keyIVs[EvenKey][KeyIndex], 0, m_keyIVs[EvenKey][KeyIndex].Length); |
| 717 | 717 | |
| 718 | 718 | // Write even initialization vector |
| 719 | − bufferLen = EndianOrder.BigEndian.GetBytes(m_keyIVs[EvenKey][IVIndex].Length); | |
| 719 | + bufferLen = BigEndian.GetBytes(m_keyIVs[EvenKey][IVIndex].Length); | |
| 720 | 720 | buffer.Write(bufferLen, 0, bufferLen.Length); |
| 721 | 721 | buffer.Write(m_keyIVs[EvenKey][IVIndex], 0, m_keyIVs[EvenKey][IVIndex].Length); |
| 722 | 722 | |
| 723 | 723 | // Write odd key |
| 724 | − bufferLen = EndianOrder.BigEndian.GetBytes(m_keyIVs[OddKey][KeyIndex].Length); | |
| 724 | + bufferLen = BigEndian.GetBytes(m_keyIVs[OddKey][KeyIndex].Length); | |
| 725 | 725 | buffer.Write(bufferLen, 0, bufferLen.Length); |
| 726 | 726 | buffer.Write(m_keyIVs[OddKey][KeyIndex], 0, m_keyIVs[OddKey][KeyIndex].Length); |
| 727 | 727 | |
| 728 | 728 | // Write odd initialization vector |
| 729 | − bufferLen = EndianOrder.BigEndian.GetBytes(m_keyIVs[OddKey][IVIndex].Length); | |
| 729 | + bufferLen = BigEndian.GetBytes(m_keyIVs[OddKey][IVIndex].Length); | |
| 730 | 730 | buffer.Write(bufferLen, 0, bufferLen.Length); |
| 731 | 731 | buffer.Write(m_keyIVs[OddKey][IVIndex], 0, m_keyIVs[OddKey][IVIndex].Length); |
| 732 | 732 | |
| @@ -203,7 +203,7 @@ namespace GSF.TimeSeries.Transport · 202 unmodified lines | ||
| 203 | 203 | m_includeTime = includeTime; |
| 204 | 204 | |
| 205 | 205 | // We keep a clone of the base time offsets, if provided, since array contents can change at any time |
| 206 | − if (baseTimeOffsets == null) | |
| 206 | + if ((object)baseTimeOffsets == null) | |
| 207 | 207 | m_baseTimeOffsets = s_emptyBaseTimeOffsets; |
| 208 | 208 | else |
| 209 | 209 | m_baseTimeOffsets = new[] { baseTimeOffsets[0], baseTimeOffsets[1] }; |
| @@ -234,7 +234,7 @@ namespace GSF.TimeSeries.Transport · 24 unmodified lines | ||
| 234 | 234 | m_includeTime = includeTime; |
| 235 | 235 | |
| 236 | 236 | // We keep a clone of the base time offsets, if provided, since array contents can change at any time |
| 237 | − if (baseTimeOffsets == null) | |
| 237 | + if ((object)baseTimeOffsets == null) | |
| 238 | 238 | m_baseTimeOffsets = s_emptyBaseTimeOffsets; |
| 239 | 239 | else |
| 240 | 240 | m_baseTimeOffsets = new[] { baseTimeOffsets[0], baseTimeOffsets[1] }; |
| @@ -409,11 +409,11 @@ namespace GSF.TimeSeries.Transport · 168 unmodified lines | ||
| 409 | 409 | CompactStateFlags = buffer[index++]; |
| 410 | 410 | |
| 411 | 411 | // Decode runtime ID |
| 412 | − RuntimeID = EndianOrder.BigEndian.ToUInt16(buffer, index); | |
| 412 | + RuntimeID = BigEndian.ToUInt16(buffer, index); | |
| 413 | 413 | index += 2; |
| 414 | 414 | |
| 415 | 415 | // Decode value |
| 416 | − Value = EndianOrder.BigEndian.ToSingle(buffer, index); | |
| 416 | + Value = BigEndian.ToSingle(buffer, index); | |
| 417 | 417 | index += 4; |
| 418 | 418 | |
| 419 | 419 | if (m_includeTime) |
| @@ -426,7 +426,7 @@ namespace GSF.TimeSeries.Transport · 6 unmodified lines | ||
| 426 | 426 | { |
| 427 | 427 | // Decode 2-byte millisecond offset timestamp |
| 428 | 428 | if (baseTimeOffset > 0) |
| 429 | − Timestamp = baseTimeOffset + EndianOrder.BigEndian.ToUInt16(buffer, index) * Ticks.PerMillisecond; | |
| 429 | + Timestamp = baseTimeOffset + BigEndian.ToUInt16(buffer, index) * Ticks.PerMillisecond; | |
| 430 | 430 | |
| 431 | 431 | index += 2; |
| 432 | 432 | } |
| @@ -434,7 +434,7 @@ namespace GSF.TimeSeries.Transport · 1 unmodified line | ||
| 434 | 434 | { |
| 435 | 435 | // Decode 4-byte tick offset timestamp |
| 436 | 436 | if (baseTimeOffset > 0) |
| 437 | − Timestamp = baseTimeOffset + EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 437 | + Timestamp = baseTimeOffset + BigEndian.ToUInt32(buffer, index); | |
| 438 | 438 | |
| 439 | 439 | index += 4; |
| 440 | 440 | } |
| @@ -442,7 +442,7 @@ namespace GSF.TimeSeries.Transport · 1 unmodified line | ||
| 442 | 442 | else |
| 443 | 443 | { |
| 444 | 444 | // Decode 8-byte full fidelity timestamp |
| 445 | − Timestamp = EndianOrder.BigEndian.ToInt64(buffer, index); | |
| 445 | + Timestamp = BigEndian.ToInt64(buffer, index); | |
| 446 | 446 | index += 8; |
| 447 | 447 | } |
| 448 | 448 | } |
| @@ -486,10 +486,10 @@ namespace GSF.TimeSeries.Transport · 37 unmodified lines | ||
| 486 | 486 | buffer[startIndex++] = CompactStateFlags; |
| 487 | 487 | |
| 488 | 488 | // Encode runtime ID |
| 489 | − startIndex += EndianOrder.BigEndian.CopyBytes(RuntimeID, buffer, startIndex); | |
| 489 | + startIndex += BigEndian.CopyBytes(RuntimeID, buffer, startIndex); | |
| 490 | 490 | |
| 491 | 491 | // Encode adjusted value (accounts for adder and multiplier) |
| 492 | − startIndex += EndianOrder.BigEndian.CopyBytes((float)AdjustedValue, buffer, startIndex); | |
| 492 | + startIndex += BigEndian.CopyBytes((float)AdjustedValue, buffer, startIndex); | |
| 493 | 493 | |
| 494 | 494 | if (m_includeTime) |
| 495 | 495 | { |
| @@ -498,18 +498,18 @@ namespace GSF.TimeSeries.Transport · 2 unmodified lines | ||
| 498 | 498 | if (m_useMillisecondResolution) |
| 499 | 499 | { |
| 500 | 500 | // Encode 2-byte millisecond offset timestamp |
| 501 | − EndianOrder.BigEndian.CopyBytes(TimestampC2, buffer, startIndex); | |
| 501 | + BigEndian.CopyBytes(TimestampC2, buffer, startIndex); | |
| 502 | 502 | } |
| 503 | 503 | else |
| 504 | 504 | { |
| 505 | 505 | // Encode 4-byte ticks offset timestamp |
| 506 | − EndianOrder.BigEndian.CopyBytes(TimestampC4, buffer, startIndex); | |
| 506 | + BigEndian.CopyBytes(TimestampC4, buffer, startIndex); | |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | else |
| 510 | 510 | { |
| 511 | 511 | // Encode 8-byte full fidelity timestamp |
| 512 | − EndianOrder.BigEndian.CopyBytes((long)Timestamp, buffer, startIndex); | |
| 512 | + BigEndian.CopyBytes((long)Timestamp, buffer, startIndex); | |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| @@ -1995,7 +1995,7 @@ namespace GSF.TimeSeries.Transport · 1994 unmodified lines | ||
| 1995 | 1995 | { |
| 1996 | 1996 | foreach (KeyValuePair<int, string> pair in notifications) |
| 1997 | 1997 | { |
| 1998 | − hash = EndianOrder.BigEndian.GetBytes(pair.Key); | |
| 1998 | + hash = BigEndian.GetBytes(pair.Key); | |
| 1999 | 1999 | message = connection.Encoding.GetBytes(pair.Value); |
| 2000 | 2000 | |
| 2001 | 2001 | buffer.Write(hash, 0, hash.Length); |
| @@ -2189,7 +2189,7 @@ namespace GSF.TimeSeries.Transport · 187 unmodified lines | ||
| 2189 | 2189 | /// <param name="startTime">Start time, in <see cref="Ticks"/>, of first measurement transmitted.</param> |
| 2190 | 2190 | internal protected virtual bool SendDataStartTime(Guid clientID, Ticks startTime) |
| 2191 | 2191 | { |
| 2192 | − bool result = SendClientResponse(clientID, ServerResponse.DataStartTime, ServerCommand.Subscribe, EndianOrder.BigEndian.GetBytes((long)startTime)); | |
| 2192 | + bool result = SendClientResponse(clientID, ServerResponse.DataStartTime, ServerCommand.Subscribe, BigEndian.GetBytes((long)startTime)); | |
| 2193 | 2193 | |
| 2194 | 2194 | ClientConnection connection; |
| 2195 | 2195 | |
| @@ -2532,12 +2532,12 @@ namespace GSF.TimeSeries.Transport · 336 unmodified lines | ||
| 2532 | 2532 | workingBuffer.Seek(2, SeekOrigin.Begin); |
| 2533 | 2533 | |
| 2534 | 2534 | // Add the actual size of payload length to response packet |
| 2535 | − workingBuffer.Write(EndianOrder.BigEndian.GetBytes(payloadLength), 0, 4); | |
| 2535 | + workingBuffer.Write(BigEndian.GetBytes(payloadLength), 0, 4); | |
| 2536 | 2536 | } |
| 2537 | 2537 | else |
| 2538 | 2538 | { |
| 2539 | 2539 | // Add size of data buffer to response packet |
| 2540 | − workingBuffer.Write(EndianOrder.BigEndian.GetBytes(data.Length), 0, 4); | |
| 2540 | + workingBuffer.Write(BigEndian.GetBytes(data.Length), 0, 4); | |
| 2541 | 2541 | |
| 2542 | 2542 | // Add data buffer |
| 2543 | 2543 | workingBuffer.Write(data, 0, data.Length); |
| @@ -2877,7 +2877,7 @@ namespace GSF.TimeSeries.Transport · 333 unmodified lines | ||
| 2877 | 2877 | if (length >= 5) |
| 2878 | 2878 | { |
| 2879 | 2879 | // First 4 bytes beyond command byte represent an integer representing the length of the authentication string that follows |
| 2880 | − int byteLength = EndianOrder.BigEndian.ToInt32(buffer, startIndex); | |
| 2880 | + int byteLength = BigEndian.ToInt32(buffer, startIndex); | |
| 2881 | 2881 | startIndex += 4; |
| 2882 | 2882 | |
| 2883 | 2883 | // Byte length should be reasonable |
| @@ -2975,7 +2975,7 @@ namespace GSF.TimeSeries.Transport · 91 unmodified lines | ||
| 2975 | 2975 | bool addSubscription = false; |
| 2976 | 2976 | |
| 2977 | 2977 | // Next 4 bytes are an integer representing the length of the connection string that follows |
| 2978 | − int byteLength = EndianOrder.BigEndian.ToInt32(buffer, startIndex); | |
| 2978 | + int byteLength = BigEndian.ToInt32(buffer, startIndex); | |
| 2979 | 2979 | startIndex += 4; |
| 2980 | 2980 | |
| 2981 | 2981 | if (byteLength > 0 && length >= 6 + byteLength) |
| @@ -3240,7 +3240,7 @@ namespace GSF.TimeSeries.Transport · 258 unmodified lines | ||
| 3240 | 3240 | // DataTable.Select() function against an in-memory DataSet and therefore are not subject to SQL injection attacks |
| 3241 | 3241 | if (length > 4) |
| 3242 | 3242 | { |
| 3243 | − int responseLength = EndianOrder.BigEndian.ToInt32(buffer, startIndex); | |
| 3243 | + int responseLength = BigEndian.ToInt32(buffer, startIndex); | |
| 3244 | 3244 | startIndex += 4; |
| 3245 | 3245 | |
| 3246 | 3246 | if (length >= responseLength + 4) |
| @@ -3438,7 +3438,7 @@ namespace GSF.TimeSeries.Transport · 191 unmodified lines | ||
| 3438 | 3438 | if (length >= 4) |
| 3439 | 3439 | { |
| 3440 | 3440 | // Next 4 bytes are an integer representing the new processing interval |
| 3441 | − int processingInterval = EndianOrder.BigEndian.ToInt32(buffer, startIndex); | |
| 3441 | + int processingInterval = BigEndian.ToInt32(buffer, startIndex); | |
| 3442 | 3442 | |
| 3443 | 3443 | IClientSubscription subscription = connection.Subscription; |
| 3444 | 3444 | |
| @@ -3470,7 +3470,7 @@ namespace GSF.TimeSeries.Transport · 25 unmodified lines | ||
| 3470 | 3470 | |
| 3471 | 3471 | if (length >= 4) |
| 3472 | 3472 | { |
| 3473 | − operationalModes = EndianOrder.BigEndian.ToUInt32(buffer, startIndex); | |
| 3473 | + operationalModes = BigEndian.ToUInt32(buffer, startIndex); | |
| 3474 | 3474 | |
| 3475 | 3475 | if ((operationalModes & (uint)OperationalModes.VersionMask) != 0u) |
| 3476 | 3476 | OnStatusMessage("WARNING: Protocol version not supported. Operational modes may not be set correctly for client {0}.", connection.ClientID); |
| @@ -3482,7 +3482,7 @@ namespace GSF.TimeSeries.Transport · 5 unmodified lines | ||
| 3482 | 3482 | // Handle confirmation of receipt of notification |
| 3483 | 3483 | private void HandleConfirmNotification(ClientConnection connection, byte[] buffer, int startIndex, int length) |
| 3484 | 3484 | { |
| 3485 | − int hash = EndianOrder.BigEndian.ToInt32(buffer, startIndex); | |
| 3485 | + int hash = BigEndian.ToInt32(buffer, startIndex); | |
| 3486 | 3486 | Dictionary<int, string> notifications; |
| 3487 | 3487 | string notification; |
| 3488 | 3488 | |
| @@ -3521,7 +3521,7 @@ namespace GSF.TimeSeries.Transport · 32 unmodified lines | ||
| 3521 | 3521 | |
| 3522 | 3522 | if (length >= 4) |
| 3523 | 3523 | { |
| 3524 | − sequenceNumber = EndianOrder.BigEndian.ToUInt32(buffer, startIndex); | |
| 3524 | + sequenceNumber = BigEndian.ToUInt32(buffer, startIndex); | |
| 3525 | 3525 | connection.Subscription.ConfirmBufferBlock(sequenceNumber); |
| 3526 | 3526 | } |
| 3527 | 3527 | } |
| @@ -875,7 +875,7 @@ namespace GSF.TimeSeries.Transport · 874 unmodified lines | ||
| 875 | 875 | base.ProcessingInterval = value; |
| 876 | 876 | |
| 877 | 877 | // Request server update the processing interval |
| 878 | − SendServerCommand(ServerCommand.UpdateProcessingInterval, EndianOrder.BigEndian.GetBytes(value)); | |
| 878 | + SendServerCommand(ServerCommand.UpdateProcessingInterval, BigEndian.GetBytes(value)); | |
| 879 | 879 | } |
| 880 | 880 | } |
| 881 | 881 | |
| @@ -1542,7 +1542,7 @@ namespace GSF.TimeSeries.Transport · 660 unmodified lines | ||
| 1542 | 1542 | bytes = bytes.Encrypt(sharedSecret, CipherStrength.Aes256); |
| 1543 | 1543 | |
| 1544 | 1544 | // Write encoded authentication key length into buffer |
| 1545 | − buffer.Write(EndianOrder.BigEndian.GetBytes(bytes.Length), 0, 4); | |
| 1545 | + buffer.Write(BigEndian.GetBytes(bytes.Length), 0, 4); | |
| 1546 | 1546 | |
| 1547 | 1547 | // Encode encrypted authentication key into buffer |
| 1548 | 1548 | buffer.Write(bytes, 0, bytes.Length); |
| @@ -2133,7 +2133,7 @@ namespace GSF.TimeSeries.Transport · 584 unmodified lines | ||
| 2133 | 2133 | bytes = m_encoding.GetBytes(connectionString); |
| 2134 | 2134 | |
| 2135 | 2135 | // Write encoded connection string length into buffer |
| 2136 | − buffer.Write(EndianOrder.BigEndian.GetBytes(bytes.Length), 0, 4); | |
| 2136 | + buffer.Write(BigEndian.GetBytes(bytes.Length), 0, 4); | |
| 2137 | 2137 | |
| 2138 | 2138 | // Encode connection string into buffer |
| 2139 | 2139 | buffer.Write(bytes, 0, bytes.Length); |
| @@ -2248,7 +2248,7 @@ namespace GSF.TimeSeries.Transport · 108 unmodified lines | ||
| 2248 | 2248 | { |
| 2249 | 2249 | byte[] bytes = m_encoding.GetBytes(message); |
| 2250 | 2250 | |
| 2251 | − buffer.Write(EndianOrder.BigEndian.GetBytes(bytes.Length), 0, 4); | |
| 2251 | + buffer.Write(BigEndian.GetBytes(bytes.Length), 0, 4); | |
| 2252 | 2252 | buffer.Write(bytes, 0, bytes.Length); |
| 2253 | 2253 | |
| 2254 | 2254 | return SendServerCommand(commandCode, buffer.ToArray()); |
| @@ -2418,7 +2418,7 @@ namespace GSF.TimeSeries.Transport · 163 unmodified lines | ||
| 2418 | 2418 | |
| 2419 | 2419 | ServerResponse responseCode = (ServerResponse)buffer[0]; |
| 2420 | 2420 | ServerCommand commandCode = (ServerCommand)buffer[1]; |
| 2421 | − int responseLength = EndianOrder.BigEndian.ToInt32(buffer, 2); | |
| 2421 | + int responseLength = BigEndian.ToInt32(buffer, 2); | |
| 2422 | 2422 | int responseIndex = DataPublisher.ClientResponseHeaderSize; |
| 2423 | 2423 | bool solicited = false; |
| 2424 | 2424 | byte[][][] keyIVs; |
| @@ -2544,12 +2544,12 @@ namespace GSF.TimeSeries.Transport · 119 unmodified lines | ||
| 2544 | 2544 | // Synchronized packets contain a frame level timestamp |
| 2545 | 2545 | if (synchronizedMeasurements) |
| 2546 | 2546 | { |
| 2547 | − timestamp = EndianOrder.BigEndian.ToInt64(buffer, responseIndex); | |
| 2547 | + timestamp = BigEndian.ToInt64(buffer, responseIndex); | |
| 2548 | 2548 | responseIndex += 8; |
| 2549 | 2549 | } |
| 2550 | 2550 | |
| 2551 | 2551 | // Deserialize number of measurements that follow |
| 2552 | − count = EndianOrder.BigEndian.ToInt32(buffer, responseIndex); | |
| 2552 | + count = BigEndian.ToInt32(buffer, responseIndex); | |
| 2553 | 2553 | responseIndex += 4; |
| 2554 | 2554 | |
| 2555 | 2555 | if (compressedPayload) |
| @@ -2713,7 +2713,7 @@ namespace GSF.TimeSeries.Transport · 157 unmodified lines | ||
| 2713 | 2713 | break; |
| 2714 | 2714 | case ServerResponse.BufferBlock: |
| 2715 | 2715 | // Buffer block received - wrap as a buffer block measurement and expose back to consumer |
| 2716 | − uint sequenceNumber = EndianOrder.BigEndian.ToUInt32(buffer, responseIndex); | |
| 2716 | + uint sequenceNumber = BigEndian.ToUInt32(buffer, responseIndex); | |
| 2717 | 2717 | int cacheIndex = (int)(sequenceNumber - m_expectedBufferBlockSequenceNumber); |
| 2718 | 2718 | BufferBlockMeasurement bufferBlockMeasurement; |
| 2719 | 2719 | Tuple<Guid, string, uint> measurementKey; |
| @@ -2726,7 +2726,7 @@ namespace GSF.TimeSeries.Transport · 6 unmodified lines | ||
| 2726 | 2726 | SendServerCommand(ServerCommand.ConfirmBufferBlock, buffer.BlockCopy(responseIndex, 4)); |
| 2727 | 2727 | |
| 2728 | 2728 | // Get measurement key from signal index cache |
| 2729 | − signalIndex = EndianOrder.BigEndian.ToUInt16(buffer, responseIndex + 4); | |
| 2729 | + signalIndex = BigEndian.ToUInt16(buffer, responseIndex + 4); | |
| 2730 | 2730 | |
| 2731 | 2731 | if (!m_signalIndexCache.Reference.TryGetValue(signalIndex, out measurementKey)) |
| 2732 | 2732 | throw new InvalidOperationException("Failed to find associated signal identification for runtime ID " + signalIndex); |
| @@ -2781,7 +2781,7 @@ namespace GSF.TimeSeries.Transport · 48 unmodified lines | ||
| 2781 | 2781 | break; |
| 2782 | 2782 | case ServerResponse.DataStartTime: |
| 2783 | 2783 | // Raise data start time event |
| 2784 | − OnDataStartTime(EndianOrder.BigEndian.ToInt64(buffer, responseIndex)); | |
| 2784 | + OnDataStartTime(BigEndian.ToInt64(buffer, responseIndex)); | |
| 2785 | 2785 | break; |
| 2786 | 2786 | case ServerResponse.ProcessingComplete: |
| 2787 | 2787 | // Raise input processing completed event |
| @@ -2795,11 +2795,11 @@ namespace GSF.TimeSeries.Transport · 7 unmodified lines | ||
| 2795 | 2795 | break; |
| 2796 | 2796 | case ServerResponse.UpdateBaseTimes: |
| 2797 | 2797 | // Get active time index |
| 2798 | − m_timeIndex = EndianOrder.BigEndian.ToInt32(buffer, responseIndex); | |
| 2798 | + m_timeIndex = BigEndian.ToInt32(buffer, responseIndex); | |
| 2799 | 2799 | responseIndex += 4; |
| 2800 | 2800 | |
| 2801 | 2801 | // Deserialize new base time offsets |
| 2802 | − m_baseTimeOffsets = new[] { EndianOrder.BigEndian.ToInt64(buffer, responseIndex), EndianOrder.BigEndian.ToInt64(buffer, responseIndex + 8) }; | |
| 2802 | + m_baseTimeOffsets = new[] { BigEndian.ToInt64(buffer, responseIndex), BigEndian.ToInt64(buffer, responseIndex + 8) }; | |
| 2803 | 2803 | break; |
| 2804 | 2804 | case ServerResponse.UpdateCipherKeys: |
| 2805 | 2805 | // Move past active cipher index (not currently used anywhere else) |
| @@ -2821,7 +2821,7 @@ namespace GSF.TimeSeries.Transport · 15 unmodified lines | ||
| 2821 | 2821 | int bufferLen; |
| 2822 | 2822 | |
| 2823 | 2823 | // Read even key size |
| 2824 | − bufferLen = EndianOrder.BigEndian.ToInt32(bytes, index); | |
| 2824 | + bufferLen = BigEndian.ToInt32(bytes, index); | |
| 2825 | 2825 | index += 4; |
| 2826 | 2826 | |
| 2827 | 2827 | // Read even key |
| @@ -2830,7 +2830,7 @@ namespace GSF.TimeSeries.Transport · 2 unmodified lines | ||
| 2830 | 2830 | index += bufferLen; |
| 2831 | 2831 | |
| 2832 | 2832 | // Read even initialization vector size |
| 2833 | − bufferLen = EndianOrder.BigEndian.ToInt32(bytes, index); | |
| 2833 | + bufferLen = BigEndian.ToInt32(bytes, index); | |
| 2834 | 2834 | index += 4; |
| 2835 | 2835 | |
| 2836 | 2836 | // Read even initialization vector |
| @@ -2839,7 +2839,7 @@ namespace GSF.TimeSeries.Transport · 2 unmodified lines | ||
| 2839 | 2839 | index += bufferLen; |
| 2840 | 2840 | |
| 2841 | 2841 | // Read odd key size |
| 2842 | − bufferLen = EndianOrder.BigEndian.ToInt32(bytes, index); | |
| 2842 | + bufferLen = BigEndian.ToInt32(bytes, index); | |
| 2843 | 2843 | index += 4; |
| 2844 | 2844 | |
| 2845 | 2845 | // Read odd key |
| @@ -2848,7 +2848,7 @@ namespace GSF.TimeSeries.Transport · 2 unmodified lines | ||
| 2848 | 2848 | index += bufferLen; |
| 2849 | 2849 | |
| 2850 | 2850 | // Read odd initialization vector size |
| 2851 | − bufferLen = EndianOrder.BigEndian.ToInt32(bytes, index); | |
| 2851 | + bufferLen = BigEndian.ToInt32(bytes, index); | |
| 2852 | 2852 | index += 4; |
| 2853 | 2853 | |
| 2854 | 2854 | // Read odd initialization vector |
| @@ -4123,7 +4123,7 @@ namespace GSF.TimeSeries.Transport · 1268 unmodified lines | ||
| 4123 | 4123 | } |
| 4124 | 4124 | |
| 4125 | 4125 | // Define operational modes as soon as possible |
| 4126 | − SendServerCommand(ServerCommand.DefineOperationalModes, EndianOrder.BigEndian.GetBytes((uint)m_operationalModes)); | |
| 4126 | + SendServerCommand(ServerCommand.DefineOperationalModes, BigEndian.GetBytes((uint)m_operationalModes)); | |
| 4127 | 4127 | |
| 4128 | 4128 | // Notify input adapter base that asynchronous connection succeeded |
| 4129 | 4129 | OnConnected(); |
| @@ -29,6 +29,8 @@ using System; · 28 unmodified lines | ||
| 29 | 29 | using System.Text; |
| 30 | 30 | using GSF.Parsing; |
| 31 | 31 | |
| 32 | +#pragma warning disable 618 | |
| 33 | + | |
| 32 | 34 | namespace GSF.TimeSeries.Transport |
| 33 | 35 | { |
| 34 | 36 | /// <summary> |
| @@ -132,11 +134,11 @@ namespace GSF.TimeSeries.Transport · 97 unmodified lines | ||
| 132 | 134 | string keySource = ""; |
| 133 | 135 | |
| 134 | 136 | // Decode key ID |
| 135 | − keyID = EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 137 | + keyID = BigEndian.ToUInt32(buffer, index); | |
| 136 | 138 | index += 4; |
| 137 | 139 | |
| 138 | 140 | // Decode key source string length |
| 139 | − size = EndianOrder.BigEndian.ToInt32(buffer, index); | |
| 141 | + size = BigEndian.ToInt32(buffer, index); | |
| 140 | 142 | index += 4; |
| 141 | 143 | |
| 142 | 144 | // Decode key source string |
| @@ -154,7 +156,7 @@ namespace GSF.TimeSeries.Transport · 11 unmodified lines | ||
| 154 | 156 | Key = MeasurementKey.LookUpOrCreate(signalID, keySource, keyID); |
| 155 | 157 | |
| 156 | 158 | // Decode tag name string length |
| 157 | − size = EndianOrder.BigEndian.ToInt32(buffer, index); | |
| 159 | + size = BigEndian.ToInt32(buffer, index); | |
| 158 | 160 | index += 4; |
| 159 | 161 | |
| 160 | 162 | // Decode tag name string |
| @@ -167,23 +169,23 @@ namespace GSF.TimeSeries.Transport · 6 unmodified lines | ||
| 167 | 169 | TagName = null; |
| 168 | 170 | |
| 169 | 171 | // Decode value |
| 170 | − Value = EndianOrder.BigEndian.ToDouble(buffer, index); | |
| 172 | + Value = BigEndian.ToDouble(buffer, index); | |
| 171 | 173 | index += 8; |
| 172 | 174 | |
| 173 | 175 | // Decode adder |
| 174 | − Adder = EndianOrder.BigEndian.ToDouble(buffer, index); | |
| 176 | + Adder = BigEndian.ToDouble(buffer, index); | |
| 175 | 177 | index += 8; |
| 176 | 178 | |
| 177 | 179 | // Decode multiplier |
| 178 | − Multiplier = EndianOrder.BigEndian.ToDouble(buffer, index); | |
| 180 | + Multiplier = BigEndian.ToDouble(buffer, index); | |
| 179 | 181 | index += 8; |
| 180 | 182 | |
| 181 | 183 | // Decode timestamp |
| 182 | − Timestamp = EndianOrder.BigEndian.ToInt64(buffer, index); | |
| 184 | + Timestamp = BigEndian.ToInt64(buffer, index); | |
| 183 | 185 | index += 8; |
| 184 | 186 | |
| 185 | 187 | // Decode state flags |
| 186 | − StateFlags = (MeasurementStateFlags)EndianOrder.BigEndian.ToUInt32(buffer, index); | |
| 188 | + StateFlags = (MeasurementStateFlags)BigEndian.ToUInt32(buffer, index); | |
| 187 | 189 | index += 4; |
| 188 | 190 | |
| 189 | 191 | return (index - startIndex); |
| @@ -233,13 +235,13 @@ namespace GSF.TimeSeries.Transport · 43 unmodified lines | ||
| 233 | 235 | string tagName = TagName.ToNonNullString(); |
| 234 | 236 | |
| 235 | 237 | // Encode key ID |
| 236 | − EndianOrder.BigEndian.CopyBytes(Key.ID, buffer, index); | |
| 238 | + BigEndian.CopyBytes(Key.ID, buffer, index); | |
| 237 | 239 | index += 4; |
| 238 | 240 | |
| 239 | 241 | // Encode key source string length |
| 240 | 242 | bytes = m_encoding.GetBytes(source); |
| 241 | 243 | size = bytes.Length; |
| 242 | − EndianOrder.BigEndian.CopyBytes(size, buffer, index); | |
| 244 | + BigEndian.CopyBytes(size, buffer, index); | |
| 243 | 245 | index += 4; |
| 244 | 246 | |
| 245 | 247 | // Encode key source string |
| @@ -256,7 +258,7 @@ namespace GSF.TimeSeries.Transport · 10 unmodified lines | ||
| 256 | 258 | // Encode tag name string length |
| 257 | 259 | bytes = m_encoding.GetBytes(tagName); |
| 258 | 260 | size = bytes.Length; |
| 259 | − EndianOrder.BigEndian.CopyBytes(size, buffer, index); | |
| 261 | + BigEndian.CopyBytes(size, buffer, index); | |
| 260 | 262 | index += 4; |
| 261 | 263 | |
| 262 | 264 | // Encode tag name string |
| @@ -267,23 +269,23 @@ namespace GSF.TimeSeries.Transport · 4 unmodified lines | ||
| 267 | 269 | } |
| 268 | 270 | |
| 269 | 271 | // Encode value |
| 270 | − EndianOrder.BigEndian.CopyBytes(Value, buffer, index); | |
| 272 | + BigEndian.CopyBytes(Value, buffer, index); | |
| 271 | 273 | index += 8; |
| 272 | 274 | |
| 273 | 275 | // Encode adder |
| 274 | − EndianOrder.BigEndian.CopyBytes(Adder, buffer, index); | |
| 276 | + BigEndian.CopyBytes(Adder, buffer, index); | |
| 275 | 277 | index += 8; |
| 276 | 278 | |
| 277 | 279 | // Encode multiplier |
| 278 | − EndianOrder.BigEndian.CopyBytes(Multiplier, buffer, index); | |
| 280 | + BigEndian.CopyBytes(Multiplier, buffer, index); | |
| 279 | 281 | index += 8; |
| 280 | 282 | |
| 281 | 283 | // Encode timestamp |
| 282 | − EndianOrder.BigEndian.CopyBytes((long)Timestamp, buffer, index); | |
| 284 | + BigEndian.CopyBytes((long)Timestamp, buffer, index); | |
| 283 | 285 | index += 8; |
| 284 | 286 | |
| 285 | 287 | // Encode state flags |
| 286 | − EndianOrder.BigEndian.CopyBytes((uint)StateFlags, buffer, index); | |
| 288 | + BigEndian.CopyBytes((uint)StateFlags, buffer, index); | |
| 287 | 289 | |
| 288 | 290 | return length; |
| 289 | 291 | } |
| @@ -31,6 +31,8 @@ using System.Linq; · 30 unmodified lines | ||
| 31 | 31 | using System.Text; |
| 32 | 32 | using GSF.Parsing; |
| 33 | 33 | |
| 34 | +#pragma warning disable 618 | |
| 35 | + | |
| 34 | 36 | namespace GSF.TimeSeries.Transport |
| 35 | 37 | { |
| 36 | 38 | /// <summary> |
| @@ -281,7 +283,7 @@ namespace GSF.TimeSeries.Transport · 244 unmodified lines | ||
| 281 | 283 | buffer.ValidateParameters(startIndex, binaryLength); |
| 282 | 284 | |
| 283 | 285 | // Byte size of cache |
| 284 | − bigEndianBuffer = EndianOrder.BigEndian.GetBytes(binaryLength); | |
| 286 | + bigEndianBuffer = BigEndian.GetBytes(binaryLength); | |
| 285 | 287 | Buffer.BlockCopy(bigEndianBuffer, 0, buffer, offset, bigEndianBuffer.Length); |
| 286 | 288 | offset += bigEndianBuffer.Length; |
| 287 | 289 | |
| @@ -291,14 +293,14 @@ namespace GSF.TimeSeries.Transport · 3 unmodified lines | ||
| 291 | 293 | offset += bigEndianBuffer.Length; |
| 292 | 294 | |
| 293 | 295 | // Number of references |
| 294 | − bigEndianBuffer = EndianOrder.BigEndian.GetBytes(m_reference.Count); | |
| 296 | + bigEndianBuffer = BigEndian.GetBytes(m_reference.Count); | |
| 295 | 297 | Buffer.BlockCopy(bigEndianBuffer, 0, buffer, offset, bigEndianBuffer.Length); |
| 296 | 298 | offset += bigEndianBuffer.Length; |
| 297 | 299 | |
| 298 | 300 | foreach (KeyValuePair<ushort, Tuple<Guid, string, uint>> kvp in m_reference) |
| 299 | 301 | { |
| 300 | 302 | // Signal index |
| 301 | − bigEndianBuffer = EndianOrder.BigEndian.GetBytes(kvp.Key); | |
| 303 | + bigEndianBuffer = BigEndian.GetBytes(kvp.Key); | |
| 302 | 304 | Buffer.BlockCopy(bigEndianBuffer, 0, buffer, offset, bigEndianBuffer.Length); |
| 303 | 305 | offset += bigEndianBuffer.Length; |
| 304 | 306 | |
| @@ -309,20 +311,20 @@ namespace GSF.TimeSeries.Transport · 4 unmodified lines | ||
| 309 | 311 | |
| 310 | 312 | // Source |
| 311 | 313 | unicodeBuffer = m_encoding.GetBytes(kvp.Value.Item2); |
| 312 | − bigEndianBuffer = EndianOrder.BigEndian.GetBytes(unicodeBuffer.Length); | |
| 314 | + bigEndianBuffer = BigEndian.GetBytes(unicodeBuffer.Length); | |
| 313 | 315 | Buffer.BlockCopy(bigEndianBuffer, 0, buffer, offset, bigEndianBuffer.Length); |
| 314 | 316 | offset += bigEndianBuffer.Length; |
| 315 | 317 | Buffer.BlockCopy(unicodeBuffer, 0, buffer, offset, unicodeBuffer.Length); |
| 316 | 318 | offset += unicodeBuffer.Length; |
| 317 | 319 | |
| 318 | 320 | // ID |
| 319 | − bigEndianBuffer = EndianOrder.BigEndian.GetBytes(kvp.Value.Item3); | |
| 321 | + bigEndianBuffer = BigEndian.GetBytes(kvp.Value.Item3); | |
| 320 | 322 | Buffer.BlockCopy(bigEndianBuffer, 0, buffer, offset, bigEndianBuffer.Length); |
| 321 | 323 | offset += bigEndianBuffer.Length; |
| 322 | 324 | } |
| 323 | 325 | |
| 324 | 326 | // Number of unauthorized IDs |
| 325 | − bigEndianBuffer = EndianOrder.BigEndian.GetBytes(unauthorizedSignalIDs.Length); | |
| 327 | + bigEndianBuffer = BigEndian.GetBytes(unauthorizedSignalIDs.Length); | |
| 326 | 328 | Buffer.BlockCopy(bigEndianBuffer, 0, buffer, offset, bigEndianBuffer.Length); |
| 327 | 329 | offset += bigEndianBuffer.Length; |
| 328 | 330 | |
| @@ -367,7 +369,7 @@ namespace GSF.TimeSeries.Transport · 38 unmodified lines | ||
| 367 | 369 | return 0; |
| 368 | 370 | |
| 369 | 371 | // Byte size of cache |
| 370 | − binaryLength = EndianOrder.BigEndian.ToInt32(buffer, offset); | |
| 372 | + binaryLength = BigEndian.ToInt32(buffer, offset); | |
| 371 | 373 | offset += 4; |
| 372 | 374 | |
| 373 | 375 | if (length < binaryLength) |
| @@ -381,13 +383,13 @@ namespace GSF.TimeSeries.Transport · 7 unmodified lines | ||
| 381 | 383 | offset += 16; |
| 382 | 384 | |
| 383 | 385 | // Number of references |
| 384 | − referenceCount = EndianOrder.BigEndian.ToInt32(buffer, offset); | |
| 386 | + referenceCount = BigEndian.ToInt32(buffer, offset); | |
| 385 | 387 | offset += 4; |
| 386 | 388 | |
| 387 | 389 | for (int i = 0; i < referenceCount; i++) |
| 388 | 390 | { |
| 389 | 391 | // Signal index |
| 390 | − signalIndex = EndianOrder.BigEndian.ToUInt16(buffer, offset); | |
| 392 | + signalIndex = BigEndian.ToUInt16(buffer, offset); | |
| 391 | 393 | offset += 2; |
| 392 | 394 | |
| 393 | 395 | // Signal ID |
| @@ -395,20 +397,20 @@ namespace GSF.TimeSeries.Transport · 1 unmodified line | ||
| 395 | 397 | offset += 16; |
| 396 | 398 | |
| 397 | 399 | // Source |
| 398 | − sourceSize = EndianOrder.BigEndian.ToInt32(buffer, offset); | |
| 400 | + sourceSize = BigEndian.ToInt32(buffer, offset); | |
| 399 | 401 | offset += 4; |
| 400 | 402 | source = m_encoding.GetString(buffer, offset, sourceSize); |
| 401 | 403 | offset += sourceSize; |
| 402 | 404 | |
| 403 | 405 | // ID |
| 404 | − id = EndianOrder.BigEndian.ToUInt32(buffer, offset); | |
| 406 | + id = BigEndian.ToUInt32(buffer, offset); | |
| 405 | 407 | offset += 4; |
| 406 | 408 | |
| 407 | 409 | m_reference[signalIndex] = new Tuple<Guid, string, uint>(signalID, source, id); |
| 408 | 410 | } |
| 409 | 411 | |
| 410 | 412 | // Number of unauthorized IDs |
| 411 | − unauthorizedIDCount = EndianOrder.BigEndian.ToInt32(buffer, offset); | |
| 413 | + unauthorizedIDCount = BigEndian.ToInt32(buffer, offset); | |
| 412 | 414 | m_unauthorizedSignalIDs = new Guid[unauthorizedIDCount]; |
| 413 | 415 | offset += 4; |
| 414 | 416 | |
| @@ -552,7 +552,7 @@ namespace GSF.TimeSeries.Transport · 551 unmodified lines | ||
| 552 | 552 | bufferBlock = new byte[4 + bufferBlockMeasurement.Length]; |
| 553 | 553 | |
| 554 | 554 | // Prepend sequence number |
| 555 | − EndianOrder.BigEndian.CopyBytes(m_bufferBlockSequenceNumber, bufferBlock, 0); | |
| 555 | + BigEndian.CopyBytes(m_bufferBlockSequenceNumber, bufferBlock, 0); | |
| 556 | 556 | m_bufferBlockSequenceNumber++; |
| 557 | 557 | |
| 558 | 558 | // Append measurement data and send |
| @@ -618,10 +618,10 @@ namespace GSF.TimeSeries.Transport · 59 unmodified lines | ||
| 618 | 618 | |
| 619 | 619 | // Serialize frame timestamp into data packet - this only occurs in synchronized data packets, |
| 620 | 620 | // unsynchronized subscriptions always include timestamps in the serialized measurements |
| 621 | − m_workingBuffer.Write(EndianOrder.BigEndian.GetBytes(frameLevelTimestamp), 0, 8); | |
| 621 | + m_workingBuffer.Write(BigEndian.GetBytes(frameLevelTimestamp), 0, 8); | |
| 622 | 622 | |
| 623 | 623 | // Serialize total number of measurement values to follow |
| 624 | − m_workingBuffer.Write(EndianOrder.BigEndian.GetBytes(measurements.Count()), 0, 4); | |
| 624 | + m_workingBuffer.Write(BigEndian.GetBytes(measurements.Count()), 0, 4); | |
| 625 | 625 | |
| 626 | 626 | // Attempt compression when requested - encoding of compressed buffer only happens if size would be smaller than normal serialization |
| 627 | 627 | if (!usePayloadCompression || !measurements.Cast<CompactMeasurement>().CompressPayload(m_workingBuffer, m_compressionStrength, false, ref flags)) |
| @@ -686,12 +686,12 @@ namespace GSF.TimeSeries.Transport · 685 unmodified lines | ||
| 686 | 686 | bufferBlock = new byte[6 + bufferBlockMeasurement.Length]; |
| 687 | 687 | |
| 688 | 688 | // Prepend sequence number |
| 689 | − EndianOrder.BigEndian.CopyBytes(m_bufferBlockSequenceNumber, bufferBlock, 0); | |
| 689 | + BigEndian.CopyBytes(m_bufferBlockSequenceNumber, bufferBlock, 0); | |
| 690 | 690 | m_bufferBlockSequenceNumber++; |
| 691 | 691 | |
| 692 | 692 | // Copy signal index into buffer |
| 693 | 693 | bufferBlockSignalIndex = m_signalIndexCache.GetSignalIndex(bufferBlockMeasurement.ID); |
| 694 | − EndianOrder.BigEndian.CopyBytes(bufferBlockSignalIndex, bufferBlock, 4); | |
| 694 | + BigEndian.CopyBytes(bufferBlockSignalIndex, bufferBlock, 4); | |
| 695 | 695 | |
| 696 | 696 | // Append measurement data and send |
| 697 | 697 | Buffer.BlockCopy(bufferBlockMeasurement.Buffer, 0, bufferBlock, 6, bufferBlockMeasurement.Length); |
| @@ -765,7 +765,7 @@ namespace GSF.TimeSeries.Transport · 67 unmodified lines | ||
| 765 | 765 | // published upon receipt, however timestamps are optionally included in the serialized measurements. |
| 766 | 766 | |
| 767 | 767 | // Serialize total number of measurement values to follow |
| 768 | − m_workingBuffer.Write(EndianOrder.BigEndian.GetBytes(measurements.Count()), 0, 4); | |
| 768 | + m_workingBuffer.Write(BigEndian.GetBytes(measurements.Count()), 0, 4); | |
| 769 | 769 | |
| 770 | 770 | // Attempt compression when requested - encoding of compressed buffer only happens if size would be smaller than normal serialization |
| 771 | 771 | if (!usePayloadCompression || !measurements.Cast<CompactMeasurement>().CompressPayload(m_workingBuffer, m_compressionStrength, m_includeTime, ref flags)) |
| @@ -838,9 +838,9 @@ namespace GSF.TimeSeries.Transport · 66 unmodified lines | ||
| 838 | 838 | // to maintaining this memory stream at a member level |
| 839 | 839 | using (BlockAllocatedMemoryStream responsePacket = new BlockAllocatedMemoryStream()) |
| 840 | 840 | { |
| 841 | − responsePacket.Write(EndianOrder.BigEndian.GetBytes(m_timeIndex), 0, 4); | |
| 842 | − responsePacket.Write(EndianOrder.BigEndian.GetBytes(m_baseTimeOffsets[0]), 0, 8); | |
| 843 | − responsePacket.Write(EndianOrder.BigEndian.GetBytes(m_baseTimeOffsets[1]), 0, 8); | |
| 841 | + responsePacket.Write(BigEndian.GetBytes(m_timeIndex), 0, 4); | |
| 842 | + responsePacket.Write(BigEndian.GetBytes(m_baseTimeOffsets[0]), 0, 8); | |
| 843 | + responsePacket.Write(BigEndian.GetBytes(m_baseTimeOffsets[1]), 0, 8); | |
| 844 | 844 | |
| 845 | 845 | m_parent.SendClientResponse(m_clientID, ServerResponse.UpdateBaseTimes, ServerCommand.Subscribe, responsePacket.ToArray()); |
| 846 | 846 | } |
| @@ -434,7 +434,7 @@ namespace GSF.TimeSeries.UI · 433 unmodified lines | ||
| 434 | 434 | /// <returns><see cref="DBNull"/> if <paramref name="value"/> is <c>null</c>; otherwise <paramref name="value"/>.</returns> |
| 435 | 435 | public static object ToNotNull(this object value) |
| 436 | 436 | { |
| 437 | − if (value == null) | |
| 437 | + if ((object)value == null) | |
| 438 | 438 | return (object)DBNull.Value; |
| 439 | 439 | |
| 440 | 440 | if (value is int && (int)value == 0) |
| @@ -105,7 +105,7 @@ namespace GSF.TimeSeries.UI.Converters · 104 unmodified lines | ||
| 105 | 105 | { |
| 106 | 106 | Dictionary<Type, string> collection = (Dictionary<Type, string>)viewSource.Source; |
| 107 | 107 | |
| 108 | − if (value != null) | |
| 108 | + if ((object)value != null) | |
| 109 | 109 | { |
| 110 | 110 | KeyValuePair<Type, string> item = collection.ToList().SingleOrDefault(pair => pair.Key.FullName == value.ToString()); |
| 111 | 111 | |
| @@ -128,7 +128,7 @@ namespace GSF.TimeSeries.UI.Converters · 16 unmodified lines | ||
| 128 | 128 | /// <returns>Integer, to bind to UI object.</returns> |
| 129 | 129 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
| 130 | 130 | { |
| 131 | − if (value != null) | |
| 131 | + if ((object)value != null) | |
| 132 | 132 | { |
| 133 | 133 | if (value is KeyValuePair<int, string>) |
| 134 | 134 | return ((KeyValuePair<int, string>)value).Key == 0 ? (object)DBNull.Value : ((KeyValuePair<int, string>)value).Key; |
| @@ -44,11 +44,11 @@ namespace GSF.TimeSeries.UI.Converters · 43 unmodified lines | ||
| 44 | 44 | /// <returns>Boolean value.</returns> |
| 45 | 45 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| 46 | 46 | { |
| 47 | − if (value != null) | |
| 47 | + if ((object)value != null) | |
| 48 | 48 | { |
| 49 | − int temp = (int) value; | |
| 49 | + int temp = (int)value; | |
| 50 | 50 | if (temp > 0) |
| 51 | − return false; | |
| 51 | + return false; | |
| 52 | 52 | else |
| 53 | 53 | return true; |
| 54 | 54 | } |
| @@ -47,7 +47,7 @@ namespace GSF.TimeSeries.UI.Converters · 46 unmodified lines | ||
| 47 | 47 | /// <returns><see cref="System.Windows.Visibility"/> enumeration.</returns> |
| 48 | 48 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| 49 | 49 | { |
| 50 | − if (value != null) | |
| 50 | + if ((object)value != null) | |
| 51 | 51 | { |
| 52 | 52 | // if value is int, then if it is greater than zero then, set it to true otherwise false. |
| 53 | 53 | // Once we set value to boolean instead of integer, next code will take care of visibility. |
| @@ -46,10 +46,10 @@ namespace GSF.TimeSeries.UI.Converters · 45 unmodified lines | ||
| 46 | 46 | /// <param name="targetType">The type of the binding target property.</param> |
| 47 | 47 | /// <param name="parameter">The converter parameter to use.</param> |
| 48 | 48 | /// <param name="culture">The culture to use in the converter.</param> |
| 49 | − /// <returns>One of the visibility enummeration</returns> | |
| 49 | + /// <returns>One of the visibility enumeration</returns> | |
| 50 | 50 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| 51 | 51 | { |
| 52 | − if (value == null || string.IsNullOrEmpty(value.ToString()) || value.ToString() == "*" || CommonFunctions.CurrentPrincipal.IsInRole(value.ToString())) | |
| 52 | + if ((object)value == null || string.IsNullOrEmpty(value.ToString()) || value.ToString() == "*" || CommonFunctions.CurrentPrincipal.IsInRole(value.ToString())) | |
| 53 | 53 | return Visibility.Visible; |
| 54 | 54 | else |
| 55 | 55 | return Visibility.Collapsed; |
| @@ -46,7 +46,7 @@ namespace GSF.TimeSeries.UI.Converters · 45 unmodified lines | ||
| 46 | 46 | /// <returns>Boolean value.</returns> |
| 47 | 47 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| 48 | 48 | { |
| 49 | − if (value != null) | |
| 49 | + if ((object)value != null) | |
| 50 | 50 | { |
| 51 | 51 | string temp = value.ToString().ToUpper(); |
| 52 | 52 | if (temp == "TRUE" || temp == "1" || temp == "IPHA" || temp == "IPHM" || temp == "VPHA" || temp == "VPHM" || temp == "FREQ") |
| @@ -51,7 +51,7 @@ namespace GSF.TimeSeries.UI.Converters · 50 unmodified lines | ||
| 51 | 51 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| 52 | 52 | { |
| 53 | 53 | string input = string.Empty; |
| 54 | − if (value != null) | |
| 54 | + if ((object)value != null) | |
| 55 | 55 | input = value.ToString().ToLower(); |
| 56 | 56 | |
| 57 | 57 | switch (input) |
| @@ -188,7 +188,7 @@ namespace GSF.TimeSeries.UI.DataModels · 187 unmodified lines | ||
| 188 | 188 | } |
| 189 | 189 | set |
| 190 | 190 | { |
| 191 | − if (value != null && value.Length > 200) | |
| 191 | + if ((object)value != null && value.Length > 200) | |
| 192 | 192 | m_pointTag = value.Substring(0, 200); |
| 193 | 193 | else |
| 194 | 194 | m_pointTag = value; |
| @@ -179,7 +179,7 @@ namespace GSF.Web.Embedded · 178 unmodified lines | ||
| 179 | 179 | // Show reset password. |
| 180 | 180 | Page.Title = StaticPageTitle + " :: Reset Password"; |
| 181 | 181 | |
| 182 | − if (ViewState[UsernameKey] == null) | |
| 182 | + if ((object)ViewState[UsernameKey] == null) | |
| 183 | 183 | { |
| 184 | 184 | // Check for reset support. |
| 185 | 185 | ResetPasswordCheckPanel.Visible = true; |
| @@ -221,7 +221,7 @@ namespace GSF.Windows.Forms · 220 unmodified lines | ||
| 221 | 221 | //AddListViewItem(ListViewApplicationInfo, "Trademark", AssemblyInfo.EntryAssembly.Trademark); |
| 222 | 222 | |
| 223 | 223 | // Query all the assemblies used by the calling application. |
| 224 | − if (m_assemblies == null) | |
| 224 | + if ((object)m_assemblies == null) | |
| 225 | 225 | { |
| 226 | 226 | m_assemblies = new List<AssemblyInfo>(); |
| 227 | 227 | foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) |
| @@ -119,7 +119,7 @@ namespace GSF.Windows.Forms · 118 unmodified lines | ||
| 119 | 119 | Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); |
| 120 | 120 | |
| 121 | 121 | // Setup the security provider for role-based security. |
| 122 | − if (SecurityProviderCache.CurrentProvider == null) | |
| 122 | + if ((object)SecurityProviderCache.CurrentProvider == null) | |
| 123 | 123 | SecurityProviderCache.CurrentProvider = SecurityProviderUtility.CreateProvider(string.Empty); |
| 124 | 124 | |
| 125 | 125 | // Verify that the current thread principal has been authenticated. |
| @@ -604,7 +604,7 @@ namespace Hadoop.Replication · 603 unmodified lines | ||
| 604 | 604 | while ((bytesRead = fileStream.Read(readBuffer, 0, readBuffer.Length)) != 0) |
| 605 | 605 | { |
| 606 | 606 | // Read "bytesPerCrc32" bytes from the file and compute CRC32. |
| 607 | − blockCRC = EndianOrder.BigEndian.GetBytes(readBuffer.Crc32Checksum(0, bytesRead)); | |
| 607 | + blockCRC = BigEndian.GetBytes(readBuffer.Crc32Checksum(0, bytesRead)); | |
| 608 | 608 | // Add big-endian byte array of the computed CRC32 to CRC32 buffer. |
| 609 | 609 | blockCRCs.AddRange(blockCRC); |
| 610 | 610 | // Stop reading and compute block MD5 hash when a HDFS block data has been processed. |
| @@ -36,6 +36,9 @@ namespace GSF.Core.Tests · 35 unmodified lines | ||
| 36 | 36 | { |
| 37 | 37 | #region [ Byte Swap/Copy Only Endian Order Testing Classes ] |
| 38 | 38 | |
| 39 | + // These classes represent a brute-force approach to Endian order handling | |
| 40 | + // that are used as a base-line for testing other optimized approaches | |
| 41 | + | |
| 39 | 42 | /// <summary> |
| 40 | 43 | /// Represents a big-endian byte order interoperability class. |
| 41 | 44 | /// </summary> |
| @@ -25,9 +25,10 @@ · 24 unmodified lines | ||
| 25 | 25 | using System; |
| 26 | 26 | using System.Linq; |
| 27 | 27 | using System.Text; |
| 28 | −using System.Web.ModelBinding; | |
| 29 | 28 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 30 | 29 | |
| 30 | +#pragma warning disable 618 | |
| 31 | + | |
| 31 | 32 | namespace GSF.Core.Tests |
| 32 | 33 | { |
| 33 | 34 | [TestClass] |