Ejemplo n.º 1
1
        protected AbstractMsmqListener(
            IQueueStrategy queueStrategy,
            Uri endpoint,
            int threadCount,
            IMessageSerializer messageSerializer,
            IEndpointRouter endpointRouter,
            TransactionalOptions transactional,
            IMessageBuilder<Message> messageBuilder)
        {
            this.queueStrategy = queueStrategy;
            this.messageSerializer = messageSerializer;
            this.endpointRouter = endpointRouter;
            this.endpoint = endpoint;

            this.threadCount = threadCount;
            threads = new Thread[threadCount];

            switch (transactional)
            {
                case TransactionalOptions.Transactional:
                    this.transactional = true;
                    break;
                case TransactionalOptions.NonTransactional:
                    this.transactional = false;
                    break;
                case TransactionalOptions.FigureItOut:
                    this.transactional = null;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("transactional");
            }
            this.messageBuilder = messageBuilder;
            this.messageBuilder.Initialize(Endpoint);
        }
Ejemplo n.º 2
0
        public override async Task FixAsync()
        {
            if (IsFixed.GetValueOrDefault(false))
                return;
            await Task.Run(() =>
                {
                    Backup();
                    // Bold Fonts
                    Helper.ReplaceInFile(FilePath, "arialbd.ttf", "msyhbd.ttf");
                    Helper.ReplaceInFile(FilePath, "verdanab.ttf", "msyhbd.ttf");
                    Helper.ReplaceInFile(FilePath, "DejaVuSans-Bold.ttf", "msyhbd.ttf");
                    Helper.ReplaceInFile(FilePath, "FRQITCBT.ttf", "msyhbd.ttf");
                    Helper.ReplaceInFile(FilePath, "Garuda-Bold.ttf", "msyhbd.ttf");
                    Helper.ReplaceInFile(FilePath, "SpiegelCDB.otf", "msyhbd.ttf");
                    Helper.ReplaceInFile(FilePath, "LucasFonts-SpiegelCdOT-SemiBold.otf", "msyhbd.ttf");

                    // Regular fonts
                    Helper.ReplaceInFile(FilePath, "arial.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "ariblk.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "verdana.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "times.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "tahoma.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "DejaVuSans.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "FRQITC01.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "Garuda.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "UTMEssendineCaps.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "UttumDotum.ttf", "msyh.ttf");
                    Helper.ReplaceInFile(FilePath, "LucasFonts-SpiegelCdOT-Regular.otf", "msyh.ttf");
                    IsFixed = null;
                });
        }
Ejemplo n.º 3
0
        public static bool InDesignMode()
        {
            if (cachedInDesignModeResult.HasValue) return cachedInDesignModeResult.Value;

            if (current != null) {
                cachedInDesignModeResult = current.InDesignMode();
                if (cachedInDesignModeResult.HasValue) return cachedInDesignModeResult.Value;
            }
            
            // Check Silverlight / WP8 Design Mode
            var type = Type.GetType("System.ComponentModel.DesignerProperties, System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", false);
            if (type != null) {
                var mInfo = type.GetMethod("GetIsInDesignMode");
                var dependencyObject = Type.GetType("System.Windows.Controls.Border, System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", false);

                if (dependencyObject != null) {
                    cachedInDesignModeResult = (bool)mInfo.Invoke(null, new object[] { Activator.CreateInstance(dependencyObject) });
                }
            } else if((type = Type.GetType("System.ComponentModel.DesignerProperties, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", false)) != null) {
                // loaded the assembly, could be .net 
                var mInfo = type.GetMethod("GetIsInDesignMode");
                Type dependencyObject = Type.GetType("System.Windows.DependencyObject, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", false);
                if (dependencyObject != null) {
                    cachedInDesignModeResult = (bool)mInfo.Invoke(null, new object[] { Activator.CreateInstance(dependencyObject) });
                }
            } else if ((type = Type.GetType("Windows.ApplicationModel.DesignMode, Windows, ContentType=WindowsRuntime", false)) != null) {
                // check WinRT next
                cachedInDesignModeResult = (bool)type.GetProperty("DesignModeEnabled").GetMethod.Invoke(null, null);
            } else {
                cachedInDesignModeResult = false;
            }

            return cachedInDesignModeResult.GetValueOrDefault();
        }
Ejemplo n.º 4
0
		public bool? GetValue ()
		{
			if (itsValue == null)
			{
				if (itsOperandName != string.Empty)
				{
					itsValue = KGFLogicAnalyzer.GetOperandValue (itsOperandName);
					if (itsValue == null)
					{
						return null;
					}
					else
					{
						return itsValue;
					}
				}
				else
				{
					return Evaluate ();
				}
			}
			else
			{
				return itsValue.Value;
			}
		}
Ejemplo n.º 5
0
		public void CopyValuesFrom (DockVisualStyle style)
		{
			if (style.PadBackgroundColor != null)
				PadBackgroundColor = style.PadBackgroundColor;
			if (style.PadTitleLabelColor != null)
				PadTitleLabelColor = style.PadTitleLabelColor;
			if (style.TabStyle != null)
				TabStyle = style.TabStyle;
			if (style.TreeBackgroundColor != null)
				TreeBackgroundColor = style.TreeBackgroundColor;
			if (style.ShowPadTitleIcon != null)
				ShowPadTitleIcon = style.ShowPadTitleIcon;
			if (style.UppercaseTitles != null)
				UppercaseTitles = style.UppercaseTitles;
			if (style.ExpandedTabs != null)
				ExpandedTabs = style.ExpandedTabs;
			if (style.InactivePadBackgroundColor != null)
				InactivePadBackgroundColor = style.InactivePadBackgroundColor;
			if (style.PadTitleHeight != null)
				PadTitleHeight = style.PadTitleHeight;
			if (style.SingleColumnMode != null)
				SingleColumnMode = style.SingleColumnMode;
			if (style.SingleRowMode != null)
				SingleRowMode = style.SingleRowMode;
		}
Ejemplo n.º 6
0
Archivo: Team.cs Proyecto: gwupe/Gwupe
 public void InitTeam(TeamElement teamElement)
 {
     InitParty(teamElement);
     bool foundMe = false;
     var currentUsername = GwupeClientAppContext.CurrentAppContext.CurrentUserManager.CurrentUser.Username;
     _teamMembers.Clear();
     _playerRequest = null;
     foreach (var teamMemberElement in teamElement.teamMembers)
     {
         var teamMember = new TeamMember(teamMemberElement);
         _teamMembers.Add(teamMember);
         Logger.Debug("Adding team member " + teamMember);
         if (!foundMe && teamMember.Username.Equals(currentUsername))
         {
             Logger.Debug("Found myself in the team list, adding my membership status " + teamMember);
             Admin = teamMember.Admin;
             Player = teamMember.Player;
             foundMe = true;
         }
     }
     if (!foundMe)
     {
         Admin = false;
         Player = PlayerMembership.none;
     }
 }
Ejemplo n.º 7
0
 private void CheckMediaLinkEntry()
 {
     Func<ClientPropertyAnnotation, bool> predicate = null;
     this.isMediaLinkEntry = false;
     MediaEntryAttribute mediaEntryAttribute = (MediaEntryAttribute) this.ElementType.GetCustomAttributes(typeof(MediaEntryAttribute), true).SingleOrDefault<object>();
     if (mediaEntryAttribute != null)
     {
         this.isMediaLinkEntry = true;
         if (predicate == null)
         {
             predicate = p => p.PropertyName == mediaEntryAttribute.MediaMemberName;
         }
         ClientPropertyAnnotation annotation = this.Properties().SingleOrDefault<ClientPropertyAnnotation>(predicate);
         if (annotation == null)
         {
             throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.ClientType_MissingMediaEntryProperty(this.ElementTypeName, mediaEntryAttribute.MediaMemberName));
         }
         this.mediaDataMember = annotation;
     }
     if (this.ElementType.GetCustomAttributes(typeof(HasStreamAttribute), true).Any<object>())
     {
         this.isMediaLinkEntry = true;
     }
     if (this.isMediaLinkEntry.HasValue && this.isMediaLinkEntry.Value)
     {
         this.SetMediaLinkEntryAnnotation();
     }
 }
        public void Setup()
        {
            //Instance Fields Setup
            BooleanField = null;
            ByteField = null;
            SByteField = null;
            IntField = null;
            LongField = null;
            Int16Field = null;
            UInt16Field = null;
            Int32Field = null;
            UInt32Field = null;
            Int64Field = null;
            UInt64Field = null;
            CharField = null;
            DoubleField = null;
            FloatField = null;

            //Static Fields Setup
            BooleanFieldStatic = null;
            ByteFieldStatic = null;
            SByteFieldStatic = null;
            IntFieldStatic = null;
            LongFieldStatic = null;
            Int16FieldStatic = null;
            UInt16FieldStatic = null;
            Int32FieldStatic = null;
            UInt32FieldStatic = null;
            Int64FieldStatic = null;
            UInt64FieldStatic = null;
            CharFieldStatic = null;
            DoubleFieldStatic = null;
            FloatFieldStatic = null;
        }
Ejemplo n.º 9
0
 //We Fail completely if there is a parse or index error anywhere in the file
 //We could skip lines with parse errors, but we have no way to alert the user
 protected override IEnumerable<ArgosTransmission> GetTransmissions(IEnumerable<string> lines)
 {
     //Each line looks like \"abc\";\"def\";\"pdq\";\"xyz\";
     int lineNumber = 1;
     foreach (var line in lines.Skip(1))
     {
         lineNumber++;
         if (String.Equals(line.Trim(), "MAX_RESPONSE_REACHED", StringComparison.InvariantCultureIgnoreCase))
         {
             _maxResponseReached = true;
             yield break;
         }
         var tokens = line.Substring(1, line.Length - 3).Split(new[] { "\";\"" }, StringSplitOptions.None);
         var transmission = new ArgosTransmission
         {
             LineNumber = lineNumber,
             ProgramId = tokens[0],
             PlatformId = tokens[1],
             DateTime = DateTime.Parse(tokens[7], CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind),
             Location = String.IsNullOrEmpty(tokens[13]) ? null : new ArgosTransmission.ArgosLocation
             {
                 DateTime = DateTime.Parse(tokens[13], CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind),
                 Latitude = Single.Parse(tokens[14]),
                 Longitude = Single.Parse(tokens[15]),
                 Altitude = Single.Parse(tokens[16]),
                 Class = tokens[17][0]
             }
         };
         transmission.AddHexString(tokens[38]);
         transmission.AddLine(line);
         yield return transmission;
     }
     _maxResponseReached = false;
 }
		public override void PerformGetValue()
		{
			base.PerformGetValue();
			GameObject[] values = this.GetValue().Cast<GameObject>().ToArray();

			this.BeginUpdate();
			if (values.Any())
			{
				GameObject parent = values.First().Parent;

				this.active = values.First().ActiveSingle;
				if (!values.All(o => o.ActiveSingle == active.Value)) this.active = null;

				if (values.Count() == 1)
				{
					this.displayedName = values.First().Name;
					this.displayedNameExt = values.First().Parent != null ? " in " + parent.FullName : "";
				}
				else
				{
					this.displayedName = string.Format(DualityEditor.EditorRes.GeneralRes.PropertyGrid_N_Objects, values.Count());
					this.displayedNameExt = "";
				}
				this.prefabLinked = values.Any(o => o.PrefabLink != null);
				this.prefabLinkAvailable = values.All(o => o.PrefabLink == null || o.PrefabLink.Prefab.IsAvailable);

				this.Invalidate();
			}
			this.EndUpdate();
		}
Ejemplo n.º 11
0
 public override void Parse(GameBitBuffer buffer)
 {
     ActorId = buffer.ReadInt(32);
     if (buffer.ReadBool())
     {
         Position = new Vector3D();
         Position.Parse(buffer);
     }
     if (buffer.ReadBool())
     {
         Angle = buffer.ReadFloat32();
     }
     if (buffer.ReadBool())
     {
         TurnImmediately = buffer.ReadBool();
     }
     if (buffer.ReadBool())
     {
         Speed = buffer.ReadFloat32();
     }
     if (buffer.ReadBool())
     {
         Field5 = buffer.ReadInt(25);
     }
     if (buffer.ReadBool())
     {
         AnimationTag = buffer.ReadInt(21) + (-1);
     }
     if (buffer.ReadBool())
     {
         Field7 = buffer.ReadInt(32);
     }
 }
Ejemplo n.º 12
0
        public void ApplyTheme()
        {
            bool isDarkTheme = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible;
            if (this._isCurrentDarkTheme == isDarkTheme)
            {
                return;
            }

            this._isCurrentDarkTheme = isDarkTheme;

            Color background = this.GetColor("Background", isDarkTheme);
            Color threadTitle = this.GetColor("ThreadTitle", isDarkTheme);
            Color primaryText = this.GetColor("PrimaryText", isDarkTheme);
            Color itemInfo = this.GetColor("ItemInfo", isDarkTheme);
            Color listSeparator = this.GetColor("ListSeparator", isDarkTheme);
            Color postBackground = this.GetColor("PostBackground", isDarkTheme);
            Color postBorder = this.GetColor("PostBorder", isDarkTheme);
            Color postnumber = this.GetColor("PostNumber", isDarkTheme);
            Color linkForeground = this.GetColor("LinkForeground", isDarkTheme);
            Color spoilerForeground = this.GetColor("SpoilerForeground", isDarkTheme);
            Color spoilerBackground = this.GetColor("SpoilerBackground", isDarkTheme);

            this.SetColor("ThemeBackground", background);
            this.SetColor("ThemeThreadTitle", threadTitle);
            this.SetColor("ThemePrimaryText", primaryText);
            this.SetColor("ThemeItemInfo", itemInfo);
            this.SetColor("ThemeListSeparator", listSeparator);
            this.SetColor("ThemePostBorder", postBorder);
            this.SetColor("ThemePostBackground", postBackground);
            this.SetColor("ThemePostNumber", postnumber);
            this.SetColor("ThemeLinkForeground", linkForeground);
            this.SetColor("ThemeSpoilerForeground", spoilerForeground);
            this.SetColor("ThemeSpoilerBackground", spoilerBackground);
        }
Ejemplo n.º 13
0
 internal LinuxNetworkInterface(string name) : base(name)
 {
     _operationalStatus = GetOperationalStatus(name);
     _supportsMulticast = GetSupportsMulticast(name);
     _speed = GetSpeed(name);
     _ipProperties = new LinuxIPInterfaceProperties(this);
 }
Ejemplo n.º 14
0
        /// <exclude />
        protected override void OnLoad(System.EventArgs e)
        {
            _posted = false;
            base.OnLoad(e);

            if (Attributes["HasCallbackId"] == "true" && Attributes["callbackid"].IsNullOrEmpty())
            {
                Attributes.Remove("HasCallbackId");
                Attributes["callbackid"] = this.UniqueID;
            }

            _callbackid = this.Attributes["callbackid"] ?? string.Empty;
            _methodName = Attributes["OnCommand"];

            // NOTE: to be removed
            if(_methodName.IsNullOrEmpty())
            {
                _methodName = Attributes["OnServerClick"];
            }

            if(_callbackid != null
                && Page.IsPostBack 
                && !Page.Request.Form["__EVENTTARGET"].IsNullOrEmpty()
                && Page.Request.Form["__EVENTTARGET"].Replace('$', '_') == _callbackid.Replace('$', '_'))
            {
                _posted = true;
                if(_methodName != null)
                {
                    this.Page.RegisterRequiresRaiseEvent(new PostBackEventHandler(this));
                }
            }
        }
