/// <summary> /// TCP服务端 /// </summary> public NetUDPServer() { InitializeComponent(); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(NetUDPServer)); } else { LanguageSet.SetLang("en-US", this, typeof(NetUDPServer)); } //cbxLocalIP.SelectedIndex = 0; if (this.DesignMode == false) { cbxLocalIP.Items.Clear(); IPHostEntry ipHostEntry = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in ipHostEntry.AddressList) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {//筛选IPV4 cbxLocalIP.Items.Add(ip.ToString()); } } } if (cbxLocalIP.Items.Count > 0) { cbxLocalIP.SelectedIndex = 0; } }
//private string lan; //private IniFiles settingFile;//配置文件 public NetUDPClient() { InitializeComponent(); //settingFile = new IniFiles(Application.StartupPath + "\\IniFile\\setting.ini"); //lan = settingFile.ReadString("SETTING", "Language", "1"); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(NetUDPClient)); } else { LanguageSet.SetLang("en-US", this, typeof(NetUDPClient)); } if (this.DesignMode == false) { IPHostEntry ipHostEntry = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in ipHostEntry.AddressList) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {//筛选IPV4 txtServerIP.Text = ip.ToString(); } } } }
private IniFiles settingFile;//配置文件 public NetRs232() { InitializeComponent(); settingFile = new IniFiles(Application.StartupPath + "\\IniFile\\setting.ini"); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(NetRs232)); } else { LanguageSet.SetLang("en-US", this, typeof(NetRs232)); } drpComList.Items.Clear(); drpComList.Items.AddRange(SerialPort.GetPortNames().Distinct().ToArray()); if (drpComList.Items.Count > 0) { drpComList.SelectedIndex = 0; btnCom.Enabled = true; } drpBaudRate.SelectedIndex = 5; drpParity.SelectedIndex = 0; drpDataBits.SelectedIndex = 0; drpStopBits.SelectedIndex = 0; ComDevice.DataReceived += new SerialDataReceivedEventHandler(Com_DataReceived); }
/// <summary> /// Create a new LanguageSet object. /// </summary> /// <param name="id">Initial value of ID.</param> /// <param name="name">Initial value of Name.</param> public static LanguageSet CreateLanguageSet(int id, string name) { LanguageSet languageSet = new LanguageSet(); languageSet.ID = id; languageSet.Name = name; return(languageSet); }
public frmGetMac() { InitializeComponent(); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(frmGetMac)); } else { LanguageSet.SetLang("en-US", this, typeof(frmGetMac)); } //GetAllIPAndMac(); }
public frmCMD() { InitializeComponent(); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(frmCMD)); } else { LanguageSet.SetLang("en-US", this, typeof(frmCMD)); } SetType(EnumType.DataEncode.Hex); }
public StringFind(DataReceive DR) { InitializeComponent(); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(StringFind)); } else { LanguageSet.SetLang("en-US", this, typeof(StringFind)); } dr = DR; }
/// <summary> /// Creates a new <see cref="SelectionCandidate"/> provider. /// </summary> /// <param name="config">User settings controlling network behaviour, solving, etc.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param> /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param> /// <param name="languages">The preferred languages for the implementation.</param> public SelectionCandidateProvider([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, LanguageSet languages) { #region Sanity checks if (config == null) throw new ArgumentNullException("config"); if (feedManager == null) throw new ArgumentNullException("feedManager"); if (store == null) throw new ArgumentNullException("store"); if (packageManager == null) throw new ArgumentNullException("packageManager"); #endregion _config = config; _isCached = BuildCacheChecker(store); _packageManager = packageManager; _comparer = new TransparentCache<FeedUri, SelectionCandidateComparer>(id => new SelectionCandidateComparer(config, _isCached, _interfacePreferences[id].StabilityPolicy, languages)); _feeds = new TransparentCache<FeedUri, Feed>(feedManager.GetFeed); }
public frmCMD(Model.CMD cmd) { InitializeComponent(); if (LanguageSet.Language == "0") { LanguageSet.SetLang("", this, typeof(frmCMD)); } else { LanguageSet.SetLang("en-US", this, typeof(frmCMD)); } txtContent.SetCMD(cmd); SetType(txtContent.EncodeType); ami_Tips.Text = cmd.Tips; }
public Question(LanguageSet language) { this.language = language; InitializeComponent(); toolStripQuestionListBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; toolStripQuestionListBox.AutoCompleteSource = AutoCompleteSource.ListItems; using (ForumContainer container = new ForumContainer()) { toolStripQuestionListBox.Items.AddRange( QuestIdentification.questIdentifications(container.QuestionSet .Where(y => y.LanguageLanguageId == this.language.LanguageId)) .Select(x => x.text).ToArray()); } }
/// <summary>Applies this tag to the given language.</summary> /// <param name="language">The language that this tag came from.</param> /// <param name="element">The element from the language file that contains the language name and code as attributes.</param> public void Apply(LanguageSet language,LanguageElement element){ language.Name=element["name"]; string code=element["code"]; if(code!=null){ language.Code=(code).Trim().ToLower(); } string direction=element["direction"]; if(direction==null){ direction=element["dir"]; } if(direction!=null){ direction=direction.Trim().ToLower(); language.GoesLeftwards=(direction=="rtl" || direction=="righttoleft" || direction=="leftwards" || direction=="left"); }else{ language.GoesLeftwards=false; } string group=element["group"]; if(group!=null){ language.Group=group; } }
/// <summary> /// Transfers attributes from another <see cref="Element"/> object to this one. /// Existing values are not replaced. Provides an inheritance-like relation. /// </summary> /// <param name="parent">The object to take the attributes from.</param> internal void InheritFrom([NotNull] Element parent) { #region Sanity checks if (parent == null) throw new ArgumentNullException(nameof(parent)); #endregion // Check if values are unset and need inheritance) if (Version == null) Version = parent.Version; if (VersionModifier == null) VersionModifier = parent.VersionModifier; if (Released == default(DateTime)) Released = parent.Released; if (Main == null) Main = parent.Main; if (SelfTest == null) SelfTest = parent.SelfTest; if (DocDir == null) DocDir = parent.DocDir; if (License == null) License = parent.License; if (Stability == Stability.Unset) Stability = parent.Stability; if (Languages.Count == 0) Languages = new LanguageSet(parent.Languages); if (Architecture == default(Architecture)) Architecture = parent.Architecture; // Accumulate list entries Commands.AddRange(parent.Commands); Dependencies.AddRange(parent.Dependencies); Restrictions.AddRange(parent.Restrictions); Bindings.AddRange(parent.Bindings); }
public void TestDuplicateDetection() { var collection = new LanguageSet("en_US"); collection.Add("en-US").Should().BeFalse(); collection.Should().BeEquivalentTo(new LanguageSet {"en-US"}); }
public void TestToString() { var collection = new LanguageSet {"en-US", "de"}; collection.ToString().Should().Be("de en_US"); }
//--------------------------------------
private static void Read_Languages() { #region Errors if (!Directory.Exists(DataPath_LanguagesDirectory)) ZOutput.ErrorMsgWait("Error! Cannot find language resources."); var languages = Directory.GetDirectories(DataPath_LanguagesDirectory); if (languages.Length == 0) { ZOutput.ErrorMsgWait("Error! Cannot find language resources."); } #endregion Languages = new LanguageSet(); HelpSets = new Dictionary<string, PropertyList>(); IntroSets = new Dictionary<string, List<string>>(); npcNames = new Dictionary<string, List<string>>(); alienNames = new Dictionary<string, List<string>>(); starNames = new Dictionary<string, List<string>>(); foreach (var languagePath in languages) { var fileNames = Directory.GetFiles(languagePath, "*.txt"); var languageName = Path.GetFileName(languagePath) ?? "Unknown"; foreach (var fullFileName in fileNames) { var codePage = int.Parse(File.ReadAllLines(fullFileName)[0]); var encoding = Encoding.GetEncoding(codePage); var fileName = Path.GetFileNameWithoutExtension(fullFileName); switch (fileName) { case DataPath_Main: #region Main resources var resources = File.ReadAllLines(fullFileName, encoding); var translations = new TranslationSet(); foreach (var resource in resources.Where(a => !string.IsNullOrEmpty(a))) { var tokens = resource.Split(new[] {'\t'}, StringSplitOptions.RemoveEmptyEntries); if (tokens.Length > 1 && !translations.ContainsKey(tokens[0])) translations.Add(tokens[0], tokens[1].Replace("\\r\\n", "\r\n")); } Languages.Add(languageName, translations); break; #endregion case DataPath_Help: var propertyList = ZConfig.ReadConfig(fullFileName, encoding); HelpSets.Add(languageName, propertyList); break; case DataPath_Intro : IntroSets.Add(languageName, File.ReadAllLines(fullFileName, encoding).Where(a => a.Any(c => !char.IsDigit(c))).ToList()); break; case DataPath_NPC_Names : npcNames.Add(languageName, File.ReadAllLines(fullFileName, encoding).Where(a => !string.IsNullOrEmpty(a) && a.Any(c => !char.IsDigit(c))).ToList()); break; case DataPath_Alien_Names: alienNames.Add(languageName, File.ReadAllLines(fullFileName, encoding).Where(a => !string.IsNullOrEmpty(a) && a.Any(c => !char.IsDigit(c))).ToList()); break; case DataPath_Star_Names: starNames.Add(languageName, File.ReadAllLines(fullFileName, encoding).Where(a => !string.IsNullOrEmpty(a) && a.Any(c => !char.IsDigit(c))).ToList()); break; } } } }