Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Ordner festlegen
            string folderName = "C:\\Inetpub";

            try
            {
                // Rekursives Ermitteln der Größe der im Ordner direkt und in allen
                // Unterordnern gespeicherten Dateien. Übergeben werden der Ordnername
                // und eine neue Instanz des Fortschritts-Delegate
                FolderUtil.FolderSizes fs = FolderUtil.GetSubFolderSizes(
                    folderName, new FolderUtil.FolderProgress(OnProgress));

                // Die Auflistung der Ordnergrößen durchgehen
                Console.WriteLine("\r\nErmittelte Größen:");
                for (int i = 0; i < fs.Count; i++)
                {
                    Console.WriteLine("{0}: {1:#,#0} Byte",
                                      fs[i].FolderName, fs[i].Size);
                }
            }
            catch (IOException ex)
            {
                Console.WriteLine("Fehler: " + ex.Message);
            }

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        private void CleanCleanBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var worker = (BackgroundWorker)sender;

            IsCleaningCache = true;
            OutputText      = string.Empty;
            ErrorText       = string.Empty;
            worker.ReportProgress(0);

            //使用CMD清理Winsxc等
            //CacheCacheByCmd(worker);
            //删除文件
            var toCleanFolders = SelectedItems.Select(I => I.ModuleFolder).ToList();

            Application.Current.Dispatcher.Invoke(() => { ItemsSource.Clear(); });
            CleanCacheUsingFileUtil(worker, toCleanFolders);

            //删除文件夹下所有的空文件夹
            foreach (var folder in ToCleanUpManager.GetFolders())
            {
                try
                {
                    FolderUtil.DeleteEmptyFolder(folder, false);
                }
                catch (Exception exception)
                {
                    LogHelper.Error(exception.Message);
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            string sourceFolderName = @"C:\Temp";
            string destFolderName   = @"C:\Temp.copy";

            // Ordner als Beispiel zum Kopieren anlegen
            System.IO.Directory.CreateDirectory(sourceFolderName);

            Console.WriteLine("Kopiere '" + sourceFolderName + "' nach '" +
                              destFolderName + "' ...");
            try
            {
                // Ordner rekursiv kopieren
                FolderUtil.Copy(sourceFolderName, destFolderName);

                Console.WriteLine("Fertig");
            }
            catch (IOException ex)
            {
                Console.WriteLine("Fehler beim Kopieren des Ordners: " + ex.Message);
            }

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 转移桌面
        /// </summary>
        private async void TransferDesktop()
        {
            try
            {
                var destFolder = DestFolder;
                if (string.IsNullOrWhiteSpace(destFolder))
                {
                    MessageBox.Show("目录路径不能为空");
                    return;
                }
                var currentDesktopFolder = DesktopFolder;
                if (destFolder == currentDesktopFolder)
                {
                    MessageBox.Show("目录路径与当前桌面路径相同");
                    return;
                }

                //destFolder = Path.Combine(destFolder, "Desktop");
                FolderUtil.EnsureDirectoryExisting(destFolder);
                var canChangeDataPath = await CheckCanChangeDataPath(currentDesktopFolder, destFolder);

                if (canChangeDataPath)
                {
                    MoveCacheWidthBackgroundWorker(currentDesktopFolder, destFolder);
                }
            }
            catch (Exception e)
            {
                LogHelper.Error(e.Message);
                System.Windows.MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            // Ordnernamen festlegen
            string sourceFolderName = @"C:\Codebook";
            string destFolderName   = @"G:\Backup\Codebook";

            Console.WriteLine("Kopiere {0} nach {1} ...", sourceFolderName,
                              destFolderName);

            // Zielordner erzeugen, falls dieser nicht vorhanden ist
            Directory.CreateDirectory(destFolderName);

            // Ordner rekursiv mit Anwender-Nachfrage für das Überschreiben von
            // Ordnern kopieren
            try
            {
                if (FolderUtil.APICopy(sourceFolderName, destFolderName, true))
                {
                    Console.WriteLine("Fertig");
                }
                else
                {
                    Console.WriteLine("Fehler beim Kopieren des Ordners");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fehler beim Kopieren des Ordners: {0}", ex.Message);
            }

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }
        private void DrawResourceSystem()
        {
            DrbComponent drb = (DrbComponent)target;

            BeginModule("Resource System");
            PathPopup("Editor Path", m_EditorPath);
            if (GUILayout.Button("Open Folder"))
            {
                FolderUtil.OpenFolder(drb.GetPath(m_EditorPath.stringValue));
            }
            PathPopup("Internal Path", m_InternalPath);
            if (GUILayout.Button("Open Folder"))
            {
                FolderUtil.OpenFolder(drb.GetPath(m_InternalPath.stringValue));
            }
            PathPopup("ReadOnly Path", m_ReadOnlyPath);
            if (GUILayout.Button("Open Folder"))
            {
                FolderUtil.OpenFolder(drb.GetPath(m_ReadOnlyPath.stringValue));
            }
            PathPopup("Persistent Path", m_PersistentPath);
            if (GUILayout.Button("Open Folder"))
            {
                FolderUtil.OpenFolder(drb.GetPath(m_PersistentPath.stringValue));
            }
            m_ResourceLoaderComponent.objectReferenceValue = EditorGUILayout.ObjectField("Resource Loader Component", m_ResourceLoaderComponent.objectReferenceValue, typeof(Internal.Resource.ResourceLoaderComponent), true);
            TypePopup("Resource Holder", ref m_ResourceHolderTypeNamesIndex, m_ResourceHolderTypeNames, m_ResourceHolderTypeName);
            TypePopup("Resource Decoder", ref m_ResourceDecoderTypeNamesIndex, m_ResourceDecoderTypeNames, m_ResourceDecoderTypeName);
            TypePopup("Dependency Manifest", ref m_ResourceDependencyManifestTypeNamesIndex, m_ResourceDependencyManifestTypeNames, m_ResourceDependencyManifestTypeName);
            EndModule();
        }
Ejemplo n.º 7
0
        protected void MoveCacheBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var worker      = (BackgroundWorker)sender;
            var workerModel = (MoveCacheBackgroundWorkerModel)e.Argument;

            IsMovingFolder = true;
            worker.ReportProgress(0);

            try
            {
                long handledSize = 0;
                //1.获取所有待转移的缓存列表
                var currentOperationDetail = "获取所有待转移的文件..";
                worker.ReportProgress(0, new ProgressChangedContent()
                {
                    OperationDetail = currentOperationDetail
                });
                var allCacheFiles = FolderUtil.GetAllFiles(workerModel.DeskTopFolder, out long usertotalSize);
                MoveCacheFiles(allCacheFiles, ref handledSize, workerModel, usertotalSize, worker);
            }
            catch (Exception exception)
            {
                RestoreCacheFilesToPreviousPath(workerModel);
                LogHelper.Error(exception.Message);
                throw;
            }

            //返回执行结果
            e.Result = workerModel;
        }
Ejemplo n.º 8
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         if (messageNumber == 0)
         {
             FolderUtil.SendFileToPlayer("Broken Bridge.txt");
         }
         if (messageNumber == 1)
         {
             FolderUtil.SendFileToPlayer("door.json");
         }
         if (messageNumber == 2)
         {
             FolderUtil.SendFileToPlayer("wall.json");
         }
         if (messageNumber == 3)
         {
             FolderUtil.SendFileToPlayer("spin.json");
         }
         if (messageNumber == 4)
         {
             FolderUtil.SendFileToPlayer("MovingPlatform.json");
         }
         if (messageNumber == 5)
         {
             FolderUtil.SendFileToPlayer("SpinAndMove.json");
         }
         if (messageNumber == 6)
         {
             FolderUtil.SendFileToPlayer("spin.json");
             FolderUtil.SendFileToPlayer("MovingPlatform.json");
         }
     }
 }
Ejemplo n.º 9
0
 private static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     FolderUtil.CreateFolders();
     Application.Run(new ItemEditorForm());
 }
