コード例 #1
0
        public void Clean()
        {
            try
            {
                if (PluginDirectory.Exists)
                {
                    foreach (var file in PluginDirectory.GetFiles())
                    {
                        var newPath = Path.Join(PluginDirectory.FullName, file.Name.Replace(file.Extension, string.Empty), file.Name);
                        Directory.CreateDirectory(Directory.GetParent(newPath).FullName);
                        file.MoveTo(newPath);
                    }
                }

                if (TrashDirectory.Exists)
                {
                    Directory.Delete(TrashDirectory.FullName, true);
                }
                if (TemporaryDirectory.Exists)
                {
                    Directory.Delete(TemporaryDirectory.FullName, true);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
コード例 #2
0
        public void Clean()
        {
            try
            {
                if (PluginDirectory.Exists)
                {
                    foreach (var file in PluginDirectory.GetFiles())
                    {
                        Log.Write("Plugin", $"Unexpected file found: '{file.FullName}'", LogLevel.Warning);
                    }
                }

                if (TrashDirectory.Exists)
                {
                    Directory.Delete(TrashDirectory.FullName, true);
                }
                if (TemporaryDirectory.Exists)
                {
                    Directory.Delete(TemporaryDirectory.FullName, true);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }