Example #1
0
        public void RebuildItems()
        {
            var items = new List <IProjectItem>();

            // If the project itself was selected, just
            // rebuild the entire project
            if (items.Contains(_project))
            {
                Build(true);
                return;
            }

            // Convert selected DirectoryItems into ContentItems
            foreach (var item in SelectedItems)
            {
                if (item is ContentItem)
                {
                    if (!items.Contains(item))
                    {
                        items.Add(item);
                    }

                    continue;
                }

                foreach (var subitem in GetItems(item))
                {
                    if (!items.Contains(subitem))
                    {
                        items.Add(subitem);
                    }
                }
            }

            // Create a unique file within the same folder as
            // the normal project to store this incremental build.
            var uniqueName = Guid.NewGuid().ToString();
            var tempPath   = Path.Combine(Path.GetDirectoryName(_project.OriginalPath), uniqueName);

            // Write the incremental project file limiting the
            // content to just the files we want to rebuild.
            using (var io = File.CreateText(tempPath))
            {
                var parser = new PipelineProjectParser(this, _project);
                parser.SaveProject(io, (i) => !items.Contains(i));
            }

            // Run the build the command.
            var commands = string.Format("/@:\"{0}\" /rebuild /incremental", tempPath);

            if (LaunchDebugger)
            {
                commands += " /launchdebugger";
            }

            BuildCommand(commands);

            // Cleanup the temp file once we're done.
            _buildTask.ContinueWith((e) => File.Delete(tempPath));
        }
            public void Do()
            {
                var parser = new PipelineProjectParser(_con, _con._project);

                _con.View.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                for (var i = 0; i < _files.Length; i++)
                {
                    var f = _files[i];
                    if (!parser.AddContent(f, true))
                    {
                        continue;
                    }

                    var item = _con._project.ContentItems.Last();
                    item.Observer = _con;
                    item.ResolveTypes();

                    _files[i] = item.OriginalPath;

                    _con.View.AddTreeItem(item);
                    _con.Selection.Add(item, _con);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;
            }
Example #3
0
        public void RebuildItems(IEnumerable <IProjectItem> items)
        {
            // Make sure we save first!
            if (!AskSaveProject())
            {
                return;
            }

            // Create a unique file within the same folder as
            // the normal project to store this incremental build.
            var uniqueName = Guid.NewGuid().ToString();
            var tempPath   = Path.Combine(Path.GetDirectoryName(_project.OriginalPath), uniqueName);

            // Write the incremental project file limiting the
            // content to just the files we want to rebuild.
            using (var io = File.CreateText(tempPath))
            {
                var parser = new PipelineProjectParser(this, _project);
                parser.SaveProject(io, (i) => !items.Contains(i));
            }

            // Run the build the command.
            var commands = string.Format("/@:\"{0}\" /rebuild /incremental", tempPath);

            if (LaunchDebugger)
            {
                commands += " /launchdebugger";
            }

            BuildCommand(commands);

            // Cleanup the temp file once we're done.
            _buildTask.ContinueWith((e) => File.Delete(tempPath));
        }
            public bool Do()
            {
                var parser = new PipelineProjectParser(_con, _con._project);
                _con.View.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                foreach(string f in _folder)
                    if(f != "")
                        _con.View.AddTreeFolder(f);

                for (var i = 0; i < _files.Length; i++ )
                {
                    var f = _files[i];
                    if (!parser.AddContent(f, true))
                        continue;

                    var item = _con._project.ContentItems.Last();
                    item.Observer = _con;
                    item.ResolveTypes();

                    _files[i] = item.OriginalPath;

                    _con.View.AddTreeItem(item);
                    _con.Selection.Add(item, _con);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;

                return true;
            }
        public bool SaveProject(bool saveAs)
        {
            // Do we need file name?
            if (saveAs || string.IsNullOrEmpty(_project.OriginalPath))
            {
                string newFilePath = _project.OriginalPath;
                if (!View.AskSaveName(ref newFilePath, null))
                {
                    return(false);
                }

                _project.OriginalPath = newFilePath;
                View.SetTreeRoot(_project);
            }

            // Do the save.
            ProjectDirty = false;
            var parser = new PipelineProjectParser(this, _project);

            parser.SaveProject();

            // Note: This is where a project loaded via 'new project' or 'import project'
            //       get recorded into PipelineSettings because up until this point they did not
            //       exist as files on disk.
            PipelineSettings.Default.AddProjectHistory(_project.OriginalPath);
            PipelineSettings.Default.StartupProject = _project.OriginalPath;
            PipelineSettings.Default.Save();
            View.UpdateRecentList(PipelineSettings.Default.ProjectHistory);
            UpdateMenu();

            return(true);
        }
            public void Do()
            {
                var ext      = Path.GetExtension(_template.TemplateFile);
                var filename = Path.ChangeExtension(_name, ext);
                var fullpath = _con.GetFullPath(Path.Combine(_location, filename));

                if (File.Exists(fullpath))
                {
                    _con.View.ShowError("Error", string.Format("File already exists: '{0}'.", fullpath));
                    return;
                }

                File.Copy(_template.TemplateFile, fullpath);

                var parser = new PipelineProjectParser(_con, _con._project);

                _con.View.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                if (parser.AddContent(fullpath, true))
                {
                    var item = _con._project.ContentItems.Last();
                    item.Observer      = _con;
                    item.ImporterName  = _template.ImporterName;
                    item.ProcessorName = _template.ProcessorName;
                    item.ResolveTypes();

                    _con.View.AddTreeItem(item);
                    _con.Selection.Add(item, _con);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;
            }
            public void Do()
            {
                var parser = new PipelineProjectParser(_con, _con._project);
                _con._view.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                for (var i = 0; i < _files.Length; i++ )
                {
                    var f = _files[i];
                    if (!parser.AddContent(f, true))
                        continue;

                    var item = _con._project.ContentItems.Last();                    
                    item.Controller = _con;
                    item.ResolveTypes();

                    _files[i] = item.OriginalPath;

                    _con._view.AddTreeItem(item);                    
                    _con.Selection.Add(item, _con);                    
                }

                _con._view.EndTreeUpdate();
                _con.ProjectDiry = true;
            }
            public void Do()
            {
                var ext = Path.GetExtension(_template.TemplateFile);
                var filename = Path.ChangeExtension(_name, ext);
                var fullpath = _con.GetFullPath(Path.Combine(_location, filename));

                if (File.Exists(fullpath))
                {
                    _con.View.ShowError("Error", string.Format("File already exists: '{0}'.", fullpath));
                    return;
                }

                File.Copy(_template.TemplateFile, fullpath);

                var parser = new PipelineProjectParser(_con, _con._project);
                _con.View.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                if (parser.AddContent(fullpath, true))
                {
                    var item = _con._project.ContentItems.Last();
                    item.Observer = _con;
                    item.ImporterName = _template.ImporterName;
                    item.ProcessorName = _template.ProcessorName;
                    item.ResolveTypes();

                    _con.View.AddTreeItem(item);
                    _con.Selection.Add(item, _con);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;
            }
        public void ImportProject()
        {
            // Make sure we give the user a chance to
            // save the project if they need too.
            if (!AskSaveProject())
            {
                return;
            }

            string projectFilePath;

            if (!View.AskImportProject(out projectFilePath))
            {
                return;
            }

            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                var parser = new PipelineProjectParser(this, _project);
                parser.ImportProject(projectFilePath);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = true;
            }
#if SHIPPING
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();
            View.UpdateTreeItem(_project);

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }

            UpdateMenu();
        }
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

            var errortext = "Failed to open the project due to an unknown error.";

            try
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) =>
                {
                    errortext = string.Format(msg, args);
                    throw new Exception();
                });
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                PipelineSettings.Default.AddProjectHistory(projectFilePath);
                PipelineSettings.Default.StartupProject = projectFilePath;
                PipelineSettings.Default.Save();
                View.UpdateRecentList(PipelineSettings.Default.ProjectHistory);
            }
            catch (Exception)
            {
                View.ShowError("Error Opening Project", Path.GetFileName(projectFilePath) + ": " + errortext);
                return;
            }

            UpdateTree();
            View.UpdateTreeItem(_project);

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }

            _watcher.Run();

            UpdateMenu();
        }
            public bool Do()
            {
                var parser = new PipelineProjectParser(_con, _con._project);

                _con.View.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                foreach (string f in _folder)
                {
                    if (f != "")
                    {
                        _con.View.AddTreeFolder(f);
                    }
                }

                for (var i = 0; i < _files.Length; i++)
                {
                    bool skipduplicate = false;

                    switch (Environment.OSVersion.Platform)
                    {
                    case PlatformID.Win32NT:
                    case PlatformID.Win32S:
                    case PlatformID.Win32Windows:
                    case PlatformID.WinCE:
                        skipduplicate = true;
                        break;
                    }

                    var f = _files[i];
                    if (!parser.AddContent(f, skipduplicate))
                    {
                        continue;
                    }

                    var item = _con._project.ContentItems.Last();
                    item.Observer = _con;
                    item.ResolveTypes();

                    _files[i] = item.OriginalPath;

                    _con.View.AddTreeItem(item);
                    _con.Selection.Add(item, _con);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;

                return(true);
            }
Example #12
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

            try
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                PipelineSettings.Default.AddProjectHistory(projectFilePath);
                PipelineSettings.Default.StartupProject = projectFilePath;
                PipelineSettings.Default.Save();
                View.UpdateRecentList(PipelineSettings.Default.ProjectHistory);
            }
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }

            UpdateTree();
            View.UpdateTreeItem(_project);

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }

            _watcher.Run();

            UpdateMenu();
        }
