Ejemplo n.º 1
0
        /// <summary>
        /// Obtain list of VPN Adapter Descriptions that must be ignored because
        /// they errantly present a NetworkInterfaceType of "Ethernet"
        ///
        /// Note:  We have included hard-coded exceptions for Cisco and Juniper
        /// because they are well known.  However, we have also "policy-enabled"
        /// this method.  If we find a policy-managed list of exceptions in the
        /// registry, we will ignore them, as well.
        ///
        /// HKLM\SOFTWARE\Policies\Microsoft\ConnectionMonitor\VPNExceptionsList
        /// </summary>
        /// <param></param>
        /// <returns>List of Errant VPN Adapter Descriptions.</returns>
        private static string GetVPNExceptionList()
        {
            const string MemberName = "GetVPNExceptionList";

            using (new Tracer(MemberName))
            {
                StringBuilder exceptionList = new StringBuilder();

                try
                {
                    DataSection ds = (DataSection)ConfigurationManager.GetSection("VPNExceptionList");

                    for (int i = 0; i < ds.Items.Count; i++)
                    {
                        if (i > 0)
                        {
                            exceptionList.Append(",");
                        }
                        exceptionList.Append(ds.Items[i].Data);
                    }
                }
                catch (Exception ex)
                {
                    //Do not throw an exception just log it
                    ConnectionMonitorException cme = new ConnectionMonitorException(
                        "No VPN Exceptions defined in the configuration file! " + MemberName, ex);
                    Logger.Write(cme);
                }

                try
                {
                    // See if the VPN Exceptions are being managed by policy
                    string keyName          = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\ConnectionMonitor";
                    string valueName        = "VPNExceptionsList";
                    string vpnExceptionList = (string)Registry.GetValue(keyName, valueName, string.Empty);

                    if (!String.IsNullOrEmpty(vpnExceptionList))
                    {
                        //Add the policy exceptions
                        if (exceptionList.Length > 0)
                        {
                            exceptionList.Append(",");
                        }
                        exceptionList.Append(vpnExceptionList);
                    }
                }
                catch (ConnectionMonitorException cme)
                {
                    Logger.Write(cme);
                    throw cme;
                }
                catch (Exception ex)
                {
                    Logger.Write(ex);
                    throw ex;
                }

                return(exceptionList.ToString());
            }
        }
Ejemplo n.º 2
0
        public string GetScript()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(DataHelper.GetCommandListScript(CommandList));

            TextSection.DecodeText();
            string strTextSection = TextSection.GetCombinedTextString();

            if (!string.IsNullOrEmpty(strTextSection))
            {
                sb.AppendLine("{SECTION:TEXT}");
                sb.AppendLine();
                sb.Append(strTextSection);
            }

            string strDataSection = DataSection.GetCombinedByteString();

            if (!string.IsNullOrEmpty(strDataSection))
            {
                sb.AppendLine("{SECTION:DATA}");
                sb.AppendLine();
                sb.Append(strDataSection);
            }

            return(sb.ToString());
        }
        public RepositoryDbAccess()
        {
            var settings = new DataSection();

            Configuration.GetSection("calmoData").Bind(settings);
            DataSection = settings;
        }