Ejemplo n.º 15
0
        internal FieldSchema(DataRow row)
        {
            ColumnName = toString(row, "ColumnName");
            ColumnOrdinal = toInt(row, "ColumnOrdinal");
            ColumnSize = toInt(row, "ColumnSize");
            NumericPrecision = toInt(row, "NumericPrecision");
            NumericScale = toInt(row, "NumericScale");
            DataType = toType(row, "DataType");
            ProviderType = toInt(row, "ProviderType");
            IsLong = toBool(row, "IsLong");
            AllowDBNull = toBool(row, "AllowDBNull");
            IsUnique = toBool(row, "IsUnique");
            IsKey = toBool(row, "IsKey");
            BaseSchemaName = toString(row, "BaseSchemaName");
            BaseTableName = toString(row, "BaseTableName");
            BaseColumnName = toString(row, "BaseColumnName");

            // --------------------------------------------------
            // SqlServer Only
            // --------------------------------------------------
            //IsReadOnly = toBool(row, "IsReadOnly");
            //IsRowVersion = toBool(row, "IsRowVersion");
            //IsAutoIncrement = toBool(row, "IsAutoIncrement");
            //BaseCatalogName = toString(row, "BaseCatalogName");

            // --------------------------------------------------
            // Oracle Only
            // --------------------------------------------------
            //IsAliased = toBool(row, "IsAliased");
            //IsExpression = toBool(row, "IsExpression");
            //ProviderSpecificDataType = toType(row, "ProviderSpecificDataType");
        }
Ejemplo n.º 16
0
 public void Reset()
 {
     lock (@lock)
     {
         updateNeeded = null;
     }
 }
        public bool UpdateNeeded()
        {
            if (updateNeeded != null)
                return updateNeeded.Value;

            lock (@lock)
            {
                if (updateNeeded != null)
                    return updateNeeded.Value;

                var connectionString = connectionStringProvider.ConnectionString;

                string error;
                var databaseProvider = currentProviderLookup[connectionStringProvider.DatabaseProvider.ToLower()];
                if (databaseProvider.TryConnect(connectionString, out error))
                {
                    var currentScripts = database.GetCoreExecutedScripts(databaseProvider.GetConnectionFactory(connectionString));
                    var requiredScripts = database.GetCoreRequiredScripts();
                    var notRun = requiredScripts.Select(x => x.Trim().ToLowerInvariant())
                        .Except(currentScripts.Select(x => x.Trim().ToLowerInvariant()))
                        .ToList();

                    updateNeeded = notRun.Count > 0
                        || ExtensionsRequireUpdate(extensions, database, databaseProvider, connectionString);
                }
                else
                {
                    updateNeeded = true;
                }

                return updateNeeded.Value;
            }
        }
Ejemplo n.º 18
0
 public void SetContentType(string acceptableMediaTypes, string acceptableCharSets)
 {
     this.acceptMediaTypes = acceptableMediaTypes;
     this.acceptCharSets = acceptableCharSets;
     this.format = null;
     this.useFormat = false;
 }
Ejemplo n.º 19
0
        public override bool NewUpdatesAvailable(string tangra3Path)
        {
            if (m_NewUpdateRequired.HasValue)
                return m_NewUpdateRequired.Value;

            Assembly asm = GetLocalTangra3UpdateAssembly();
            if (asm != null)
            {
                CustomAttributeData[] atts = asm.GetCustomAttributesData().Where(x=>x.Constructor.DeclaringType == typeof(AssemblyFileVersionAttribute)).ToArray();
                if (atts.Length == 1)
                {
                    string currVersionString = (atts[0]).ConstructorArguments[0].Value.ToString();
                    int currVersionAsInt = Config.Instance.Tangra3UpdateVersionStringToVersion(currVersionString);

                    m_NewUpdateRequired = base.Version > currVersionAsInt;
                    if (m_NewUpdateRequired.Value)
                    {
                        Trace.WriteLine(string.Format("Update required for '{0}': local version: {1}; server version: {2}", SharedUpdateConstants.MAIN_UPDATER_EXECUTABLE_NAME, currVersionAsInt, Version));
                        return true;
                    }
                }
            }

            return false;
        }
 public override void SetKey(AsymmetricAlgorithm key) {
     if (key == null) 
         throw new ArgumentNullException("key");
     Contract.EndContractBlock();
     _rsaKey = (RSA) key;
     _rsaOverridesDecrypt = default(bool?);
 }
