From cefcc903f51610846fa313a3a35bca34e129c1fe Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期五, 25 十月 2024 08:57:01 +0800
Subject: [PATCH] 代码清理以及格式化

---
 DevApp/Gs.DevApp/DevFrm/Sys/FileSelector.cs |   79 +++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/FileSelector.cs b/DevApp/Gs.DevApp/DevFrm/Sys/FileSelector.cs
index 52d32b1..1baf41f 100644
--- a/DevApp/Gs.DevApp/DevFrm/Sys/FileSelector.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Sys/FileSelector.cs
@@ -1,15 +1,33 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
+锘縰sing System.Windows.Forms;
 
 namespace Gs.DevApp.DevFrm.Sys
 {
-    public enum FileType { Txt, Xml, Pdf, Bin, Zip, All, Img, Excel }
+    public enum FileType
+    {
+        Txt,
+        Xml,
+        Pdf,
+        Bin,
+        Zip,
+        All,
+        Img,
+        Excel
+    }
+
     public class FileSelector
     {
         public static string Title = "Please choose the file:";
-        public static string Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
+
+        public static string Filter =
+            "Text files (*.txt)|*.txt|All files (*.*)|*.*";
+
+        /// <summary>
+        ///     Get or set the initial directory displayed by the file dialog box.
+        /// </summary>
+        public static OpenFileDialog OFD = new OpenFileDialog();
+
+        public static SaveFileDialog SFD = new SaveFileDialog();
+
         public static FileType FileExtension
         {
             set
@@ -20,22 +38,28 @@
                         Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*";
                         break;
                     case FileType.Excel:
-                        Filter = "Text files(*.xls;*.xlsx)|*.xls;*.xlsx|All files(*.*)|*.*";
+                        Filter =
+                            "Text files(*.xls;*.xlsx)|*.xls;*.xlsx|All files(*.*)|*.*";
                         break;
                     case FileType.Xml:
-                        Filter = "XML files(*.xml)|*.xml|Config files(*.config)|*.config|All files(*.*)|*.*";
+                        Filter =
+                            "XML files(*.xml)|*.xml|Config files(*.config)|*.config|All files(*.*)|*.*";
                         break;
                     case FileType.Pdf:
-                        Filter = "Pdf files(*.Pdf)|*.Pdf|Pdf form files(*.fdf)|*.fdf|All files(*.*)|*.*";
+                        Filter =
+                            "Pdf files(*.Pdf)|*.Pdf|Pdf form files(*.fdf)|*.fdf|All files(*.*)|*.*";
                         break;
                     case FileType.Bin:
-                        Filter = "Binary files(*.bin)|*.bin|Application files(*.exe;*.lib;*.dll)|*.exe;*.lib;*.dll|All files(*.*)|*.*";
+                        Filter =
+                            "Binary files(*.bin)|*.bin|Application files(*.exe;*.lib;*.dll)|*.exe;*.lib;*.dll|All files(*.*)|*.*";
                         break;
                     case FileType.Zip:
-                        Filter = "Zip files(*.zip;*.rar)|*.zip;*.rar|All files(*.*)|*.*";
+                        Filter =
+                            "Zip files(*.zip;*.rar)|*.zip;*.rar|All files(*.*)|*.*";
                         break;
                     case FileType.Img:
-                        Filter = "GIF(*.gif)|*.gif|Jpeg(*.jpg)|*.jpg|Bmp(*.bmp)|*.bmp|Emf(*.emf)|*.emf|Png(*.png)|*.png";
+                        Filter =
+                            "GIF(*.gif)|*.gif|Jpeg(*.jpg)|*.jpg|Bmp(*.bmp)|*.bmp|Emf(*.emf)|*.emf|Png(*.png)|*.png";
                         break;
                     case FileType.All:
                         Filter = "All files(*.*)|*.*";
@@ -43,11 +67,6 @@
                 }
             }
         }
-        ///<summary>
-        ///Get or set the initial directory displayed by the file dialog box.
-        ///</summary>
-        public static OpenFileDialog OFD = new OpenFileDialog();
-        public static SaveFileDialog SFD = new SaveFileDialog();
 
         public static string InitialPath
         {
@@ -63,13 +82,8 @@
             OFD.Title = Title;
             OFD.Filter = Filter;
             if (OFD.ShowDialog() == DialogResult.OK)
-            {
                 return OFD.FileName;
-            }
-            else
-            {
-                return null;
-            }
+            return null;
         }
 
         public static string BrowseFileForSave()
@@ -77,13 +91,8 @@
             SFD.Title = Title;
             SFD.Filter = Filter;
             if (SFD.ShowDialog() == DialogResult.OK)
-            {
                 return SFD.FileName;
-            }
-            else
-            {
-                return null;
-            }
+            return null;
         }
 
         public static string BrowseFile(FileType type)
@@ -109,17 +118,13 @@
             Filter = filter;
             return BrowseFileForSave();
         }
+
         public static string BrowseFilePathForSave()
         {
-            FolderBrowserDialog fbd = new FolderBrowserDialog();
+            var fbd = new FolderBrowserDialog();
             if (fbd.ShowDialog() == DialogResult.OK)
-            {
                 return fbd.SelectedPath; //鑾峰緱閫夋嫨鐨勬枃浠跺す璺緞
-            }
-            else
-            {
-                return "";
-            }
+            return "";
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3