1221 lines · 41.3 KB · C#
RawDownload
        public byte[] value;         public E_GRP_SELECT(BinaryReader reader)        {            size = reader.ReadInt16();            value = reader.ReadBytes(size);        }    }     [StructLayout(LayoutKind.Sequential)]    public struct PHASOR_GROUP    {        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]        public short[] values;       // channels Va, Vb, Vc, Ia, Ib, Ic, In in order     }     // Since this structure includes a dynamically sized array, we manually parse structure    public struct PHASOR_GROUPS    {        public short length;        public PHASOR_GROUP[] groups;         public PHASOR_GROUPS(BinaryReader reader)        {            length = reader.ReadInt16();            groups = new PHASOR_GROUP[length / Marshal.SizeOf(typeof(PHASOR_GROUP))];             for (int i = 0; i < groups.Length; i++)            {                groups[i] = reader.ReadStructure<PHASOR_GROUP>();            }        }    }     [StructLayout(LayoutKind.Sequential)]    public struct _complex    {        /* real and imaginary parts */        [MarshalAs(UnmanagedType.R8)]        public double x;        [MarshalAs(UnmanagedType.R8)]        public double y;    }     [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]    public struct LINE_CONSTANT    {        public _complex z0;        public _complex z1;        public _complex zaa;        public _complex zbb;        public _complex zcc;        public _complex zab;        public _complex zbc;        public _complex zca;        [MarshalAs(UnmanagedType.R4)]        public float line_len;        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)]        public string units;        [MarshalAs(UnmanagedType.R4)]        public float fault_percent_of_full_scale;    }     // Since this structure includes a dynamically sized array, we manually parse structure    public struct LINE_CONSTANTS    {        public short length;        public LINE_CONSTANT[] constants;         public LINE_CONSTANTS(BinaryReader reader)        {            length = reader.ReadInt16();            constants = new LINE_CONSTANT[length / Marshal.SizeOf(typeof(LINE_CONSTANT))];             for (int i = 0; i < constants.Length; i++)            {                constants[i] = reader.ReadStructure<LINE_CONSTANT>();            }        }    }     [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]    public struct LINE_NAME    {        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]        public string value;    }     // Since this structure includes a dynamically sized array, we manually parse structure    public struct LINE_NAMES    {        public short length;        public LINE_NAME[] names;         public LINE_NAMES(BinaryReader reader)        {            length = reader.ReadInt16();            names = new LINE_NAME[length / Marshal.SizeOf(typeof(LINE_NAME))];             for (int i = 0; i < names.Length; i++)            {                names[i] = reader.ReadStructure<LINE_NAME>();            }        }    }     [Flags]    public enum FAULT_LIST_FLAGS : ushort    {        MASK_UNDER = 0x0010,        MASK_OVER = 0x0020,        MASK_SLOPE = 0x0040,    // (Rate)        MASK_LIMIT = 0x0080,        MASK_FAULT = 0x0001,        MSK_ZERO = 0x0100,        MSK_POS_OVER = 0x0200,        MSK_POS_UNDER = 0x0400,        MSK_NEG = 0x0800,        MSK_FREQ = 0x1000,        MSK_HARM = 0x2000,        MSK_SWING = 0x4000,        MSK_PWR = 0x8000    }     [StructLayout(LayoutKind.Sequential)]    public struct FAULT_LIST    {        [MarshalAs(UnmanagedType.R4)]        public float fvalue;        [MarshalAs(UnmanagedType.U2)]        public FAULT_LIST_FLAGS flag;         /*  chanlnum represents analog channel for over,under            slope and frequency.            For sequence triggers, chanlnum = sequence group – 1.            For power triggers, chanlnum = line group – 1.            For event triggers, chanlnum = -event channel.       */        [MarshalAs(UnmanagedType.I2)]        public short chanlnum;        [MarshalAs(UnmanagedType.I2)]        public short duration_sec;        [MarshalAs(UnmanagedType.I2)]        public short duration_mS;        [MarshalAs(UnmanagedType.I2)]        public short fault_sec;        [MarshalAs(UnmanagedType.I2)]        public short fault_mS;        [MarshalAs(UnmanagedType.I4)]        public int rms_offset;        [MarshalAs(UnmanagedType.R4)]        public float rms_value;    }     [StructLayout(LayoutKind.Sequential)]    public struct FAULT_LOCATION    {        [MarshalAs(UnmanagedType.I2)]        public short type;        [MarshalAs(UnmanagedType.R4)]        public float k;    };     // Since this structure includes a dynamically sized array, we manually parse structure    public struct FAULT_LOCATIONS    {        public short length;        public FAULT_LOCATION[] locations;         public FAULT_LOCATIONS(BinaryReader reader)        {            length = reader.ReadInt16();            locations = new FAULT_LOCATION[length / Marshal.SizeOf(typeof(FAULT_LOCATION))];             for (int i = 0; i < locations.Length; i++)            {                locations[i] = reader.ReadStructure<FAULT_LOCATION>();            }        }    }     [StructLayout(LayoutKind.Sequential)]    public struct SEQUENCE_CHANNEL    {        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]        public short[] values;    }     // Since this structure includes a dynamically sized array, we manually parse structure    public struct SEQUENCE_CHANNELS    {        public short length;        public SEQUENCE_CHANNEL[] channels;         public SEQUENCE_CHANNELS(BinaryReader reader)        {            length = reader.ReadInt16();            channels = new SEQUENCE_CHANNEL[length / Marshal.SizeOf(typeof(SEQUENCE_CHANNEL))];             for (int i = 0; i < channels.Length; i++)            {                channels[i] = reader.ReadStructure<SEQUENCE_CHANNEL>();            }        }    }     public static class ControlFileStructureExtensions    {        public static TimeZoneInfo GetTimeZoneInfo(this SYSTEM_PARAMETERS systemParameters)        {            try            {                return TimeZoneInfo.FindSystemTimeZoneById(systemParameters.time_zone_information.StandardName);            }            catch            {                return TimeZoneInfo.Local;            }        }    }}

Lines 1001–1221 of 1221. Previous lines

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t