Example #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);
        }
		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;
			}
		}
Example #3
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;
		}
Example #4
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();
     }
 }
 //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 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);
     }
 }
 internal LinuxNetworkInterface(string name) : base(name)
 {
     _operationalStatus = GetOperationalStatus(name);
     _supportsMulticast = GetSupportsMulticast(name);
     _speed = GetSpeed(name);
     _ipProperties = new LinuxIPInterfaceProperties(this);
 }
        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");
        }
Example #9
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;
 }
 public void SetUp()
 {
     MockValidator<object>.ResetCaches();
     validationStatusOnCallback = null;
     valueConvertEventArgs = null;
     validationPerformedEventArgs = null;
 }
Example #11
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;
        }
        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);
            }
        }
        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;
        }
Example #14
0
 public PuzzleMap(Puzzle owner)
 {
     puzzle = owner;
     map = new SokobanMap();
     solutions = new List<Solution>();
     isMasterMap = null;
 }
Example #15
0
 static StaticConfiguration()
 {
     disableErrorTraces = !(disableCaches = IsRunningDebug);
     CaseSensitive = false;
     RequestQueryFormMultipartLimit = 1000;
     AllowFileStreamUploadAsync = true;
 }
        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;
            }
        }
Example #17
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));
                }
            }
        }
 // 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 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);
        }
Example #20
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);
 }
		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();
		}
 public override void SetKey(AsymmetricAlgorithm key) {
     if (key == null) 
         throw new ArgumentNullException("key");
     Contract.EndContractBlock();
     _rsaKey = (RSA) key;
     _rsaOverridesDecrypt = default(bool?);
 }
        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;
        }
 public void SetContentType(ODataFormat payloadFormat)
 {
     this.acceptCharSets = null;
     this.acceptMediaTypes = null;
     this.format = payloadFormat;
     this.useFormat = true;
 }
Example #25
0
File: Team.cs Project: 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;
     }
 }
 public void SetContentType(string acceptableMediaTypes, string acceptableCharSets)
 {
     this.acceptMediaTypes = acceptableMediaTypes;
     this.acceptCharSets = acceptableCharSets;
     this.format = null;
     this.useFormat = false;
 }
Example #27
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();
        }
Example #28
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 void Reset()
 {
     lock (@lock)
     {
         updateNeeded = null;
     }
 }
        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;
                });
        }