private static void WriteOptionVariable(OptionVariable variable, CSideWriter writer)
 {
     if (writer.CodeStyle.ExportToNewSyntax)
     {
         Core.Property.Implementation.OptionValueList list = new Core.Property.Implementation.OptionValueList();
         list.SetFromString(variable.OptionString);
         var typeName = $"'{string.Join(",", list.Select(ov => ov.OptionValueName.QuotedFieldName(writer.CodeStyle)))}'";
         DoWrite(variable.Name, variable.ID, typeName, variable.Dimensions, writer);
     }
     else
     {
         DoWrite(variable.Name, variable.ID, variable.TypeName, variable.Dimensions, writer);
     }
 }
Beispiel #2
0
        public NewEnvironCommand(InputByteArray InputArray, CommandCode CmdCode)
            : base(InputArray, CmdCode, TelnetSubject.NEW_ENVIRON)
        {
            this.SubOption  = null;
            this.OptionList = new List <OptionVariable>();
            this.EndFound   = false;

            // statement contains additional parameters.
            if (this.CmdCode == CommandCode.SB)
            {
                var b1 = InputArray.GetNextByte();
                this.RawBytes.Append(b1);
                this.SubOption = b1.ToTelnetOptionParm(); // IS, SEND, INFO

                // list of VARs and USERVARS follow until IAC SE.
                if ((this.SubOption.Value == TelnetOptionParm.SEND) ||
                    (this.SubOption.Value == TelnetOptionParm.IS))
                {
                    while (true)
                    {
                        var ov = OptionVariable.Construct(InputArray);
                        if (ov == null)
                        {
                            break;
                        }
                        this.OptionList.Add(ov);
                        this.RawBytes.Append(ov.ToBytes());
                    }

                    if (InputArray.PeekIacSe())
                    {
                        this.EndFound = true;
                        this.RawBytes.Append(InputArray.GetBytes(2));
                    }
                }

                // parse the closing IAC SE
                ParseClosingSE(InputArray);
            }
        }
Beispiel #3
0
        public void AddOptionVar(EnvironVarCode VarCode, string VarName, byte[] VarValue)
        {
            var ov = new OptionVariable(VarCode, VarName, VarValue);

            this.OptionList.Add(ov);
        }
Beispiel #4
0
 public void AddOptionVar(OptionVariable Var)
 {
     this.OptionList.Add(Var);
 }