Example #1
0
        static Constants()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var name = assembly.GetName();

            ApplicationTitle = "Tailviewer";
            ApplicationVersion = name.Version;
            BuildDate = GetLinkerTime(assembly);
            MainWindowTitle = string.Format("Tailviewer, v{0}", ApplicationVersion.Format());
            ProjectPage = new Uri("https://kittyfisto.github.io/Tailviewer/");
            GithubPage = new Uri("https://github.com/Kittyfisto/Tailviewer");
            ReportBugPage = new Uri("https://github.com/Kittyfisto/Tailviewer/issues/new");
            ApplicationFolder = assembly.GetFolder();
            AppDataLocalFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationTitle);
            DownloadFolder = Path.Combine(AppDataLocalFolder, "Downloads");
        }
        private void RefreshS3Location()
        {
            var webConfigFile = Path.Combine(ContentFolder, "web.config");
            var formattedVersion = LastFormattedVersion;

            if (!File.Exists(webConfigFile))
                return;

            var dt = File.GetLastWriteTimeUtc(webConfigFile);

            if (uxS3BucketComboBox.Text.Length == 0 || uxSubfolderComboBox.Text.Length == 0)
            {
                uxS3LocationTextBox.Text = string.Empty;
                return;
            }

            if (webConfigFile != LastWebConfigFile || dt != WebConfigTimestamp)
            {
                WebConfigTimestamp = dt;
                LastWebConfigFile = webConfigFile;

                var doc = new XmlDocument();
                doc.Load(webConfigFile);
                var xPath = "/configuration/appSettings/add[@key='VersionNumber']/@value";
                var nodes = doc.SelectNodes(xPath);

                if (nodes.Count > 0)
                {
                    var v = nodes[0].Value;
                    var ver = new Version(v);
                    formattedVersion = ver.Format();
                }
            }

            LastFormattedVersion = formattedVersion;

            S3Path = string.Format("s3://{0}/{1}", uxS3BucketComboBox.Text,
                uxSubfolderComboBox.Text.ToLowerInvariant());

            ZipFile = string.Format("pkg-{0}-{1:00}.zip", formattedVersion, uxPackageVersionUpDown.Value);

            uxS3LocationTextBox.Text = S3Location;
            uxS3LocationTextBox.Refresh();
        }