Esempio n. 1
0
        /// <summary>
        /// Retrieve the external ip of this pc from one of n external websites
        ///
        /// Currently available and processed in this order:
        /// 1) whatismyip.com (url for automated access)
        /// 2) dyndns.com (checkip.dyndns.com)
        /// 3) agentgatech.appspot.com (google app engine)
        /// </summary>
        /// <param name="forceUpdate">If true, cache is ignored</param>
        /// <returns>External ip of pc</returns>
        public static IPAddress GetIP(bool forceUpdate)
        {
            if (!forceUpdate && CachedIP != null &&
                (DateTime.Now - CacheLastUpdated).TotalSeconds < CACHE_LIFETIME)
            {
                return(CachedIP);
            }

            WebClient client = new WebClient();

            client.Headers[HttpRequestHeader.UserAgent] = VersionUtil.GetUserAgent();

            string ip = RetrieveFromWhatsMyIp(client) ??
                        RetrieveFromDynDNS(client) ??
                        RetrieveFromAppEngine(client);

            if (ip != null)
            {
                CacheLastUpdated = DateTime.Now;
                if (!IPAddress.TryParse(ip, out CachedIP))
                {
                    Log.Warn("Failed to parse retrieved external address '{0}'", ip);
                    return(null);
                }

                return(CachedIP);
            }
            else
            {
                Log.Warn("Couldn't retrieve external IP from any of the external websites. Is a firewall blocking outgoing traffic?");
                return(null);
            }
        }
        public void TestDLLVersion()
        {
            var version = typeof(VersionUtil).Assembly.GetName().Version.ToString();

            Assert.True(version.StartsWith(VersionUtil.GetDllVersion()));
            Assert.False(VersionUtil.GetDllVersion().EndsWith(".0"));
        }
Esempio n. 3
0
        public async Task Check(bool notifyNoFound, bool isPreRelease)
        {
            try
            {
                var updater = new GitHubRelease(Owner, Repo);
                var url     = updater.AllReleaseUrl;

                var json = await GetAsync(url);

                var releases      = JsonSerializer.Deserialize <List <Release> >(json);
                var latestRelease = VersionUtil.GetLatestRelease(releases, isPreRelease);
                if (VersionUtil.CompareVersion(latestRelease.tag_name, Version) > 0)
                {
                    LatestVersionNumber = latestRelease.tag_name;
                    LatestVersionUrl    = latestRelease.html_url;
                    NewVersionFound?.Invoke(this, new EventArgs());
                }
                else
                {
                    LatestVersionNumber = latestRelease.tag_name;
                    if (notifyNoFound)
                    {
                        NewVersionNotFound?.Invoke(this, new EventArgs());
                    }
                }
            }
            catch
            {
                if (notifyNoFound)
                {
                    NewVersionFoundFailed?.Invoke(this, new EventArgs());
                }
            }
        }
Esempio n. 4
0
    public static void UpdateProjectVersion()
    {
        var baseDirectory = Directory.GetCurrentDirectory();

        var buildNumber    = VersionUtil.GetBuildNumber();
        var revNumber      = VersionUtil.GetRevNumber();
        var projectVersion = $"222.6.{buildNumber}.{revNumber}";

        Environment.SetEnvironmentVariable("VERSION_NUMBER", projectVersion);
        RunRecursive(baseDirectory: baseDirectory, version: projectVersion);

        var envVersionNumber = Environment.GetEnvironmentVariable("VERSION_NUMBER");

        Console.WriteLine($"Project version updated to {projectVersion}");
        Console.WriteLine($"Environment variable VERSION_NUMBER set to {envVersionNumber}");

        var appVeyorConfig = new AppVeyorConfig()
        {
            Version     = projectVersion,
            Environment = new AppVeyorEnvironment()
            {
                VersionNumber = projectVersion
            }
        };

        var configYaml = appVeyorConfig.ToYaml();

        Console.WriteLine("Writing AppVeyor config...");
        configYaml.ToFile("appveyor.yml").WaitAndUnwrapException();
    }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        public List <string> SetSizingMeasure()
        {
            List <string> _ignoreApps = new List <string>();

            using (var castRepsitory = GetRepository())
            {
                if (Snapshots.Length <= 0)
                {
                    return(_ignoreApps);
                }
                foreach (Snapshot snap in Snapshots)
                {
                    try
                    {
                        if (VersionUtil.IsAdgVersion82Compliant(snap.AdgVersion))
                        {
                            const string strSizingMeasures = "technical-size-measures,run-time-statistics,technical-debt-statistics,functional-weight-measures,critical-violation-statistics,violation-statistics";
                            snap.SizingMeasuresResults = castRepsitory.GetResultsSizingMeasures(snap.Href, strSizingMeasures, string.Empty, "$all", "$all").SelectMany(_ => _.ApplicationResults);
                        }
                        else
                        {
                            const string strSizingMeasureOld = "technical-size-measures,run-time-statistics,technical-debt-statistics,functional-weight-measures,critical-violation-statistics";
                            snap.SizingMeasuresResults = castRepsitory.GetResultsSizingMeasures(snap.Href, strSizingMeasureOld, string.Empty, "$all", "$all").SelectMany(_ => _.ApplicationResults);
                        }
                    }
                    catch (WebException ex)
                    {
                        LogHelper.Instance.LogInfo(ex.Message);
                        _ignoreApps.Add(snap.Href);
                    }
                }
            }
            return(_ignoreApps);
        }
