private string GetBasePath(string fileStoreKey) { XmlNode configSection = CSConfiguration.GetConfig().GetConfigSection("CommunityServer/CentralizedFileStorage"); string basePath = null; if (configSection != null) { foreach (XmlNode xmlNode in configSection.ChildNodes.Cast <XmlNode>().Where(xmlNode => xmlNode.NodeType != XmlNodeType.Comment)) { if (xmlNode.Name == "fileStoreGroup") { if (xmlNode.Attributes != null && xmlNode.Attributes["default"] != null && xmlNode.Attributes["default"].Value == "true" && xmlNode.Attributes["basePath"] != null && !String.IsNullOrEmpty(xmlNode.Attributes["basePath"].Value) && basePath == null) { basePath = xmlNode.Attributes["basePath"].Value; } foreach (XmlNode xmlNode2 in xmlNode.ChildNodes) { if (xmlNode2.Name == "fileStore" && xmlNode2.Attributes != null && xmlNode2.Attributes["name"] != null && xmlNode2.Attributes["name"].Value == fileStoreKey && xmlNode2.Attributes["basePath"] != null && !String.IsNullOrEmpty(xmlNode2.Attributes["basePath"].Value)) { basePath = xmlNode2.Attributes["basePath"].Value; break; } } continue; } if (xmlNode.Name == "fileStore" && xmlNode.Attributes != null && xmlNode.Attributes["name"] != null && xmlNode.Attributes["name"].Value == fileStoreKey && xmlNode.Attributes["basePath"] != null && !String.IsNullOrEmpty(xmlNode.Attributes["basePath"].Value)) { basePath = xmlNode.Attributes["basePath"].Value; break; } } } return(basePath); }
public static void Main(string[] args) { var config = new CSConfiguration { Host = "192.168.1.11", Port = 3456, SerializerType = typeof(Serializer) }; var server = new ClientServer4Net.Server.Server(config); server.Start(new FactoryServerHandler <ClientHandler>()); Console.WriteLine("Server stop"); Console.ReadLine(); }
public static void Main(string[] args) { Thread.Sleep(1000); var config = new CSConfiguration { Host = "192.168.1.11", Port = 3456, SerializerType = typeof(Serializer) }; var client = new ClientServer4Net.Client.Client(config); client.Start(new ClientHandler()); Console.WriteLine("Client stop"); Console.ReadLine(); }
protected SerializationContext(CSConfiguration configuration) { _serializer = (ISerializer)Activator.CreateInstance(configuration.SerializerType); }
public Client(CSConfiguration configuration) : base(configuration) { _configuration = configuration; _isConnected = false; }
public Server(CSConfiguration configuration) : base(configuration) { _configuration = configuration; _isConnected = false; }