Example #13
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                History.Default.AddProjectHistory(projectFilePath);
                History.Default.StartupProject = projectFilePath;
                History.Default.Save();
            }
#if SHIPPING
            catch (Exception e)
            {
                _view.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }
        }
            public bool Do()
            {
                var parser = new PipelineProjectParser(_con, _con._project);
                _con.View.BeginTreeUpdate();

                _con.Selection.Clear(_con);

                foreach(string f in _folder)
                    if(f != "")
                        _con.View.AddTreeFolder(f);

                for (var i = 0; i < _files.Length; i++ )
                {
                    bool skipduplicate = false;

                    switch (Environment.OSVersion.Platform) 
                    {
                        case PlatformID.Win32NT:
                        case PlatformID.Win32S:
                        case PlatformID.Win32Windows:
                        case PlatformID.WinCE:
                            skipduplicate = true;
                            break;
                    }

                    var f = _files[i];
                    if (!parser.AddContent(f, skipduplicate))
                        continue;

                    var item = _con._project.ContentItems.Last();
                    item.Observer = _con;
                    item.ResolveTypes();

                    _files[i] = item.OriginalPath;

                    _con.View.AddTreeItem(item);
                    _con.Selection.Add(item, _con);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;

                return true;
            }
Example #15
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if !DEBUG
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                
                var parser = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen = true;
                ProjectDirty = false;

                PipelineSettings.Default.AddProjectHistory(projectFilePath);
                PipelineSettings.Default.StartupProject = projectFilePath;
                PipelineSettings.Default.Save();
            }
#if !DEBUG
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();

            _watcher.Run();
        }
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                var parser = new PipelineProjectParser(this, _project);
                parser.OpenProject(projectFilePath);
                ResolveTypes();

                ProjectOpen = true;
                ProjectDiry = false;
            }
#if SHIPPING
            catch (Exception e)
            {
                _view.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();
        }
Example #17
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                watcher = new FileSystemWatcher(Path.GetDirectoryName(projectFilePath));
                watcher.NotifyFilter          = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.FileName;
                watcher.Filter                = "*.*";
                watcher.IncludeSubdirectories = true;
                watcher.Created              += delegate(object sender, FileSystemEventArgs e) {
                    HandleCreated(e.FullPath);
                };
                watcher.Deleted += delegate(object sender, FileSystemEventArgs e) {
                    HandleDeleted(e.FullPath);
                };
                watcher.Renamed += delegate(object sender, RenamedEventArgs e) {
                    HandleDeleted(e.OldFullPath);
                    HandleCreated(e.FullPath);
                };

                watcher.EnableRaisingEvents = true;

                History.Default.AddProjectHistory(projectFilePath);
                History.Default.StartupProject = projectFilePath;
                History.Default.Save();
            }
#if SHIPPING
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }
        }
Example #18
0
        public bool SaveProject(bool saveAs)
        {
            // Do we need file name?
            if (saveAs || string.IsNullOrEmpty(_project.OriginalPath))
            {
                string newFilePath = _project.OriginalPath;
                if (!View.AskSaveName(ref newFilePath, null))
                    return false;

                _project.OriginalPath = newFilePath;
				View.SetTreeRoot(_project);
            }

            // Do the save.
            ProjectDirty = false;
            var parser = new PipelineProjectParser(this, _project);
            parser.SaveProject();

            // Note: This is where a project loaded via 'new project' or 'import project' 
            //       get recorded into PipelineSettings because up until this point they did not
            //       exist as files on disk.
            PipelineSettings.Default.AddProjectHistory(_project.OriginalPath);
            PipelineSettings.Default.StartupProject = _project.OriginalPath;
            PipelineSettings.Default.Save();

            return true;
        }
        public void ImportProject()
        {
            // Make sure we give the user a chance to
            // save the project if they need too.
            if (!AskSaveProject())
                return;

            string projectFilePath;
            if (!_view.AskImportProject(out projectFilePath))
                return;

            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                var parser = new PipelineProjectParser(this, _project);
                parser.ImportProject(projectFilePath);

                ResolveTypes();                
                
                ProjectOpen = true;
                ProjectDiry = true;
            }
