Example #1
0
 public static void Initialize(RenderWindow window, ITimeInfo timeInfo, IInput input, IWindowUtil windowUtil, Func <ILogger> getLogger, ITextInfo text)
 {
     Window = window;
     if (_initialized)
     {
         return;
     }
     _initialized = true;
     TimeInfo     = timeInfo;
     Input        = input;
     WindowUtil   = windowUtil;
     _getLogger   = getLogger;
     Text         = text;
 }
Example #2
0
 public static string GetLocalIP(Form owner, ITextInfo info)
 {
     if (local_ip == null)
     {
         if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
         {
             info.Add(Images.Error, "Rede não disponível!");
             return("0.0.0.0");
         }
         IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
         if (host.AddressList.Length == 1)
         {
             local_ip = host.AddressList[0].ToString();
         }
         else
         {
             //o usuario tem que escolher a rede...
             ChooseList c = new ChooseList(owner, "Escolha a rede local conectada no equipamento:");
             foreach (IPAddress ip in host.AddressList)
             {
                 if (ip.ToString().IndexOf(":") == -1) //ignora IPv6
                 {
                     c.AddItem(ip.ToString());
                 }
             }
             if (c.Count > 1)
             {
                 owner.Invoke((Action)(() => c.ShowDialog()));
                 local_ip = c.SelectedItem;
             }
             else
             {
                 local_ip = c.First;
             }
         }
     }
     return(local_ip);
 }
            public TextLayout(
                TextServiceDirectWrite service,
                string line,
                Graphics _graphics,
                Font _font)
            {
                try
                {
                    int hr;

                    text = line;

                    lineInterop = new TextServiceLineDirectWriteInterop();
                    hr = lineInterop.Init(service.interop, line, line.Length);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }

                #if true
                    uniscribeLine = service.uniscribeService.AnalyzeText(_graphics, _font, _font.Height, line);
                #else // TODO: support Windows.Data.Text for universal script segmentation support
                #endif
                }
                catch (Exception)
                {
                    Dispose();
                    throw;
                }
            }
Example #4
0
 /// <summary>
 /// 处理文本信息
 /// </summary>
 /// <param name="textMsgInfo"></param>
 private void dealWithMessage(ITextInfo textMsgInfo)
 {
 }
        public static TypeDefinition Resolve(TypeReference tr, IEnumerable<AssemblyDefinition> assemblyList, ITextInfo info)
        {
            if (tr == null) 
                return null;
            if (tr is TypeDefinition)
                return (TypeDefinition)tr;
            
            try
            {
                SetupResolveFirst(assemblyList);

                if (tr.Name == null || tr.Name.Length == 0)
                {
                    throw new ApplicationException(
                        String.Format("Could not resolve: type reference 0x{0:x08}, type name is empty.", 
                        tr.MetadataToken.ToUInt32()));
                }

                return tr.Resolve();
            }
            catch(Exception ex)
            {
                if (info != null && !info.TextInfo.Contains(ex.Message))
                    info.AppendTextInfoLine(ex.Message);
                return null;
            }
            finally
            {
                RemoveResolveFirst();
            }
        }
 public static MethodDefinition Resolve(MethodReference mr, IEnumerable<AssemblyDefinition> assemblyList, ITextInfo info)
 {
     if (mr == null) 
         return null;
     if (mr is MethodDefinition)
         return (MethodDefinition)mr;
     try
     {
         SetupResolveFirst(assemblyList);
         return mr.Resolve();
     }
     catch(Exception ex)
     {
         if (info != null && !info.TextInfo.Contains(ex.Message))
             info.AppendTextInfoLine(ex.Message);
         return null;
     }
     finally
     {
         RemoveResolveFirst();
     }
 }