private bool SetUrl() { bool handled = false; string iconFile = string.Empty; try { FileIni file = new FileIni(TargetFilePath); iconFile = file.Value("IconFile", string.Empty); if (string.IsNullOrEmpty(iconFile)) { string browserPath = FileUrl.GetDefaultBrowserPath(); if (string.IsNullOrEmpty(browserPath)) { Log.Info($"Resolve *.URL '{TargetFilePath}'" + $"No default browser found!"); } else { Icon = IconReader.GetFileIconWithCache(browserPath, false); diposeIcon = false; handled = true; } } else if (System.IO.File.Exists(iconFile)) { Icon = Icon.ExtractAssociatedIcon(iconFile); handled = true; } else { Log.Info($"Resolve *.URL '{TargetFilePath}' has no icon"); } } catch (Exception ex) { if (ex is SecurityException || ex is ArgumentException || ex is UnauthorizedAccessException || ex is PathTooLongException || ex is NotSupportedException) { Log.Warn($"path:'{TargetFilePath}', " + $"iconFile:'{iconFile}'", ex); } else { throw; } } SetText($"{FileInfo.Name.Substring(0, FileInfo.Name.Length - 4)}"); return(handled); }
/// <summary> /// �ڳ�ʼ��֮ǰִ�� /// </summary> public void fisrtInit() { RunPath = Application.ExecutablePath; RunPath = RunPath.Substring(0, RunPath.LastIndexOf("\\")); SERPATH = RunPath + "\\" + SERPATH; INIPATH = RunPath + "\\" + INIPATH; fIni = new FileIni(INIPATH); fSer = new FileSer(); fTxt = new FileTxt(); frmSet = null; }
public frmMessage() { InitializeComponent(); fm = new frmMain(); fIni = fm.fIni; }
//�����û�ϰ��¼ private void Del_User_ini() { if (File.Exists(Application.StartupPath+"\\User.ini")) { User_Ini = new FileIni(Application.StartupPath + "\\User.ini"); string Select_Views = User_Ini.ReadValue("Setting", UserID+"Select_View"); string Select_Types = User_Ini.ReadValue("Setting", UserID+"Select_Type"); string left_widths = User_Ini.ReadValue("Setting", UserID+"left_width"); string down_widths = User_Ini.ReadValue("Setting", UserID+"down_width"); string right_widths = User_Ini.ReadValue("Setting", UserID+"right_width"); string FontSizes = User_Ini.ReadValue("Setting", UserID + "FontSize"); try { if (Select_Views!="") { Select_View=Convert.ToInt32(Select_Views.ToString()); } if (Select_Types != "") { Select_Type=Convert.ToInt32(Select_Types.ToString()); } if (left_widths != "") { left_width = Convert.ToInt32(left_widths.ToString()); } if (down_widths != "") { down_width = Convert.ToInt32(down_widths.ToString()); } if (right_widths != "") { right_width = Convert.ToInt32(right_widths.ToString()); } if (FontSizes != "") { FontSize = float.Parse(FontSizes.ToString()); } } catch (Exception) { throw; } } else { User_Ini = new FileIni(Application.StartupPath + "\\User.ini"); } switch (Select_View) { case 0: toolStripMenu_Sl.PerformClick(); break; case 1: toolStripMenu_PP.PerformClick(); break; case 2: toolStripMenu_TB.PerformClick(); break; case 3: toolStripMenu_LB.PerformClick(); break; default: break; } switch (Select_Type) { case 0: toolStripMenu_Big.PerformClick(); break; case 1: toolStripMenu_Mid.PerformClick(); break; case 2: toolStripMenu_Little.PerformClick(); break; default: break; } splitContainer1.SplitterDistance = left_width; splitContainer3.SplitterDistance = down_width; splitContainer2.SplitterDistance = right_width; treeList1.Columns[0].AppearanceCell.Font = new System.Drawing.Font(treeList1.Columns[0].AppearanceCell.Font.FontFamily, FontSize); treeList1.RowHeight = Convert.ToInt32(20 * treeList1.Columns[0].AppearanceCell.Font.Size / 10F); treeList1.Refresh(); }