private void SaveVesionToLocal(HTTPResponse response) { string savePath = PathHelp.GetDownLoadPath(); if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } version_Path = Path.Combine(savePath, version); Debug.Log("版本号获得成功--" + response.DataAsText); bool isUpdate = VersionController.ReadLocalVersion(response.DataAsText, version_Path); if (isUpdate)//需要更新 { RequestVersionList(); } else { Debug.Log("已是最新版本不需更新"); if (finish != null) { finish(); } } }
public IEnumerator TestResetPositionBeforeHEAD() { // Given VersionableObjectFactory factory = new VersionableObjectFactory(); VersionController testController = factory.createVersionablePlayer(); GameObject testObject = testController.GetActiveVersion(); testObject.transform.position = new Vector2(0.0f, 0.0f); VersionManager.Instance().Add(testController); ICommit commitToLoad = VersionManager.Instance().Commit("Set thing position to 0,0"); yield return(null); testObject.transform.position = new Vector2(1.0f, 1.0f); VersionManager.Instance().Add(testController); VersionManager.Instance().Commit("Set thing position to 1,1"); yield return(null); // When VersionManager.Instance().CheckoutCommit(commitToLoad); yield return(null); // Then Assert.AreEqual(0.0f, testObject.transform.position.x, 0.1f); Assert.AreEqual(0.0f, testObject.transform.position.y, 0.1f); }
public void PickVersion(VersionController versionedObject, IVersion version) { if (conflictControllers.Contains(versionedObject)) { conflictControllers.Remove(versionedObject); resolvedControllers.Add(versionedObject); stagingArea.Add(versionedObject, version); } else if (resolvedControllers.Contains(versionedObject)) { stagingArea[versionedObject] = version; } else { throw new Exception("Tried to resolve controller, but wasn't in conflict controller set"); } this.UpdateStatus(); if (pickTrigger != null) { pickTrigger.Trigger(); } }
public void Duplicate(ChangeControl control) { int index = ChangeParent.Children.IndexOf(control); if (index == -1) { return; } VersionController versionController = MainWindow.GetInstance().VersionController; Version version = openVersionRef.GetVersion().Result; ChangeRef oldChangeRef = version.Changes[index]; string guid = Guid.NewGuid().ToString(); string relativePath = Path.Combine(version.VersionName, "changes", $"{guid}.json"); ChangeRef newChangeRef = new ChangeRef(versionController, guid, relativePath); version.Changes.Insert(index + 1, newChangeRef); Change oldChange = oldChangeRef.GetChange(false).Result; VersionRef releaseVersion = new VersionRef(versionController, oldChange.ReleaseVersion.RelativeFilePath, oldChange.ReleaseVersion.VersionName); Change newChange = new Change(versionController, guid, relativePath, oldChange.Title, oldChange.Description, releaseVersion); if (oldChange.AdditionalData != null) { newChange.AdditionalData = (JObject)oldChange.AdditionalData.DeepClone(); } versionController.CacheChange(newChange); ChangeControl newControl = new ChangeControl(newChangeRef); ChangeParent.Children.Insert(index + 1, newControl); }
public IEnumerator ShouldSetLocalScale() { VersionableObjectFactory factory = new VersionableObjectFactory(); VersionController testController = factory.createBinaryVersionable(); GameObject testObject = testController.GetActiveVersion(); Assert.AreEqual(1.0f, testObject.transform.localScale.x, 0.01f); VersionManager.Instance().Add(testController); ICommit commit = VersionManager.Instance().Commit("Add a box"); yield return(null); testObject.transform.localScale = new Vector3(-1.0f, 1.0f, 1.0f); Assert.AreEqual(-1.0f, testObject.transform.localScale.x, 0.01f); VersionManager.Instance().Add(testController); VersionManager.Instance().Commit("Flip the box"); yield return(null); VersionManager.Instance().CheckoutCommit(commit); yield return(null); Assert.AreEqual(1.0f, testObject.transform.localScale.x, 0.01f); }
public void Version() { var mockBuildInfoProvider = new Mock <IBuildInfoProvider>(MockBehavior.Strict); mockBuildInfoProvider.SetupGet(_ => _.Changelist).Returns("SomeChangelist").Verifiable(); mockBuildInfoProvider.SetupGet(_ => _.BuildId).Returns("SomeBuildId").Verifiable(); var mockHostingEnvironment = new Mock <IHostingEnvironment>(MockBehavior.Strict); mockHostingEnvironment.SetupGet(_ => _.EnvironmentName).Returns("SomeEnvironmentName").Verifiable(); var controller = new VersionController(mockBuildInfoProvider.Object, mockHostingEnvironment.Object); var result = controller.Version(); Assert.NotNull(result); Assert.IsType <OkObjectResult>(result); // It's an anonymous type, so use dynamic to get the props off it. dynamic model = ((OkObjectResult)result).Value; Assert.NotNull(model); Assert.Equal("SomeEnvironmentName", model.Environment); Assert.Equal("SomeChangelist", model.Changelist); Assert.Equal("SomeBuildId", model.BuildId); mockBuildInfoProvider.Verify(); mockHostingEnvironment.Verify(); }
public void OpenButtonPressed(object sender, RoutedEventArgs args) { if (MainWindow.GetInstance().VersionController != null) { if (MessageBox.Show("Any unsaved changes will be lost.", "Are you sure?", MessageBoxButton.YesNo) == MessageBoxResult.No) { return; } } OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "ChangeLog Json File (changelog.json)|changelog.json"; openFileDialog.InitialDirectory = Environment.SpecialFolder.Personal.ToString(); if (openFileDialog.ShowDialog() == true) { if (!string.IsNullOrEmpty(openFileDialog.FileName)) { if (Path.GetFileName(openFileDialog.FileName) == "changelog.json" && File.Exists(openFileDialog.FileName)) { string dir = Path.GetDirectoryName(openFileDialog.FileName); VersionController controller = new VersionController("0", new FileSystemProvider(dir)); ChangeLog changeLog = controller.GetChangeLog().Result; if (changeLog != null) { MainWindow.GetInstance().VersionController = controller; ContentArea.GetInstance().OpenPage(ContentArea.PageType.ChangeLog); return; } } } MessageBox.Show("The selected file was not a valid 'changelog.json' file.", "Open ChangeLog Failed", MessageBoxButton.OK, MessageBoxImage.Error); } }
public IEnumerator shouldResetTrackedObjectsWhenCheckingOutCommitWhereAnObjectWasNotTracked() { VersionableObjectFactory factory = new VersionableObjectFactory(); VersionController testController = factory.createVersionableBox(); GameObject testObject = testController.GetActiveVersion(); testObject.transform.position = new Vector2(0.0f, 0.0f); VersionManager.Instance().Add(testController); Guid firstCommitId = VersionManager.Instance().Commit("Create a box").GetId(); yield return(null); VersionController otherTestController = factory.createVersionableBox(); GameObject otherTestObject = otherTestController.GetActiveVersion(); testObject.transform.position = new Vector2(-3.0f, 0.0f); otherTestObject.transform.position = new Vector2(3.0f, -2.0f); VersionManager.Instance().Add(testController); VersionManager.Instance().Add(otherTestController); VersionManager.Instance().Commit("Create another box and move the first box"); yield return(null); VersionManager.Instance().Checkout(VersionManager.Instance().GetActiveBranch(), firstCommitId); Assert.False(VersionManager.Instance().IsObjectTracked(otherTestController)); }
public IEnumerator TestResetMultipleObjectPositions() { // Given VersionableObjectFactory factory = new VersionableObjectFactory(); VersionController testController = factory.createVersionablePlayer(); VersionController otherTestController = factory.createVersionableBox(); GameObject testObject = testController.GetActiveVersion(); GameObject otherTestObject = otherTestController.GetActiveVersion(); testObject.transform.position = new Vector2(1.0f, 3.0f); otherTestObject.transform.position = new Vector2(-1.0f, 5.0f); VersionManager.Instance().Add(testController); VersionManager.Instance().Add(otherTestController); VersionManager.Instance().Commit("Create two objects"); yield return(null); testObject.transform.position = new Vector2(0.0f, 0.0f); yield return(null); VersionManager.Instance().ResetToHead(); yield return(null); Assert.AreEqual(1.0f, testObject.transform.position.x, 0.1f); Assert.AreEqual(3.0f, testObject.transform.position.y, 0.1f); Assert.AreEqual(-1.0f, otherTestObject.transform.position.x, 0.1f); Assert.AreEqual(5.0f, otherTestObject.transform.position.y, 0.1f); }
public async void Get_ReturnsSuccess() { _catapultEngineService.Setup(s => s.GetCatapultEngines(It.IsAny <string>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new List <CatapultEngine> { new CatapultEngine { Id = 1, Name = "Engine01" } }); _providerService.Setup(s => s.GetTaskProviders(It.IsAny <string>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new List <TaskProvider> { new TaskProvider { Id = 1, Name = "AspMvcNet" } }); var controller = new VersionController(_catapultEngineService.Object, _providerService.Object, _mapper, _logger.Object); var result = await controller.Get(); Assert.IsType <OkObjectResult>(result); }
public Main() { InitializeComponent(); var userGuid = System.Guid.NewGuid().ToString("B").ToUpper(); Analytics.Initialize("pzNi0MJVC1P9tVZdnvDOyptvUwPov9BN", new Config().SetAsync(false)); Analytics.Client.Track(userGuid, "Started App", new Segment.Model.Properties() { // { "datetime", DateTime.Now }, { "dimension1", OSVersionInfo.Name + " " + OSVersionInfo.Edition + " " + OSVersionInfo.ServicePack } }); lblVersion.Text = "v" + Application.ProductVersion; var latestVersion = VersionController.GetRemoteLatestVersion(); if (Version.Parse(latestVersion) > Version.Parse(Application.ProductVersion)) { tileGetNewVersion.Visible = true; } Start control = new Start(); control.Dock = DockStyle.Fill; Controls.Add(control); }
private void Init() { _options = new BuildOptions(); _fileController = new FileController(); _fileController.TryLoad(); _versionController = new VersionController(_fileController.VersioningPattern); }
public async Task PostSerializeReload(VersionController versionController) { ChangeLog changeLog = await versionController.GetChangeLog(); if (EmptyPage.Visibility == Visibility.Visible) { return; } if (ChangeLogPage.Visibility == Visibility.Visible) { OpenPage(PageType.ChangeLog); return; } if (VersionPage.Visibility == Visibility.Visible) { VersionRef oldRef = VersionPage.GetRef(); foreach (VersionRef versionRef in changeLog.Versions) { if (versionRef.VersionName == oldRef.VersionName) { OpenPage(PageType.Version, versionRef); return; } } OpenPage(PageType.ChangeLog); return; } if (ChangePage.Visibility == Visibility.Visible) { VersionRef oldVersionRef = VersionPage.GetRef(); ChangeRef oldChangeRef = ChangePage.GetChangeRef(); foreach (VersionRef versionRef in changeLog.Versions) { if (versionRef.VersionName == oldVersionRef.VersionName) { Version version = await versionRef.GetVersion(); foreach (ChangeRef changeRef in version.Changes) { if (changeRef.Guid == oldChangeRef.Guid) { OpenPage(PageType.Change, versionRef, changeRef); return; } } OpenPage(PageType.Version, versionRef); return; } } OpenPage(PageType.ChangeLog); return; } }
public void Get() { VersionController versionController = new VersionController(); var result = versionController.Get(); Assert.AreEqual(1, result); }
// Use this for initialization void Start() { LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsController>(); VersionController = GameObject.Find("VersionController").GetComponent <VersionController>(); LevelsController.HideLoadingDialog(); CreditsPanel.SetActive(false); MoreGamesPanel.SetActive(false); }
public void ThenTheVersionIsTheAssembly() { var versionController = new VersionController(); var result = versionController.Get(); var expected = Assembly.GetExecutingAssembly().GetName().Version.ToString(); Assert.AreEqual(expected, result); }
// Use this for initialization void Start() { LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsControllerCS>(); VersionController = GameObject.Find("VersionController").GetComponent <VersionController>(); HideUnlockModal(); CheckIfLevelsUnlocked(); }
// Update is called once per frame void Update() { if (VersionManager.Instance().GetMergeWorker() != null) { selectClosestPreview(); if (currentlySelectedObject != null && Input.GetKeyDown(KeyCode.P)) { VersionManager.Instance().GetMergeWorker().PickObject(currentlySelectedObject); } } else { selectVersionable(); if (currentlySelectedObject != null && Input.GetKeyDown(KeyCode.Q)) { VersionController versionController = currentlySelectedObject.GetComponentInParent <VersionController>(); if (VersionManager.Instance().IsObjectStaged(versionController)) { VersionManager.Instance().Unstage(versionController); } else { VersionManager.Instance().Add(versionController); } Debug.Log(currentlySelectedObject == gameObject ? "Adding player" : "Adding closest object"); Debug.Log(currentlySelectedObject); } else if (Input.GetKeyDown(KeyCode.R)) { VersionManager.Instance().ResetToHead(); } else if (Input.GetKeyDown(KeyCode.J)) { if (!VersionManager.Instance().HasBranch("demo")) { VersionManager.Instance().CreateBranch("demo"); } VersionManager.Instance().Checkout("demo"); } else if (Input.GetKeyDown(KeyCode.K)) { VersionManager.Instance().Checkout("master"); } } if (Input.GetKeyDown(KeyCode.O)) { if (overlay != null) { overlay.Destroy(); overlay = null; } else { overlay = new Overlay(VersionManager.Instance().GetHead(), Color.red); } } }
public void TestMethod1() { //var filename = "project-2.rar"; //var delRar = filename.Remove(filename.LastIndexOf(".")); //var fileName1 = delRar.Substring(delRar.LastIndexOf('-') + 1); VersionController version = new VersionController(); version.GetLatestVersion(); }
public void incrementVersion_whenTypeOfReleaseIsBugfix_valueDoesMatch([Values("bugfix")] string input) { VersionController vc = new VersionController("5.39.8.0"); vc.extractVersionNumbers(); vc.incrementVersion(input); vc.rebuildVersionNumbers(); Assert.AreEqual("5.39.8.1", vc.getNewVersion()); }
public void extractVersionNumbers_whenVersionFormatIncorrect_valueDoesNotMatch ([Values("1", "1111", "1.1", "1.1.1", "1.1.1.1.1", "1 . 1. 1 .1")] string input) { VersionController vc = new VersionController(input); vc.extractVersionNumbers(); vc.rebuildVersionNumbers(); Assert.AreNotEqual(vc.getVersion(), vc.getNewVersion()); }
public void Get_ReturnsVersion() { string versionFromAssembly = typeof(Api.Program).Assembly?.GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion; var controller = new VersionController(); string version = controller.Get(); Assert.AreEqual($"Ais.ImageSplitter.Api v{versionFromAssembly}", version); }
public void extractVersionNumbers_whenVersionFormatCorrect_valueDoesMatch ([Values("5.39.8.0", "5.656.895.11", "0.01.01.01", "0.0.0.0", "1.1.99999999.99999999", " 1.1.1.1 ")] string input) { VersionController vc = new VersionController(input); vc.extractVersionNumbers(); vc.rebuildVersionNumbers(); Assert.AreEqual(vc.getVersion(), vc.getNewVersion()); }
public GameObject GetPreviewForObject(VersionController versionedObject) { GameObject preview; if (overlayObjects.TryGetValue(versionedObject, out preview)) { return(preview); } return(null); }
public void When_getting_version_then_return_version() { this._versionController = new VersionController(); var result = this._versionController.GetVersion(); var apiVersion = result.As <OkObjectResult>().Value as ApiVersion; apiVersion.Version.Should().BeEquivalentTo(new ApiVersion().Version); }
/// <summary> /// Initializes a new instance of the <see cref="Main"/> class. /// </summary> /// <param name="loggingLevelSwitch">An object that can be used to dynamically change the logging level at runtime.</param> public Main(LoggingLevelSwitch loggingLevelSwitch) { this.InitializeComponent(); if (Properties.Settings.Default.UpdateSettings) { Log.Logger.Information("Updating user settings per new release."); Log.Logger.Debug("OLD user settings: {@settings}", Properties.Settings.Default); Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpdateSettings = false; Properties.Settings.Default.Save(); Log.Logger.Debug("NEW user settings: {@settings}", Properties.Settings.Default); } var osInfo = $"{OSVersionInfo.Name} {OSVersionInfo.Edition} {OSVersionInfo.ServicePack}"; var versionString = OSVersionInfo.VersionString; Log.Logger.Information("Operating System information: {osInfo} {versionString}", osInfo, versionString); if (Properties.Settings.Default.ShareStatistics) { var userGuid = Guid.NewGuid().ToString("B").ToUpper(CultureInfo.InvariantCulture); Analytics.Initialize("pzNi0MJVC1P9tVZdnvDOyptvUwPov9BN", new Config().SetAsync(false)); Analytics.Client.Track( userGuid, "Started App", new Segment.Model.Properties() { { "dimension1", osInfo }, }); } this.lblVersion.Text = "v" + Application.ProductVersion; try { var latestVersion = VersionController.GetRemoteLatestVersion(); if (Version.Parse(latestVersion) > Version.Parse(Application.ProductVersion)) { Log.Information("Version {version} is available.", latestVersion); this.tileGetNewVersion.Visible = true; } } catch (VersionControllerException ex) { DialogController.ShowMessage(ex.Source, ex.Message, SystemIcons.Error, DialogController.DialogButtons.OK); } Start control = new Start(loggingLevelSwitch); control.Dock = DockStyle.Fill; this.Controls.Add(control); }
protected override bool shouldFire() { VersionController lastUnstagedObject = versionManager.GetLastUnstagedObject(); if (lastUnstagedObject != null && lastUnstagedObject.Equals(targetObject)) { return(true); } return(false); }
void Start() { // If we haven't set up the Unity Purchasing reference if (m_StoreController == null) { // Begin to configure our connection to Purchasing InitializePurchasing(); } VersionController = GameObject.Find("VersionController").GetComponent <VersionController>(); }
public void SetUp() { VersionManager.Reset(); testController1 = factory.createVersionablePlayer(); testController2 = factory.createVersionableBox(); testObject1 = testController1.GetActiveVersion(); testObject2 = testController2.GetActiveVersion(); master = VersionManager.Instance().GetActiveBranch(); }
public void Call_Get_Resturns_Version() { var logger = new Mock <ILogger <VersionController> >(); var controller = new VersionController(logger.Object); var result = controller.Get() as OkObjectResult; var t = typeof(VersionController); // Instantiate an Assembly class to the assembly housing the Integer type. var assem = Assembly.GetAssembly(t); Assert.AreEqual(assem.GetName().Version.ToString(), result.Value); }