コード例 #1
0
        private void InitialiseVariables(string configurationFilePath)
        {
            _configurationFilePath = configurationFilePath;

            RC_XmlSchame tmp  = new RC_XmlSchame();
            Topology     temp = new Topology();

            tmp = RC_LoadingXmlFile.Deserialization(_configurationFilePath);
            _localPcIpAddress = tmp.XML_myIPAddress;
            _myAreaName       = tmp.XMP_myAreaName;
            _domainIpAddress  = tmp.XMP_DomainIpAddress;
            if (_myAreaName.Equals("Dom_1"))
            {
                if (tmp.Translate1 != null)
                {
                    foreach (var v in tmp.Translate1)
                    {
                        SN_1ToDomain.Add(v.ID_SN_1, v.ID_Domain);
                    }
                }
                if (tmp.Translate2 != null)
                {
                    foreach (var v in tmp.Translate2)
                    {
                        SN_2ToDomain.Add(v.ID_SN_2, v.ID_Domain);
                    }
                }
            }
            if (tmp.iptoidDictionary != null)
            {
                foreach (var v in tmp.iptoidDictionary)
                {
                    IPTOIDDictionary.Add(v.IP, v.ID);
                }
            }
            if (tmp.interdomainDictionary != null)
            {
                foreach (var v in tmp.interdomainDictionary)
                {
                    interdomainLinksDictionary.Add(v.id1, v.id2);
                }
            }
            foreach (var v in tmp.LocalTopology)
            {
                AbstractVertex tmpAbstractVertex = new AbstractVertex(v.ID, v.capacity, v.weight, v.areaName, v.reachableNodes);
                abstractVertices.Add(tmpAbstractVertex);
            }
        }
コード例 #2
0
ファイル: RC_LoadingXmlFile.cs プロジェクト: Ferchmin/RC_temp
        public static void Serialization(string configFilePath, RC_XmlSchame dataSource)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(RC_XmlSchame));

            try
            {
                using (TextWriter writer = new StreamWriter(configFilePath, false))
                {
                    serializer.Serialize(writer, dataSource);
                }
            }
            catch (Exception e)
            {
                SignallingNodeDeviceClass.MakeSignallingLog("RC", "ERROR - Serialization cannot be complited.");
            }
        }