public ExcutedResult GetQuery(string name, int?number, int?clientType, int pageIndex = 1, int pageSize = 10, string sortName = "", bool?order = null)
 {
     try
     {
         VersionParam param = new VersionParam()
         {
             Name            = name,
             Number          = number,
             ClientType      = clientType,
             PageIndex       = pageIndex,
             PageSize        = pageSize,
             SortName        = "date",
             IsSortOrderDesc = true
         };
         if (!string.IsNullOrEmpty(sortName))
         {
             param.SortName = sortName;
         }
         if (order.HasValue)
         {
             param.IsSortOrderDesc = order.Value;
         }
         var result = _versionLogic.GetQuery(param);
         return(ExcutedResult.SuccessResult(result));
     }
     catch (BusinessException businessException)
     {
         return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message));
     }
 }
Example #2
0
 public override void FinishOff()
 {
     foreach (var Ver in VersionParamL)
     {
         if (Versions[Versions.Count - 1].VER == Ver.Version)
         {
             VP = Ver;
             break;
         }
     }
     OutputString($"Board last saved by \"Altium {Versions[Versions.Count - 1].VER}\"");
     if (Versions[Versions.Count - 1].VER.Contains("Release"))
     {
         Post09 = true;
     }
     VersionString = Versions[Versions.Count - 1].VER;
 }
Example #3
0
	private static IEnumerable InstallCoroutine(VersionParam versionParam, UIPanelUpdate updatePanel, ReturnTuple<ProgramsUpdateRetcode> result)
	{
		result.value_0 = ProgramsUpdateRetcode.NotSuccess;

		//load string table
		var stringTable = GameUpdateManager.Instance.StringTable;

		//check runtime platform
		if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.Android)		//supported
		{
		}
		else if (Application.platform == RuntimePlatform.WindowsEditor)		//方便测试用
		{}
		else
		{
			updatePanel.sub_statusText.text = stringTable["auto update not supported"];
			foreach (var item in UpdateMessageBox.Pop(stringTable["auto update not supported, please update manually"], UpdateMessageBox.MessageBoxType.OK))
			    yield return item;

		    result.value_0 = ProgramsUpdateRetcode.Fail;
		    yield break;
		}

		yield return null;

		PatcherSpace.LauncherConfig launcherConfig;
		launcherConfig.resourcePath = EntryPointParam.AssetsPath;
		launcherConfig.stringTable = stringTable;
		launcherConfig.targetVersion = versionParam.newestVersion;
		launcherConfig.packAddress = versionParam.updateUrl;
		launcherConfig.packMd5 = versionParam.updateMd5;
		launcherConfig.tempDir = makeLauncherTempDir();

		PatcherSpace.Launcher launcher = PatcherSpace.Launcher.instance();
		launcher.init(launcherConfig);
		launcher.startInstall((e) => { Debug.LogException(e); });

		Int32 toFinish = 2;
		while (toFinish > 0)
		{
			if (!launcher.isBusy())	//这样能在结束后更新状态
				--toFinish;

			updatePanel.sub_progress.value = (float)launcher.getTotalProgress();
			updatePanel.sub_statusText.text = launcher.getStatusText();

			Int64 totalUpdateSize = launcher.getUpdateTotalSize();
			if (totalUpdateSize > 0)
			{
				updatePanel.sub_progressText.text = FormatFileSize((Int64)(totalUpdateSize * launcher.getTotalProgress())) + "/" + FormatFileSize(totalUpdateSize);
			}
			else
			{
				updatePanel.sub_progressText.text = "";
			}

			yield return null;
		}

		PatcherSpace.Launcher.ErrorCode errorCode = launcher.getErrorCode();
		Boolean bSuccess = (errorCode == PatcherSpace.Launcher.ErrorCode.OK);
		result.value_0 = ProgramsUpdateRetcode.Success;

		if (errorCode == PatcherSpace.Launcher.ErrorCode.OK)
		{
			if (Application.platform == RuntimePlatform.WindowsPlayer)
			{
				EntryPoint.ExitGame();
			}
			else if (Application.platform == RuntimePlatform.WindowsEditor)		//方便测试用
			{
				foreach (var item in UpdateMessageBox.Pop(GameUpdateManager.Instance.GetString("waiting for finish install"), UpdateMessageBox.MessageBoxType.None))
					yield return item;
				yield return new WaitForSeconds(Single.MaxValue);
			}
			else if (Application.platform == RuntimePlatform.Android)
			{
				foreach (var item in UpdateMessageBox.Pop(GameUpdateManager.Instance.GetString("waiting for finish install"), UpdateMessageBox.MessageBoxType.None))
					yield return item;
				yield return new WaitForSeconds(Single.MaxValue);
			}
		}
		else if (errorCode == PatcherSpace.Launcher.ErrorCode.Fail)
		{
			foreach (var item in UpdateMessageBox.Pop(GameUpdateManager.Instance.GetString("update failed"), UpdateMessageBox.MessageBoxType.None))
				yield return item;
			yield return new WaitForSeconds(Single.MaxValue);
		}
		else if (errorCode == PatcherSpace.Launcher.ErrorCode.NoSpace)
		{
			foreach (var item in UpdateMessageBox.Pop(GameUpdateManager.Instance.GetString("no disk space"), UpdateMessageBox.MessageBoxType.None))
				yield return item;
			yield return new WaitForSeconds(Single.MaxValue);
		}
	}