Esempio n. 6
0
 public void WhenMpvAndMaxDsvAreAtLeast30AndFormatIsJsonLightResponseVersionShouldBe30()
 {
     VersionUtil.GetResponseVersionForError(/*acceptableContentType*/ MimeApplicationJsonODataFullMetadata, /*maxDSV*/ VersionUtil.Version4Dot0, /*MPV*/ VersionUtil.Version4Dot0).Should().Be(VersionUtil.Version4Dot0);
     VersionUtil.GetResponseVersionForError(/*acceptableContentType*/ MimeApplicationJsonODataMinimalMetadata, /*maxDSV*/ Version100Dot1, /*MPV*/ Version100Dot1).Should().Be(VersionUtil.Version4Dot0);
     VersionUtil.GetResponseVersionForError(/*acceptableContentType*/ MimeApplicationJsonODataNoMetadata, /*maxDSV*/ Version100Dot1, /*MPV*/ Version100Dot1).Should().Be(VersionUtil.Version4Dot0);
     VersionUtil.GetResponseVersionForError(/*acceptableContentType*/ MimeApplicationJson, /*maxDSV*/ Version100Dot1, /*MPV*/ Version100Dot1).Should().Be(VersionUtil.Version4Dot0);
 }
Esempio n. 7
0
 public void Test82Compliant()
 {
     Assert.IsTrue(VersionUtil.IsAdgVersion82Compliant("8.2.0"));
     Assert.IsTrue(VersionUtil.IsAdgVersion82Compliant("9.0.0"));
     Assert.IsFalse(VersionUtil.IsAdgVersion82Compliant("8.1.0"));
     Assert.IsFalse(VersionUtil.IsAdgVersion82Compliant("7.3.0"));
 }
Esempio n. 8
0
        private ClientMessage EncodeAuthenticationRequest()
        {
            var serializationService = _client.SerializationService;
            var serializationVersion = serializationService.GetVersion();

            var credentials = _client.CredentialsFactory.NewCredentials();
            var clusterName = _client.ClientConfig.GetClusterName();

            var dllVersion = VersionUtil.GetDllVersion();
            var clientGuid = _client.ClientGuid;

            if (credentials is IPasswordCredentials passwordCredentials)
            {
                return(ClientAuthenticationCodec.EncodeRequest(clusterName, passwordCredentials.Name,
                                                               passwordCredentials.Password, clientGuid, ClientTypeCsharp, serializationVersion, dllVersion, _client.Name,
                                                               _labels));
            }
            byte[] secretBytes;
            if (credentials is ITokenCredentials tokenCredentials)
            {
                secretBytes = tokenCredentials.Token;
            }
            else
            {
                secretBytes = serializationService.ToData(credentials).ToByteArray();
            }
            return(ClientAuthenticationCustomCodec.EncodeRequest(clusterName, secretBytes, clientGuid, ClientTypeCsharp,
                                                                 serializationVersion, dllVersion, _client.Name, _labels));
        }