Ejemplo n.º 21
0
 public void SetContentType(ODataFormat payloadFormat)
 {
     this.acceptCharSets = null;
     this.acceptMediaTypes = null;
     this.format = payloadFormat;
     this.useFormat = true;
 }
 // constructors
 /// <summary>
 /// Creates a new instance of MongoUrlBuilder.
 /// </summary>
 public MongoUrlBuilder()
 {
     _connectionMode = ConnectionMode.Automatic;
     _connectTimeout = MongoDefaults.ConnectTimeout;
     _databaseName = null;
     _defaultCredentials = null;
     _fsync = null;
     _guidRepresentation = MongoDefaults.GuidRepresentation;
     _ipv6 = false;
     _journal = null;
     _maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
     _maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
     _maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
     _minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
     _readPreference = null;
     _replicaSetName = null;
     _secondaryAcceptableLatency = MongoDefaults.SecondaryAcceptableLatency;
     _servers = null;
     _slaveOk = null;
     _socketTimeout = MongoDefaults.SocketTimeout;
     _useSsl = false;
     _verifySslCertificate = true;
     _w = null;
     _waitQueueMultiple = MongoDefaults.WaitQueueMultiple;
     _waitQueueSize = MongoDefaults.WaitQueueSize;
     _waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
     _wTimeout = null;
 }
 public void SetUp()
 {
     MockValidator<object>.ResetCaches();
     validationStatusOnCallback = null;
     valueConvertEventArgs = null;
     validationPerformedEventArgs = null;
 }
        public static void AssertOracleClientIsInstalled()
        {
            if (!oracleClientIsInstalled.HasValue)
            {
                try
                {
                    var factory = new DatabaseProviderFactory(OracleTestConfigurationSource.CreateConfigurationSource());
                    var db = factory.Create("OracleTest");
                    var conn = db.CreateConnection();
                    conn.Open();
                    conn.Close();
                }
                catch (Exception ex)
                {
                    if (ex.Message != null && ex.Message.Contains("System.Data.OracleClient")
                        && ex.Message.Contains("8.1.7"))
                    {
                        oracleClientIsInstalled = false;
                        oracleClientNotInstalledErrorMessage = ex.Message;
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            if (oracleClientIsInstalled.HasValue && oracleClientIsInstalled.Value == false)
            {
                Assert.Inconclusive(oracleClientNotInstalledErrorMessage);
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Determines if the Roslyn extensions for Visual Studio are installed.
        /// </summary>
        /// <remarks>
        /// This method caches the result after it is first checked with the IDE.
        /// </remarks>
        /// <param name="serviceProvider">A service provider for accessing global IDE services.</param>
        /// <returns>
        /// <see langword="true"/> if the Roslyn extensions are installed.
        /// <para>-or-</para>
        /// <para><see langword="false"/> if the Roslyn extensions are not installed.</para>
        /// <para>-or-</para>
        /// <para>null if the result of this method has not been cached from a previous call, and <paramref name="serviceProvider"/> is <see langword="null"/> or could not be used to obtain an instance of <see cref="IVsShell"/>.</para>
        /// </returns>
        public static bool? IsRoslynInstalled(IServiceProvider serviceProvider)
        {
            if (roslynInstalled.HasValue)
                return roslynInstalled;

            if (IsFinalRoslyn)
            {
                roslynInstalled = true;
                return true;
            }

            if (serviceProvider == null)
                return null;

            IVsShell vsShell = serviceProvider.GetService(typeof(SVsShell)) as IVsShell;
            if (vsShell == null)
                return null;

            Guid guid = new Guid("6cf2e545-6109-4730-8883-cf43d7aec3e1");
            int isInstalled;
            if (ErrorHandler.Succeeded(vsShell.IsPackageInstalled(ref guid, out isInstalled)))
                roslynInstalled = isInstalled != 0;

            return roslynInstalled;
        }
Ejemplo n.º 26
0
 public PuzzleMap(Puzzle owner)
 {
     puzzle = owner;
     map = new SokobanMap();
     solutions = new List<Solution>();
     isMasterMap = null;
 }
Ejemplo n.º 27
0
        private IParentViewModel GetParentMock()
        {
            var parentViewModelMoq = new Mock<IParentViewModel>();
            parentViewModelMoq
                .Setup(x => x.CloseItem(It.Is<IViewModel>(vm => vm == _instance)))
                .Callback(() =>
                {
                    _closed = true;
                    _activated = false;
                });

            parentViewModelMoq
                .Setup(x => x.ActivateItem(It.Is<IViewModel>(vm => vm == _instance)))
                .Callback(() =>
                {
                    _activated = true;
                    _closed = false;
                });

            parentViewModelMoq
                .Setup(x => x.ActivateItem(It.Is<IViewModel>(vm => vm != _instance)))
                .Callback(() =>
                {
                    _activated = false;
                });

            var parentMock = parentViewModelMoq.Object;
            return parentMock;
        }
Ejemplo n.º 28
0
 // constructors
 /// <summary>
 /// Creates a new instance of MongoUrlBuilder.
 /// </summary>
 public MongoUrlBuilder()
 {
     _authenticationMechanism = MongoDefaults.AuthenticationMechanism;
     _authenticationMechanismProperties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
     _authenticationSource = null;
     _connectionMode = ConnectionMode.Automatic;
     _connectTimeout = MongoDefaults.ConnectTimeout;
     _databaseName = null;
     _fsync = null;
     _guidRepresentation = MongoDefaults.GuidRepresentation;
     _ipv6 = false;
     _journal = null;
     _maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
     _maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
     _maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
     _minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
     _password = null;
     _readConcernLevel = null;
     _readPreference = null;
     _replicaSetName = null;
     _localThreshold = MongoDefaults.LocalThreshold;
     _servers = new[] { new MongoServerAddress("localhost", 27017) };
     _serverSelectionTimeout = MongoDefaults.ServerSelectionTimeout;
     _socketTimeout = MongoDefaults.SocketTimeout;
     _username = null;
     _useSsl = false;
     _verifySslCertificate = true;
     _w = null;
     _waitQueueMultiple = MongoDefaults.WaitQueueMultiple;
     _waitQueueSize = MongoDefaults.WaitQueueSize;
     _waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
     _wTimeout = null;
 }
Ejemplo n.º 29
0
 static StaticConfiguration()
 {
     disableErrorTraces = !(disableCaches = IsRunningDebug);
     CaseSensitive = false;
     RequestQueryFormMultipartLimit = 1000;
     AllowFileStreamUploadAsync = true;
 }
Ejemplo n.º 30
0
 public ComplexExplanation(bool match, float value, string description)
     : base(value, description)
 {
     // NOTE: use of "boolean" instead of "Boolean" in params is conscious
     // choice to encourage clients to be specific.
     this.match = Convert.ToBoolean(match);
 }
 /// <summary>
 /// Initializes a new instance of the RoleAssignmentFilter class.
 /// </summary>
 /// <param name="principalId">Returns role assignment of the specific
 /// principal.</param>
 /// <param name="canDelegate">The Delegation flag for the
 /// roleassignment</param>
 public RoleAssignmentFilter(string principalId = default(string), bool?canDelegate = default(bool?))
 {
     PrincipalId = principalId;
     CanDelegate = canDelegate;
     CustomInit();
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderByAttribute"/> class.
 /// </summary>
 public OrderByAttribute()
 {
     _defaultEnableOrderBy = true;
 }
Ejemplo n.º 33
0
        public IEnumerable<ScheduledTask> GetScheduledTasks(out int totalMatches, string searchText = null, bool? enableStatus = null, int page = 1,
            int count = Int32.MaxValue)
        {
            var query = Repository;
            if (!searchText.IsNullEmptyOrWhiteSpace())
                query = query.Where(x => x.Name.StartsWith(searchText));
            if (enableStatus.HasValue)
                query = query.Where(x => x.Enabled == enableStatus);

            query = query.OrderBy(x => x.Name);
            return query.SelectWithTotalMatches(out totalMatches, page, count);
        }
Ejemplo n.º 34
0
		public override void Initialize(SocketGuild server)
		{
			commandPrefix = '!';
			showUnknownCommandMessage = true;
			embedColor = new Color(168,125,101);
		}
Ejemplo n.º 35
0
        public IMDResponse<List<EntFolioReporte>> CGetFolios([FromUri]int? piIdFolio = null, [FromUri]int? piIdEmpresa = null, [FromUri]int? piIdProducto = null, [FromUri]int? piIdOrigen = null, [FromUri]string psFolio = null, [FromUri]string psOrdenConekta = null, [FromUri]bool? pbTerminosYCondiciones = null, [FromUri]bool? pbActivo = true, [FromUri]bool? pbBaja = false, [FromUri]bool? pbVigente = null)
        {
            IMDResponse<List<EntFolioReporte>> response = new IMDResponse<List<EntFolioReporte>>();

            string metodo = nameof(this.CGetFolios);
            logger.Info(IMDSerialize.Serialize(67823458436041, $"Inicia {metodo}([FromUri]int? piIdFolio = null, [FromUri]int? piIdEmpresa = null, [FromUri]int? piIdProducto = null, [FromUri]int? piIdOrigen = null, [FromUri]string psFolio = null, [FromUri]string psOrdenConekta = null, [FromUri]bool? pbTerminosYCondiciones = null, [FromUri]bool? pbActivo = true, [FromUri]bool? pbBaja = false)", piIdFolio, piIdEmpresa, piIdProducto, piIdOrigen, psFolio, psOrdenConekta, pbTerminosYCondiciones, pbActivo, pbBaja));

            try
            {
                BusFolio busFolio = new BusFolio();
                response = busFolio.BGetFolios(piIdFolio, piIdEmpresa, piIdProducto, piIdOrigen, psFolio, psOrdenConekta, pbTerminosYCondiciones, pbActivo, pbBaja, pbVigente);
            }
            catch (Exception ex)
            {
                response.Code = 67823458436818;
                response.Message = "Ocurrió un error inesperado en el servicio al consultar los folios del sistema.";

                logger.Error(IMDSerialize.Serialize(67823458436818, $"Error en {metodo}([FromUri]int? piIdFolio = null, [FromUri]int? piIdEmpresa = null, [FromUri]int? piIdProducto = null, [FromUri]int? piIdOrigen = null, [FromUri]string psFolio = null, [FromUri]string psOrdenConekta = null, [FromUri]bool? pbTerminosYCondiciones = null, [FromUri]bool? pbActivo = true, [FromUri]bool? pbBaja = false): {ex.Message}", piIdFolio, piIdEmpresa, piIdProducto, piIdOrigen, psFolio, psOrdenConekta, pbTerminosYCondiciones, pbActivo, pbBaja, ex, response));
            }
            return response;
        }
Ejemplo n.º 36
0
        public BsDialog AddButton(string label, string action, string cssClass = null, int hotkey = 0, string icon = null, bool?autospin = null)
        {
            var str = @"{
            label: '" + label + @"',
            " + (hotkey == 0 ? "" : "hotkey: " + hotkey + ",") + @"
            " + (string.IsNullOrEmpty(cssClass) ? "" : "cssClass: '" + cssClass + "',") + @"
            " + (string.IsNullOrEmpty(icon) ? "" : "icon: '" + icon + "',") + @"
            " + (autospin == null ? "" : "autospin: '" + autospin + "',") + @"
            action: " + action + @"
        }";

            ButtonAttributes.Add("", str);
            SetScript();
            return(this);
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
		/// <param name="useProvidedId">If true, the provided Id value will be used as the ProductSortDefinitionId. If omitted or false, the system will generate a ProductSortDefinitionId</param>
		/// <param name="definition">Properties of the new product sort definition. Required properties of StartDate and Name.</param>
		/// <returns>
		///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.ProductSortDefinition"/>}
		/// </returns>
		/// <example>
		/// <code>
		///   var mozuClient=AddProductSortDefinition(dataViewMode,  definition,  useProvidedId,  responseFields);
		///   var productSortDefinitionClient = mozuClient.WithBaseAddress(url).Execute().Result();
		/// </code>
		/// </example>
		public static MozuClient<Mozu.Api.Contracts.ProductAdmin.ProductSortDefinition> AddProductSortDefinitionClient(DataViewMode dataViewMode, Mozu.Api.Contracts.ProductAdmin.ProductSortDefinition definition, bool? useProvidedId =  null, string responseFields =  null)
		{
			var url = Mozu.Api.Urls.Commerce.Catalog.Admin.ProductSortDefinitionUrl.AddProductSortDefinitionUrl(useProvidedId, responseFields);
			const string verb = "POST";
			var mozuClient = new MozuClient<Mozu.Api.Contracts.ProductAdmin.ProductSortDefinition>()
									.WithVerb(verb).WithResourceUrl(url)
									.WithBody<Mozu.Api.Contracts.ProductAdmin.ProductSortDefinition>(definition)									.WithHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.ToString())
;
			return mozuClient;

		}
Ejemplo n.º 38
0
        private async void ExportCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog
            {
                Title = "Save Log As",
            };

            switch (_m.FileFormat)
            {
                case LogExportType.Text:
                    dialog.Filter = "Text Format (*.txt)|*.txt";
                    break;
                case LogExportType.Html:
                    dialog.Filter = "HTML Format (*.html)|*.html";
                    break;
                default:
                    Debug.Assert(false, "Internal Logic Error at LogExportWindow.ExportCommand_Executed");
                    break;
            }

            if (_m.ExportSystemLog)
            {
                // Local time should be ok because the filename is likely only useful to the person exporting the log
                DateTime localTime = DateTime.Now;
                dialog.FileName = $"SystemLog_{localTime.ToString("yyyy_MM_dd_HHmmss", CultureInfo.InvariantCulture)}";
            }
            else if (_m.ExportBuildLog)
            {
                Debug.Assert(0 < _m.BuildEntries.Count, "Internal Logic Error at LogExportWindow.ExportCommand_Executed");
                LogModel.BuildInfo bi = _m.BuildEntries[_m.SelectedBuildEntryIndex];

                // Filter invalid filename chars
                List<char> filteredChars = new List<char>(bi.Name.Length);
                List<char> invalidChars = Path.GetInvalidFileNameChars().ToList();
                invalidChars.Add('['); // Remove [ and ]
                invalidChars.Add(']');
                invalidChars.Add(' '); // Spaces are not very script or web friendly, let's remove them too.
                foreach (char ch in bi.Name)
                {
                    if (invalidChars.Contains(ch))
                    {
                        filteredChars.Add(Convert.ToChar("_")); // Replace invalid chars and spaces with an underscore
                    }
                    else
                    {
                        filteredChars.Add(ch);
                    }
                }
                string filteredName = new string(filteredChars.ToArray());
                // The log stores dateTime as UTC so its safe to use ToLocalTime() to convert to the users timezone
                dialog.FileName = $"BuildLog_{bi.StartTime.ToLocalTime().ToString("yyyy_MM_dd_HHmmss", CultureInfo.InvariantCulture)}_{filteredName}";
            }

            bool? result = dialog.ShowDialog();
            // If user cancelled SaveDialog, do nothing
            if (result != true)
                return;
            string destFile = dialog.FileName;

            _m.InProgress = true;
            try
            {
                await Task.Run(() =>
                {
                    if (_m.ExportSystemLog)
                    {
                        _m.Logger.ExportSystemLog(_m.FileFormat, destFile);
                    }
                    else if (_m.ExportBuildLog)
                    {
                        Debug.Assert(0 < _m.BuildEntries.Count, "Internal Logic Error at LogExportWindow.ExportCommand_Executed");
                        int buildId = _m.BuildEntries[_m.SelectedBuildEntryIndex].Id;
                        _m.Logger.ExportBuildLog(_m.FileFormat, destFile, buildId, new BuildLogOptions
                        {
                            IncludeComments = _m.BuildLogIncludeComments,
                            IncludeMacros = _m.BuildLogIncludeMacros,
                            ShowLogFlags = _m.BuildLogShowLogFlags,
                        });
                    }
                });
            }
            finally
            {
                _m.InProgress = false;
            }

            // Open log file
            Application.Current.Dispatcher.Invoke(() =>
            {
                if (_m.FileFormat == LogExportType.Html)
                {
                    // Call FileHelper.OpenUri (instead of OpenPath) to open .html files with the default browser.
                    ResultReport result = FileHelper.OpenUri(destFile);
                    if (!result.Success)
                    {
                        MessageBox.Show(this, $"URL [{destFile}] could not be opened.\r\n\r\n{result.Message}.",
                            "Error Opening URL", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MainViewModel.OpenTextFile(destFile);
                }
            });

            // Close LogExportWindow
            Close();
        }
Ejemplo n.º 39
0
        public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool?required, List <Type> seenTypes)
        {
            Name          = name;
            Type          = type;
            InfoAttribute = infoAttribute;

            Required    = required ?? InfoAttribute.Required;
            ReadOnly    = InfoAttribute.ReadOnly;
            Description = InfoAttribute.Description.ToPsSingleLine();

            var unwrappedType = Type.Unwrap();
            var hasBeenSeen   = seenTypes?.Contains(unwrappedType) ?? false;

            (seenTypes ?? (seenTypes = new List <Type>())).Add(unwrappedType);
            NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] {} :
            unwrappedType.GetInterfaces()
            .Concat(InfoAttribute.PossibleTypes)
            .SelectMany(pt => pt.GetProperties()
                        .SelectMany(pi => pi.GetCustomAttributes(true).OfType <InfoAttribute>()
                                    .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes))))
            .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray();
            // https://stackoverflow.com/a/503359/294804
            var associativeArrayInnerType = Type.GetInterfaces()
                                            .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray <>))
                                            ?.GetTypeInfo().GetGenericArguments().First();

            if (!hasBeenSeen && associativeArrayInnerType != null)
            {
                var anyInfo = new InfoAttribute {
                    Description = "This indicates any property can be added to this object."
                };
                NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray();
            }
            IsComplexInterface = NestedInfos.Any();
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = null;

            info = null;

            JObject entry;

            context.ResponsePayload.TryToJObject(out entry);

            List <string> expandProps = ODataUriAnalyzer.GetQueryOptionValsFromUrl(context.Destination.ToString(), @"expand");

            if (entry != null && entry.Type == JTokenType.Object && expandProps.Count > 0)
            {
                var props = entry.Children();

                foreach (JProperty prop in props)
                {
                    if (expandProps.Contains(prop.Name))
                    {
                        passed = null;

                        if (prop.Value.Type == JTokenType.Object)
                        {
                            JObject jObj = prop.Value as JObject;
                            JsonParserHelper.ClearPropertiesList();

                            if (JsonParserHelper.GetSpecifiedPropertiesFromEntryPayload(jObj, Constants.OdataV4JsonIdentity).Count > 0)
                            {
                                passed = true;
                                break;
                            }
                            else
                            {
                                passed = false;
                            }
                        }
                        else if (prop.Value.Type == JTokenType.Array)
                        {
                            JArray jArr = prop.Value as JArray;

                            if (JsonParserHelper.GetSpecifiedPropertiesFromFeedPayload(jArr, Constants.OdataV4JsonIdentity).Count > 0)
                            {
                                passed = true;
                                break;
                            }
                            else
                            {
                                passed = false;
                            }
                        }
                    }
                }

                if (passed == false)
                {
                    info = new ExtensionRuleViolationInfo(this.ErrorMessage, context.Destination, context.ResponsePayload);
                }
            }

            return(passed);
        }
        /// <summary>
        /// Get adoxio_enforcementaction_ServiceAppointments from
        /// adoxio_enforcementactions
        /// </summary>
        /// <param name='adoxioEnforcementactionid'>
        /// key: adoxio_enforcementactionid of adoxio_enforcementaction
        /// </param>
        /// <param name='top'>
        /// </param>
        /// <param name='skip'>
        /// </param>
        /// <param name='search'>
        /// </param>
        /// <param name='filter'>
        /// </param>
        /// <param name='count'>
        /// </param>
        /// <param name='orderby'>
        /// Order items by property values
        /// </param>
        /// <param name='select'>
        /// Select properties to be returned
        /// </param>
        /// <param name='expand'>
        /// Expand related entities
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="HttpOperationException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<HttpOperationResponse<MicrosoftDynamicsCRMserviceappointmentCollection>> GetWithHttpMessagesAsync(string adoxioEnforcementactionid, int? top = default(int?), int? skip = default(int?), string search = default(string), string filter = default(string), bool? count = default(bool?), IList<string> orderby = default(IList<string>), IList<string> select = default(IList<string>), IList<string> expand = default(IList<string>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (adoxioEnforcementactionid == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "adoxioEnforcementactionid");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("adoxioEnforcementactionid", adoxioEnforcementactionid);
                tracingParameters.Add("top", top);
                tracingParameters.Add("skip", skip);
                tracingParameters.Add("search", search);
                tracingParameters.Add("filter", filter);
                tracingParameters.Add("count", count);
                tracingParameters.Add("orderby", orderby);
                tracingParameters.Add("select", select);
                tracingParameters.Add("expand", expand);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "adoxio_enforcementactions({adoxio_enforcementactionid})/adoxio_enforcementaction_ServiceAppointments").ToString();
            _url = _url.Replace("{adoxio_enforcementactionid}", System.Uri.EscapeDataString(adoxioEnforcementactionid));
            List<string> _queryParameters = new List<string>();
            if (top != null)
            {
                _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"'))));
            }
            if (skip != null)
            {
                _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"'))));
            }
            if (search != null)
            {
                _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search)));
            }
            if (filter != null)
            {
                _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
            }
            if (count != null)
            {
                _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"'))));
            }
            if (orderby != null)
            {
                _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(string.Join(",", orderby))));
            }
            if (select != null)
            {
                _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(string.Join(",", select))));
            }
            if (expand != null)
            {
                _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(string.Join(",", expand))));
            }
            if (_queryParameters.Count > 0)
            {
                _url += "?" + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers


            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                if (_httpResponse.Content != null) {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                }
                else {
                    _responseContent = string.Empty;
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new HttpOperationResponse<MicrosoftDynamicsCRMserviceappointmentCollection>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<MicrosoftDynamicsCRMserviceappointmentCollection>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }
Ejemplo n.º 42
0
 public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool?required = null, List <Type> seenTypes = null)
 => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes);
