No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OperationParams.cs 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.IO;
  2. using Codice.CM.Common;
  3. using PlasticGui.WebApi;
  4. namespace Unity.PlasticSCM.Editor.Hub.Operations
  5. {
  6. internal class OperationParams
  7. {
  8. internal readonly string WorkspaceFullPath;
  9. internal readonly string Organization;
  10. internal readonly string Repository;
  11. internal readonly RepositorySpec RepositorySpec;
  12. internal readonly string AccessToken;
  13. internal static OperationParams BuildFromCommand(
  14. ParseArguments.Command command,
  15. string unityAccessToken)
  16. {
  17. string workspaceFullPath = command.HasWorkspacePath() ?
  18. Path.GetFullPath(command.WorkspacePath) :
  19. Path.GetFullPath(command.ProjectPath);
  20. return new OperationParams(
  21. workspaceFullPath,
  22. command.Organization,
  23. command.Repository,
  24. BuildRepositorySpec(
  25. command.Organization, command.Repository),
  26. unityAccessToken);
  27. }
  28. static RepositorySpec BuildRepositorySpec(
  29. string organization,
  30. string repository)
  31. {
  32. string defaultCloudAlias = new PlasticWebRestApi()
  33. .GetDefaultCloudAlias();
  34. return new RepositorySpec()
  35. {
  36. Name = repository,
  37. Server = CloudServer.BuildFullyQualifiedName(
  38. organization, defaultCloudAlias)
  39. };
  40. }
  41. OperationParams(
  42. string workspaceFullPath,
  43. string organization,
  44. string repository,
  45. RepositorySpec repositorySpec,
  46. string accessToken)
  47. {
  48. WorkspaceFullPath = workspaceFullPath;
  49. Organization = organization;
  50. Repository = repository;
  51. RepositorySpec = repositorySpec;
  52. AccessToken = accessToken;
  53. }
  54. }
  55. }