Esempio n. 9
0
        public void Check(bool notifyNoFound, bool isPreRelease)
        {
            try
            {
                var updater = new GitHubRelease(Owner, Repo);
                var url     = updater.AllReleaseUrl;

                var json = WebUtil.DownloadString(WebUtil.CreateRequest(url));

                var releases      = JsonConvert.DeserializeObject <List <Release> >(json);
                var latestRelease = VersionUtil.GetLatestRelease(releases, isPreRelease);
                if (VersionUtil.CompareVersion(latestRelease.tag_name, Version) > 0)
                {
                    LatestVersionNumber = latestRelease.tag_name;
                    LatestVersionUrl    = latestRelease.html_url;
                    NewVersionFound?.Invoke(this, new EventArgs());
                }
                else
                {
                    LatestVersionNumber = latestRelease.tag_name;
                    if (notifyNoFound)
                    {
                        NewVersionNotFound?.Invoke(this, new EventArgs());
                    }
                }
            }
            catch (Exception e)
            {
                Logging.Error(e.ToString());
                if (notifyNoFound)
                {
                    NewVersionFoundFailed?.Invoke(this, new EventArgs());
                }
            }
        }
Esempio n. 10
0
    /// <summary>
    /// 从服务器下载所有文件
    /// </summary>
    private void DownloadAllFilesFromServer()
    {
        string url = getServerUrl().Combine(UrlUtil.UrlEncode(CurrentVersionPath));

        WWWManager.Instance.DownloadWWW(url, CacheVersionPath, (suc) =>
        {
            if (suc)
            {
                VersionConfig vc = VersionUtil.ReadConfig(CacheVersionPath);
                if (vc != null)
                {
                    NewCfg = vc;

                    files = new List <string>();
                    foreach (KeyValuePair <string, VersionFileConfig> kv in vc.fileDict)
                    {
                        files.Add(kv.Value.path);
                    }
                    gotoUpdate();
                }
                else
                {
                    ShowDialog_CanNotReadLastestVersionConfig();
                }
            }
            else
            {
                ShowDialog_CanNotUpdateToLatestVersion();
            }
        });
    }
Esempio n. 11
0
        private async void AboutWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (_pendingRestart)
            {
                UpdateStatusSuccess("Update completed. Restart the application.");
                return;
            }

            try
            {
                var updateInfo = await ClickOnceHelper.CheckNewVersion();

                if (updateInfo.UpdateAvailable)
                {
                    Telemetry.Instance.Native?.TrackEvent("About.UpdateAvailable", new Dictionary <string, string>
                    {
                        { "currentVersion", VersionUtil.GetVersion() },
                        { "newVersion", updateInfo.AvailableVersion.ToString(4) }
                    });
                    UpdateStatusMessage($"New version '{updateInfo.AvailableVersion.ToString(4)}' is available.", true);
                    ucUpdateButton.Visibility = Visibility.Visible;
                }
                else
                {
                    UpdateStatusMessage("Application is up to date.");
                }
            }
            catch (Exception ex)
            {
                UpdateStatusError("Could not check updates, try again later.", ex);
            }
        }
        private ClientMessage EncodeAuthenticationRequest()
        {
            var serializationService = _client.SerializationService;
            var serializationVersion = serializationService.GetVersion();

            var credentials = _client.CredentialsFactory.NewCredentials();
            var clusterName = _client.Configuration.ClusterName;

            var dllVersion = VersionUtil.GetDllVersion();
            var clientGuid = _client.ClientGuid;

            switch (credentials)
            {
            case IPasswordCredentials passwordCredentials:
                return(ClientAuthenticationCodec.EncodeRequest(clusterName,
                                                               passwordCredentials.Name, passwordCredentials.Password,
                                                               clientGuid, ClientTypeCsharp, serializationVersion, dllVersion, _client.Name, _labels));

            case ITokenCredentials tokenCredentials:
                return(ClientAuthenticationCustomCodec.EncodeRequest(clusterName,
                                                                     tokenCredentials.Token,
                                                                     clientGuid, ClientTypeCsharp, serializationVersion, dllVersion, _client.Name, _labels));

            default:
                return(ClientAuthenticationCustomCodec.EncodeRequest(clusterName,
                                                                     serializationService.ToData(credentials).ToByteArray(),
                                                                     clientGuid, ClientTypeCsharp, serializationVersion, dllVersion, _client.Name, _labels));
            }
        }
