Exemplo n.º 1
0
        public static void ClustersNodeYaml()
        {
            var serializer = new Serializer();
            var buffer     = new StringWriter();
            var Clusters   = new ServerSettingClustersModel();

            foreach (var item in Node.ClustersNode.node)
            {
                Clusters.node.Add(new ServerSettingClustersNodeModel()
                {
                    ip     = item.Key,
                    master = item.Value.master,
                });
            }
            serializer.Serialize(buffer, Clusters, typeof(ServerSettingClustersModel));
            string _str = buffer.ToString();

            buffer.Dispose();
            File.WriteAllText(GetPath(_conf_Clusters), _str);
        }
Exemplo n.º 2
0
        static ServerConfSetting()
        {
            try
            {
                string read_conf = File.ReadAllText(GetPath(_conf));
                using (var input = new StringReader(read_conf))
                {
                    var serializer = new Serializer();
                    serverSettingModel = serializer.Deserialize <ServerSettingModel>(input);
                }

                string read_conf_node = File.ReadAllText(GetPath(_conf_Clusters));
                using (var input = new StringReader(read_conf_node))
                {
                    var serializer = new Serializer();
                    serverSettingClusters_Node_Model = serializer.Deserialize <ServerSettingClustersModel>(input);
                }
            }
            catch (Exception ex)
            {
            }
        }