MapSuiteGisEditor/GisEditorInfrastructure/Managers/ProjectManager/ProjectPluginManager.cs
/// <summary>
/// Delete the extra files.
/// Assume we have an project file that contains 3 docuemnts, we open it, delete one of the documents by
/// using the document list, then we save the project file, and that is when this method will be called
/// to deleted the extra files.
/// </summary>
Delete the extra files.
Assume we have an project file that contains 3 docuemnts, we open it, delete one of the documents by
using the document list, then we save the project file, and that is when this method will be called
to deleted the extra files.
Delete the extra files . Assume we have an project file that contains 3 docuemnts we open it delete one of the documents by using the document list then we save the project file and that is when this method will be called to deleted the extra files .
private void CleanFiles(string projectFileName, string fileFolder, IEnumerable<DocumentWindow> documents)
        {
            DirectoryInfo directory = new DirectoryInfo(System.IO.Path.GetDirectoryName(fileFolder + @"\" + Path.GetFileNameWithoutExtension(projectFileName)));
            FileInfo[] files = directory.GetFiles("*.tgmap");
            foreach (FileInfo file in files)
            {
                string fileName = Path.GetFileNameWithoutExtension(file.Name);
                if (!documents.Any(d => d.Name.Equals(fileName, StringComparison.OrdinalIgnoreCase)
                    || d.Title.Equals(fileName, StringComparison.OrdinalIgnoreCase)))
                {
                    file.Delete();
                }
            }
        }
private void CleanFiles ( string projectFileName , string fileFolder , IEnumerable < DocumentWindow > documents ) { DirectoryInfo directory = new DirectoryInfo ( System . IO . Path . GetDirectoryName ( fileFolder + @"\" + Path . GetFileNameWithoutExtension ( projectFileName ) ) ) ; FileInfo [ ] files = directory . GetFiles ( " " ) ; foreach ( FileInfo file in files ) { string fileName = Path . GetFileNameWithoutExtension ( file . Name ) ; if ( ! documents . Any ( d => d . Name . Equals ( fileName , StringComparison . OrdinalIgnoreCase ) || d . Title . Equals ( fileName , StringComparison . OrdinalIgnoreCase ) ) ) { file . Delete ( ) ; } } }
Delete the extra files.
Delete the extra files .
projectFileName
string
fileFolder
string
documents
IEnumerable<DocumentWindow>