Esempio n. 13
0
        public WebMediaServiceDescription GetServiceDescription()
        {
            return(new WebMediaServiceDescription()
            {
                MovieApiVersion = MOVIE_API,
                MusicApiVersion = MUSIC_API,
                PicturesApiVersion = PICTURES_API,
                TvShowsApiVersion = TVSHOWS_API,
                FilesystemApiVersion = FILESYSTEM_API,

                ServiceVersion = VersionUtil.GetVersionName(),

                AvailableFileSystemLibraries = FileSystemLibraries.GetAllAsBackendProvider(),
                AvailableMovieLibraries = MovieLibraries.GetAllAsBackendProvider(),
                AvailableMusicLibraries = MusicLibraries.GetAllAsBackendProvider(),
                AvailablePictureLibraries = PictureLibraries.GetAllAsBackendProvider(),
                AvailableTvShowLibraries = TVShowLibraries.GetAllAsBackendProvider(),

                DefaultFileSystemLibrary = ProviderHandler.GetDefaultProvider(ProviderType.Filesystem),
                DefaultMovieLibrary = ProviderHandler.GetDefaultProvider(ProviderType.Movie),
                DefaultMusicLibrary = ProviderHandler.GetDefaultProvider(ProviderType.Music),
                DefaultPictureLibrary = ProviderHandler.GetDefaultProvider(ProviderType.Picture),
                DefaultTvShowLibrary = ProviderHandler.GetDefaultProvider(ProviderType.TVShow),
            });
        }
Esempio n. 14
0
        /// <summary>
        /// Retrieve the external ip of this pc from one of n external websites
        ///
        /// Currently available and processed in this order:
        /// 1) whatismyip.com (url for automated access)
        /// 2) dyndns.com (checkip.dyndns.com)
        /// 3) agentgatech.appspot.com (google app engine)
        /// </summary>
        /// <param name="forceUpdate">If true, cache is ignored</param>
        /// <returns>External ip of pc</returns>
        public static IPAddress GetIP(bool forceUpdate)
        {
            if (!forceUpdate && CachedIP != null && (DateTime.Now - CacheLastUpdated).TotalSeconds < CACHE_LIFETIME)
            {
                return(CachedIP);
            }

            WebClient client = new WebClient();

            client.Headers[HttpRequestHeader.UserAgent] = VersionUtil.GetUserAgent();

            var methods = new Func <WebClient, string>[] { RetrieveFromDynDNS, RetrieveFromAppEngine };

            foreach (var method in methods)
            {
                string result = method.Invoke(client);
                if (result == null)
                {
                    continue;
                }

                if (!IPAddress.TryParse(result, out CachedIP))
                {
                    Log.Warn("Failed to parse retrieved external address '{0}'", result);
                    continue;
                }

                CacheLastUpdated = DateTime.Now;
                return(CachedIP);
            }

            Log.Warn("Couldn't retrieve external IP from any of the external websites. Is your network functioning and the firewall configured correctly?");
            return(null);
        }
Esempio n. 15
0
        /// <summary>
        /// Determines the minimum payload version that can be used for the set.
        /// </summary>
        /// <param name="service">The data service instance</param>
        /// <returns>The minimum version that can be used for a payload for or from this set.</returns>
        internal Version MinimumResponsePayloadVersion(IDataService service)
        {
            Version minimumVersion = VersionUtil.Version4Dot0;

            // Call this.CheckHierarchy(provider) method, in case its already not called
            // (when ShouldIncludeAssociationLinksInResponse is false)
            this.CheckHierarchy(service.Provider);
            Debug.Assert(this.metadataVersion != null, "this.version != null");

            // If target set contains collection properties we need v4.0
            // If target type contains named streams, we need v4.0
            minimumVersion = VersionUtil.RaiseVersion(minimumVersion, this.metadataVersion);

            // If the resource type is an open type, then we do not know the metadata of the open property and hence cannot
            // predict the response version. Hence we need to bump the version to the maximum possible version that the server
            // can write and client can understand (i.e. min of MPV in the server and request MaxDSV).
            // If we encounter during serialization, anything greater than the computed response version, we will throw instream error.
            if (this.hasOpenTypes)
            {
                Version maxProtocolVersion = service.Configuration.DataServiceBehavior.MaxProtocolVersion.ToVersion();
                Version requestMaxVersion  = service.OperationContext.RequestMessage.RequestMaxVersion;
                Version responseVersion    = (requestMaxVersion < maxProtocolVersion) ? requestMaxVersion : maxProtocolVersion;
                minimumVersion = VersionUtil.RaiseVersion(minimumVersion, responseVersion);
            }

            return(minimumVersion);
        }