Ejemplo n.º 43
0
 /// <summary>
 /// 获取描述
 /// </summary>
 /// <param name="value">布尔值</param>
 public static string Description(this bool?value)
 {
     return(value == null ? "" : Description(value.Value));
 }
 /// <summary>
 /// Enable or disable TrackActiveTokens for test
 /// </summary>
 public void EnableDiagnosticTokens(bool enable)
 {
     _enableDiagnosticTokens = enable;
     _singletonListeners.Values.Do(l => l.TrackActiveTokens = enable);
 }
Ejemplo n.º 45
0
 public static T SetTimeInfo <T>(this T toolSettings, bool?timeInfo) where T : MSpecSettings
 {
     toolSettings          = toolSettings.NewInstance();
     toolSettings.TimeInfo = timeInfo;
     return(toolSettings);
 }
Ejemplo n.º 46
0
 public void SetNotify(bool?set)
 {
     SilenceUntill = 0; Notify = set;
 }
Ejemplo n.º 47
0
 public static T SetNoTeamCity <T>(this T toolSettings, bool?noTeamCity) where T : MSpecSettings
 {
     toolSettings            = toolSettings.NewInstance();
     toolSettings.NoTeamCity = noTeamCity;
     return(toolSettings);
 }
Ejemplo n.º 48
0
 public static T SetSilent <T>(this T toolSettings, bool?silent) where T : MSpecSettings
 {
     toolSettings        = toolSettings.NewInstance();
     toolSettings.Silent = silent;
     return(toolSettings);
 }
