public static void ResetDefault() { _flagOwnerWithDomain = true; _rowHeight = 24; _enableAutoRefreshAtStartup = true; _autoRefreshInternval = 10; _ownerShowFmt = OwnerShowFormat.FullName; _curThemeName = "default"; }
public void UpdateOwnerFormat(OwnerShowFormat fmt) { AppConfig.OwnerFormat = fmt; ComPortItem[] allItems = ComPortControlTable.AllItems; foreach (ComPortItem item in allItems) { if (item.GuiItem != null && item.OwnUser != string.Empty) { item.GuiItem.SubItems[1].Text = item.FormatedOwner; } } menuOwnerFormatDomainUser.Checked = (fmt == OwnerShowFormat.DomainUser); menuOwnerFormatFullName.Checked = (fmt == OwnerShowFormat.FullName); menuOwnerFormatPhone.Checked = (fmt == OwnerShowFormat.Phone); menuOwnerFormatShortName.Checked = (fmt == OwnerShowFormat.ShortName || fmt == OwnerShowFormat.Default); }
public static string GetOwnerShow(OwnerShowFormat fmt, string domainuser) { if (fmt == OwnerShowFormat.Default) { return(domainuser); } string lowdu = domainuser.ToLower(); if (fmt == OwnerShowFormat.DomainUser) { return(lowdu); } if (!_allOwners.ContainsKey(lowdu)) { return(domainuser); } OwnerEntry owner = _allOwners[lowdu]; if (owner == null) { return(domainuser); } if (fmt == OwnerShowFormat.FullName) { return(owner.FullName); } else if (fmt == OwnerShowFormat.ShortName) { return(owner.ShortName); } else if (fmt == OwnerShowFormat.Phone) { return(owner.Phone); } else { return(domainuser); } }
public static void LoadGlobalConfig() { string path = "config\\com_owner_spy_global.dat"; StreamReader reader = null; try { reader = File.OpenText(path); } catch { return; } string line; //ComHandle.Clear(); while (!reader.EndOfStream) { line = reader.ReadLine(); if (line.StartsWith("Ports:")) { //string[] ports = line.Substring("Ports:".Length).Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); //foreach (string p in ports) //{ // ComHandle.Add(new ComItem(p)); //} } else if (line.StartsWith("RowHeight:")) { try { _rowHeight = int.Parse(line.Substring("RowHeight".Length)); if (_rowHeight < 10 || _rowHeight > 48) { _rowHeight = 24; } } catch { _rowHeight = 24; } } else if (line.StartsWith("EnableAutoRefreshAtStartup:")) { bool val = false; try { val = bool.Parse(line.Substring("EnableAutoRefreshAtStartup:".Length)); } catch { val = false; } _enableAutoRefreshAtStartup = val; } else if (line.StartsWith("AutoRefreshInternval:")) { int val = 30; try { val = int.Parse(line.Substring("AutoRefreshInternval:".Length)); } catch { val = 30; } _autoRefreshInternval = val;; } else if (line.StartsWith("OwnerShowFormat:")) { string str = line.Substring("OwnerShowFormat:".Length); _ownerShowFmt = Utility.ParseOwnerShowFormat(str); } else if (line.StartsWith("CurrentThemeName:")) { string str = line.Substring("CurrentThemeName:".Length); _curThemeName = str; } else if (line.StartsWith("#End Data#")) { break; //end of config file } } reader.Close(); }