Esempio n. 16
0
        public void TestDllVersion()
        {
            var assemblyVersion = typeof(VersionUtil).Assembly.GetName().Version.ToString();
            var extracted       = VersionUtil.GetDllVersion();

            Assert.That(assemblyVersion, Does.StartWith(extracted));
        }
Esempio n. 17
0
        public static bool IsUpdateAvailable()
        {
            Version ourBuild  = VersionUtil.GetBuildVersion();
            Version lastBuild = GetLastReleasedVersion().BuildNumber;

            return(ourBuild.CompareTo(lastBuild) < 0);
        }
Esempio n. 18
0
        //
        // GET: /Settings/
        public ActionResult Index()
        {
            ViewBag.Version = VersionUtil.GetFullVersionString();
            ServiceAvailability.Reload();

            return(View(new SettingsViewModel(Settings.ActiveSettings)));
        }
Esempio n. 19
0
 public void Test17Compliant()
 {
     Assert.IsTrue(VersionUtil.Is17Compatible("1.8.0.256"));
     Assert.IsTrue(VersionUtil.Is17Compatible("1.9.0.457"));
     Assert.IsTrue(VersionUtil.Is17Compatible("1.7.0.355"));
     Assert.IsFalse(VersionUtil.Is17Compatible("1.6.0.355"));
 }
Esempio n. 20
0
        protected void Application_Start()
        {
            // standard ASP.NET MVC setup
            AreaRegistration.RegisterAllAreas();
            GlobalFilters.Filters.Add(new HandleErrorAttribute());
            RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            RouteTable.Routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });

            // initialize settings and the skin-override mechanism
            ContentLocator.Current = new ContentLocator(Context.Server);
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new SkinnableViewEngine());
            Settings.ApplySkinSettings();

            // set connection settings
            Connections.SetUrls(Settings.ActiveSettings.MASUrl, Settings.ActiveSettings.TASUrl);
            Log.Info("WebMediaPortal version {0} started with MAS {1} and TAS {2}",
                     VersionUtil.GetFullVersionString(), Settings.ActiveSettings.MASUrl, Settings.ActiveSettings.TASUrl);
            Connections.LogServiceVersions();

            // automatically reload changes to the configuration files, mainly so that we instantly pick up new/deleted users.
            Configuration.EnableChangeWatching();

            // generate a random token, which we can use for security stuff
            Context.Application["randomToken"] = Guid.NewGuid();
        }
Esempio n. 21
0
    IEnumerator DownloadUpdateFile()
    {
        string versionCheckURL = "http://localhost/CurrentVersion.txt";

        using (UnityWebRequest www = UnityWebRequest.Get(versionCheckURL))
        {
            yield return(www.Send());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                string remoteVersionStr = www.downloadHandler.text;
                remoteVersionStr = remoteVersionStr.Trim();
                if (VersionUtil.VersionFormatCheck(remoteVersionStr))
                {
                    if (VersionUtil.VersionCompareResult.GT == VersionUtil.VersionStringCompare(remoteVersionStr, PlayerData.GetLocalVersionCode()))
                    {
                        //StartCoroutine(UpdateClient());
                    }
                }
            }
        }
    }
Esempio n. 22
0
        public void can_add_multiple_versions_to_log()
        {
            var timestamp = DateTime.Now;

            VersionUtil.UpdateVersionLog(".", new DeployedVersion()
            {
                VersionBranch    = "master",
                VersionCommit    = "123",
                VersionTimestamp = timestamp,
                VersionId        = "theId",
                VersionNumber    = "v1.2.3.4",
                LogFileName      = "logfile.txt"
            });

            VersionUtil.UpdateVersionLog(".", new DeployedVersion()
            {
                VersionBranch    = "production",
                VersionCommit    = "222",
                VersionTimestamp = timestamp,
                VersionId        = "theId2",
                VersionNumber    = "v1.2.3.5",
                LogFileName      = "logfile.txt"
            });

            var log = VersionUtil.ReadVersionLog(".");

            log[0].VersionBranch.ShouldBe("production");
            log[0].VersionCommit.ShouldBe("222");
            log[0].VersionTimestamp.ShouldBe(timestamp);
            log[0].VersionId.ShouldBe("theId2");
            log[0].VersionNumber.ShouldBe("v1.2.3.5");
        }
        public virtual DeployUnitInfo GetUnitInfo()
        {
            var deployUnitInfo = new DeployUnitInfo
            {
                Name = Name,
                HasDeployParameters = HasDeployParameters
            };

            if (Version == null)
            {
                Version = VersionUtil.GetCurrentVersion(DataDirectory);
                if (Version.DeployFailed)
                {
                    DeployStatus = DeployStatus.DeployFailed;
                }
            }

            if (!Version.DeployFailed)
            {
                deployUnitInfo.LastDeployed = $"Deployed by {Version.UserName} {DateUtils.GetFriendlyAge(Version.DeployTimestamp)}";
            }

            deployUnitInfo.Version      = Version;
            deployUnitInfo.DeployStatus = DeployStatus;

            return(deployUnitInfo);
        }
