コード例 #1
0
ファイル: ScriptProcessor.cs プロジェクト: sakpung/webstudy
        public void LoadScripts()
        {
            _Delegates.Clear();
            Logger.Global.SystemMessage(LogType.Information, "Loading scripts", string.Empty);
            if (!string.IsNullOrEmpty(_RuleDirectory))
            {
                foreach (string file in Directory.GetFiles(_RuleDirectory, "*.rule", SearchOption.AllDirectories))
                {
                    try
                    {
                        ServerRule rule = RuleEditorPresenter.LoadRule <ServerRule>(file);

                        if (rule.Script.Length > 0)
                        {
                            if (!_Delegates.ContainsKey(rule.ServerEvent))
                            {
                                _Delegates.Add(rule.ServerEvent, new ThreadSafeDictionary <ServerRule, ScriptObject>());
                            }
                            _Delegates[rule.ServerEvent].Add(rule, null);
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Global.SystemException(string.Empty, e);
                    }
                }
            }
        }
コード例 #2
0
 public static void get_dataset(string sopInstanceUID, Action <DicomDS, string, string, string> datasetFile, int numRetries, int retryInterval)
 {
     AsyncHelper.Execute(() =>
     {
         if (Module.Service != null)
         {
             try
             {
                 if (_Callbacks.ContainsKey(sopInstanceUID))
                 {
                     _Callbacks[sopInstanceUID] = datasetFile;
                 }
                 else
                 {
                     _Callbacks.Add(sopInstanceUID, datasetFile);
                 }
                 Module.Service.SendMessage(GetReferencedFile, sopInstanceUID, numRetries, retryInterval);
             }
             catch (Exception e)
             {
                 Logger.Global.SystemException(string.Empty, e);
             }
         }
     });
 }
コード例 #3
0
            public void EqualityComparer()
            {
                var dict = new ThreadSafeDictionary <string, int>(StringComparer.InvariantCultureIgnoreCase);

                dict.Add("Weißbier", 93);
                Assert.AreEqual(dict["WEISSBIER"], 93);
                dict["weissbier"] = 777;
                Assert.AreEqual(dict["Weißbier"], 777);
                dict.Add(new KeyValuePair <string, int>("Δίος", 21));
                Assert.AreEqual(2, dict.Count);
                Assert.IsTrue(dict.ContainsKey("ΔΊΟΣ"));
                Assert.IsTrue(dict.Contains(new KeyValuePair <string, int>("δίος", 21)));
                Assert.IsFalse(dict.Contains(new KeyValuePair <string, int>("δίος", 3)));
                Assert.IsTrue(dict.Keys.Contains("δίος"));
                Assert.IsFalse(dict.Keys.Contains("δίοςδίος"));
                Assert.IsTrue(dict.Values.Contains(770, new RoundedEquality()));
                Assert.IsFalse(dict.Values.Contains(770));
                int result;

                Assert.IsTrue(dict.TryGetValue("ΔΊΟΣ", out result) && result == 21);
                Assert.IsFalse(dict.TryGetValue("Eggplant", out result));
                Assert.IsFalse(dict.Remove("aubergine"));
                Assert.IsTrue(dict.Remove("Δίος"));
                Assert.IsFalse(dict.Remove(new KeyValuePair <string, int>("WEISSBIER", 93)));
                Assert.IsTrue(dict.Remove(new KeyValuePair <string, int>("WEISSBIER", 777)));
                Assert.IsFalse(dict.ContainsKey("WEISSBIER"));
                Assert.IsFalse(dict.Remove(new KeyValuePair <string, int>("WEISSBIER", 777)));
                Assert.AreEqual(dict.Count, 0);
                dict.Add("Palmer", 1111);
                Assert.IsFalse(dict.Remove("Palmer", 1110, out result));
                Assert.AreEqual(dict.Count, 1);
                Assert.IsTrue(dict.Remove("Palmer", 1110, new RoundedEquality(), out result));
                Assert.AreEqual(result, 1111);
                Assert.AreEqual(dict.Count, 0);
            }
コード例 #4
0
        /// <summary>
        /// 根据配置路径和段落名称获取配置对象
        /// </summary>
        /// <typeparam name="TConfig"></typeparam>
        /// <param name="configurationPath"></param>
        /// <param name="type">区分平台和插件</param>
        /// <param name="sectionName"></param>
        /// <returns></returns>
        private TConfig Get <TConfig>(string configurationPath, ConfigurationType type, string sectionName) where TConfig : class
        {
            string            key = configurationPath.ToLower();
            TConfig           tconfig;
            ConfigurationItem ci;

            if (configurationItemCache.ContainsKey(key))
            {
                ci = configurationItemCache[key];
            }
            else
            {
                ci = new ConfigurationItem()
                {
                    ConfigurationFilePath = configurationPath,
                    Type = type.ToDescription()
                };
                configurationItemCache.Add(key, ci);
            }
            if (sectionName != "")
            {
                tconfig = ci.Configuration.GetSection(sectionName) as TConfig;
                if (tconfig == null)
                {
                    throw new ConfigurationErrorsException("The configuration file {0} Lack of configuration section {1}".FormatString(ci.ConfigurationFilePath, sectionName));
                }
            }
            else
            {
                tconfig = ci.Configuration as TConfig;
            }
            return(tconfig);
        }
コード例 #5
0
        public void ContainsKey_should_return_true_if_it_exists()
        {
            var dict = new ThreadSafeDictionary <string, string>(new Dictionary <string, string>());

            dict.Add("1", "Any Item 1");

            Assert.That(dict.ContainsKey("1"), Is.True);
            Assert.That(dict.ContainsKey("2"), Is.False);
        }
コード例 #6
0
ファイル: AutoCopyEngine.cs プロジェクト: sakpung/webstudy
 public static void AddAeTitle(string aeTitle, string clientae)
 {
     if (!_Datasets.ContainsKey(aeTitle))
     {
         _Datasets[aeTitle] = new AutoCopyItem(aeTitle)
         {
             ClientAE = clientae
         };
     }
 }
コード例 #7
0
ファイル: VehicleManager.cs プロジェクト: zVortexx/Nitrox
 public void UpdateVehicle(VehicleMovementData vehicleMovement)
 {
     if (vehiclesById.ContainsKey(vehicleMovement.Id))
     {
         VehicleModel vehicleModel = vehiclesById[vehicleMovement.Id];
         vehicleModel.Position = vehicleMovement.Position;
         vehicleModel.Rotation = vehicleMovement.Rotation;
         vehicleModel.Health   = vehicleMovement.Health;
     }
 }
コード例 #8
0
 public override void OnDataComplete(string url)
 {
     if (active.ContainsKey(url))
     {
         active[url].CallBack();
         active.Remove(url);
         if (waiting.Count > 0)
         {
             var job = waiting.Dequeue();
             AddObservable(job);
         }
     }
 }
コード例 #9
0
        private static void RegisterType(Type type, string lifeCycle)
        {
            var exportAttributes = type.GetCustomAttributes(typeof(ExportAttribute), false);

            if (exportAttributes == null || exportAttributes.Length == 0)
            {
                return;
            }

            ExportAttribute exportAttribute = exportAttributes[0] as ExportAttribute;

            //string[] filterArray = new string[] { "IEnumerable" };
            //Type[] objectInterfaces = interfaces.Where(pre => !filterArray.Contains(pre.Name) && !(pre.IsGenericType)).ToArray();

            //反射类型中包含的所有非系统的方法,判断方法中是否带有特性,如果参数中不包含特性,则不处理
            var allMethods = exportAttribute.InterfaceType.GetMethods(System.Reflection.BindingFlags.Public);

            if (methodMappingContainer.ContainsKey(type))
            {
                IList <ValidatorMethodMapping> methodMappings = methodMappingContainer[type];

                //添加当前方法对应的映射元数据信息
                foreach (var method in allMethods)
                {
                    ValidatorMethodMapping methodMapping = new ValidatorMethodMapping(method);

                    if (methodMapping.MethodParameters != null && methodMapping.MethodParameters.Length > 0)
                    {
                        methodMappings.Add(methodMapping);
                    }
                }
            }
            else
            {
                IList <ValidatorMethodMapping> methodMappings = new List <ValidatorMethodMapping>();

                foreach (var method in allMethods)
                {
                    ValidatorMethodMapping methodMapping = new ValidatorMethodMapping(method);

                    if (methodMapping.MethodParameters != null && methodMapping.MethodParameters.Length > 0)
                    {
                        methodMappings.Add(methodMapping);
                    }
                }

                methodMappingContainer.Add(type, methodMappings);
            }
        }
コード例 #10
0
        internal bool AddComponent(IComponent component)
        {
            Type t = component.GetType();

            if (components.ContainsKey(t))
            {
                components [t] = component;
            }
            //return false;
            else
            {
                components.Add(t, component);
            }
            return(true);
        }
コード例 #11
0
 private void UpdateForProject(Project project)
 {
     if (lastStatuses.ContainsKey(project.Url) && lastCompletedStatuses.ContainsKey(project.Url))
     {
         if (lastStatuses[project.Url].IsInProgress)
         {
             if (project.StatusValue == BuildStatusEnum.Successful)
             {
                 if (BuildStatusUtils.IsErrorBuild(lastCompletedStatuses[project.Url]))
                 {
                     FixedProjects.Add(project);
                 }
                 else
                 {
                     SucceedingProjects.Add(project);
                 }
             }
             else if (TreatAsFailure(project.Status))
             {
                 if (TreatAsFailure(lastCompletedStatuses[project.Url]))
                 {
                     StillFailingProjects.Add(project);
                 }
                 else
                 {
                     FailingProjects.Add(project);
                 }
             }
         }
     }
 }
コード例 #12
0
ファイル: StatisticsManager.cs プロジェクト: mrbrist/nebula
 public void UnRegisterPlayer(ushort playerId)
 {
     if (Requestors.ContainsKey(playerId))
     {
         Requestors.Remove(playerId);
         if (Requestors.Count == 0)
         {
             IsStatisticsNeeded = false;
         }
     }
 }
コード例 #13
0
        private static bool isOptimisableBlock(BlockIDs block)
        {
            if (optimisableBlockCache.ContainsKey((int)block))
            {
                return(optimisableBlockCache[(int)block]);
            }

            bool result = block.ToString().EndsWith("Cube", StringComparison.InvariantCultureIgnoreCase);

            optimisableBlockCache[(int)block] = result;
            return(result);
        }
コード例 #14
0
        public bool ContainsKey(TKey key)
        {
            // key could be null
            if (key == null)
            {
                // ConcurrentDictionary hates null
                throw new ArgumentNullException(nameof(key));
            }

            // No existing value is set, so no locking, right?
            return(_wrapped.ContainsKey(key));
        }
コード例 #15
0
        /// <summary>
        /// error handler for validation messages
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="businessException"></param>
        /// <returns></returns>
        public bool ErrorHandler(Exception ex = null, ExceptionsML businessException = null)
        {
            var noError = true;

            if (businessException != null)
            {
                if (businessException.Type == typeof(LoginRequiredException).ToString())
                {
                    throw LoginRequiredException.Create((LoginRequiredReason)Enum.Parse(typeof(LoginRequiredReason), businessException.Data));
                }
                else
                {
                    if (ValidationMessages.ContainsKey("Exception"))
                    {
                        ValidationMessages["Exception"] = businessException;
                    }
                    else
                    {
                        ValidationMessages.Add("Exception", businessException);
                    }
                }
                noError = false;
            }
            if (ex != null)
            {
                if (ValidationMessages.ContainsKey("Exception"))
                {
                    ValidationMessages["Exception"] = ExceptionsML.GetExceptionML(ex);
                }
                else
                {
                    ValidationMessages.Add("Exception", ExceptionsML.GetExceptionML(ex));
                }

                noError = false;
            }

            return(noError);
        }
コード例 #16
0
 public void RemoveSomeAsWeGo()
 {
     SkipIfCantChangeAffinity();
     unchecked
     {
         var dict = new ThreadSafeDictionary <int, int>();
         int len  = _threads.Length - 1;
         if (len < 1)
         {
             len = 1;
         }
         int gap        = Math.Min(10, len);
         int shouldStop = 0;
         for (int i = 0; i != len; ++i)
         {
             _threads[i] = new Thread((object obj) => {
                 int x = (int)obj;
                 while (x < 200000)
                 {
                     dict[x] = x * x;
                     x      += gap;
                 }
             });
             _params[i] = i % gap;
         }
         StartThreads(len);
         Thread remover = new Thread(() => {
             while (shouldStop == 0)
             {
                 dict.Remove((k, v) => k % 100 == 0);
             }
             dict.Remove((k, v) => k % 100 == 0);                                            //one more sweep.
         });
         remover.Start();
         EndThreads();
         Interlocked.Exchange(ref shouldStop, 1);
         remover.Join();
         for (int i = 0; i != 200000; ++i)
         {
             if (i % 100 == 0)
             {
                 Assert.IsFalse(dict.ContainsKey(i));
             }
             else
             {
                 Assert.AreEqual(dict[i], i * i);
             }
         }
     }
 }
コード例 #17
0
ファイル: ScriptFunctions.cs プロジェクト: sakpung/webstudy
        /// <summary>
        /// Gets the script for the associated event.
        /// </summary>
        /// <param name="serverEvent">The server event to get the script for.</param>
        /// <returns>The script that represents the function that will be called as the entry point to user provided script.</returns>
        /// <remarks>
        /// To make the implementation easier each script constant is named for a ServerEvent enum.  This allows us to look up the constant using
        /// the name of the server event.  If the event is found it is cached so it can be used later without a reflection performance hit.
        /// </remarks>
        public static string GetScript(ServerEvent serverEvent)
        {
            if (!_Functions.ContainsKey(serverEvent))
            {
                FieldInfo field = typeof(ScriptFunctions).GetFields().Where(f => f.Name.ToLower() == serverEvent.ToString().ToLower()).FirstOrDefault();

                if (field == null)
                {
                    return(string.Empty);
                }

                _Functions[serverEvent] = field.GetValue(null).ToString();
            }
            return(_Functions[serverEvent]);
        }
コード例 #18
0
        /// <summary>
        /// Searches for the requested base type in the cache
        /// </summary>
        /// <param name="baseType">type used to located the set of registered alternate types</param>
        /// <returns>the set of matching alternate types or null when a set is not found</returns>
        public static IEnumerable <Type> GetDerivedTypes(Type baseType)
        {
            if (typeCache.ContainsKey(baseType))
            {
                return(typeCache[baseType]);
            }

            // next we'll search for the derived type aware attributes on the type.
            // letting go of the lock as this operation can be longer lived

            var attributes =
                baseType.GetCustomAttributes(typeof(DerivedTypeBinderAwareAttribute), true) as
                DerivedTypeBinderAwareAttribute[];

            var types = from a in attributes select a.DerivedType;

            RegisterDerivedTypes(baseType, types);

            return(types);
        }
コード例 #19
0
        public NitroxId AssignPlayerToEscapePod(ushort playerId, out Optional <EscapePodModel> newlyCreatedPod)
        {
            newlyCreatedPod = Optional.Empty;

            if (escapePodsByPlayerId.ContainsKey(playerId))
            {
                return(escapePodsByPlayerId[playerId].Id);
            }

            if (podForNextPlayer.IsFull())
            {
                newlyCreatedPod  = Optional.Of(CreateNewEscapePod());
                podForNextPlayer = newlyCreatedPod.Value;
            }

            podForNextPlayer.AssignedPlayers.Add(playerId);
            escapePodsByPlayerId[playerId] = podForNextPlayer;

            return(podForNextPlayer.Id);
        }
コード例 #20
0
 public static bool ContainsPrebuildRequest(int planetId, int prebuildId)
 {
     return(prebuildRequests.ContainsKey(new PrebuildOwnerKey(planetId, prebuildId)));
 }
コード例 #21
0
 public virtual bool ContainsChild(IMonohierarchy <T, TKey> child)
 {
     return(DictChildren.ContainsKey(child.Key));
 }
コード例 #22
0
        internal static void RegisterType(Type type, string lifeCycle)
        {
            var exportAttributes = type.GetCustomAttributes(typeof(RuleExportAttribute), false);

            if (exportAttributes == null || exportAttributes.Length == 0)
            {
                return;
            }

            RuleExportAttribute exportAttribute = exportAttributes[0] as RuleExportAttribute;

            switch (GetObjectLifeCycle(lifeCycle))
            {
            case ObjectLifeCycle.Singleton:
                unityContainer.RegisterInstance(exportAttribute.InterfaceType, Activator.CreateInstance(type));
                var tempArguments = exportAttribute.InterfaceType.GetGenericArguments();
                var eventType     = tempArguments.Count() > 0 ? tempArguments[0] : exportAttribute.InterfaceType;

                if (ruleHandlerContainer.ContainsKey(eventType))
                {
                    ruleHandlerContainer[eventType].Add(new RuleHandlerKeyValuePair()
                    {
                        InterfaceType = exportAttribute.InterfaceType,
                        ImplementType = type
                    });
                }
                else
                {
                    IList <RuleHandlerKeyValuePair> tempTypes = new List <RuleHandlerKeyValuePair>();
                    tempTypes.Add(new RuleHandlerKeyValuePair()
                    {
                        InterfaceType = exportAttribute.InterfaceType,
                        ImplementType = type
                    });
                    ruleHandlerContainer.Add(eventType, tempTypes);
                }
                break;

            case ObjectLifeCycle.New:
                //foreach (var tempInstance in objectInterfaces)
                unityContainer.RegisterType(exportAttribute.InterfaceType, type);
                var tempArguments1 = exportAttribute.InterfaceType.GetGenericArguments();
                var eventType1     = tempArguments1.Count() > 0 ? tempArguments1[0] : exportAttribute.InterfaceType;

                if (ruleHandlerContainer.ContainsKey(eventType1))
                {
                    ruleHandlerContainer[eventType1].Add(new RuleHandlerKeyValuePair()
                    {
                        InterfaceType = exportAttribute.InterfaceType,
                        ImplementType = type
                    });
                }
                else
                {
                    IList <RuleHandlerKeyValuePair> tempTypes = new List <RuleHandlerKeyValuePair>();
                    tempTypes.Add(new RuleHandlerKeyValuePair()
                    {
                        InterfaceType = exportAttribute.InterfaceType,
                        ImplementType = type
                    });
                    ruleHandlerContainer.Add(eventType1, tempTypes);
                }
                break;
            }
        }
コード例 #23
0
ファイル: Extensions.cs プロジェクト: sakpung/webstudy
        public static object GetElementValue(this DicomDataSet ds, long tag, bool list)
        {
            DicomVRType vr = DicomVRType.UN;

            if (Tags.ContainsKey(tag))
            {
                vr = Tags[tag].VR;
            }
            else
            {
                DicomTag dt = DicomTagTable.Instance.Find(tag);

                if (dt != null)
                {
                    vr = dt.VR;
                    Tags.Add(tag, dt);
                }
            }

            switch (vr)
            {
            case DicomVRType.AE:
            case DicomVRType.CS:
            case DicomVRType.LO:
            case DicomVRType.LT:
            case DicomVRType.SH:
            case DicomVRType.ST:
            case DicomVRType.UI:
            case DicomVRType.UT:
            case DicomVRType.PN:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <string> >(tag, null));
                }
                return(ds.GetValue <string>(tag, string.Empty));

            case DicomVRType.FL:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <float> >(tag, null));
                }
                return(ds.GetValue <float?>(tag, null));

            case DicomVRType.OW:
            case DicomVRType.SS:
            case DicomVRType.US:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <short> >(tag, null));
                }
                return(ds.GetValue <short?>(tag, null));

            case DicomVRType.DS:
            case DicomVRType.FD:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <double> >(tag, null));
                }
                return(ds.GetValue <double?>(tag, null));

            case DicomVRType.AT:
            case DicomVRType.IS:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <int> >(tag, null));
                }
                return(ds.GetValue <int?>(tag, null));

            case DicomVRType.SL:
            case DicomVRType.UL:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <long> >(tag, null));
                }
                return(ds.GetValue <long?>(tag, null));

            case DicomVRType.DA:
                if (list && ds.GetCount(tag) > 0)
                {
                    return(ds.GetValue <List <DateTime> >(tag, null));
                }
                return(ds.GetValue <DateTime?>(tag, null));
            }

            return(null);
        }