#if SHIPPING
            catch (Exception e)
            {
                _view.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();
        }
            /// <summary>
            /// Prepares the item list and creates all the neccecary files.
            /// </summary>
            public void FirstDo()
            {
                var parser = new PipelineProjectParser(_con, _con._project);

                for (int i = 0; i < _includes.Count; i++)
                {
                    var item = _includes[i].IsDirectory ?
                               (IProjectItem) new DirectoryItem("") : new ContentItem();

                    if (_includes[i].IncludeType == IncludeType.Create ||
                        _includes[i].IncludeType == IncludeType.Link)
                    {
                        item.OriginalPath    = Util.GetRelativePath(_includes[i].SourcePath, _con.ProjectLocation);
                        item.DestinationPath = _includes[i].RelativeDestPath;

                        if (_includes[i].IncludeType == IncludeType.Create)
                        {
                            if (_includes[i].IsDirectory)
                            {
                                Directory.CreateDirectory(_includes[i].SourcePath);
                            }
                            else
                            {
                                var conitem  = item as ContentItem;
                                var template = _includes[i].ItemTemplate;

                                conitem.ImporterName  = template.ImporterName;
                                conitem.ProcessorName = template.ProcessorName;

                                Directory.CreateDirectory(Path.GetDirectoryName(_includes[i].SourcePath));
                                File.Copy(template.TemplateFile, _includes[i].SourcePath);
                            }
                        }
                    }
                    else if (!_includes[i].IsDirectory) // This is only a valid action for files
                    {
                        var sourcePath = _includes[i].SourcePath;
                        var destPath   = Path.Combine(_con.ProjectLocation, _includes[i].RelativeDestPath);

                        Directory.CreateDirectory(Path.GetDirectoryName(destPath));
                        File.Copy(sourcePath, destPath);

                        item.OriginalPath = item.DestinationPath = _includes[i].RelativeDestPath;
                    }

                    var citem = item as ContentItem;
                    if (citem != null)
                    {
                        citem.ProcessorParams = new Microsoft.Xna.Framework.Content.Pipeline.OpaqueDataDictionary();
                        citem.Observer        = _con;

                        citem.ResolveTypes();
                    }

                    // Always keep Unix slashes in the .mgcb files for cross platform compatibility
                    item.OriginalPath    = item.OriginalPath.Replace('\\', '/');
                    item.DestinationPath = item.DestinationPath.Replace('\\', '/');

                    _items.Add(item);
                }
            }
Example #21
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                
                var parser = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen = true;
                ProjectDirty = false;

                watcher = new FileSystemWatcher (Path.GetDirectoryName (projectFilePath));
                watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.FileName;
                watcher.Filter = "*.*";
                watcher.IncludeSubdirectories = true;
                watcher.Created += delegate(object sender, FileSystemEventArgs e) {
                    HandleCreated(e.FullPath);
                };
                watcher.Deleted += delegate(object sender, FileSystemEventArgs e) {
                    HandleDeleted(e.FullPath);
                };
                watcher.Renamed += delegate(object sender, RenamedEventArgs e) {
                    HandleDeleted(e.OldFullPath);
                    HandleCreated(e.FullPath);
                };

                watcher.EnableRaisingEvents = true;

                History.Default.AddProjectHistory(projectFilePath);
                History.Default.StartupProject = projectFilePath;
                History.Default.Save();
            }
#if SHIPPING
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();
        }
        public bool SaveProject(bool saveAs)
        {
            // Do we need file name?
            if (saveAs || string.IsNullOrEmpty(_project.OriginalPath))
            {
                string newFilePath = _project.OriginalPath;
                if (!_view.AskSaveName(ref newFilePath, null))
                    return false;

                _project.OriginalPath = newFilePath;
            }

            // Do the save.
            ProjectDiry = false;
            var parser = new PipelineProjectParser(this, _project);
            parser.SaveProject();            

            return true;
        }
        public void RebuildItems(IEnumerable<IProjectItem> items)
        {
            // Make sure we save first!
            if (!AskSaveProject())
                return;

            // Create a unique file within the same folder as
            // the normal project to store this incremental build.
            var uniqueName = Guid.NewGuid().ToString();
            var tempPath = Path.Combine(Path.GetDirectoryName(_project.OriginalPath), uniqueName);

            // Write the incremental project file limiting the
            // content to just the files we want to rebuild.
            using (var io = File.CreateText(tempPath))
            {
                var parser = new PipelineProjectParser(this, _project);
                parser.SaveProject(io, (i) => !items.Contains(i));
            }

            // Run the build the command.
            var commands = string.Format("/@:\"{0}\" /rebuild /incremental", tempPath);
            if (LaunchDebugger)
                commands += " /launchdebugger";

            BuildCommand(commands);

            // Cleanup the temp file once we're done.
            _buildTask.ContinueWith((e) => File.Delete(tempPath));
        }