コード例 #1
0
		public IBuildToken Create(string text, string mainAssembly, IEnumerable<string> references, Action<Control> controlCreated, Action<Exception> error)
		{
			RemoveOutput();
			var token = new BuildToken();

			var refs = references?.ToList() ?? new List<string>();
			// ensure we use the built-in version of Eto, not the one used by the project
			if (!string.IsNullOrEmpty(mainAssembly))
				refs.Insert(0, mainAssembly);
			refs.RemoveAll(r => Path.GetFileName(r).ToLowerInvariant() == "eto.dll");
			refs.Add(typeof(Control).Assembly.Location);

			ThreadPool.QueueUserWorkItem(state =>
			{
				try
				{
					Assembly generatedAssembly;
					//output = Path.Combine(Path.GetTempPath(), "EtoDesigner", Path.GetRandomFileName() + ".dll");

					var result = Compile(null, refs, text, out generatedAssembly);
					if (result.Success)
					{
						Application.Instance.Invoke(() =>
						{
							try
							{
								var type = FindControlType(generatedAssembly);
								var control = InstantiateControl(type);

								if (token.IsCancelled)
									return;

								if (control != null)
									controlCreated(control);
								else
									error(new FormatException("Could not find control. Make sure you have a single class derived from Control."));
							}
							catch (Exception ex)
							{
								if (!token.IsCancelled)
									error(ex);
							}
						});
					}
					else
					{
						var errorText = string.Join("\n", result.Errors);

						if (!token.IsCancelled)
							Application.Instance.Invoke(() => error(new FormatException(string.Format("Compile error: {0}", errorText))));
					}
				}
				catch (Exception ex)
				{
					if (!token.IsCancelled)
						Application.Instance.Invoke(() => error(ex));
				}
			});
			return token;
		}
コード例 #2
0
ファイル: TokenController.cs プロジェクト: zzekikaya/InGame
        public IActionResult CreateToken([FromBody] LoginModel login)
        {
            IActionResult response = Unauthorized();


            var result = _signInManager.PasswordSignInAsync(login.Username, login.Password, false, false);

            if (result.Result.Succeeded)
            {
                ApplicationUser userInfo   = _userManager.FindByEmailAsync(login.Username).Result;
                var             identity   = _userManager.GetClaimsAsync(userInfo);
                BuildToken      buildToken = new BuildToken(_config);
                string          token      = buildToken.CreateToken(userInfo);

                //_logger.LogInformation("User logged in.");
                _userManager.GetClaimsAsync(userInfo);
                response = Ok(new { token = token });
            }


            return(response);
        }
コード例 #3
0
        public BuildToken Create(BuildTokenViewModel toCreate)
        {
            if (string.IsNullOrWhiteSpace(toCreate.Name))
            {
                throw new EntityValidationException("Token name cannot be blank!");
            }

            if (_db.BuildTokens.Active().Any(bt => bt.Name == toCreate.Name))
            {
                throw new EntityValidationException("A build token with this name already exists!");
            }

            var token = new BuildToken()
            {
                Name   = toCreate.Name,
                Value  = toCreate.Value,
                Active = true
            };

            _db.BuildTokens.Add(token);
            _db.SaveChanges();

            return(Get(token.BuildTokenId));
        }
コード例 #4
0
        void InitializePlastic()
        {
            if (mForceToOpen)
            {
                mForceToOpen = false;
                return;
            }

            try
            {
                if (UnityConfigurationChecker.NeedsConfiguration())
                {
                    return;
                }

                mWkInfo = FindWorkspace.InfoForApplicationPath(
                    Application.dataPath, mPlasticAPI);

                if (mWkInfo == null)
                {
                    return;
                }

                AssetsProcessors.Enable(mPlasticAPI);

                mIsGluonMode = mPlasticAPI.IsGluonWorkspace(mWkInfo);

                mPingEventLoop.SetWorkspace(mWkInfo);
                mEventSenderRestApi.SetToken(BuildToken.FromServerProfile(
                                                 ClientConfig.Get().GetDefaultProfile()));

                InitializeNewIncomingChanges(mWkInfo, mIsGluonMode);

                ViewHost viewHost = new ViewHost();

                PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges =
                    new PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges(mWkInfo);

                mViewSwitcher = new ViewSwitcher(
                    mWkInfo,
                    viewHost,
                    mIsGluonMode,
                    pendingChanges,
                    mDeveloperNewIncomingChangesUpdater,
                    mGluonNewIncomingChangesUpdater,
                    mIncomingChangesNotificationPanel,
                    this);

                mPlasticClient = new PlasticGUIClient(
                    mWkInfo,
                    mViewSwitcher,
                    mViewSwitcher,
                    viewHost,
                    pendingChanges,
                    mDeveloperNewIncomingChangesUpdater,
                    mGluonNewIncomingChangesUpdater,
                    this,
                    new UnityPlasticGuiMessage(this));

                mViewSwitcher.SetPlasticGUIClient(mPlasticClient);
                mViewSwitcher.ShowInitialView();

                mLastUpdateTime = EditorApplication.timeSinceStartup;
            }
            catch (Exception ex)
            {
                mException = ex;

                ExceptionsHandler.HandleException("InitializePlastic", ex);
            }
        }
コード例 #5
0
        void InitializePlastic()
        {
            if (mForceToOpen)
            {
                mForceToOpen = false;
                return;
            }

            try
            {
                if (UnityConfigurationChecker.NeedsConfiguration())
                {
                    return;
                }

                mWkInfo = FindWorkspace.InfoForApplicationPath(
                    Application.dataPath, mPlasticAPI);

                if (mWkInfo == null)
                {
                    AssetMenuItems.Disable();
                    return;
                }

                // SetupCloudProjectId.ForWorkspace(mWkInfo, mPlasticAPI);

                DisableVCSIfEnabled(mWkInfo.ClientPath);

                mIsGluonMode = mPlasticAPI.IsGluonWorkspace(mWkInfo);

                IAssetStatusCache assetStatusCache =
                    new AssetStatusCache(
                        mWkInfo,
                        mIsGluonMode,
                        RepaintProjectWindow);

                AssetsProcessors.Enable(
                    mPlasticAPI,
                    assetStatusCache);

                mPingEventLoop.SetWorkspace(mWkInfo);
                mEventSenderRestApi.SetToken(BuildToken.FromServerProfile(
                                                 ClientConfig.Get().GetDefaultProfile()));

                InitializeNewIncomingChanges(mWkInfo, mIsGluonMode);

                ViewHost viewHost = new ViewHost();

                PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges =
                    new PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges(mWkInfo);

                mViewSwitcher = new ViewSwitcher(
                    mWkInfo,
                    viewHost,
                    mIsGluonMode,
                    pendingChanges,
                    mDeveloperNewIncomingChangesUpdater,
                    mGluonNewIncomingChangesUpdater,
                    mIncomingChangesNotificationPanel,
                    assetStatusCache,
                    this);

                mPlasticClient = new PlasticGUIClient(
                    mWkInfo,
                    mViewSwitcher,
                    mViewSwitcher,
                    viewHost,
                    pendingChanges,
                    mDeveloperNewIncomingChangesUpdater,
                    mGluonNewIncomingChangesUpdater,
                    this,
                    new UnityPlasticGuiMessage(this));

                mViewSwitcher.SetPlasticGUIClient(mPlasticClient);
                mViewSwitcher.ShowInitialView();

                UnityStyles.Initialize(Repaint);

                AssetOperations.IAssetSelection inspectorAssetSelection =
                    new InspectorAssetSelection();

                AssetOperations.IAssetSelection projectViewAssetSelection =
                    new ProjectViewAssetSelection();

                AssetOperations inspectorAssetOperations =
                    new AssetOperations(
                        mWkInfo,
                        mPlasticClient,
                        mViewSwitcher,
                        mViewSwitcher,
                        viewHost,
                        mDeveloperNewIncomingChangesUpdater,
                        assetStatusCache,
                        mViewSwitcher,
                        mViewSwitcher,
                        this,
                        inspectorAssetSelection,
                        mIsGluonMode);

                AssetOperations projectViewAssetOperations =
                    new AssetOperations(
                        mWkInfo,
                        mPlasticClient,
                        mViewSwitcher,
                        mViewSwitcher,
                        viewHost,
                        mDeveloperNewIncomingChangesUpdater,
                        assetStatusCache,
                        mViewSwitcher,
                        mViewSwitcher,
                        this,
                        projectViewAssetSelection,
                        mIsGluonMode);

                AssetMenuItems.Enable(
                    projectViewAssetOperations,
                    assetStatusCache,
                    projectViewAssetSelection);

                DrawInspectorOperations.Enable(
                    inspectorAssetOperations,
                    assetStatusCache,
                    inspectorAssetSelection);

                DrawAssetOverlay.Initialize(
                    assetStatusCache,
                    RepaintProjectWindow);

                AutoCommitOperation.SetPlasticGUIClient(mPlasticClient);

                mLastUpdateTime = EditorApplication.timeSinceStartup;
            }
            catch (Exception ex)
            {
                mException = ex;

                ExceptionsHandler.HandleException("InitializePlastic", ex);
            }
        }
コード例 #6
0
        public IBuildToken Create(string text, string mainAssembly, IEnumerable <string> references, Action <Control> controlCreated, Action <Exception> error)
        {
            RemoveOutput();
            var token = new BuildToken();

            var refs = references?.ToList() ?? new List <string>();

            // ensure we use the built-in version of Eto, not the one used by the project
            if (!string.IsNullOrEmpty(mainAssembly))
            {
                refs.Insert(0, mainAssembly);
            }
            refs.RemoveAll(r => Path.GetFileName(r).ToLowerInvariant() == "eto.dll");
            refs.Add(typeof(Control).Assembly.Location);

            ThreadPool.QueueUserWorkItem(state =>
            {
                try
                {
                    Assembly generatedAssembly;
                    //output = Path.Combine(Path.GetTempPath(), "EtoDesigner", Path.GetRandomFileName() + ".dll");

                    var result = Compile(null, refs, text, out generatedAssembly);
                    if (result.Success)
                    {
                        Application.Instance.Invoke(() =>
                        {
                            try
                            {
                                var type    = FindControlType(generatedAssembly);
                                var control = InstantiateControl(type);

                                if (token.IsCancelled)
                                {
                                    return;
                                }

                                if (control != null)
                                {
                                    controlCreated(control);
                                }
                                else
                                {
                                    error(new FormatException("Could not find control. Make sure you have a single class derived from Control."));
                                }
                            }
                            catch (Exception ex)
                            {
                                if (!token.IsCancelled)
                                {
                                    error(ex);
                                }
                            }
                        });
                    }
                    else
                    {
                        var errorText = string.Join("\n", result.Errors);

                        if (!token.IsCancelled)
                        {
                            Application.Instance.Invoke(() => error(new FormatException(string.Format("Compile error: {0}", errorText))));
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (!token.IsCancelled)
                    {
                        Application.Instance.Invoke(() => error(ex));
                    }
                }
            });
            return(token);
        }
コード例 #7
0
 public KeywordInfo(AppendTokenTo append, TokenType type, BuildToken buildMethod)
 {
     this.AppendTokenTo = append;
     this.TokenType = type;
     this.BuildMethod = buildMethod;
 }