Пример #1
0
 public override void VisitIdentifierName(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax node)
 {
     if (node.ToString() == identifier)
     {
         var symbol = model.GetSymbolInfo(node).Symbol;
         if (symbol != null)
         {
             symbols.Add(symbol);
         }
     }
     base.VisitIdentifierName(node);
 }
 public void ChangeState(Microsoft.Transactions.Wsat.StateMachines.State newState)
 {
     if (this.history != null)
     {
         this.history.AddState(newState.ToString());
     }
     if (this.current != null)
     {
         if (DebugTrace.Info)
         {
             DebugTrace.TxTrace(TraceLevel.Info, this.enlistment.EnlistmentId, "Leaving [{0}]", this.current);
         }
         this.current.Leave(this);
     }
     if (DebugTrace.Info)
     {
         DebugTrace.TxTrace(TraceLevel.Info, this.enlistment.EnlistmentId, "Entering [{0}]", newState);
     }
     this.current = newState;
     this.current.Enter(this);
 }
        public static MessageReceiveMode TranslateAzureServiceBusReceiveModeValueToConfigurationValue(Microsoft.ServiceBus.Messaging.ReceiveMode azureServiceBusReceiveMode)
        {
            MessageReceiveMode result;

            switch(azureServiceBusReceiveMode)
            {
                case Microsoft.ServiceBus.Messaging.ReceiveMode.PeekLock:
                    result = MessageReceiveMode.PeekLock;

                    break;

                case Microsoft.ServiceBus.Messaging.ReceiveMode.ReceiveAndDelete:
                    result = MessageReceiveMode.ReceiveAndDelete;

                    break;

                default:
                    throw new ArgumentOutOfRangeException("azureServiceBusReceiveMode", "Unexpected ReceiveMode value specified: " + azureServiceBusReceiveMode.ToString());
            }

            return result;
        }
Пример #4
0
 public static bool TriggerEquals(Microsoft.Win32.TaskScheduler.Trigger a, Microsoft.Win32.TaskScheduler.Trigger b)
 {
     return (a.ToString() == b.ToString()) && (a.StartBoundary == b.StartBoundary) && (a.EndBoundary == b.EndBoundary) && (a.ExecutionTimeLimit == b.ExecutionTimeLimit);
 }
Пример #5
0
 /// <summary>
 /// Sets ComboBox to TaskScheduler.WhichWeek
 /// </summary>
 /// <param name="aWitch">TaskScheduler.WhichWeek</param>
 private void SetWhich(Microsoft.Win32.TaskScheduler.WhichWeek aWitch)
 {
     this.WhichComboBox.SelectedItem = aWitch.ToString().Replace("Week", string.Empty);
 }
Пример #6
0
        /// <summary>
        /// Verify that a specific user has access rights to a specific Registry Key
        /// </summary>
        /// <param name="userName">Name of the user to check for</param>
        /// <param name="root">Root key for the registry key</param>
        /// <param name="subKey">Registry key to check for</param>
        /// <param name="rights">Expected access rights</param>
        public static void VerifyRegistryKeyPermission(string userName, Microsoft.Win32.RegistryKey root, string subKey, RegistryRights rights)
        {
            RegistryKey registryKey = root.OpenSubKey(subKey);
            RegistrySecurity registrySecurity = registryKey.GetAccessControl();
            AuthorizationRuleCollection accessRules = registrySecurity.GetAccessRules(true, true, typeof(NTAccount));

            foreach (RegistryAccessRule accessRule in accessRules)
            {
                if (userName.ToLowerInvariant().Equals(accessRule.IdentityReference.Value.ToLowerInvariant()))
                {
                    if ((accessRule.RegistryRights & rights) == rights)
                    {
                        return;
                    }
                }
            }

            Assert.True(false, string.Format("User '{0}' do not have the correct permessions to RegistryKey '{1}/{2}'.", userName, root.ToString(), subKey));
        }