Esempio n. 24
0
 /// <summary>
 ///
 /// </summary>
 public void SetSizingMeasure()
 {
     using (var castRepsitory = GetRepository())
     {
         try
         {
             if (VersionUtil.IsAdgVersion82Compliant(_Snapshot.AdgVersion))
             {
                 const string strSizingMeasures = "technical-size-measures,run-time-statistics,technical-debt-statistics,functional-weight-measures,critical-violation-statistics,violation-statistics";
                 _Snapshot.SizingMeasuresResults = castRepsitory.GetResultsSizingMeasures(_Snapshot.Href, strSizingMeasures, string.Empty, "$all", "$all").SelectMany(_ => _.ApplicationResults);
             }
             else
             {
                 const string strSizingMeasuresOld = "technical-size-measures,run-time-statistics,technical-debt-statistics,functional-weight-measures,critical-violation-statistics";
                 _Snapshot.SizingMeasuresResults = castRepsitory.GetResultsSizingMeasures(_Snapshot.Href, strSizingMeasuresOld, string.Empty, "$all", "$all").SelectMany(_ => _.ApplicationResults);
             }
         }
         catch (System.Net.WebException ex)
         {
             LogHelper.Instance.LogInfo(ex.Message);
             const string strSizingMeasuresOld = "technical-size-measures,run-time-statistics,technical-debt-statistics,functional-weight-measures,critical-violation-statistics";
             _Snapshot.SizingMeasuresResults = castRepsitory.GetResultsSizingMeasures(_Snapshot.Href, strSizingMeasuresOld, string.Empty, "$all", "$all").SelectMany(_ => _.ApplicationResults);
         }
     }
 }
Esempio n. 25
0
        private static void RunNegotiatedFormatTest(string requestAccept, string requestMaxVersion, Microsoft.OData.Client.ODataProtocolVersion maxProtocolVersion, ODataFormat expectedFormat)
        {
            DataServiceHostSimulator host = new DataServiceHostSimulator
            {
                RequestHttpMethod = "GET",
                RequestAccept     = requestAccept,
                RequestMaxVersion = requestMaxVersion,
                RequestVersion    = "4.0",
            };
            DataServiceSimulator service = new DataServiceSimulator
            {
                OperationContext = new DataServiceOperationContext(host),
                Configuration    = new DataServiceConfiguration(new DataServiceProviderSimulator()),
            };

            service.Configuration.DataServiceBehavior.MaxProtocolVersion = maxProtocolVersion;
            service.OperationContext.InitializeAndCacheHeaders(service);
            service.OperationContext.RequestMessage.InitializeRequestVersionHeaders(VersionUtil.ToVersion(maxProtocolVersion));

            var d = new RequestDescription(RequestTargetKind.Primitive, RequestTargetSource.Property, new Uri("http://temp.org/"));

            d.DetermineWhetherResponseBodyOrETagShouldBeWritten(service.OperationContext.RequestMessage.HttpVerb);
            d.DetermineWhetherResponseBodyShouldBeWritten(service.OperationContext.RequestMessage.HttpVerb);
            d.DetermineResponseFormat(service);
            d.ResponseFormat.Should().NotBeNull();
            d.ResponseFormat.Format.Should().BeSameAs(expectedFormat);
        }
