Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize working with filters and extensions in FileDialog, decrease allocations #9599

Merged
merged 5 commits into from
Jan 31, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Post-merge issues
h3xds1nz committed Jan 31, 2025
commit e4b63e22bfa52e1be85e86abb8c6df6e8c95bd98
Original file line number Diff line number Diff line change
@@ -30,14 +30,6 @@ namespace Microsoft.Win32
/// </summary>
public abstract class CommonDialog
{
//---------------------------------------------------
//
// Constructors
//
//---------------------------------------------------
//#region Constructors
//#endregion Constructors

//---------------------------------------------------
//
// Public Methods
@@ -191,14 +183,6 @@ public object Tag

#endregion Public Properties

//---------------------------------------------------
//
// Public Events
//
//---------------------------------------------------
//#region Public Events
//#endregion Public Events

//---------------------------------------------------
//
// Protected Methods
@@ -322,38 +306,6 @@ private void MoveToScreenCenter(HandleRef hWnd)

#endregion Internal Methods

//---------------------------------------------------
//
// Internal Properties
//
//---------------------------------------------------
//#region Internal Properties
//#endregion Internal Properties

//---------------------------------------------------
//
// Internal Events
//
//---------------------------------------------------
//#region Internal Events
//#endregion Internal Events

//---------------------------------------------------
//
// Private Methods
//
//---------------------------------------------------
//#region Private Methods
//#endregion Private Methods

//---------------------------------------------------
//
// Protected Properties
//
//---------------------------------------------------
//#region Protected Properties
//#endregion Protected Properties

//---------------------------------------------------
//
// Private Fields
Original file line number Diff line number Diff line change
@@ -500,14 +500,6 @@ private protected string[] CloneItemNames()

#endregion Internal Properties

//---------------------------------------------------
//
// Internal Events
//
//---------------------------------------------------
//#region Internal Events
//#endregion Internal Events

//---------------------------------------------------
//
// Private Methods
Original file line number Diff line number Diff line change
@@ -2,13 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using MS.Internal;
using MS.Internal.AppModel;
using MS.Internal.Interop;
using System.ComponentModel;
using System.IO;
using System.Windows;

//
//
// Description:
@@ -19,16 +12,13 @@
// deferred to the derived classes.
//

using MS.Internal;
using MS.Internal.AppModel;
using MS.Internal.Interop;

using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.ComponentModel;
using MS.Internal.AppModel;
using MS.Internal.Interop;
using System.Windows;
using MS.Internal;
using System.IO;
using System;

namespace Microsoft.Win32
{
@@ -411,14 +401,6 @@ public bool RestoreDirectory

#endregion Public Events

//---------------------------------------------------
//
// Public Events
//
//---------------------------------------------------
// #region Public Events
// #endregion Public Events

//---------------------------------------------------
//
// Protected Methods
@@ -527,22 +509,6 @@ private protected override void RevertItemOk(object state)

#endregion

//---------------------------------------------------
//
// Internal Properties
//
//---------------------------------------------------
//#region Internal Properties
//#endregion Internal Properties

//---------------------------------------------------
//
// Internal Events
//
//---------------------------------------------------
//#region Internal Events
//#endregion Internal Events

//---------------------------------------------------
//
// Private Methods
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

@@ -195,22 +195,6 @@ public bool Multiselect

#endregion Public Properties

//---------------------------------------------------
//
// Public Events
//
//---------------------------------------------------
//#region Public Events
//#endregion Public Events

//---------------------------------------------------
//
// Protected Methods
//
//---------------------------------------------------
// #region Protected Methods
// #endregion Protected Methods

//---------------------------------------------------
//
// Internal Methods
@@ -225,22 +209,6 @@ private protected override IFileDialog CreateDialog()

#endregion Internal Methods

//---------------------------------------------------
//
// Internal Properties
//
//---------------------------------------------------
//#region Internal Properties
//#endregion Internal Properties

//---------------------------------------------------
//
// Internal Events
//
//---------------------------------------------------
//#region Internal Events
//#endregion Internal Events

//---------------------------------------------------
//
// Private Methods
@@ -268,21 +236,5 @@ private void Initialize()
}

#endregion Private Methods

//---------------------------------------------------
//
// Private Properties
//
//---------------------------------------------------
//#region Private Properties
//#endregion Private Properties

//---------------------------------------------------
//
// Private Fields
//
//---------------------------------------------------
//#region Private Fields
//#endregion Private Fields
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.ComponentModel;
using System.IO;

using MS.Internal.AppModel;
using MS.Internal.Interop;

//
//
// Description:
@@ -16,6 +10,11 @@
// additional properties relevant only to folder open dialog.
//

using System.ComponentModel;
using MS.Internal.AppModel;
using MS.Internal.Interop;
using System.IO;

namespace Microsoft.Win32
{
/// <summary>
@@ -222,14 +221,6 @@ public bool Multiselect

#endregion Public Events

//---------------------------------------------------
//
// Public Events
//
//---------------------------------------------------
//#region Public Events
//#endregion Public Events

//---------------------------------------------------
//
// Protected Methods
@@ -261,22 +252,6 @@ private protected override IFileDialog CreateDialog()

#endregion Internal Methods

//---------------------------------------------------
//
// Internal Properties
//
//---------------------------------------------------
//#region Internal Properties
//#endregion Internal Properties

//---------------------------------------------------
//
// Internal Events
//
//---------------------------------------------------
//#region Internal Events
//#endregion Internal Events

//---------------------------------------------------
//
// Private Methods
@@ -306,21 +281,5 @@ private void Initialize()
}

#endregion Private Methods

//---------------------------------------------------
//
// Private Properties
//
//---------------------------------------------------
//#region Private Properties
//#endregion Private Properties

//---------------------------------------------------
//
// Private Fields
//
//---------------------------------------------------
//#region Private Fields
//#endregion Private Fields
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

@@ -151,22 +151,6 @@ public bool CreateTestFile

#endregion Public Properties

//---------------------------------------------------
//
// Public Events
//
//---------------------------------------------------
//#region Public Events
//#endregion Public Events

//---------------------------------------------------
//
// Protected Methods
//
//---------------------------------------------------
//#region Protected Methods
//#endregion Protected Methods

//---------------------------------------------------
//
// Internal Methods
@@ -238,22 +222,6 @@ private protected override IFileDialog CreateDialog()

#endregion Internal Methods

//---------------------------------------------------
//
// Internal Properties
//
//---------------------------------------------------
//#region Internal Properties
//#endregion Internal Properties

//---------------------------------------------------
//
// Internal Events
//
//---------------------------------------------------
//#region Internal Events
//#endregion Internal Events

//---------------------------------------------------
//
// Private Methods
@@ -302,21 +270,5 @@ private bool PromptFileOverwrite(string fileName)
}

#endregion Private Methods

//---------------------------------------------------
//
// Private Properties
//
//---------------------------------------------------
//#region Private Properties
//#endregion Private Properties

//---------------------------------------------------
//
// Private Fields
//
//---------------------------------------------------
//#region Private Fields
//#endregion Private Fields
}
}