Ejemplo n.º 49
0
 public static T SetDottedProgress <T>(this T toolSettings, bool?dottedProgress) where T : MSpecSettings
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.DottedProgress = dottedProgress;
     return(toolSettings);
 }
Ejemplo n.º 50
0
 public static T SetNoAppVeyor <T>(this T toolSettings, bool?noAppVeyor) where T : MSpecSettings
 {
     toolSettings            = toolSettings.NewInstance();
     toolSettings.NoAppVeyor = noAppVeyor;
     return(toolSettings);
 }
Ejemplo n.º 51
0
        protected virtual List<IEvent> GetEventOverloads(List<IEvent> list = null, ITypeDefinition typeDef = null)
        {
            typeDef = typeDef ?? this.TypeDefinition;

            bool isTop = list == null;
            list = list ?? new List<IEvent>();

            if (typeDef != null)
            {
                var events = typeDef.Events.Where(e =>
                {
                    if (e.IsExplicitInterfaceImplementation)
                    {
                        return false;
                    }

                    var inline = e.AddAccessor != null ? this.Emitter.GetInline(e.AddAccessor) : null;
                    if (!string.IsNullOrWhiteSpace(inline))
                    {
                        return false;
                    }

                    inline = e.RemoveAccessor != null ? this.Emitter.GetInline(e.RemoveAccessor) : null;
                    if (!string.IsNullOrWhiteSpace(inline))
                    {
                        return false;
                    }

                    bool eq = false;
                    bool? equalsByAdd = null;
                    if (e.IsStatic == this.Static)
                    {
                        var addName = e.AddAccessor != null && e.CanAdd ? Helpers.GetEventRef(e, this.Emitter, false, true, true) : null;
                        var removeName = e.RemoveAccessor != null && e.CanRemove ? Helpers.GetEventRef(e, this.Emitter, true, true, true) : null;
                        var fieldName = Helpers.GetEventRef(e, this.Emitter, true, true, true, false, true);
                        if (addName != null && (addName == this.JsName || addName == this.AltJsName || addName == this.FieldJsName))
                        {
                            eq = true;
                            equalsByAdd = true;
                        }
                        else if (removeName != null && (removeName == this.JsName || removeName == this.AltJsName || removeName == this.FieldJsName))
                        {
                            eq = true;
                            equalsByAdd = false;
                        }
                        else if (fieldName != null && (fieldName == this.JsName || fieldName == this.AltJsName || fieldName == this.FieldJsName))
                        {
                            eq = true;
                        }
                    }

                    if (eq)
                    {
                        if (e.IsOverride && !this.IsTemplateOverride(e))
                        {
                            return false;
                        }

                        if (equalsByAdd.HasValue && this.Member is IMethod && this.AltJsName == null)
                        {
                            this.AltJsName = Helpers.GetEventRef(e, this.Emitter, equalsByAdd.Value, true, true);
                        }

                        return true;
                    }

                    return false;
                });

                list.AddRange(events);

                if (this.Inherit)
                {
                    var baseTypeDefinitions = typeDef.DirectBaseTypes.Where(t => t.Kind == typeDef.Kind || (typeDef.Kind == TypeKind.Struct && t.Kind == TypeKind.Class));

                    foreach (var baseTypeDef in baseTypeDefinitions)
                    {
                        list = this.GetEventOverloads(list, baseTypeDef.GetDefinition());
                    }
                }
            }

            var returnEvents = isTop ? list.Distinct().ToList() : list;
            return returnEvents;
        }
