private static void CopyMessageCodeToServer() { string serverPattern = "SimpleServer/SimpleServer/messageCode"; string serverPath = string.Format("{0}{1}", SimpleUtils.GetBasePath(), serverPattern); string clientPattern = "Client/Assets/messageCode"; string clientPath = string.Format("{0}{1}", SimpleUtils.GetBasePath(), clientPattern); if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } string[] clientMessageFiles = Directory.GetFiles(clientPath, "*.cs"); for (int i = 0; i < clientMessageFiles.Length; i++) { string serverFileName = clientMessageFiles[i].Replace(clientPattern, serverPattern); File.Copy(clientMessageFiles[i], serverFileName, true); } }
private static void UpdateProto() { string basePath = SimpleUtils.GetBasePath(); string externalExe = string.Format("{0}generator/protogen", basePath); string sourcePath = string.Format("{0}Client/Assets/protoSource/", basePath); string clientPath = string.Format("{0}Client/Assets/protoCode/", basePath); string serverPath = string.Format("{0}SimpleServer/SimpleServer/proto", basePath); string[] allFiles = Directory.GetFiles(sourcePath, "*.proto"); string[] fileNames = new string[allFiles.Length]; for (int i = 0; i < allFiles.Length; i++) { fileNames[i] = allFiles[i].Replace(sourcePath, ""); fileNames[i] = fileNames[i].Replace(".proto", ""); string clientArg = string.Format("-i:{0}{2}.proto -o:{1}{2}.cs", sourcePath, clientPath, fileNames[i]); string serverArg = string.Format("-i:{0}{2}.proto -o:{1}/{2}.cs", sourcePath, serverPath, fileNames[i]); UnityEngine.Debug.Log(string.Format("{0} {1}", externalExe, clientArg)); SimpleUtils.ProcessProto(externalExe, clientArg); SimpleUtils.ProcessProto(externalExe, serverArg); } }