Example #4
0
	/// <param name="targetVersion">应设为 GetProgramNewestVersion 所得结果</param>
	/// <param name="result">第一个元素表示是否成功</param>
	private static IEnumerable UpdateProgram(VersionParam versionParam, UIPanelUpdate updatePanel, ReturnTuple<ProgramsUpdateRetcode> result)
	{
		//init
		result.value_0 = ProgramsUpdateRetcode.NotSuccess;

		String method = versionParam.updateMethod;
		if (method == "install")
		{
			foreach (var item in InstallCoroutine(versionParam, updatePanel, result))
				yield return item;
		}
		else if (method == "open_url")
		{
			OpenUrl(versionParam.updateUrl);
			var stringTable = GameUpdateManager.Instance.StringTable;
			foreach (var item in UpdateMessageBox.Pop(stringTable["waiting for finish update"], UpdateMessageBox.MessageBoxType.None))
				yield return item;
			yield return new WaitForSeconds(Single.MaxValue);
		}
		else if (method == "yyb")
		{
			foreach (var item in ProgramUpdateYYB.UpdateCoroutine(versionParam, updatePanel, result))
				yield return item;
		}
		else if (method == "pop_yyb")
		{
			foreach (var item in ProgramUpdateYYB.PopYYBCoroutine(versionParam, updatePanel, result))
				yield return item;
		}
		else if (method == "msg")	//实在没辙了可以显示一条消息
		{
			foreach (var item in UpdateMessageBox.Pop(versionParam.updateUrl, UpdateMessageBox.MessageBoxType.None))
				yield return item;

			yield return new WaitForSeconds(Single.MaxValue);
		}
		else
		{
			throw new Exception("unsupported program_update method: " + method);
		}
	}