Ejemplo n.º 52
0
 /// <summary>
 ///   <p>MSpec is called a 'context/specification' test framework because of the 'grammar' that is used in describing and coding the tests or 'specs'.</p>
 ///   <p>For more details, visit the <a href="https://github.com/machine/machine.specifications">official website</a>.</p>
 /// </summary>
 public static IReadOnlyCollection <Output> MSpec(string arguments, string workingDirectory = null, IReadOnlyDictionary <string, string> environmentVariables = null, int?timeout = null, bool?logOutput = null, bool?logInvocation = null, bool?logTimestamp = null, string logFile = null, Func <string, string> outputFilter = null)
 {
     using var process = ProcessTasks.StartProcess(MSpecPath, arguments, workingDirectory, environmentVariables, timeout, logOutput, logInvocation, logTimestamp, logFile, MSpecLogger, outputFilter);
     process.AssertZeroExitCode();
     return(process.Output);
 }
 /// <summary>
 /// Sets the TerminateResources property
 /// </summary>
 /// <param name="terminateResources">The value to set for the TerminateResources property </param>
 /// <returns>this instance</returns>
 public TerminateEnvironmentRequest WithTerminateResources(bool terminateResources)
 {
     this.terminateResources = terminateResources;
     return this;
 }
Ejemplo n.º 54
0
        public IActionResult ListAssets(string name, [FromQuery] string version, int?buildId, bool?nonShipping, bool?loadLocations)
        {
            IQueryable <Data.Models.Asset> query = _context.Assets;

            if (!string.IsNullOrEmpty(name))
            {
                query = query.Where(asset => asset.Name == name);
            }

            if (!string.IsNullOrEmpty(version))
            {
                query = query.Where(asset => asset.Version == version);
            }

            if (buildId.HasValue)
            {
                query = query.Where(asset => asset.BuildId == buildId.Value);
            }

            if (nonShipping.HasValue)
            {
                query = query.Where(asset => asset.NonShipping == nonShipping.Value);
            }

            if (loadLocations ?? false)
            {
                query = query.Include(asset => asset.Locations);
            }

            query = query.OrderByDescending(a => a.Id);
            return(Ok(query));
        }
Ejemplo n.º 55
0
        public async Task <IEnumerable <ServiceDeskQueue> > GetServiceDeskQueuesAsync(string serviceDeskId, bool?includeCount = false,
                                                                                      int?maxPages = null,
                                                                                      int?limit    = null,
                                                                                      int?start    = null)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                ["includeCount"] = includeCount,
                ["limit"]        = limit,
                ["start"]        = start
            };

            return(await GetPagedResultsAsync(maxPages, queryParamValues, async qpv =>
                                              await GetServiceDeskUrl(serviceDeskId)
                                              .AppendPathSegment("/queue")
                                              .SetQueryParams(qpv)
                                              .GetJsonAsync <PagedResults <ServiceDeskQueue> >()
                                              .ConfigureAwait(false))
                   .ConfigureAwait(false));
        }
Ejemplo n.º 56
0
        protected virtual List<IProperty> GetPropertyOverloads(List<IProperty> list = null, ITypeDefinition typeDef = null)
        {
            typeDef = typeDef ?? this.TypeDefinition;

            bool isTop = list == null;
            list = list ?? new List<IProperty>();

            if (this.Member != null && this.Member.IsOverride && !this.IsTemplateOverride(this.Member))
            {
                if (this.OriginalMember == null)
                {
                    this.OriginalMember = this.Member;
                }

                this.Member = InheritanceHelper.GetBaseMember(this.Member);
                typeDef = this.Member.DeclaringTypeDefinition;
            }

            if (typeDef != null)
            {
                bool isMember = this.Member is IMethod;
                var properties = typeDef.Properties.Where(p =>
                {
                    if (p.IsExplicitInterfaceImplementation)
                    {
                        return false;
                    }

                    var canGet = p.CanGet && p.Getter != null;
                    var canSet = p.CanSet && p.Setter != null;

                    if (!this.IncludeInline)
                    {
                        var inline = canGet ? this.Emitter.GetInline(p.Getter) : null;
                        if (!string.IsNullOrWhiteSpace(inline))
                        {
                            return false;
                        }

                        inline = canSet ? this.Emitter.GetInline(p.Setter) : null;
                        if (!string.IsNullOrWhiteSpace(inline))
                        {
                            return false;
                        }

                        if (p.IsIndexer && canGet && p.Getter.Attributes.Any(a => a.AttributeType.FullName == "Bridge.ExternalAttribute"))
                        {
                            return false;
                        }
                    }

                    bool eq = false;
                    bool? equalsByGetter = null;

                    if (p.IsStatic == this.Static)
                    {
                        var fieldName = this.Emitter.GetEntityName(p);

                        if (fieldName != null && (fieldName == this.JsName || fieldName == this.AltJsName || fieldName == this.FieldJsName))
                        {
                            eq = true;
                        }

                        if (!eq && p.IsIndexer)
                        {
                            var getterIgnore = canGet && this.Emitter.Validator.IsExternalType(p.Getter);
                            var setterIgnore = canSet && this.Emitter.Validator.IsExternalType(p.Setter);
                            var getterName = canGet ? Helpers.GetPropertyRef(p, this.Emitter, false, true, true) : null;
                            var setterName = canSet ? Helpers.GetPropertyRef(p, this.Emitter, true, true, true) : null;

                            if (!getterIgnore && getterName != null && (getterName == this.JsName || getterName == this.AltJsName || getterName == this.FieldJsName))
                            {
                                eq = true;
                                equalsByGetter = true;
                            }
                            else if (!setterIgnore && setterName != null && (setterName == this.JsName || setterName == this.AltJsName || setterName == this.FieldJsName))
                            {
                                eq = true;
                                equalsByGetter = false;
                            }
                        }
                    }

                    if (eq)
                    {
                        if (p.IsOverride && !this.IsTemplateOverride(p))
                        {
                            return false;
                        }

                        if (equalsByGetter.HasValue && isMember && this.AltJsName == null)
                        {
                            this.AltJsName = Helpers.GetPropertyRef(p, this.Emitter, equalsByGetter.Value, true, true);
                        }

                        return true;
                    }

                    return false;
                });

                list.AddRange(properties);

                if (this.Inherit)
                {
                    var baseTypeDefinitions = typeDef.DirectBaseTypes.Where(t => t.Kind == typeDef.Kind || (typeDef.Kind == TypeKind.Struct && t.Kind == TypeKind.Class));

                    foreach (var baseTypeDef in baseTypeDefinitions)
                    {
                        list = this.GetPropertyOverloads(list, baseTypeDef.GetDefinition());
                    }
                }
            }

            var returnProperties = isTop ? list.Distinct().ToList() : list;
            return returnProperties;
        }