Пример #7
0
 private void InputManager_KeyPressedCallback(Microsoft.Xna.Framework.Input.Keys key)
 {
     if(!HasKeyboardFocus || !IsEditable)
     {
         return;
     }
     Keys prevKey = Key;
     Key = key;
     Text = key.ToString();
     OnTextModified.Invoke(Text);
     OnKeyModified.Invoke(prevKey, Key, this);
 }
 public static string GetSectionName(Microsoft.Office.Interop.Visio.VisSectionIndices value)
 {
     string s = value.ToString();
     return s.Substring(10); // Get Rid of the visSection prefix
 }
 private void CheckDirectionMenu(Microsoft.Msagl.Drawing.LayerDirection dir) {
     Check(this.direction.ToString(), false);
     this.direction = dir;
     Check(dir.ToString(), true);
 }        
Пример #10
0
 private string GetText(Microsoft.Msagl.Drawing.DrawingObject drawingObject) {
     if (drawingObject == null)
         return "null";
     return drawingObject.ToString();
 }
Пример #11
0
        public void UpdateExecutionPolicy(Microsoft.PowerShell.ExecutionPolicy policy)
        {
            log.Info("Attempting to update Powershell Execution policy");
            using (PWS ps = PWS.Create())
            {
                ps.AddScript("Set-Executionpolicy -Scope CurrentUser -ExecutionPolicy " + policy.ToString());

                //ps.AddScript("./Scripts/PowerShell/UpdateExecutionPolicy.ps1 -policy " + policy.ToString());
                var result = ps.Invoke();
                if (ps.Streams.Error.Count > 0)
                {
                    log.Error(ps.Streams.Error[0].ErrorDetails.Message);
                }

                //log.Info("Current Powershell execution policy changed from '" + result[0].Members["CurrentPolicy"].Value.ToString() + "' to '"+ result[0].Members["NewPolicy"].Value.ToString()+"'");

            }
        }
Пример #12
0
 private void AdControl_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
 {
     Console.Write(e.ToString());
 }
Пример #13
0
        public override bool OnKeyDown(Microsoft.Xna.Framework.Input.Keys k)
        {
            if ((_visible) && (_focus))
            {
                switch (k)
                {
                    case Keys.Back:
                        if ((_text.Length + 1 > _cursor) && (_cursor > 0))
                        {
                            _text = _text.Remove(_cursor - 1, 1);
                            _cursor -= 1;
                        }
                        return true;

                    case Keys.Delete:
                        if (_text.Length + 1 > _cursor + 1)
                            _text = _text.Remove(_cursor, 1);
                        return true;

                    case Keys.Space:
                        _text = _text.Insert(_cursor++, " ");
                        return true;

                    case Keys.Insert:
                        _overwrite = !_overwrite;
                        return true;

                    case Keys.Enter:
                        _parent.HandleEvent(false, Backend.Events.TextEntered);
                        return true;

                    case Keys.Left:
                        if (_cursor > 0)
                            _cursor -= 1;
                        return true;

                    case Keys.Right:
                        if (_cursor < _text.Length)
                            _cursor += 1;
                        return true;

                    case Keys.Home:
                        _cursor = 0;
                        return true;

                    case Keys.End:
                        _cursor = _text.Length - 1;
                        return true;
                    case Keys.D0:
                        _text = _text.Insert(_cursor++, "0");

                        break;
                    case Keys.D1:
                        _text = _text.Insert(_cursor++, "1");

                        break;

                    case Keys.D2:
                        _text = _text.Insert(_cursor++, "2");

                        break;
                    case Keys.D3:
                        _text = _text.Insert(_cursor++, "3");
                        break;
                    case Keys.D4:
                        _text = _text.Insert(_cursor++, "4");

                        break;
                    case Keys.D5:
                        _text = _text.Insert(_cursor++, "5");

                        break;
                    case Keys.D6:
                        _text = _text.Insert(_cursor++, "6");

                        break;
                    case Keys.D7:
                        _text = _text.Insert(_cursor++, "7");

                        break;
                    case Keys.D8:
                        _text = _text.Insert(_cursor++, "8");

                        break;
                    case Keys.D9:
                        _text = _text.Insert(_cursor++, "9");

                        break;
                    default:
                        if (k.ToString().Length == 1)
                        {
                            if ((Keyboard.GetState().IsKeyDown(Keys.LeftShift)) || (Keyboard.GetState().IsKeyDown(Keys.RightShift)))
                                _text = _text.Insert(_cursor, k.ToString().ToUpper());
                            else
                                _text = _text.Insert(_cursor, k.ToString().ToLower());
                            _cursor += 1;
                            return true;
                        }
                        break;

                }
            }
            return false;
        }