コード例 #24
0
ファイル: GuiFont.cs プロジェクト: kroll-software/SummerGUI
        private void InitFont(float scaleFactor)
        {
            try {
                System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();

                ScaleFactor   = scaleFactor;
                YOffsetScaled = YOffset * scaleFactor;

                // Reset everything
                Clear();

                Font = new Face(FontManager.Library, FilePath);

                // Go on

                float size = Size.Scale(ScaleFactor);

                Fixed26Dot6 sz = new Fixed26Dot6(size / 64);
                Font.SetCharSize(sz, sz, 72, 72);

                int pixelSize = (size * 1.3334).Ceil();
                Font.SetPixelSizes((uint)pixelSize, (uint)pixelSize);

                GlyphCount = Font.GlyphCount;
                int glyphCount = GlyphCount;
                Monospace = Font.FaceFlags.HasFlag(FaceFlags.FixedWidth);

                string tmpName = Font.GetPostscriptName();
                if (!String.IsNullOrEmpty(tmpName))
                {
                    Name = tmpName;
                }


                // We support 4 different glyph loading strategies:
                //
                // (1) All: all glyphs loaded at once on start
                // (2) Filtered: all filtered glyphs loaded at once on start
                // (3) OnDemand: no glyphs loaded at start, all glyphs on demand


                if (OnDemand)
                {
                    // Startegy (3)
                    GlyphCount = 0;
                }
                else if (Filter > GlyphFilterFlags.OnDemand)
                {
                    // Startegy (2)
                    // If we have a Filter set, let's count the number of valid glyphs
                    // to minimize graphics memory.
                    uint glyphindex;
                    uint cc    = Font.GetFirstChar(out glyphindex);
                    int  count = 0;
                    while (glyphindex > 0)
                    {
                        char c = (char)cc;
                        if (Filter.IsValid(c))
                        {
                            count++;
                        }
                        cc = Font.GetNextChar(cc, out glyphindex);
                    }
                    GlyphCount = count;
                }
                else
                {
                    // Strategy (1), loading the entire font
                }

                m_Textures = new int[Math.Max(32, GlyphCount)];
                CharMap    = new ThreadSafeDictionary <char, GlyphInfo>(Math.Max(31, GlyphCount));

                if (!OnDemand)
                {
                    // Strategy (1) + (2): Load all or filtered glyphs
                    m_ListBase = GL.GenLists(GlyphCount);
                    GL.GenTextures(GlyphCount, m_Textures);

                    uint glyphindex;
                    uint cc = Font.GetFirstChar(out glyphindex);
                    while (glyphindex > 0)
                    {
                        char c = (char)cc;
                        if (!CharMap.ContainsKey(c) && Filter.IsValid(c))
                        {
                            try {
                                CharMap.Add(c, CompileCharacter(Font, glyphindex, c));
                            } catch (Exception ex) {
                                ex.LogWarning();
                            }
                        }
                        cc = Font.GetNextChar(cc, out glyphindex);
                    }
                    CharMap.TryGetValue(SpecialCharacters.Ellipsis, out m_EllipsisGlyphIndex);
                }
                else
                {
                    try {
                        GetGlyphIndex(SpecialCharacters.Ellipsis, out m_EllipsisGlyphIndex);
                    } catch (Exception ex) {
                        ex.LogError();
                    }
                }

                //if (Height <= 1)
                //Height = pixelSize.NextPowerOf2();
                //Height = pixelSize * 1.33335f;

                Height = pixelSize;

                float fscale = Height / Font.Height * 1.33334f;
                //float fscale = Height / Font.Height * 0.776f;

                Ascender  = Font.Ascender * fscale;
                Descender = Font.Descender * fscale;
                //HalfHeight = Height / 2;

                Height     = (Ascender).Ceil();
                HalfHeight = (int)(Height / 2);

                //LineHeight = Height * 1.42f * LineSpacing;
                LineHeight = (int)((Height * 1.42f * LineSpacing) + 0.5f);

                //TextBoxHeight = ((Height * 2f) + (ScaleFactor * 2f)).Ceil();
                //TextBoxHeight = (int)(Height * 1.85f + 0.5f);
                TextBoxHeight = (int)(Height * 1.85f + 2);
                CaptionHeight = (int)(Height * 1.55 + 2);

                YOffsetScaled = (YOffset * ScaleFactor) - HalfHeight;

                if (OnDemand)
                {
                    Count.LogInformation("Font {0} ({1}), {2}/{3} glyphs pre-loaded in {4} ms, more glyphs are loaded on demand.", Name, Size, Count, glyphCount, sw.ElapsedMilliseconds);
                }
                else
                {
                    Count.LogInformation("Font {0} ({1}), {2}/{3} glyphs loaded in {4} ms.", Name, Size, Count, glyphCount, sw.ElapsedMilliseconds);
                }
            } catch (Exception ex) {
                ex.LogError();
            } finally {
                if (!OnDemand && Font != null)
                {
                    Font.Dispose();
                    Font = null;
                }
            }
        }
コード例 #25
0
ファイル: ImageList.cs プロジェクト: kroll-software/SummerGUI
 public bool ContainsKey(string key)
 {
     return(m_Images.ContainsKey(key));
 }
コード例 #26
0
ファイル: GuiFont.cs プロジェクト: kroll-software/SummerGUI
 public bool ContainsChar(char c)
 {
     return(CharMap.ContainsKey(c));
 }