Ejemplo n.º 4
0
        private static void PrintsDescriptors(ILogger logger, DataBlock dataBlock)
        {
            logger.Info("");
            logger.Info($@" Extracted contents:");
            logger.Info($@" ┌{new string('─', 48)}");

            DataSection headerSection = dataBlock.Sections[(int)EdidSection.Header];

            logger.Info($@" │ Header:{'\t'}{'\t'}{string.Join(" ", headerSection.RawData.AsHexadecimal())}");

            DataSection         vendorSection      = dataBlock.Sections[(int)EdidSection.Vendor];
            QueryPropertyResult serialNumberResult = vendorSection.GetProperty(EedidProperty.Edid.Vendor.IdSerialNumber);

            if (serialNumberResult.Success)
            {
                logger.Info($@" │ Serial number:{'\t'}{serialNumberResult.Result.Value}");
            }
            else
            {
                logger.Info($@" │ Serial number:{'\t'}...");
            }

            DataSection versionSection = dataBlock.Sections[(int)EdidSection.Version];

            logger.Info($@" │ Version:{'\t'}{'\t'}{string.Join(" ", versionSection.RawData.AsHexadecimal())}");

            DataSection basicDisplaySection = dataBlock.Sections[(int)EdidSection.BasicDisplay];

            logger.Info($@" │ Basic params:{'\t'}{string.Join(" ", basicDisplaySection.RawData.AsHexadecimal())}");

            DataSection colorCharacteristicsTimingsSection = dataBlock.Sections[(int)EdidSection.ColorCharacteristics];

            logger.Info($@" │ Chroma info:{'\t'}{'\t'}{string.Join(" ", colorCharacteristicsTimingsSection.RawData.AsHexadecimal())}");

            DataSection establishedTimingsSection = dataBlock.Sections[(int)EdidSection.EstablishedTimings];

            logger.Info($@" │ Established:{'\t'}{'\t'}{string.Join(" ", establishedTimingsSection.RawData.AsHexadecimal())}");

            DataSection standardTimingsSection = dataBlock.Sections[(int)EdidSection.StandardTimings];

            logger.Info($@" │ Standard:{'\t'}{'\t'}{string.Join(" ", standardTimingsSection.RawData.AsHexadecimal())}");

            DataSection dataBlocksSection = dataBlock.Sections[(int)EdidSection.DataBlocks];

            logger.Info($@" │ Descriptor 1:{'\t'}{string.Join(" ", ((ReadOnlyCollection<byte>)dataBlocksSection.GetProperty(EedidProperty.Edid.DataBlock.Descriptor1).Result.Value).AsHexadecimal())}");
            logger.Info($@" │ Descriptor 2:{'\t'}{string.Join(" ", ((ReadOnlyCollection<byte>)dataBlocksSection.GetProperty(EedidProperty.Edid.DataBlock.Descriptor2).Result.Value).AsHexadecimal())}");
            logger.Info($@" │ Descriptor 3:{'\t'}{string.Join(" ", ((ReadOnlyCollection<byte>)dataBlocksSection.GetProperty(EedidProperty.Edid.DataBlock.Descriptor3).Result.Value).AsHexadecimal())}");
            logger.Info($@" │ Descriptor 4:{'\t'}{string.Join(" ", ((ReadOnlyCollection<byte>)dataBlocksSection.GetProperty(EedidProperty.Edid.DataBlock.Descriptor4).Result.Value).AsHexadecimal())}");

            DataSection extensionSection = dataBlock.Sections[(int)EdidSection.ExtensionBlocks];

            logger.Info($@" │ Extensions:{'\t'}{'\t'}{string.Join(" ", extensionSection.RawData.AsHexadecimal())}");

            DataSection checksumSection = dataBlock.Sections[(int)EdidSection.Checksum];

            logger.Info($@" │ Checksum:{'\t'}{'\t'}{string.Join(" ", checksumSection.RawData.AsHexadecimal())}");

            logger.Info("");
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 /// <param name="parent">The parent emitter.</param>
 /// <param name="outer">The outer code section.</param>
 /// <param name="sourceMap">The current source map.</param>
 private Emitter(Emitter parent, CodeSection outer, SourceMap sourceMap)
 {
     this.data      = parent.data;
     this.code      = parent.code;
     this.local     = new CodeSection();
     this.sourceMap = sourceMap;
     outer.Add(this.local);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 /// <param name="source">The source code, split into lines.</param>
 public Emitter(string[] source)
 {
     this.data      = new DataSection();
     this.code      = new CodeSection();
     this.local     = new CodeSection();
     this.sourceMap = new SourceMap(source);
     this.code.Add(this.local);
 }
Ejemplo n.º 7
0
            public void Parse(DataSection node, VoidPtr address)
            {
                Offsets *addr = (Offsets *)address;

                for (int i = 11; i < 14; i++)
                {
                    int x = (int)addr->Entries[i];
                    node._articles.Add(x, node.Parse <ArticleEntry>(x));
                }
            }
Ejemplo n.º 8
0
 public PUSH_VARIABLE(VirtualAddress VariableAddress, DataSection dataSection)
     : base(5, typeof(IPush))
 {
     /*string val = "";
      * if (dataSection.LoadString(VariableAddress, ref val))
      * {
      *  this.Value = val;
      * }*/
     this.ValueAddress = VariableAddress.Address;
     this.dataSection  = dataSection;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Enumerates the messages in the underlying stream.
        /// </summary>
        /// <returns>The messages in the GRIB 2 stream.</returns>
        public IEnumerable <Message> ReadMessages()
        {
            reader.Seek(0, SeekOrigin.Begin);

            do
            {
                var indicatorSection      = IndicatorSection.BuildFrom(reader);
                var identificationSection = IdentificationSection.BuildFrom(reader);

                var message = new Message(indicatorSection, identificationSection);

                LocalUseSection localUseSection = null;
                do
                {
                    if (reader.PeekSection().Is(SectionCode.LocalUseSection))
                    {
                        localUseSection = LocalUseSection.BuildFrom(reader);
                    }

                    while (reader.PeekSection().Is(SectionCode.GridDefinitionSection))
                    {
                        var gridDefinitionSection = GridDefinitionSection.BuildFrom(reader);

                        while (reader.PeekSection().Is(SectionCode.ProductDefinitionSection))
                        {
                            var productDefinitionSection  = ProductDefinitionSection.BuildFrom(reader, indicatorSection.Discipline);
                            var dataRepresentationSection = DataRepresentationSection.BuildFrom(reader);

                            var bitmapSection = BitmapSection.BuildFrom(reader, dataRepresentationSection.DataPointsNumber);

                            var dataSection = DataSection.BuildFrom(reader);

                            message.AddDataset(
                                localUseSection,
                                gridDefinitionSection,
                                productDefinitionSection,
                                dataRepresentationSection,
                                bitmapSection,
                                dataSection);
                        }
                    }
                } while (!reader.PeekSection().Is(SectionCode.EndSection));
                EndSection.BuildFrom(reader);

                // Saves and restore the current position
                // to avoid losing track of the current message
                // if a data set read happens during the enumeration
                var currentPosition = reader.Position;
                yield return(message);

                reader.Seek(currentPosition, SeekOrigin.Begin);
            } while (!reader.HasReachedStreamEnd && reader.PeekSection().Is(SectionCode.IndicatorSection));
        }
Ejemplo n.º 10
0
        private void ReadDataChunk(EndianBinaryReader reader)
        {
            reader.BaseStream.Position = Header.OffsetToDataChunk;

            DATA          = new DataSection();
            DATA.ID       = new string(reader.ReadChars(4));
            DATA.Length   = reader.ReadInt32();
            DATA.Unknown  = reader.ReadInt32();
            DATA.Padding  = reader.ReadBytes(14);
            DATA.Data     = reader.ReadBytes(DATA.Length - 26); // - 26 to take into account the previously read data
            DATA.Padding2 = reader.ReadBytes(26);
        }
Ejemplo n.º 11
0
            public void Parse(DataSection node, VoidPtr address)
            {
                Offsets *addr = (Offsets *)address;

                for (int i = 0; i < 5; i++)
                {
                    node._extraEntries.Add(node.Parse <RawParamList>((int)addr->Entries[i]));
                }
                for (int i = 5; i < 10; i++)
                {
                    node._articles.Add((int)addr->Entries[i], node.Parse <ArticleEntry>((int)addr->Entries[i]));
                }
            }
Ejemplo n.º 12
0
        public AsmNet(byte[] data)
        {
            byte[] payload = new byte[data.Length];
            Array.Copy(data, payload, payload.Length);
            payload = QuickLZ.Decompress(payload, 0);

            int ReadOffset = 0;

            byte[] DataSectionBytes = new byte[BitConverter.ToInt32(payload, ReadOffset)];
            ReadOffset += 4;
            Array.Copy(payload, 4, DataSectionBytes, 0, DataSectionBytes.Length);
            ReadOffset += DataSectionBytes.Length;

            byte[] CodeSectionBytes = new byte[BitConverter.ToInt32(payload, ReadOffset)];
            ReadOffset += 4;
            Array.Copy(payload, ReadOffset, CodeSectionBytes, 0, CodeSectionBytes.Length);
            ReadOffset += CodeSectionBytes.Length;

            byte[] ApiSectionBytes = new byte[BitConverter.ToInt32(payload, ReadOffset)];
            ReadOffset += 4;
            Array.Copy(payload, ReadOffset, ApiSectionBytes, 0, ApiSectionBytes.Length);
            ReadOffset += ApiSectionBytes.Length;

            byte[] DataSectionChecksum = new byte[16];
            byte[] CodeSectionChecksum = new byte[16];
            byte[] ApiSectionChecksum  = new byte[16];

            Array.Copy(payload, ReadOffset, DataSectionChecksum, 0, 16);
            Array.Copy(payload, ReadOffset + 16, CodeSectionChecksum, 0, 16);
            Array.Copy(payload, ReadOffset + 32, ApiSectionChecksum, 0, 16);

            for (int i = 0; i < DataSectionBytes.Length; i++)
            {
                DataSectionBytes[i] ^= DataSectionChecksum[i % DataSectionChecksum.Length];
            }
            for (int i = 0; i < CodeSectionBytes.Length; i++)
            {
                CodeSectionBytes[i] ^= CodeSectionChecksum[i % CodeSectionChecksum.Length];
            }
            for (int i = 0; i < ApiSectionBytes.Length; i++)
            {
                ApiSectionBytes[i] ^= ApiSectionChecksum[i % ApiSectionChecksum.Length];
            }

            ApiSection  = new src.Sections.ApiSection(ApiSectionBytes);
            DataSection = new DataSection(DataSectionBytes);

            this.CodeSectionReader = new OpcodeReader(CodeSectionBytes, DataSection, ApiSection);
            this.DataSectionReader = new OpcodeReader(DataSectionBytes, DataSection, ApiSection);
            Instructions           = CodeSectionReader.ReadAllInstructions();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Starts each dependent service listed in the configuration file
        /// </summary>
        void CheckForDependentServices()
        {
            const string MemberName = "CheckForDependentServices";

            try
            {
                List <string> dependentSevices = new List <string>();
                DataSection   ds = (DataSection)ConfigurationManager.GetSection("DependentServiceList");

                if (ds.Items == null || ds.Items.Count == 0)
                {
                    ConnectionMonitorException cme = new ConnectionMonitorException(
                        "No Dependent services defined in the configuration file! " + MemberName);
                }

                for (int i = 0; i < ds.Items.Count; i++)
                {
                    string name = ds.Items[i].Data;
                    try
                    {
                        ServiceHelper.StartService(name, name);
                        dependentSevices.Add(name);
                    }
                    catch (Exception ex)
                    {
                        ConnectionMonitorException cme = new ConnectionMonitorException(
                            "Cannot start dependent service " + name, ex);
                        Logger.Write(cme);
                        throw cme;
                    }
                }

                if (dependentSevices != null && dependentSevices.Count > 0)
                {
                    this.EnsureWCFClient();
                    this.ConMonServiceEventsWCFServiceClient.DependentServicesChecked(dependentSevices.ToArray());
                }
            }
            catch (ConnectionMonitorException cme)
            {
                Logger.Write(cme);
                throw cme;
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                throw;
            }
        }
Ejemplo n.º 14
0
        public static void ExtractDuneDatFile(string inputFile)
        {
            Console.WriteLine($"[STARTING] Extraction of the DAT file has started...{Environment.NewLine}");
            var dataInMemory = File.ReadAllBytes(inputFile).AsSpan();

            using FileStream datafile = new FileStream(inputFile, FileMode.Open);
            datafile.Seek(0L, SeekOrigin.Begin);
            Console.WriteLine($"[STEP 1] Reading DatFile header... PLEASE WAIT{Environment.NewLine}");
            byte[] numArray2 = new byte[2] {
                61, 10
            };
            byte[] numArray3 = ReadData(datafile, 2);
            if (numArray3[0] == numArray2[0] & numArray3[1] == numArray2[1])
            {
                Console.WriteLine($"Cryo DatFile Detected... {Environment.NewLine}");
                Console.WriteLine($"[STEP 2] Extracting each files... PLEASE WAIT{Environment.NewLine}");
                var dataList = new List <DataSection>();
                int index    = 0;
                do
                {
                    DataSection section = new DataSection();
                    ReadDatFileSectionHeader(datafile, section);
                    if ((uint)Operators.CompareString(section.NameOfFile, "", false) > 0U)
                    {
                        dataList.Add(section);
                        datafile.ReadByte();
                    }
                    else
                    {
                        break;
                    }
                }while (index < dataList[0].OffsetOfFile);
                var outputFolder = $"{Path.GetFileName(inputFile)}_";
                for (int i = 0; i < dataList.Count; i++)
                {
                    DataSection dataSection = dataList[i];
                    Console.WriteLine($"Extracting... {dataSection.NameOfFile} ({Math.Round(dataSection.SizeOfFile / 1024.0, 2)} KB)");
                    WriteDataSectionToDisk(dataInMemory, outputFolder, dataSection.NameOfFile, dataSection.OffsetOfFile, dataSection.SizeOfFile);
                }
                Console.WriteLine($"{Environment.NewLine}[DONE] Extraction finished !{Environment.NewLine}");
            }
            else
            {
                Console.WriteLine($"FATAL ERROR: {inputFile} is not a valid Cryo DatFile !{Environment.NewLine}");
            }
            datafile.Close();
        }
Ejemplo n.º 15
0
 internal DataSet(
     Message message,
     LocalUseSection localUseSection,
     GridDefinitionSection gridDefinitionSection,
     ProductDefinitionSection productDefinitionSection,
     DataRepresentationSection dataRepresentationSection,
     BitmapSection bitmapSection,
     DataSection dataSection)
 {
     Message = message;
     GridDefinitionSection     = gridDefinitionSection;
     ProductDefinitionSection  = productDefinitionSection;
     DataRepresentationSection = dataRepresentationSection;
     BitmapSection             = bitmapSection;
     DataSection     = dataSection;
     LocalUseSection = localUseSection;
 }
Ejemplo n.º 16
0
        public static DataSection Data(this CustomConfiguration config)
        {
            lock (_lockObjectData)
            {
                if (_dataSection == null)
                {
                    _dataSection = ConfigurationManager.GetSection(DataSection.SectionName) as DataSection;

                    if (_dataSection == null)
                    {
                        throw new ConfigurationErrorsException(String.Format(ConfigurationMessages.SectionNotFound, DataSection.SectionName));
                    }
                }
            }

            return(_dataSection);
        }
Ejemplo n.º 17
0
        public virtual void Save(Stream stream)
        {
            var writer = new DataWriter(stream, Endianess.BigEndian);

            if (DataSection != null)
            {
                DataSection.Write(writer);
            }
            if (DataMappingSection != null)
            {
                DataMappingSection.Write(writer);
            }
            if (DefinitionSection != null)
            {
                DefinitionSection.Write(writer);
            }
        }
    public static int ClearInitedData(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            dataSection.ClearInitedData();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int OnClientSynced(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            dataSection.OnClientSynced();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int get_ClientCommitedVersion(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, dataSection.ClientCommitedVersion);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            DataSection o = new DataSection();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 22
0
        public string GetValue(long eventId, int index, long value)
        {
            string s = null;

            switch (eventId)
            {
            case 0x04000100:
            case 0x04000200:
                if (index == 0)
                //if (TargetNode.Parent != null && TargetNode.Parent.Parent != null && TargetNode.Parent.Parent.Name.StartsWith("Article"))
                //{
                //    ResourceNode sa = TargetNode.Parent.Parent.FindChild("SubActions", false);
                //    if (sa != null)
                //        return sa.Children[(int)value].Name;
                //}
                //else
                {
                    DataSection data = ((MovesetNode)TargetNode._root).Data;
                    if (data != null && data.SubActions != null && value < data.SubActions.Count && value >= 0)
                    {
                        return(data.SubActions[(int)value].Name);
                    }
                    else
                    {
                        return(((int)value).ToString());
                    }
                }

                break;
                //case 0x02010200:
                //case 0x02010300:
                //case 0x02010500:
                //    if (index == 0)
                //        if (TargetNode.Parent != null && TargetNode.Parent.Parent != null && TargetNode.Parent.Parent.Name.StartsWith("Article"))
                //        {
                //            ResourceNode sa = TargetNode.Parent.Parent.FindChild("Actions", false);
                //            if (sa != null)
                //                return sa.Children[(int)value].Name;
                //        }
                //        else if (value < TargetNode.Root._actions.Children.Count)
                //            return TargetNode.Root._actions.Children[(int)value].Name;
                //    break;
            }
            return(s == null?value.ToString() : s);
        }
    public static int SerializeToClient(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            object      o           = dataSection.SerializeToClient();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int NeedSyncToDB(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            bool        b           = dataSection.NeedSyncToDB();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, b);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 25
0
        public LogData getData(String sourceFile)
        {
            LogData       logData     = new LogData();
            File          file        = new File();
            DataSection   dataSection = new DataSection();
            List <String> myData      = new List <String>();


            String[] terms = sourceFile.Split('\\');
            file.Name = terms[terms.Length - 1];


            using (StreamReader sr = new StreamReader(sourceFile))
            {
                String line;
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.Equals("[Code]"))
                    {
                        file.Code = dataSection.ParamList = sr.ReadLine();
                    }

                    if (line.Equals("[Description]"))
                    {
                        file.Description = sr.ReadLine();
                    }

                    if (line.Equals("[Data]"))
                    {
                        while ((line = sr.ReadLine()) != null)
                        {
                            myData.Add(line);
                        }
                        break;
                    }
                }
            }

            dataSection.Data = myData;
            logData.File     = new List <File>();
            logData.File.Add(file);
            logData.DataSection = dataSection;
            return(logData);
        }
Ejemplo n.º 26
0
        internal void AddDataset(
            LocalUseSection lus,
            GridDefinitionSection gds,
            ProductDefinitionSection pds,
            DataRepresentationSection drs,
            BitmapSection bs,
            DataSection ds)
        {
            var record = new DataSet(
                this,
                lus,
                gds,
                pds,
                drs,
                bs,
                ds);

            dataSets.Add(record);
        }
    public static int SetDirty(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            bool        dirty;
            LuaObject.checkType(l, 2, out dirty);
            dataSection.SetDirty(dirty);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int SetClientCommitedVersion(IntPtr l)
    {
        int result;

        try
        {
            DataSection dataSection = (DataSection)LuaObject.checkSelf(l);
            ushort      clientCommitedVersion;
            LuaObject.checkType(l, 2, out clientCommitedVersion);
            dataSection.SetClientCommitedVersion(clientCommitedVersion);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 29
0
        private void Read(BinaryReader reader)
        {
            // determine where all the sections are
            HeaderSection      = new(reader);
            ProtocolSection    = new(reader);
            AdcSection         = new(reader);
            DacSection         = new(reader);
            StringsSection     = new(reader);
            TagSection         = new(reader);
            DataSection        = new(reader);
            SynchArraySection  = new(reader);
            EpochSection       = new(reader);
            EpochPerDacSection = new(reader);
            AdcPerDacSection   = new(reader);
            UserListSection    = new(reader);
            StatsRegionSection = new(reader);
            MathSection        = new(reader);
            ScopeSection       = new(reader);
            DeltaSection       = new(reader);
            VoiceTagSection    = new(reader);
            AnnotationSection  = new(reader);
            StatsSection       = new(reader);

            // populate header values from each section
            ReadGroup1();
            ReadGroup2();
            ReadGroup3();
            ReadGroup5();
            ReadGroup6();
            ReadGroup7();
            ReadGroup9();
            ReadGroup10();
            ReadGroup12();

            // use header values to put additional information in the header object
            float tagTimeMult = (fSynchTimeUnit == 0)
                ? SamplePeriod / ChannelCount
                : fSynchTimeUnit / 1e6f;

            Tags = TagSection.GetTags(tagTimeMult);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Reads the non-custom section with the given header.
        /// </summary>
        /// <param name="Header">The section header.</param>
        /// <returns>The parsed section.</returns>
        protected Section ReadKnownSectionPayload(SectionHeader Header)
        {
            switch (Header.Name.Code)
            {
            case SectionCode.Type:
                return(TypeSection.ReadSectionPayload(Header, this));

            case SectionCode.Import:
                return(ImportSection.ReadSectionPayload(Header, this));

            case SectionCode.Function:
                return(FunctionSection.ReadSectionPayload(Header, this));

            case SectionCode.Table:
                return(TableSection.ReadSectionPayload(Header, this));

            case SectionCode.Memory:
                return(MemorySection.ReadSectionPayload(Header, this));

            case SectionCode.Global:
                return(GlobalSection.ReadSectionPayload(Header, this));

            case SectionCode.Export:
                return(ExportSection.ReadSectionPayload(Header, this));

            case SectionCode.Start:
                return(StartSection.ReadSectionPayload(Header, this));

            case SectionCode.Element:
                return(ElementSection.ReadSectionPayload(Header, this));

            case SectionCode.Code:
                return(CodeSection.ReadSectionPayload(Header, this));

            case SectionCode.Data:
                return(DataSection.ReadSectionPayload(Header, this));

            default:
                return(ReadUnknownSectionPayload(Header));
            }
        }
 public void Parse(DataSection node, VoidPtr address)
 {
     Offsets* addr = (Offsets*)address;
     for (int i = 4; i < 8; i++)
     {
         int x = (int)addr->Entries[i];
         node._articles.Add(x, node.Parse<ArticleEntry>(x));
     }
 }
Ejemplo n.º 32
0
        private void checkLine(String line)
        {
            if (line.CompareTo("DATA_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.DATA;
            }
            else if (line.CompareTo("DEPOTS") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.DEPOTS;
            }
            else if (line.CompareTo("DEMAND_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.DEMAND;

            }
            else if (line.CompareTo("LOCATION_COORD_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.LOCATION_COORD;

            }
            else if (line.CompareTo("DEPOT_LOCATION_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.DEPOT_LOCATION;

            }
            else if (line.CompareTo("VISIT_LOCATION_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.VISIT_LOCATION;

            }
            else if (line.CompareTo("DURATION_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.DURATION;

            }
            else if (line.CompareTo("DEPOT_TIME_WINDOW_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.DEPOT_TIME_WINDOW;

            }
            else if (line.CompareTo("TIME_AVAIL_SECTION") == 0)
            {
                mIsBeginState = true;
                mCurrSect = DataSection.TIME_AVAIL;

            }
            else if (line.CompareTo("EOF") == 0)
            {
                mCurrSect = DataSection.EOF;
            }
        }
 public void Parse(DataSection node, VoidPtr address)
 {
     Offsets* addr = (Offsets*)address;
     for (int i = 0; i < 5; i++)
         node._extraEntries.Add(node.Parse<RawParamList>((int)addr->Entries[i]));
     for (int i = 5; i < 10; i++)
         node._articles.Add((int)addr->Entries[i], node.Parse<ArticleEntry>((int)addr->Entries[i]));
 }