当前位置: 首页>>代码示例>>C#>>正文


C# SecureString.AppendChar方法代码示例

本文整理汇总了C#中System.Security.SecureString.AppendChar方法的典型用法代码示例。如果您正苦于以下问题:C# SecureString.AppendChar方法的具体用法?C# SecureString.AppendChar怎么用?C# SecureString.AppendChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.SecureString的用法示例。


在下文中一共展示了SecureString.AppendChar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainViewModel

        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        /// <param name="windowService">
        /// The window service
        /// </param>
        /// <param name="addinService">
        /// The add-in service
        /// </param>
        /// <param name="settingsService">
        /// The settings service
        /// </param>
        public MainViewModel(IWindowService windowService, IAddinService addinService, ISettingsService settingsService)
        {
            this.windowService = windowService;

            var projects = settingsService.GetProjects();
            var projectModel = projects.FirstOrDefault();

            var tt = addinService.TaskTrackers.First();
            var qs = tt.GenerateQuerySettings();

            if (!projects.Any())
            {
                projectModel = new ProjectModel("Demo project", tt.Id);
                var ss = new SecureString();
                ss.AppendChar('H');
                ss.AppendChar('e');
                ss.AppendChar('l');
                ss.AppendChar('l');
                ss.AppendChar('o');

                var testSettings = new Dictionary<string, SecureString>
                {
                    { "SomeKey1", ss },
                    { "SomeKey2", ss }
                };

                var projectSettings1 = new SettingsModel(projectModel.InternalUrn, testSettings);
                settingsService.SaveProject(projectModel, projectSettings1);
            }

            var projectSettings2 = settingsService.GetProjectSettings(projectModel);
            this.Tasks = new ObservableCollection<ITaskModel>(tt.GetAssignedToUser(projectModel, projectSettings2));

            settingsService.SaveProject(projectModel);
        }
开发者ID:andycb,项目名称:BugView,代码行数:47,代码来源:MainViewModel.cs

示例2: CheckPasswords_PasswordsIsMatching_Returns1

        public void CheckPasswords_PasswordsIsMatching_Returns1()
        {
            SecureString secureString = new SecureString();
            secureString.AppendChar('a');
            secureString.AppendChar('a');
            secureString.AppendChar('a');

            Assert.That(_uut.CheckPasswords(secureString, secureString), Is.EqualTo(1));
        }
开发者ID:IKT4SemesterPRJ,项目名称:Pristjek220,代码行数:9,代码来源:AdminUnitTest.cs

示例3: CheckPasswords_PasswordIsNotMatchingWithOnePasswordBeingNull_Returns0

        public void CheckPasswords_PasswordIsNotMatchingWithOnePasswordBeingNull_Returns0()
        {
            SecureString secureString = new SecureString();
            secureString.AppendChar('a');
            secureString.AppendChar('a');
            secureString.AppendChar('a');
            SecureString secureString2 = null;

            Assert.That(_uut.CheckPasswords(secureString, secureString2), Is.EqualTo(0));
        }
开发者ID:IKT4SemesterPRJ,项目名称:Pristjek220,代码行数:10,代码来源:AdminUnitTest.cs

示例4: ChangeWindowHomeCommand_ChangeWindowToHome_MainWindowTekstIsPristjek220ForbrugerStartside

 public void ChangeWindowHomeCommand_ChangeWindowToHome_MainWindowTekstIsPristjek220ForbrugerStartside()
 {
     _uut.LogInCommand.Execute(this);
     _uut.Username = "TestName";
     var secureString = new SecureString();
     secureString.AppendChar('A');
     secureString.AppendChar('A');
     secureString.AppendChar('A');
     _uut.SecurePassword = secureString;
     Store loginstore = new Store() {StoreName = "Admin"};
     _logIn.CheckUsernameAndPassword(_uut.Username, secureString, ref loginstore).ReturnsForAnyArgs(0);
     Assert.That(_uut.Error, Is.EqualTo("Kodeordet er ugyldigt."));
 }
开发者ID:IKT4SemesterPRJ,项目名称:Pristjek220,代码行数:13,代码来源:LogInViewModelUnitTest.cs

示例5: CheckUsernameAndPassword_CheckIfUsernameIsNotInDatabase_returnMinus1

        public void CheckUsernameAndPassword_CheckIfUsernameIsNotInDatabase_returnMinus1()
        {
            Store storeGotten = _store;
            string username = "test";
            Login login = null;

            SecureString secureString = new SecureString();
            secureString.AppendChar('1');
            secureString.AppendChar('2');
            secureString.AppendChar('3');
            _unitOfWork.Logins.CheckUsername(username).Returns(login);

            Assert.That(_uut.CheckUsernameAndPassword(username, secureString, ref storeGotten), Is.EqualTo(-1));
        }
开发者ID:IKT4SemesterPRJ,项目名称:Pristjek220,代码行数:14,代码来源:LogInUnitTest.cs

示例6: GetPassword

        /// <summary>
        /// Get a password from the console
        /// </summary>
        /// <returns>Password stored in a SecureString</returns>
        private static SecureString GetPassword()
        {
            var password = new SecureString();
            while (true)
            {
                var keyInfo = Console.ReadKey(true);
                if (keyInfo.Key == ConsoleKey.Enter)
                {
                    break;
                }

                if (keyInfo.Key == ConsoleKey.Backspace)
                {
                    if (password.Length > 0)
                    {
                        password.RemoveAt(password.Length - 1);
                        Console.Write("\b \b");
                    }
                }
                else
                {
                    password.AppendChar(keyInfo.KeyChar);
                    Console.Write("*");
                }
            }
            return password;
        }
开发者ID:huoxudong125,项目名称:SourceBrowser,代码行数:31,代码来源:WebProxyAuthenticator.cs

示例7: getInfo

        public void getInfo()
        {
            // Starting with ClientContext, the constructor requires a URL to the
            // server running SharePoint.
            using (ClientContext context = new ClientContext("https://galwaymayoinstitute-my.sharepoint.com/personal/10019488_gmit_ie/"))
            {
                try
                {
                    SecureString passWord = new SecureString();
                    foreach (char c in "ZqzaQG$8".ToCharArray()) passWord.AppendChar(c);//password is ZqzaQG$8
                    context.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);

                    // The SharePoint web at the URL.
                    Web web = context.Web;

                    // Retrieve all lists from the server.
                    context.Load(web.Lists, lists => lists.Include(list => list.Title,  list => list.Id));// For each list, retrieve Title and Id.

                    // Execute query.
                    context.ExecuteQuery();

                    // Enumerate the web.Lists.
                    foreach (Microsoft.SharePoint.Client.List list in web.Lists)
                    {
                        txtInfo.Text = txtInfo.Text + ", " + list.Title + "\n";
                    }
                }
                catch
                {
                    MessageBox.Show("Failed to get Info");
                }
            }
        }
开发者ID:printfImNewHi,项目名称:FinalYearProject,代码行数:33,代码来源:GetSharpointInfo.xaml.cs

示例8: LoginAsRegisteredUserAsync

        public async Task LoginAsRegisteredUserAsync()
        {
            //Prepare
            Mock<LoginStatusChangedEvent> loginStatusChangedEvent = new Mock<LoginStatusChangedEvent>();
            loginStatusChangedEvent.Setup(x => x.Publish(It.IsAny<IUserService>())).Verifiable();

            Mock<IEventAggregator> eventAggregator = new Mock<IEventAggregator>();
            eventAggregator.Setup(x => x.GetEvent<LoginStatusChangedEvent>()).Returns(loginStatusChangedEvent.Object);

            string user = "Foo";
            char[] pass = "1234".ToCharArray();
            SecureString password = new SecureString();
            foreach (char c in pass)
            {
                password.AppendChar(c);
            } 

            //Act 
            IUserService target = new BattlenetService(eventAggregator.Object);
            UserQueryResult result = await target.LoginAsync(user, password);

            //Verify
            Assert.AreEqual(user, target.CurrentUser.Username);
            Assert.IsTrue(target.IsLoggedIn);
            Assert.IsTrue(result.Success);
            Assert.AreEqual(OnlineStatuses.Online, target.OnlineStatus);
            loginStatusChangedEvent.VerifyAll();
        }
开发者ID:Displayedd,项目名称:PrismWpfApplication,代码行数:28,代码来源:BattlenetServiceFixture.cs

示例9: Index

        public ActionResult Index()
        {
            User spUser = null;

            var url = "https://website/";
            var accountName = "accountName";
            var password = "password";

            var securePassword = new SecureString();
            foreach (char c in password)
            {
                securePassword.AppendChar(c);
            }
            var onlineCredentials = new SharePointOnlineCredentials(accountName, securePassword);

            using (var clientContext = new ClientContext(url))
            {
                if (clientContext != null)
                {
                    clientContext.Credentials = onlineCredentials;
                    spUser = clientContext.Web.CurrentUser;
                    clientContext.Load(spUser, user => user.Title);
                    clientContext.ExecuteQuery();
                    ViewBag.UserName = spUser.Title;
                }
            }

            return View();
        }
开发者ID:Vethro,项目名称:Learning,代码行数:29,代码来源:HomeController.cs

示例10: About

        public ActionResult About()
        {
            Global.globalError1 += "Only World No Hello, ";
            using (ClientContext clientContext = new ClientContext("https://stebra.sharepoint.com/sites/sd1"))
            {

                if (clientContext != null)
                {

                    string userName = "[email protected]";

                    SecureString passWord = new SecureString();
                    string passStr = "Simoon123";
                    foreach (char c in passStr.ToCharArray()) passWord.AppendChar(c);

                    clientContext.Credentials = new SharePointOnlineCredentials(userName, passWord);
                    new RemoteEventReceiverManager().AssociateRemoteEventsToHostWeb(clientContext);
                }
            }

            //        var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            //using (var clientContext = spContext.CreateUserClientContextForSPHost())
            //{ new RemoteEventReceiverManager().AssociateRemoteEventsToHostWeb(clientContext); }

            ViewBag.RemoteEvent = " Hello globalError: " + Global.globalError + " \n globalError1: " + Global.globalError1;
            return View();
        }
开发者ID:stebra-consulting,项目名称:newsFlash,代码行数:28,代码来源:HomeController.cs

示例11: EnableRemoteDesktop

        /// <summary>
        /// Invoke the Enable-AzureServiceProjectRemoteDesktop enableRDCmdlet.
        /// </summary>
        /// <param name="username">Username.</param>
        /// <param name="password">Password.</param>
        public static void EnableRemoteDesktop(string username, string password)
        {
            SecureString securePassword = null;
            if (password != null)
            {
                securePassword = new SecureString();
                foreach (char ch in password)
                {
                    securePassword.AppendChar(ch);
                }
                securePassword.MakeReadOnly();
            }

            if (enableRDCmdlet == null)
            {
                enableRDCmdlet = new EnableAzureServiceProjectRemoteDesktopCommand();
                if (mockCommandRuntime == null)
                {
                    mockCommandRuntime = new MockCommandRuntime();
                }
                enableRDCmdlet.CommandRuntime = mockCommandRuntime;
            }

            enableRDCmdlet.Username = username;
            enableRDCmdlet.Password = securePassword;
            enableRDCmdlet.EnableRemoteDesktop();
        }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:32,代码来源:EnableAzureRemoteDesktopCommandTest.cs

示例12: MingleServer

 /// <summary>
 /// Constructs a new MingleServer
 /// </summary>
 /// <param name="hostUrl">Host url</param>
 /// <param name="loginName">Login name of the user</param>
 /// <param name="password">password</param>
 public MingleServer(string hostUrl, string loginName, string password)
 {
     _host = hostUrl;
     _login = loginName;
     _password = new SecureString();
     foreach (var c in password.ToCharArray()) _password.AppendChar(c);
 } 
开发者ID:ThoughtWorksStudios,项目名称:mingle.net,代码行数:13,代码来源:MingleServer.cs

示例13: RunTest

        public ActionResult RunTest()
        {
            var appPath = ConfigurationManager.AppSettings["applicationPath"];
            var pwd = new SecureString();
            foreach(char c in "dense")
                pwd.AppendChar(c);
            var ftpStartInfo = new ProcessStartInfo(appPath)
                                   {
                                       UseShellExecute = false,
                                       RedirectStandardOutput = true,
                                       CreateNoWindow = false,
                                       Domain = "afpi",
                                       UserName = "AFPAutomation",
                                       Password = pwd
                                   };
            try
            {

                Process proc = Process.Start(ftpStartInfo);
                if (proc == null)
                    ViewData["output"] = "Could not start FTP application!";
                else
                    ViewData["output"] = proc.StandardOutput.ReadToEnd().Replace("\r\n","<br />").Replace("\t"," ");
            }
            catch (Exception ex)
            {
                ViewData["output"] = ex.ToString();
            }
            return View();
        }
开发者ID:agglerithm,项目名称:CJRFTP,代码行数:30,代码来源:HomeController.cs

示例14: takePassword

		private SecureString takePassword ()
		{
			SecureString result = new SecureString();

			Console.Write("Password: ");
			while (true)
			{
				ConsoleKeyInfo i = Console.ReadKey(true);
				if (i.Key == ConsoleKey.Enter)
				{
					break;
				}
				else if (i.Key == ConsoleKey.Backspace)
				{
					if (result.Length > 0)
					{
						result.RemoveAt(result.Length - 1);
						Console.Write("\b \b");
					}
				}
				else if (i.Key == ConsoleKey.Spacebar || result.Length > 20) {}
				else
				{
					result.AppendChar(i.KeyChar);
					Console.Write("*");
				}
			}
			Console.WriteLine();

			return result;
		}
开发者ID:frachstudia,项目名称:studies,代码行数:31,代码来源:Client.cs

示例15: SendMonitoringData

        public void SendMonitoringData(int UniqueID, string type, double value)
        {
            // Get access to source site
            using (var ctx = new ClientContext(tenant))
            {
                //Provide count and pwd for connecting to the source
                var passWord = new SecureString();
                foreach (char c in passwordString.ToCharArray()) passWord.AppendChar(c);
                ctx.Credentials = new SharePointOnlineCredentials(userName, passWord);
                // Actual code for operations
                Web web = ctx.Web;
                ctx.Load(web);
                ctx.ExecuteQuery();

                List myList = web.Lists.GetByTitle("MonitorLiveData");

                ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
                ListItem newItem = myList.AddItem(itemCreateInfo);
                newItem["AlertID"] = UniqueID.ToString();
                newItem["DataType"] = type.ToString();
                newItem["DataValue"] = value;
                newItem.Update();

                ctx.ExecuteQuery();
            }
        }
开发者ID:Inmeta,项目名称:aspc2016,代码行数:26,代码来源:Service1.svc.cs


注:本文中的System.Security.SecureString.AppendChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。