Ejemplo n.º 57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="V3StopAmenityDetails" /> class.
 /// </summary>
 /// <param name="Toilet">Indicates if there is a public toilet at or near the stop.</param>
 /// <param name="TaxiRank">Indicates if there is a taxi rank at or near the stop.</param>
 /// <param name="CarParking">The number of free car parking spots at the stop.</param>
 /// <param name="Cctv">Indicates if there are CCTV (i.e. closed circuit television) cameras at the stop.</param>
 public V3StopAmenityDetails(bool?Toilet = null, bool?TaxiRank = null, string CarParking = null, bool?Cctv = null)
 {
     this.Toilet     = Toilet;
     this.TaxiRank   = TaxiRank;
     this.CarParking = CarParking;
     this.Cctv       = Cctv;
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Riskv1decisionsDeviceInformation" /> class.
 /// </summary>
 /// <param name="CookiesAccepted">Whether the customer’s browser accepts cookies. This field can contain one of the following values: - &#x60;yes&#x60;: The customer’s browser accepts cookies. - &#x60;no&#x60;: The customer’s browser does not accept cookies. .</param>
 /// <param name="IpAddress">IP address of the customer.  #### Used by **Authorization, Capture, and Credit** Optional field. .</param>
 /// <param name="HostName">DNS resolved hostname from &#x60;ipAddress&#x60;..</param>
 /// <param name="FingerprintSessionId">Field that contains the session ID that you send to Decision Manager to obtain the device fingerprint information. The string can contain uppercase and lowercase letters, digits, hyphen (-), and underscore (_). However, do not use the same uppercase and lowercase letters to indicate different session IDs.  The session ID must be unique for each merchant ID. You can use any string that you are already generating, such as an order number or web session ID.  The session ID must be unique for each page load, regardless of an individual’s web session ID. If a user navigates to a profiled page and is assigned a web session, navigates away from the profiled page, then navigates back to the profiled page, the generated session ID should be different and unique. You may use a web session ID, but it is preferable to use an application GUID (Globally Unique Identifier). This measure ensures that a unique ID is generated every time the page is loaded, even if it is the same user reloading the page. .</param>
 /// <param name="HttpBrowserEmail">Email address set in the customer’s browser, which may differ from customer email. .</param>
 /// <param name="UserAgent">Customer’s browser as identified from the HTTP header data. For example, &#x60;Mozilla&#x60; is the value that identifies the Netscape browser. .</param>
 /// <param name="RawData">RawData.</param>
 /// <param name="HttpAcceptBrowserValue">Value of the Accept header sent by the customer’s web browser. **Note** If the customer’s browser provides a value, you must include it in your request. .</param>
 /// <param name="HttpAcceptContent">The exact content of the HTTP accept header. .</param>
 /// <param name="HttpBrowserLanguage">Value represents the browser language as defined in IETF BCP47. Example:en-US, refer  https://en.wikipedia.org/wiki/IETF_language_tag for more details. .</param>
 /// <param name="HttpBrowserJavaEnabled">A Boolean value that represents the ability of the cardholder browser to execute Java. Value is returned from the navigator.javaEnabled property. Possible Values:True/False .</param>
 /// <param name="HttpBrowserJavaScriptEnabled">A Boolean value that represents the ability of the cardholder browser to execute JavaScript. Possible Values:True/False. **Note**: Merchants should be able to know the values from fingerprint details of cardholder&#39;s browser. .</param>
 /// <param name="HttpBrowserColorDepth">Value represents the bit depth of the color palette for displaying images, in bits per pixel. Example : 24, refer https://en.wikipedia.org/wiki/Color_depth for more details .</param>
 /// <param name="HttpBrowserScreenHeight">Total height of the Cardholder&#39;s scree in pixels, example: 864. .</param>
 /// <param name="HttpBrowserScreenWidth">Total width of the cardholder&#39;s screen in pixels. Example: 1536. .</param>
 /// <param name="HttpBrowserTimeDifference">Time difference between UTC time and the cardholder browser local time, in minutes, Example:300 .</param>
 /// <param name="UserAgentBrowserValue">Value of the User-Agent header sent by the customer’s web browser. Note If the customer’s browser provides a value, you must include it in your request. .</param>
 public Riskv1decisionsDeviceInformation(string CookiesAccepted = default(string), string IpAddress = default(string), string HostName = default(string), string FingerprintSessionId = default(string), string HttpBrowserEmail = default(string), string UserAgent = default(string), List <Ptsv2paymentsDeviceInformationRawData> RawData = default(List <Ptsv2paymentsDeviceInformationRawData>), string HttpAcceptBrowserValue = default(string), string HttpAcceptContent = default(string), string HttpBrowserLanguage = default(string), bool?HttpBrowserJavaEnabled = default(bool?), bool?HttpBrowserJavaScriptEnabled = default(bool?), string HttpBrowserColorDepth = default(string), string HttpBrowserScreenHeight = default(string), string HttpBrowserScreenWidth = default(string), string HttpBrowserTimeDifference = default(string), string UserAgentBrowserValue = default(string))
 {
     this.CookiesAccepted      = CookiesAccepted;
     this.IpAddress            = IpAddress;
     this.HostName             = HostName;
     this.FingerprintSessionId = FingerprintSessionId;
     this.HttpBrowserEmail     = HttpBrowserEmail;
     this.UserAgent            = UserAgent;
     this.RawData = RawData;
     this.HttpAcceptBrowserValue       = HttpAcceptBrowserValue;
     this.HttpAcceptContent            = HttpAcceptContent;
     this.HttpBrowserLanguage          = HttpBrowserLanguage;
     this.HttpBrowserJavaEnabled       = HttpBrowserJavaEnabled;
     this.HttpBrowserJavaScriptEnabled = HttpBrowserJavaScriptEnabled;
     this.HttpBrowserColorDepth        = HttpBrowserColorDepth;
     this.HttpBrowserScreenHeight      = HttpBrowserScreenHeight;
     this.HttpBrowserScreenWidth       = HttpBrowserScreenWidth;
     this.HttpBrowserTimeDifference    = HttpBrowserTimeDifference;
     this.UserAgentBrowserValue        = UserAgentBrowserValue;
 }
Ejemplo n.º 59
0
        private void GenerateInfo(INamedTypeSymbol entryPoint, CompilationContext context)
        {
            string author           = entryPoint.Name;
            string name             = entryPoint.Name;
            string shortName        = (entryPoint.Name + "____").Substring(0, 4);
            string description      = string.Empty;
            int    version          = 1;
            int?   minVersionToLoad = null;
            string date             = DateTime.Now.ToString("yyyy-MM-dd");
            bool?  useAsRandomAi    = null;
            string apiVersion       = "1.8";
            string url = null;

            foreach (var attribute in entryPoint.GetAttributes())
            {
                if (Is(attribute.AttributeClass, AuthorAttibuteType))
                {
                    author = (string)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, NameAttributeType))
                {
                    name = (string)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, ShortNameAttributeType))
                {
                    shortName = (string)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, DescriptionAttributeType))
                {
                    description = (string)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, VersionAttributeType))
                {
                    version = (int)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, MinVersionToLoadAttributeType))
                {
                    minVersionToLoad = (int)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, DateAttributeType))
                {
                    date = (string)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, UseAsRandomAIAttributeType))
                {
                    useAsRandomAi = (bool)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, APIVersionAttributeType))
                {
                    apiVersion = (string)attribute.ConstructorArguments[0].Value;
                }
                else if (Is(attribute.AttributeClass, URLAttributeType))
                {
                    url = (string)attribute.ConstructorArguments[0].Value;
                }
                else
                {
                    Debug.WriteLine("Unknown attribute: " + attribute.AttributeClass.Name);
                }
            }

            if ((shortName == null) || (shortName.Length != 4))
            {
                throw new InvalidOperationException("ShortName must be 4 characters.");
            }

            infoText.AppendFormat("class {0} extends AIInfo", entryPoint.Name);
            infoText.Append("{");
            string instanceName = context.GetName(entryPoint, entryPoint.Name);

            infoText.AppendFormat("function CreateInstance(){{return{0};}}", Utilities.WriteLiteral(instanceName, true));
            infoText.AppendFormat("function GetAuthor(){{return{0};}}", Utilities.WriteLiteral(author, true));
            infoText.AppendFormat("function GetName(){{return{0};}}", Utilities.WriteLiteral(name, true));
            infoText.AppendFormat("function GetShortName(){{return{0};}}", Utilities.WriteLiteral(shortName, true));
            infoText.AppendFormat("function GetDescription(){{return{0};}}", Utilities.WriteLiteral(description, true));
            infoText.AppendFormat("function GetVersion(){{return{0};}}", Utilities.WriteLiteral(version, true));

            if (minVersionToLoad.HasValue)
            {
                infoText.AppendFormat("function MinVersionToLoad(){{return{0};}}", Utilities.WriteLiteral(minVersionToLoad.Value));
            }

            if (date != null)
            {
                infoText.AppendFormat("function GetDate(){{return{0};}}", Utilities.WriteLiteral(date));
            }

            if (useAsRandomAi.HasValue)
            {
                infoText.AppendFormat("function UseAsRandomAI(){{return{0};}}", Utilities.WriteLiteral(useAsRandomAi.Value));
            }

            if (apiVersion != null)
            {
                infoText.AppendFormat("function GetAPIVersion(){{return{0};}}", Utilities.WriteLiteral(apiVersion));
            }

            if (url != null)
            {
                infoText.AppendFormat("function GetURL(){{return{0};}}", Utilities.WriteLiteral(url));
            }

            infoText.Append("}RegisterAI(");
            infoText.Append(entryPoint.Name);
            infoText.Append("());");
        }
Ejemplo n.º 60
0
 //Reset information cached in the "DatabaseIsInstalled" method
 public static void ResetCache()
 {
     _databaseIsInstalled = null;
 }