Ejemplo n.º 10
0
        private static void AddKakaoFrameworks(string buildPath)
        {
            foreach (var framework in _SystemFrameworks)
            {
                KGIosSupport.AddFramework(framework);
            }

            string frameworkFullPath = BuildTools.GetXcodeFrameworkFullPath(buildPath);

            foreach (var folderPath in _FolderPaths)
            {
                string folderFullPath = Path.Combine(_FrameworkRoot, folderPath);
                if (Directory.Exists(folderFullPath))
                {
                    foreach (var fileFullPath in Directory.GetDirectories(folderFullPath))
                    {
                        string fileName = Path.GetFileName(fileFullPath);
                        if (fileName.EndsWith(".framework") || fileName.EndsWith(".bundle"))
                        {
                            string dstFullPath = Path.Combine(frameworkFullPath, fileName);
                            FolderUtil.CopyAndReplace(fileFullPath, dstFullPath);
                            string xcodePath = Path.Combine(BuildTools.FrameworkXcodeRoot, fileName);                       //添加到Xcode工程的文件路径(相对路径)
                            KGIosSupport.AddFileToBuild(xcodePath, xcodePath);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void OnBuildAssetBundleClick()
        {
            int fileCount = IOUtil.GetAllFileCount(m_AssetPath);
            int index     = 0;

            //SaveFolderSettings(new string[] { m_AssetPath }, fileCount, ref index);

            for (int i = 0; i < m_PlatformSelected.Count; ++i)
            {
                string toPath = StringUtil.CombinePath(m_OutputPath, m_PlatformSelected[i].ToString());
                if (!Directory.Exists(toPath))
                {
                    Directory.CreateDirectory(toPath);
                }
                BuildPipeline.BuildAssetBundles(toPath, m_BuildAssetBundleOptions, m_PlatformSelected[i]);
            }

            if (m_Encoder != null)
            {
                fileCount = IOUtil.GetAllFileCount(m_OutputPath);
                index     = 0;
                EncryptAssetBundle(m_OutputPath, fileCount, ref index);
            }
            EditorUtility.ClearProgressBar();
            FolderUtil.OpenFolder(m_OutputPath);
            ShowNotification(new GUIContent("Build Asset Bundles Finish"));
            UnityEngine.Debug.Log("Build Asset Bundles Finish");
        }
Ejemplo n.º 12
0
        private void MoveCacheFiles(List <string> allCacheFiles, ref long handledSize, MoveCacheBackgroundWorkerModel workerModel,
                                    long totalSize, BackgroundWorker worker)
        {
            var currentOperationDetail = $"正在转移。。。";

            worker.ReportProgress(-1, new ProgressChangedContent()
            {
                OperationDetail = currentOperationDetail,
            });

            var currentOperationError = string.Empty;
            int filesCount            = allCacheFiles.Count;
            int moveIndex             = 0;

            foreach (var cacheFilePath in allCacheFiles)
            {
                try
                {
                    moveIndex++;
                    handledSize += new FileInfo(cacheFilePath).Length;

                    //移动文件
                    var newFilePath = GetNewFilePath(cacheFilePath, workerModel.DeskTopFolder, workerModel.UserDefinedFolder);
                    FileUtil.Move(cacheFilePath, newFilePath);

                    //记录已经转移的缓存文件
                    workerModel.MovedFiles.Add(new MovedFileDataMode(cacheFilePath, newFilePath));

                    //删除原有文件
                    FileUtil.Delete(cacheFilePath);
                }
                catch (Exception e)
                {
                    LogHelper.Error(e.Message);
                    currentOperationError = e.Message;
                    throw;
                }
                finally
                {
                    var cleanCacheProgressDetail = $"{moveIndex}/{filesCount}";
                    //报告进度
                    var progress = totalSize == 0 ? 100 : handledSize * 100 / totalSize;
                    worker.ReportProgress(Convert.ToInt32(progress), new ProgressChangedContent()
                    {
                        ProgressDetail = cleanCacheProgressDetail,
                        OperationError = currentOperationError
                    });
                }
            }

            //删除产品文件夹及其下所有的空文件夹
            FolderUtil.DeleteEmptyFolder(workerModel.DeskTopFolder, false);
            //报告进度
            worker.ReportProgress(-1, new ProgressChangedContent()
            {
                OperationOutput = $"转移完成.."
            });
        }
Ejemplo n.º 13
0
 private static void DeleteSDKFolder()
 {
     foreach (var folder in _AllFolders)
     {
         string folderPath = Path.Combine(Application.dataPath, folder);
         FolderUtil.Delete(folderPath);
         Debug.LogFormat("[Kakao]DeleteSDKFolder => Asset/{0} Succeed", folder);
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// 当前系统用户是否拥有目标路径的操作权限
        /// </summary>
        /// <param name="destDataPathFolder"></param>
        /// <returns></returns>
        private bool CheckPermission(string destDataPathFolder)
        {
            bool hasPermission = FolderUtil.HasOperationPermission(destDataPathFolder);

            if (!hasPermission)
            {
                //MessageBox.Show(this, "没有操作权限");
            }

            return(hasPermission);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// private constructor
        /// </summary>
        private DeviceSettings()
            : base(null)
        {
            string folderPath = FolderUtil.GetFolderPath(ThingsSettingsFolder, false);

            if (!string.IsNullOrEmpty(folderPath))
            {
                SettingsFile = Path.Combine(folderPath, ThingsSettingsFile);
                IsValid      = LoadSettings();
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 选择桌面
 /// </summary>
 private void SelectDesktop()
 {
     using (var dialog = FolderUtil.GetFolderBrowserDialog())
     {
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             var destFolder = dialog.SelectedPath;
             var isEndsWith = destFolder.EndsWith("Desktop");
             DestFolder = isEndsWith ? destFolder : Path.Combine(destFolder, "Desktop");
         }
     }
 }
Ejemplo n.º 17
0
 //拷贝插件
 private static void CopyPlugins()
 {
     #if UNITY_IOS
     string srcPath  = Path.Combine(_PluginsSrcPath, "iOS");
     string destPath = Path.Combine(_PluginsDestPath, "iOS");
     FolderUtil.CopyAndReplaceSub(srcPath, destPath);
     #elif UNITY_ANDROID
     string srcPath  = Path.Combine(_PluginsSrcPath, "Android");
     string destPath = Path.Combine(_PluginsDestPath, "Android");
     FolderUtil.CopyAndReplaceSub(srcPath, destPath);
     #endif
 }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            string sourceFolderName = @"C:\Codebook";
            string destFolderName   = @"G:\Backup\Codebook";

            Console.WriteLine("Kopiere '" + sourceFolderName + "' nach '" +
                              destFolderName + "' ...");

            // CopyFaults-Auflistung erzeugen
            CopyFaults copyFaults = new CopyFaults();

            // Ordner kopieren
            try
            {
                if (FolderUtil.ExtCopy(sourceFolderName, destFolderName,
                                       copyFaults))
                {
                    Console.WriteLine("Fertig");
                }
                else
                {
                    // Beim Kopieren sind Fehler aufgetreten: Alle Fehler
                    // durchgehen und ausgeben
                    for (int i = 0; i < copyFaults.Count; i++)
                    {
                        if (copyFaults[i].IsFile)
                        {
                            // es handelt sich um eine Datei
                            Console.WriteLine("Fehler beim Kopieren der " +
                                              "Datei '{0}' nach '{1}': {2}",
                                              copyFaults[i].Source, copyFaults[i].Destination,
                                              copyFaults[i].Error);
                        }
                        else
                        {
                            // es handelt sich um einen Ordner
                            Console.WriteLine("Fehler beim Kopieren des " +
                                              "Ordners '{0}' nach '{1}': {2}",
                                              copyFaults[i].Source, copyFaults[i].Destination,
                                              copyFaults[i].Error);
                        }
                    }
                }
            }
            catch (IOException ex)
            {
                Console.WriteLine("Fehler beim Kopieren des Ordners: {0}",
                                  ex.Message);
            }

            Console.ReadLine();
        }
Ejemplo n.º 19
0
        private void Gen(string path)
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            Assembly[]  assemblys = AppDomain.CurrentDomain.GetAssemblies();
            List <Type> types     = new List <Type>();

            for (int i = 0; i < assemblys.Length; ++i)
            {
                try
                {
                    Type[] ts = assemblys[i].GetTypes();
                    types.AddRange(ts);
                }
                catch
                {
                }
            }

            List <Type> extTypes = new List <Type>();

            for (int i = 0; i < types.Count; ++i)
            {
                if (types[i].Name.EndsWith(m_ExtensionsName))
                {
                    extTypes.Add(types[i]);
                }
            }
            float count = types.Count;

            for (int i = 0; i < types.Count; ++i)
            {
                Type t = types[i];
                if (EditorUtility.DisplayCancelableProgressBar("Generating EmmyLua Api", t.FullName, i / count))
                {
                    break;
                }
                Type extType = extTypes.Find((Type temp) => { return(temp.Name.Equals(t.Name + m_ExtensionsName)); });
                if (extType != null && (!extType.IsAbstract || !extType.IsSealed))
                {
                    extType = null;
                }
                GenType(t, extType, false, path);
            }
            EditorUtility.ClearProgressBar();
            FolderUtil.OpenFolder(m_OutputPath);
            UnityEngine.Debug.Log("Generate EmmyLua Api Finish");
        }
Ejemplo n.º 20
0
    public static T ReadJSON <T>(GlitchObject gObject)
    {
        try
        {
            return(JsonUtility.FromJson <T>(FolderUtil.GetFullTextFromPlayer(gObject.jsonFileName)));
        }
        catch (Exception)
        {
            Debug.Log("INVALID JSON RESETING");
            CreateJSON(gObject.jsonFileName);

            return(JsonUtility.FromJson <T>(FolderUtil.GetFullTextFromSource(gObject.jsonFileName)));
        }
    }
Ejemplo n.º 21
0
        private static List <string> GetAllPictures()
        {
            var list                 = new List <string>();
            var baseDirectory        = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var memoryPicturesFolder = Path.Combine(baseDirectory, @"Resources\MemoryPictures");

            if (Directory.Exists(memoryPicturesFolder))
            {
                var allFiles = FolderUtil.GetAllFiles(memoryPicturesFolder);
                list.AddRange(allFiles);
            }

            return(list);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// 恢复已经转移的缓存文件
 /// </summary>
 /// <param name="workerModel"></param>
 private void RestoreCacheFilesToPreviousPath(MoveCacheBackgroundWorkerModel workerModel)
 {
     try
     {
         foreach (var data in workerModel.MovedFiles)
         {
             File.Move(data.NewFilePath, data.PreviousFilePath);
         }
         //删除文件夹下所有的空文件夹
         FolderUtil.DeleteEmptyFolder(workerModel.UserDefinedFolder, false);
     }
     catch (Exception e)
     {
         LogHelper.Error("恢复缓存失败,异常信息为:" + e.Message);
     }
 }
        public static void FolderPathField(string label, string text, string title, Action <string> onValueChanged)
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUI.BeginChangeCheck();
                var value = EditorGUILayout.TextField(label, text);
                if (EditorGUI.EndChangeCheck())
                {
                    onValueChanged.Invoke(value);
                }

                if (GUILayout.Button("...", GUILayout.Width(30)))
                {
                    onValueChanged(FolderUtil.GetSaveFolderPath(title));
                }
            }
        }
Ejemplo n.º 24
0
        public async Task <ServerTaskResult> ReceiveFile()
        {
            return(await Task.Factory.StartNew(() =>
            {
                try
                {
                    FileData fileData = GetFileInfo();

                    byte[] receivedData = new byte[BUFFER_SIZE];

                    int receivedBytes = 0;
                    int totalBytes = 0;

                    FilePath = FolderUtil.GetFolderPath(fileData.FileName);

                    DeleteFile();

                    Stopwatch watch = Stopwatch.StartNew();

                    using (var fs = new FileStream(FilePath, FileMode.Create, FileAccess.Write))
                    {
                        while (totalBytes != fileData.ByteSize)
                        {
                            receivedBytes = NetworkStream.Read(receivedData, 0, receivedData.Length);

                            fs.Write(receivedData, 0, receivedBytes);

                            totalBytes += receivedBytes;

                            string fileStatus = $"({NetworkUtil.GetFileSize(totalBytes)} / {fileData.FileSize}) {ProgressPercentage(totalBytes, fileData.ByteSize)}%";
                            Server.OnUpdateFileStatus(fileStatus);
                        }
                    }

                    watch.Stop();

                    int elapsedSeconds = (int)watch.ElapsedMilliseconds / 1000;

                    return new ServerTaskResult(true, $"\n{FilePath} [{elapsedSeconds}s] ({DateTime.Now})", MessageType.OK);
                }
                catch (Exception e)
                {
                    return new ServerTaskResult(false, e.Message, MessageType.ERROR);
                }
            }));
        }
        /// <summary>
        /// 一致
        /// </summary>
        /// <returns></returns>
        public static List <ColorPictureInfo> GetConsistentPictures()
        {
            var list                 = new List <ColorPictureInfo>();
            var baseDirectory        = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var memoryPicturesFolder = Path.Combine(baseDirectory, @"Resources\MemoryPictures\一致");

            if (Directory.Exists(memoryPicturesFolder))
            {
                var allFiles = FolderUtil.GetAllFiles(memoryPicturesFolder);
                list.AddRange(allFiles.Select(i => GetPictureInfo(i)));
            }

            if (list.Count < 1)
            {
                throw new InvalidOperationException($"图片配置数量小于{0}张!");
            }
            return(list);
        }
Ejemplo n.º 26
0
        public override ObservableCollection <INavigationTreeItem> GetMyChildren()
        {
            ObservableCollection <INavigationTreeItem> childrenList = new ObservableCollection <INavigationTreeItem>();

            INavigationTreeItem item;

            string fn = GetFolderPath(SpecialFolder.UserProfile);

            fn = fn + "\\Links";

            try
            {
                DirectoryInfo dirInfo = new DirectoryInfo(fn);
                if (!dirInfo.Exists)
                {
                    return(childrenList);
                }

                string fileResolvedShortCut = "";

                foreach (FileInfo finfo in dirInfo.GetFiles())
                {
                    if (finfo.Name.ToUpper().EndsWith(".LNK"))
                    {
                        fileResolvedShortCut = FolderUtil.ResolveShortCut(finfo.FullName);
                        if (!String.IsNullOrEmpty(fileResolvedShortCut))
                        {
                            FileInfo fileInfo = new FileInfo(fileResolvedShortCut);

                            item = new NavigationFileItem();
                            item.FriendlyName = fileInfo.Name != string.Empty ? fileInfo.Name : fileInfo.ToString();
                            item.FullPathName = fileInfo.FullName;

                            childrenList.Add(item);
                        }
                    }
                }
            }


            catch { }

            return(childrenList);
        }
Ejemplo n.º 27
0
        private void OnCreateVersionInfoCallBack()
        {
            if (m_PlatformSelected == null)
            {
                return;
            }
            for (int index = 0; index < m_PlatformSelected.Count; ++index)
            {
                string path = m_OutputPath + m_PlatformSelected[index];
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string        strVersionInfoPath = path + "/VersionInfo.txt";
                DirectoryInfo directory          = new DirectoryInfo(path);
                StringBuilder sb = new StringBuilder();

                FileInfo[] arrFiles = directory.GetFiles("*", SearchOption.AllDirectories);
                for (int i = 0; i < arrFiles.Length; ++i)
                {
                    FileInfo file     = arrFiles[i];
                    string   fullName = file.FullName.Replace('\\', '/');
                    string   name     = fullName.Substring(fullName.IndexOf(m_PlatformSelected[index].ToString()) + m_PlatformSelected[index].ToString().Length + 1);

                    string md5 = EncryptUtil.GetFileMD5(fullName);
                    if (string.IsNullOrEmpty(md5))
                    {
                        continue;
                    }

                    string size = file.Length.ToString();

                    string strLine = string.Format("{0};{1};{2};{3}", name, md5, size, 1);
                    sb.AppendLine(strLine);
                }

                IOUtil.CreateTextFile(strVersionInfoPath, sb.ToString());
                this.ShowNotification(new GUIContent("create version file finished"));
                UnityEngine.Debug.Log("create version file finished");
                FolderUtil.SelectFile(strVersionInfoPath);
            }
        }
Ejemplo n.º 28
0
        private void MoveCacheWidthBackgroundWorker(string currentDesktopFolder, string destDataPathFolder)
        {
            var workerModel = new MoveCacheBackgroundWorkerModel()
            {
                DeskTopFolder          = currentDesktopFolder,
                DesktopFoldersAndFiles = FolderUtil.GetSubFoldersAndFiles(currentDesktopFolder),
                UserDefinedFolder      = destDataPathFolder,
            };

            using (var backgroundWorker = new BackgroundWorker()
            {
                WorkerReportsProgress = true
            })
            {
                backgroundWorker.ProgressChanged    += MoveCacheBackgroundWorker_ProgressChanged;
                backgroundWorker.DoWork             += MoveCacheBackgroundWorker_DoWork;
                backgroundWorker.RunWorkerCompleted += MoveCacheBackgroundWorker_RunWorkerCompleted;
                backgroundWorker.RunWorkerAsync(workerModel);
            }
        }
Ejemplo n.º 29
0
        static void Main(string[] args)
        {
            string windowsDirectory   = FolderUtil.GetWindowsDirectoryName();
            string systemDirectory    = FolderUtil.GetSystemDirectoryName();
            string programDirectory   = FolderUtil.GetProgramDirectoryName();
            string desktopDirectory   = FolderUtil.GetDesktopDirectoryName();
            string favoritesDirectory = FolderUtil.GetFavoritesDirectoryName();
            string recentDirectory    = FolderUtil.GetRecentDirectoryName();

            Console.WriteLine("Windows-Ordner:\r\n{0}", windowsDirectory);
            Console.WriteLine("\r\nWindows-SystemOrdner:\r\n{0}", systemDirectory);
            Console.WriteLine("\r\nProgrammmordner:\r\n{0}", programDirectory);
            Console.WriteLine("\r\nDesktop-Ordner:\r\n{0}", desktopDirectory);
            Console.WriteLine("\r\nFavoriten-Ordner:\r\n{0}", favoritesDirectory);
            Console.WriteLine("\r\nOrdner der zuletzt geöffneten Dokumente:\r\n{0}",
                              recentDirectory);

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }
Ejemplo n.º 30
0
        static void Main(string[] args)
        {
            // Windows-Systemordner ermitteln
            string folderName = Environment.SystemDirectory;

            Console.WriteLine("Ermittle die Größe von {0}", folderName);

            try
            {
                // Ordnergröße ermitteln
                long folderSize = FolderUtil.GetFolderSize(folderName);

                Console.WriteLine("Größe von {0}: {1:#,#0} Byte.", folderName,
                                  folderSize);
            }
            catch (IOException ex)
            {
                Console.WriteLine("Fehler: {0}.", ex.Message);
            }

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }