コード例 #1
0
        public int AddSubNetwork(tSubNetwork sn)
        {
            tSubNetwork tsn = sn;

            if (sn == null)
            {
                tsn                    = new tSubNetwork();
                tsn.name               = "Subnetwork" + nsn++;
                tsn.BitRate            = new tBitRateInMbPerSec();
                tsn.BitRate.unit       = tSIUnitEnum.bs;
                tsn.BitRate.multiplier = tUnitMultiplierEnum.M;
                tsn.BitRate.Value      = 100;
                tsn.type               = "IP";
            }
            int index = -1;

            if (this.subNetworkField != null)
            {
                System.Array.Resize <tSubNetwork>(ref this.subNetworkField,
                                                  this.subNetworkField.Length + 1);

                index = this.subNetworkField.Length - 1;
            }
            else
            {
                this.subNetworkField = new tSubNetwork[1];
                index = 0;
            }
            this.subNetworkField[index] = tsn;
            return(index);
        }
コード例 #2
0
        /// <summary>
        /// Adds a new Subnetwork with the given name.
        /// </summary>
        /// <param name="name">
        /// A <see cref="System.String"/> with the name of the new subnetwork to add.
        /// </param>
        /// <returns>
        /// A <see cref="System.Int32"/> with the index of the new subnetwork.
        /// </returns>
        public int AddSubNetwork(string name, string desc)
        {
            if (name == null)
            {
                return(-1);
            }

            tSubNetwork sn = new tSubNetwork();

            sn.name = name;
            sn.desc = desc;
            if (this.subNetworkField != null)
            {
                // Search for existing subnetwork
                for (int i = 0; i < this.subNetworkField.Length; i++)
                {
                    if (name.Equals(this.subNetworkField[i].name))
                    {
                        return(i);
                    }
                }
            }
            // Add to Array
            return(AddSubNetwork(sn));
        }
コード例 #3
0
ファイル: SCL.cs プロジェクト: ttgzs/opensclconfig-code
        public System.Collections.Hashtable GetGSE(string iedname, string apname, string ldinst, string gsecname)
        {
            var h = new System.Collections.Hashtable();

            if (this.Communication == null)
            {
                return(h);
            }
            if (this.Communication.SubNetwork == null)
            {
                return(h);
            }

            for (int i = 0; i < this.Communication.SubNetwork.Length; i++)
            {
                tSubNetwork s = this.Communication.SubNetwork[i];
                if (s.ConnectedAP == null)
                {
                    return(h);
                }
                for (int c = 0; c < s.ConnectedAP.Length; c++)
                {
                    tConnectedAP cap = s.ConnectedAP[c];
                    if (cap.iedName.Equals(iedname) &&
                        cap.apName.Equals(apname))
                    {
                        if (cap.GSE == null)
                        {
                            return(h);
                        }
                        for (int g = 0; g < cap.GSE.Length; g++)
                        {
                            tGSE gse = cap.GSE[g];
                            if (gse.cbName.Equals(gsecname) &&
                                gse.ldInst.Equals(ldinst))
                            {
                                h.Add("gse", gse);
                                h.Add("subnetwork", s);
                                h.Add("connectedap", cap);
                                return(h);
                            }
                        }
                    }
                }
            }
            return(h);
        }