Esempio n. 26
0
 /// <summary>
 ///
 /// </summary>
 public List <string> GetQualityStandardsRulesList(string snapshotHref, string standardTag)
 {
     using (var castRepsitory = GetRepository())
     {
         try
         {
             IEnumerable <Result> results = VersionUtil.IsAdgVersion833Compliant(_Snapshot.AdgVersion) ? castRepsitory.GetResultsQualityStandardsRules(snapshotHref, standardTag, string.Empty, string.Empty) : null;
             if (results == null)
             {
                 return(null);
             }
             List <string> metrics = new List <string>();
             foreach (Result _result in results)
             {
                 metrics.AddRange(_result.ApplicationResults.Select(resultApplicationResult => resultApplicationResult.Reference.Key.ToString()));
             }
             return(metrics);
         }
         catch (System.Net.WebException ex)
         {
             LogHelper.Instance.LogInfo(ex.Message);
             return(null);
         }
     }
 }
Esempio n. 27
0
        private static void CompatibilityCheck()
        {
            ModsCompatibilityChecker mcc = new ModsCompatibilityChecker();

            mcc.PerformModCheck();
            VersionUtil.CheckGameVersion();
        }
Esempio n. 28
0
        static void Buildupdate()
        {
            GameObject wwwMange = new GameObject();

            wwwMange.AddComponent <WWWManager>();

            AssetBundleBuildConfig config = AssetBundleBuildPanel.LoadConfig();

            AssetBundleBuilder.Build(config);

            VersionConfig newCfg    = getNewVersion();
            string        url       = getServerUrl().Combine(GameUpdater.CurrentVersionPath);
            string        cachePath = GameUpdater.CacheVersionPath;

            Debug.LogError("加载服务端version信息……");
            GameUpdater.Instance.DeleteCacheVersion();
            WWWManager.Instance.DownloadWWW(url, cachePath, (suc) =>
            {
                VersionConfig serverCfg = VersionUtil.ReadConfig(cachePath);
                List <string> files     = GameUpdater.Instance.GetFileListNeedDownloaded(serverCfg, newCfg);
                Debug.LogError("需要更新的ab包个数:" + files.Count);
                FileUtil.DeleteFileOrDirectory(cachePath);
                copyToUpdate(files);
                GameObject.DestroyImmediate(wwwMange);
                Debug.LogError("外网更新打包结束!");
            });
        }
Esempio n. 29
0
        public async void Check(bool notifyNoFound, bool isPreRelease)
        {
            try
            {
                var updater = new GitHubRelease(Owner, Repo);
                var url     = updater.AllReleaseUrl;

                var json = await GetAsync(url, true);

                var releases      = JsonConvert.DeserializeObject <List <Release> >(json);
                var latestRelease = VersionUtil.GetLatestRelease(releases, isPreRelease);
                if (VersionUtil.CompareVersion(latestRelease.tag_name, Version) > 0)
                {
                    LatestVersionNumber = latestRelease.tag_name;
                    LatestVersionUrl    = latestRelease.html_url;
                    NewVersionFound?.Invoke(this, new EventArgs());
                }
                else
                {
                    LatestVersionNumber = latestRelease.tag_name;
                    if (notifyNoFound)
                    {
                        NewVersionNotFound?.Invoke(this, new EventArgs());
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                if (notifyNoFound)
                {
                    NewVersionFoundFailed?.Invoke(this, new EventArgs());
                }
            }
        }
Esempio n. 30
0
        private void hbUpdates_RequestNavigate(object sender, RequestNavigateEventArgs e)
        {
            tbVersion.Text = String.Format("{0} ({1})", VersionUtil.GetVersionName(), UI.CheckingForUpdates);
            e.Handled      = true;

            versionChecker         = new BackgroundWorker();
            versionChecker.DoWork += delegate(object s, DoWorkEventArgs args)
            {
                string text;
                if (!UpdateChecker.IsWorking())
                {
                    text = UI.FailedToRetrieveUpdateInformation;
                }
                else if (UpdateChecker.IsUpdateAvailable())
                {
                    text = String.Format(UI.UpdateAvailable, UpdateChecker.GetLastReleasedVersion().Version, UpdateChecker.GetLastReleasedVersion().ReleaseDate);
                }
                else
                {
                    text = UI.NoUpdateAvailable;
                }

                args.Result = String.Format("{0} ({1})", VersionUtil.GetVersionName(), text);
            };
            versionChecker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args)
            {
                tbVersion.Text = args.Result as string;
            };
            versionChecker.RunWorkerAsync();
        }