AcManager.Tools.Miscellaneous.AppReporter.SendUnpackedLocale C# (CSharp) Метод

SendUnpackedLocale() приватный Метод

private SendUnpackedLocale ( string directory, string message = null ) : void
directory string
message string
Результат void
        public static void SendUnpackedLocale(string directory, string message = null) {
            using (var memory = new MemoryStream()) {
                using (var writer = WriterFactory.Open(memory, ArchiveType.Zip, CompressionType.Deflate)) {
                    if (!string.IsNullOrWhiteSpace(message)) {
                        try {
                            writer.WriteString("Message.txt", message);
                        } catch (Exception e) {
                            Logging.Warning("Can’t attach Message.txt: " + e);
                        }
                    }

                    try {
                        writer.WriteString("Description.txt", JsonConvert.SerializeObject(new {
                            BuildInformation.AppVersion,
                            BuildInformation.Platform,
                            MainExecutingFile.Location,
                            Environment.OSVersion,
                            Environment.CommandLine,
                            Environment = Environment.GetEnvironmentVariables(),
                            SteamId = SteamIdHelper.Instance.Value
                        }, Formatting.Indented));
                    } catch (Exception e) {
                        Logging.Warning("Can’t attach Description.txt: " + e);
                    }

                    foreach (var fileInfo in new DirectoryInfo(directory).GetFiles("*.resx")) {
                        try {
                            writer.Write("Locale/" + fileInfo.Name, fileInfo.FullName);
                        } catch (Exception e) {
                            Logging.Warning("Can’t attach Locale/" + fileInfo.Name + ": " + e);
                        }
                    }

                    var data = memory.ToArray();
                    if (data.Length > 20000000) {
                        throw new Exception("Size limit exceeded");
                    }
                }

                File.WriteAllBytes(Path.Combine(directory, "sent.zip"), memory.ToArray());
                InternalUtils.SendLocale(memory.ToArray(), $@"Name: {GetUserName()}
Used language: {CultureInfo.CurrentUICulture.Name}
Locale: {Path.GetFileName(directory)}
Operating system: {GetWindowsName()}
App version: {BuildInformation.AppVersion}", CmApiProvider.UserAgent);
            }
        }