示例#1
0
 public bool Load(string inputStr)
 {
     try
     {
         sctphost = SctpHostColiParser.Parse(inputStr);
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message, "Parsing error");
         return false;
     }
     EndpointFilter = new EndpointFilter(EndpointFilterType.All);
     AssociationFilter = new AssociationFilter(AssocFilterType.All);
     Clients = new ObservableCollection<ExtClient>(sctphost.SCTPIclients.Values);
     Config = new ConfigVM(sctphost.Configuration);
     RaisePropChange("Endpoints");
     RaisePropChange("Clients");
     RaisePropChange("RpuId");
     RaisePropChange("CpId");
     RaisePropChange("BASEstate");
     RaisePropChange("HOSTstate");
     RaisePropChange("Board");
     RaisePropChange("Configuration");
     RaisePropChange("Config");
     RaisePropChange("Ip1");
     RaisePropChange("Ip2");
     return true;
 }
        /// <summary>
        /// Parse SctpHost from input file with name @ref fileName
        /// </summary>
        /// <param name="fileName">name of file to parse SctpHost</param>
        /// <returns>parsed SctpHost</returns>
        public static SctpHost Parse(String inputColi)
        {
            input = inputColi;
            _host = new SctpHost();

            if(!ParseHeader())
            {
                throw new Exception("could not parse header of sctphost COLI command");
            }
            if(!ParseConfig())
            {
                throw new Exception("could not parse configuration part of sctphost COLI command");
            }
            if (!ParseExtClientsInfo())
            {
                throw new Exception("could not parse ext client info in sctphost COLI command");
            }
            if(!ParseEndpoints())
            {
                throw new Exception("could not parse endpoints in scpthost coli command");
            }
            if(!ParseAssociations())
            {
                throw new Exception("could not parse associations in scpthost coli command");
            }
            if (!ParseAssociationCounters())
            {
                throw new Exception("could not parse assoc counters in scpthost coli command");
            }

            return _host;
        }