Example #5
0
	public static IEnumerable UpdateCoroutine(UIPanelUpdate updatePanel, ReturnTuple<ProgramsUpdateRetcode> result, ReturnTuple<MaintenanceInfo> maintenanceInfo)
	{
		result.value_0 = ProgramsUpdateRetcode.NotSuccess;
		maintenanceInfo.value_0.status = false;
		maintenanceInfo.value_0.reason = "";

		//load string table
		var stringTable = GameUpdateManager.Instance.StringTable;

		{	//init update ui
			updatePanel.sub_programTextGroup.SetActive(true);
			updatePanel.sub_resourceTextGroup.SetActive(false);

			updatePanel.sub_progress.value = 0;
			updatePanel.sub_progressText.text = "";
			updatePanel.sub_programLocalVersion.text = "";
			updatePanel.sub_programNewestVersion.text = "";
			updatePanel.sub_statusText.text = "";
		}

		//local version
		ProgramVersionInfo localVersionInfo = GetProgramCurrentVersionInfo();
		
		updatePanel.sub_programLocalVersion.text = localVersionInfo.descriptionName;
		Debug.Log(String.Format("local version: {0}", localVersionInfo.version));

		////Test message box
		//{
		//    var msgBoxRet = new ReturnTuple<UpdateMessageBox.MessageBoxResult>();
		//    foreach (var item in UpdateMessageBox.Pop("Are you sure to update program ?", UpdateMessageBox.MessageBoxType.YES_NO, msgBoxRet))
		//        yield return item;

		//    if (msgBoxRet.value_0 == UpdateMessageBox.MessageBoxResult.NO)
		//    {
		//        result.value_0 = false;
		//        yield break;
		//    }
		//}

		updatePanel.sub_statusText.text = stringTable["checking for update"];
		var getVersionResult = new ReturnTuple<Boolean, String>();		//bSucc, content

		String newestVersionInfo = null;
		if (GNET.DirClient.GetInstance().HasGotInfo())
		{
			newestVersionInfo = GNET.DirClient.GetInstance().GetVersion();
		}
		else
		{
			while (true)
			{
				foreach (var item in GetProgramNewestVersionInfo(getVersionResult))
					yield return item;

				if (getVersionResult.value_0)
				{
					break;
				}
				else	//未取得版本号
				{
					var msgBoxRet = new ReturnTuple<UpdateMessageBox.MessageBoxResult>();
					foreach (var item in UpdateMessageBox.Pop(stringTable["failed to check for update. click confirm to retry"], UpdateMessageBox.MessageBoxType.OK, msgBoxRet))
						yield return item;
				}
			}
			newestVersionInfo = getVersionResult.value_1;
		}

		//分析取得的版本信息
		Exception error = null;
		VersionParam versionParam = new VersionParam();
		try
		{
			SecurityElement versionDoc = SecurityElement.FromString(newestVersionInfo);
			SecurityElement verNode = versionDoc;

			//如果有 specialRegion,按 specialRegion 再找一级
			String specialRegion = PlatformConfig.GetSpecialRegion();
			if (specialRegion != "")
				verNode = verNode.SearchForChildByTag(specialRegion);

			versionParam.newestVersion = Convert.ToInt32(verNode.Attributes["value"].ToString());
			Int32.TryParse(verNode.Attributes["compatible_version"].ToString(), out versionParam.compatibleVersion);

			if (verNode.Attributes["evaluation"] != null && verNode.Attributes["evaluation"].ToString() == "true")
				m_isEvaluation = true;
				
			if (verNode.Attributes["evaluation_version"] != null)
			{
				String evaluation_version_str = verNode.Attributes["evaluation_version"].ToString();
				if (evaluation_version_str.Length > 0)
				{
					Int32 evaluation_version = Convert.ToInt32(verNode.Attributes["evaluation_version"].ToString());
					if (localVersionInfo.version >= evaluation_version)
						m_isEvaluation = true;
				}
			}

			if (verNode.Attributes["evaluation_update"] != null && verNode.Attributes["evaluation_update"].ToString() == "true")
				m_isEvaluationUpdate = true;


			versionParam.minimumResourceVersion = verNode.Attributes["minimum_resource_version"].ToString();
			versionParam.updateMethod = verNode.SearchForChildByTag("update").Attributes["method"].ToString();
			String url = "";
			if (verNode.SearchForChildByTag("update").Attributes.Contains("url"))
				url = verNode.SearchForChildByTag("update").Attributes["url"].ToString();
			versionParam.updateUrl = url;

			if (verNode.SearchForChildByTag("update").Attributes.Contains("md5"))
				versionParam.updateMd5 = verNode.SearchForChildByTag("update").Attributes["md5"].ToString();

			versionParam.newestVersionShowName = verNode.SearchForChildByTag("description").Attributes["name"].ToString();
			versionParam.newestVersionContent = verNode.SearchForChildByTag("description").Attributes["content"].ToString();

			maintenanceInfo.value_0.status = verNode.SearchForChildByTag("maintenance").Attributes["status"].ToString() == "true";
			maintenanceInfo.value_0.reason = verNode.SearchForChildByTag("maintenance").Attributes["reason"].ToString();
			
			PlatformConfig.SetResourceUpdateConfig(verNode.SearchForChildByTag("resource_update"));
		}
		catch (XmlSyntaxException e)
		{	error = e;	}
		catch (NullReferenceException e)
		{	error = e;	}
		catch (FormatException e)
		{	error = e;	}
		catch (OverflowException e)
		{	error = e;	}

		if (error != null)
		{
			Debug.LogWarning("version.xml has format error");
			Debug.LogException(error);
			foreach (var item in UpdateMessageBox.Pop(stringTable["update server has error"], UpdateMessageBox.MessageBoxType.None))
			    yield return item;

			yield return new WaitForSeconds(Single.MaxValue);
		}

		if (IsEvaluation() && !IsEvaluationUpdate())
		{
			result.value_0 = ProgramsUpdateRetcode.Skip;
			yield break;
		}

		//已取得最低资源版本,记下来
		GameUpdateManager.Instance.MinimumResourceVersion = PatcherSpace.Patcher.VersionInfo.FromString(versionParam.minimumResourceVersion);

		updatePanel.sub_programNewestVersion.text = versionParam.newestVersionShowName;

		if (versionParam.newestVersion > localVersionInfo.version)
		{
			PatcherSpace.Launcher.instance().ClearTempDir(versionParam.newestVersion, makeLauncherTempDir());

			Debug.Log(String.Format("has new version: {0}", versionParam.newestVersion));

			while (true)
			{
				ReturnTuple<Boolean> chooseWhetherUpdateResult = new ReturnTuple<Boolean>();
				String title = String.Format(stringTable["newest version is {0}"], versionParam.newestVersionShowName);
				foreach (var item in UpdateChooseBox.ChooseWhetherUpdate(title, versionParam.newestVersionContent, chooseWhetherUpdateResult))
					yield return item;

				if (chooseWhetherUpdateResult.value_0)	//选了“是”
				{
					break;
				}
				else
				{
					//选了“否”
					if (versionParam.compatibleVersion > localVersionInfo.version)	//必须更新
					{
						var msgBoxRet = new ReturnTuple<UpdateMessageBox.MessageBoxResult>();
						foreach (var item in UpdateMessageBox.Pop(stringTable["must update"], UpdateMessageBox.MessageBoxType.OK, msgBoxRet))
							yield return item;
					}
					else	//跳过更新
					{
						result.value_0 = ProgramsUpdateRetcode.Success;
						yield break;
					}
				}
			}

			foreach (var item in UpdateProgram(versionParam, updatePanel, result))
				yield return item;

			if (result.value_0 == ProgramsUpdateRetcode.Fail)
			{
				Debug.Log("UpdateCoroutine failed");
				foreach (var item in UpdateMessageBox.Pop(stringTable["update failed"], UpdateMessageBox.MessageBoxType.None))
					yield return item;
				yield return new WaitForSeconds(Single.MaxValue);
			}
		}
		else
		{
			PatcherSpace.Launcher.instance().ClearTempDir(makeLauncherTempDir());
		}
	}
Example #6
0
 public FileVersionInfo(string filename, string cmfilename, string record, Type type, int off) : base(filename, cmfilename, record, type, off)
 {
     Count    = 0;
     Versions = new List <Version>();
     VP       = new VersionParam();
 }
Example #7
0
 /// <summary>
 /// 查询版本记录分页
 /// </summary>
 /// <returns></returns>
 public PagedResults <Version> GetQuery(VersionParam param)
 {
     return(Repository.AdvQuery(param));
 }