// // Copyright 2014 Perforce Software Inc. // using Perforce.Helper; using Perforce.Model; using Perforce.View; using Perforce.ViewModel; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Web; using System.Windows.Threading; namespace Perforce { public class Utility { // the basic method to retrieve a property in the App context public static object GetProperty(object key) { object value = null; if (key != null && App.Current != null) { value = App.Current.Properties[key]; } return value; } // the basic method to store a property in the App context public static void SetProperty(object key, object value) { if (key != null) { if (App.Current.Properties.Contains(key)) { App.Current.Properties.Remove(key); } App.Current.Properties.Add(key, value); } } public static void ClearProperty(object key) { if (key != null) { App.Current.Properties.Remove(key); } } // helper method to encode a path (i.e. change spaces to make valid URL) public static string EncodePath(string path) { return HttpUtility.UrlPathEncode(path); } // helper method to decode an encoded path public static string DecodePath(string encoded) { return HttpUtility.UrlDecode(encoded); } // helper method to normalize a depot path // - removes the trailing '/' // - removes the trailing '%' (used for doing a 'p4 where' to determine if a directory is mapped) public static string NormalizeDepotPath(string path) { return path.TrimEnd('%') .TrimEnd('/'); } // helper method to normalize a client path // - removes the trailing '%' // - removes the traliing directory separator (\) public static string NormalizeClientPath(string path) { return Path.GetFullPath(new Uri(path).LocalPath) .TrimEnd('%') .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); } // helper method to get the UNIX epoch time public static long GetEpochTime() { return GetEpochTime(DateTime.UtcNow); } // helper method to get the UNIX epoch time from a given .net DateTime public static long GetEpochTime(DateTime datetime) { TimeSpan t = datetime.ToUniversalTime() - new DateTime(1970, 1, 1); return (long)t.TotalSeconds; } // METHODS TO CONFIGURE HELPER CLASSES public static PerforceHelper SetupPerforceHelper() { PerforceHelper helper = null; var prefs = Utility.GetUserPreferences(); var p4port = prefs.LastP4Port; var p4user = prefs.LastP4User; var p4client = prefs.LastP4Client; try { if (!string.IsNullOrEmpty(p4port) && !string.IsNullOrEmpty(p4user)) { helper = new PerforceHelper(p4port, p4user); Utility.SetProperty(Constants.PERFORCE_HELPER, helper); if (helper.IsLoggedIn()) { if (!string.IsNullOrEmpty(prefs.LastP4Ticket)) { helper.Ticket = prefs.LastP4Ticket; } if (!string.IsNullOrEmpty(p4client) && helper.ClientExists(p4client)) { helper.SetClient(p4client); helper.CleanChangelist(); // commented out for now // helper.GatherOpenFilesInCurrentChangelist(); Utility.SetupSearchHelper(); Utility.SetupWorkspaceWatcher(); } } } } catch (Perforce.P4.P4Exception p4e) { Console.WriteLine(p4e.Message); } catch (ApplicationException ae) { Console.WriteLine(ae.Message); } return helper; } public static void SetupFavoritesHelper() { var favoritesHelper = GetFavoritesHelper(); if (favoritesHelper == null) { favoritesHelper = new FavoritesHelper(); SetProperty(Constants.FAVORITES_HELPER, favoritesHelper); } } public static void SetupFileMappings() { var extensionHelper = GetExtensionHelper(); if (extensionHelper == null) { extensionHelper = new ExtensionHelper(); SetProperty(Constants.EXTENSION_HELPER, extensionHelper); } } public static void SetupSearchHelper() { var searchHelper = GetSearchHelper(); if (searchHelper == null) { var p4Helper = GetPerforceHelper(check: false); if (p4Helper != null) { var url = p4Helper.GetKey(Constants.P4SEARCH_URL); if (url != null) { searchHelper = new SearchHelper(url); SetProperty(Constants.SEARCH_HELPER, searchHelper); } } } } public static void SetupBackgroundSyncWorker() { var syncWorker = GetSyncBackgroundWorker(); if (syncWorker == null) { syncWorker = new SyncBackgroundWorker(); } } public static void SetupWorkspaceWatcher() { var watchdog = GetWorkspaceWatcher(); if (watchdog == null) { watchdog = new WorkspaceWatcher(); SetProperty(Constants.WATCHDOG, watchdog); } } // BACKGROUND (WORKER) PROCESSES // start up the various background workers public static void StartBackgroundProcesses() { StartSyncWorker(); StartWatchdog(); } // start the sync background worker public static void StartSyncWorker() { var prefs = GetUserPreferences(); if (prefs.SyncEnabled) { var syncWorker = GetSyncBackgroundWorker(); if (syncWorker != null) syncWorker.StartSync(); } } // start the filesystem watcher public static void StartWatchdog() { var watchdog = GetWorkspaceWatcher(); if (watchdog != null) watchdog.Start(); } // shut down the various background workers public static void StopBackgroundProcesses() { StopSyncWorker(); //StopWatchdog(); } public static void StopSyncWorker() { var syncWorker = GetSyncBackgroundWorker(); if (syncWorker != null) syncWorker.StopSync(); } public static void StopWatchdog() { var watchdog = GetWorkspaceWatcher(); if (watchdog != null) watchdog.Stop(); } // CONVENIENCE METHODS TO GET THE VARIOUS HELPER CLASSES public static UserPreferences GetUserPreferences() { var prefs = GetProperty(Constants.USER_PREFERENCES) as UserPreferences; if (prefs == null) { prefs = new UserPreferences(); } return prefs; } public static ExtensionHelper GetExtensionHelper() { return GetProperty(Constants.EXTENSION_HELPER) as ExtensionHelper; } public static FavoritesHelper GetFavoritesHelper() { return GetProperty(Constants.FAVORITES_HELPER) as FavoritesHelper; } public static SyncBackgroundWorker GetSyncBackgroundWorker() { var worker = GetProperty(Constants.SYNC_WORKER) as SyncBackgroundWorker; if (worker == null) { worker = new SyncBackgroundWorker(); } return worker; } public static WorkspaceWatcher GetWorkspaceWatcher() { return GetProperty(Constants.WATCHDOG) as WorkspaceWatcher; } public static SearchHelper GetSearchHelper() { return GetProperty(Constants.SEARCH_HELPER) as SearchHelper; } public static ToolBarViewModel GetToolBarViewModel() { return GetProperty(Constants.TOOLBAR_VIEWMODEL) as ToolBarViewModel; } public static PerforceHelper GetPerforceHelper(bool check = true) { var helper = GetProperty(Constants.PERFORCE_HELPER) as PerforceHelper; if (check && helper != null) { var alive = helper.IsConnected(); if (!alive) { // stop the background workers StopBackgroundProcesses(); // use a dispatcher to invoke the dialog to determine if there are issues App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { var main = App.Current.MainWindow as MainWindow; var dialog = main.DialogManager.CreateMessageDialog("Server is not reachable. What do you want to do?", Technewlogic.WpfDialogManagement.DialogMode.YesNo); dialog.VerticalDialogAlignment = System.Windows.VerticalAlignment.Top; dialog.YesText = "Relaunch"; dialog.NoText = "Shutdown"; dialog.Yes = () => { // clear the ticket, if it is currently set var userprefs = Utility.GetUserPreferences(); userprefs.LastP4Ticket = string.Empty; userprefs.Save(); // restart the application -- this starts a new copy of the application System.Windows.Forms.Application.Restart(); // shutdown the current application System.Windows.Application.Current.Shutdown(); }; dialog.No = () => { System.Windows.Application.Current.Shutdown(); }; dialog.Show(); })); } } return helper; } public static SortedSet<ListingItem> GetRecentSet() { var set = GetProperty(Constants.RECENT_LIST) as SortedSet<ListingItem>; if (set == null) { set = new SortedSet<ListingItem>(); SetProperty(Constants.RECENT_LIST, set); } return set; } public static List<ListingItem> GetRecentList() { return GetRecentSet().ToList(); } public static LogWindow GetLogWindow() { var lw = GetProperty(Constants.LOG_WINDOW) as LogWindow; if (lw == null || !lw.IsOpen) { lw = new LogWindow(); SetProperty(Constants.LOG_WINDOW, lw); } return lw; } public static void CopyDirectory(string sourcePath, string destPath) { if (!Directory.Exists(destPath)) { Directory.CreateDirectory(destPath); } foreach (string file in Directory.GetFiles(sourcePath)) { CopyFileToDirectory(file, destPath); } foreach (string folder in Directory.GetDirectories(sourcePath)) { string dest = Path.Combine(destPath, Path.GetFileName(folder)); CopyDirectory(folder, dest); } } // CopyFileToDirectory -- copies file to a directory, adding (Copy n) to the filename. public static string CopyFileToDirectory(string filePath, string destDirPath, string filename = null) { Log.Debug(string.Format("Copying {0} -> {1}", filePath, destDirPath)); if (!Directory.Exists(destDirPath)) { Directory.CreateDirectory(destDirPath); } if (string.IsNullOrEmpty(filename)) { filename = Path.GetFileName(filePath); } var filenameWithoutExtension = Path.GetFileNameWithoutExtension(filename); var extension = Path.GetExtension(filename); var copynum = 0; var destFilePath = Path.Combine(destDirPath, filename); while (File.Exists(destFilePath)) { copynum++; var newFilename = string.Format("{0} (Copy){1}", filenameWithoutExtension, extension); if (copynum > 1) { newFilename = string.Format("{0} (Copy {1}){2}", filenameWithoutExtension, copynum, extension); } destFilePath = Path.Combine(destDirPath, newFilename); } File.Copy(filePath, destFilePath); return destFilePath; } public static bool CheckTCPConnection(string p4port = null, int timeout = 1) { var canPing = false; if (string.IsNullOrEmpty(p4port)) { var userPrefs = GetUserPreferences(); p4port = userPrefs.LastP4Port; } if (!string.IsNullOrEmpty(p4port)) { // remove ssl prefix if present if (p4port.StartsWith("ssl:")) { p4port = p4port.Substring(4); } var parts = p4port.Split(':'); if (parts.Length != 2) return canPing; var host = parts[0]; var port = Int32.Parse(parts[1]); var tcpClient = new TcpClient(); tcpClient.ReceiveTimeout = 2000; try { var result = tcpClient.BeginConnect(host, port, null, null); var success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(timeout)); if (!success) { throw new Exception("Failed to connect."); } // we have connected tcpClient.EndConnect(result); canPing = true; } catch (Exception e) { Console.WriteLine("CONNECTION {0}:{1} FAILED", host, port); } finally { tcpClient.Close(); } } return canPing; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15071 | alan_petersen |
Populate -o //guest/perforce_software/piper/... //guest/alan_petersen/piper/.... |
||
//guest/perforce_software/piper/windows/main/Perforce/Utility.cs | |||||
#3 | 13571 | alan_petersen | Lots 'o bug fixes | ||
#2 | 12025 | alan_petersen |
**** MEGA UPDATE **** UPDATE - reworked initial calls to GetPerforceHelper to avoid the 'alive' check - fixed error in the connection failed logic to launch the dialog using a dispatcher (without this, a threading error occurs if this code was called from a background thread) UPDATE - reworked initial calls to GetPerforceHelper to avoid the 'alive' check - fixed error in the connection failed logic to launch the dialog using a dispatcher (without this, a threading error occurs if this code was called from a background thread) reg script to add URL handler UPDATE: - updated P4.NET api to latest release ### Bug fixes: ### #84: DEFECT: submit single item should just have item checked in the current changelist - reworked the submit logic to take selected item(s) and move them to a new changelist. - failed submission restores files to original changelist and the new changelist is deleted #110: DEFECT: submit fails if changelist has shelved items - now that items are moved to a new changelist and then that is submitted, shelved items do not cause an issue. - shelved items are not automatically deleted -- they will need to be removed from the shelf manually #111: DEFECT: submit changelist should sort with checked items on top - added CompareTo to the ChangelistFile class to allow comparison for sorting #112: DEFECT: application will not open login dialog if server check fails - reworked helper creation logic to create most helpers when the application first starts - fixed bug in which cached Repository object was retrieved (rather than the new Repo) ### Bug fixes: ### #85: DEFECT: submit error not useful - submit errors now list files that could not be submitted (and caused submit failure) #113: DEFECT: watcher does not restart if submit cancelled - cancel button was not associated with any operations (it just made the dialog go away). Now cancel calls Utility.StartBackgroundProcesses(). UPDATE: - combined syncworker and refreshworker into 1 background thread, rather than 2 separate threads - UI refresh now occurs immediately after sync - removed refreshworker class, settings, etc. ### Bug fixes: ### #114: Defect: Deleted items are not unsynced from workspace - fixed two issues: - sync worker was not starting correctly - sync / refresh being on different schedules was causing some strange behavior UPDATE: - modified CheckInButtonEnabled logic in ToolBarViewModel to enable the button if a valid client is configured. - previous version had more complex logic and cached data, but refresh was slow and this is now simpler. ### Bug fixes: ### #25: Defect: Ability to check in part of the move operation - modified checkbox click logic to see if file action is move/add or move/delete and if it is, an fstat is executed to get the source (MovedFile) and then the associated line in the table is checked/unchecked. This will prevent a user from deselecting part of a move operation #107: Defect: Unsync from computer not working - modified 'unsync from workspace' logic to use exclude mapping if directory has a parent directory that is mapped - modified code that gets client mappings for depot paths to use the raw 'p4 where' command rather than the API -- the API results don't let you distinguish between directories that are mapped and those that are excluded. The p4 where command tagged output includes an extra field 'unmap' for paths that are excluded. this is probably a bug in the API #116: DEFECT: submit reports changelist -1 if no files submitted - modified logic in command helper to only display the changelist ID if it is greater than 0 (i.e. files were submitted) #117: Defect: Desi application crashes on delete folder - modified logic in the CommandHelper delete method to check to see if any files are openeed in the directory path, and if so the delete is prevented and a message dialog is displayed indicating that the folder could not be deleted. #49: Defect: Desi throws exception when internet connection is lost - modified the unhandled exception method in App.xaml.cs to give the user the option to quit or reopen the application - modified the GetRepository logic in PerforceHelper to avoid the try/catch and keep the cached repo (for performance) UPDATE: - modified CommandHelper.RevertFiles to stop / start the background processes (sync, watchdog) to hopefully prevent watchdog from seeing files appear in the workspace - modified watchdog with slight delay and then check to see if file exists when issuing a create (p4 add) ### Bug fixes: ### #82: DEFECT: strange add/remove behavior with Microsoft Excel - was able to replicate, added delay to logic in watchdog and a check to see if the created file actually exists -- these temporary excel files appear and disappear quickly -- the delay can be increased if files still appear in DESI #85: DEFECT: submit error not useful - modified submit logic in CommandHelper to display the error message if the details are empty (this happens sometimes, apparently) #115: Defect: File watchdog does not register deletes and moves from the explorer - modified watchdog code a little to try to catch deletes and moves better - files with .tmp extension were completely ignored, which could cause issues if there are actual files with .tmp extensions #118: Defect: search does not return result if keywords are from two different source (filename + content) - modified search query building logic to match that used by mac DESI #119: Defect : Checkout folders should be deleted - modified logic used when sending a folder to the trash to ignore files marked for add when running 'p4 opened' #83: DEFECT: folder history should have button to show files in changelist - added new window to display changelist information, specifically the description, modification date, and files (with actions) in the changelist. - currently, this opens up as a modal window (dialog) that can be resized, etc. I thought that it was better than a fixed window attached to the main DESI window. #60: Defect: Search should be restricted to current folder - added new toggle to the 'more options' section that gets populated if the user has a folder selected in the Workspace or Server tabs when s/he performs a search. #49: Defect: Desi throws exception when internet connection is lost - Modified logic in App.xaml.cs to do the following when an unhandled exception is caught: - stops background processes (to prevent double dialog seen in latest reported error) - uses the DialogManager to display dialog aligned at the top of the window, giving the user the option of restarting or quitting the application #118: Defect: search does not return result if keywords are from two different source (filename + content) - Modified logic in SearchHelper.cs to format the search terms with wildcards (*) before and after each term #60: Defect: Search should be restricted to current folder - modified logic to keep selected folder if the current view is on the search screen #120: Defect : Adding Same File with add button - Changed add logic in ToolBar.xaml.cs to use the Utility.CopyFileToDirectory method to copy files to the destination directory, adding "(Copy n)" to the filenames if a file with that name already exists in the destination #83: DEFECT: folder history should have button to show files in changelist - Modified logic executed when clicking the rollback button in the FolderHistory.xaml.cs file to display a wait dialog when rolling back, which will help prevent the perception of the application "locking up" #101: DEFECT: Add button not working for favorite - modified AddFile and AddFolder toolbar button logic to enable the buttons if the favorite points to a workspace folder (as opposed to a server folder) #102: DEFECT: Favorite pointing to folder on server tab should have server background - modified FavoritesView.xaml to display background contingent on favorite item's source (workspace or server) - re-worked FavoritesViewModel as datacontext for FavoritesView - added server check logic to FavoritesViewModel #95: DEFECT: Positioning of add tag popup - Due to differences in popup positioning between Win7 and Win8, the only positioning that seemed to be consistent was "center" on the parent position. I modified the Sidebar.xaml to position the Add Tag popup relative to the + button. #86: DEFECT: workspace thumbnails - updated ListingItemInfoViewModel.cs to try to generate png thumbnail of file if the file's action is Edit, Add or MoveAdd, which might indicate that the file has changed. #93: Defect: Bread crumbs cuts off if the path is too long - modified ControlTemplate in BreadcrumbBar.xaml to include a thin (5px) horizontal scrollbar on the bottom UPDATE: Added new logging facility (available via the View menu). Currently, logging is set to "ALL" (which means "everything") but for release this will be set to INFO or WARN. The user can change the log level by opening the log window and selecting the log level from the combo box at the top. The Clear button clears the log, and the Save button allows the user to save the log to a file ### Bug fixes: ### #100: DEFECT: Copy/paste results in Windows "Cannot create directory" error - unable to replicate, added a new logging facility (Log window under the View menu) to provide more information #105: Defect: Object reference error pops up intermittently - unclear when this is happening... cleaned up the one place #49: Defect: Desi throws exception when internet connection is lost - Updated exception handler in App.xaml.cs to stop background processes and display integrated dialog (rather than standalone dialog) UPDATE: - update to logic regarding switching workspaces - update to breadcrumb logic to display breadcrumbs more accurately when the selection is changed ### Bug fixes: ### #121: DESI Screen not get updated - changing the workspace now clears the workspace grid and deselects the workspace selector, if it is already selected #121: DESI Screen not get updated - two null references were not being caught, resulting in application crashes under specific circumstances. these have now been fixed! - updated workspace selection logic to clear out old values (that was resulting in old data still present when the workspace is switched) #122: Drag/Drop Folder not working - modified logic for drag&drop to more intelligently handle a dropped item UPDATE: - modified sync button functionality - reports number of changes synchronized from server - waits for 20 seconds (or until the user clicks the OK button) ### Bug fixes: ### #123: Defect :Files Deleted is also displaying in Recently added - modified count of files during sync so this should be fine now #124: DEFECT: add button does not work when creating favorite tag - removed the add button (since it is superfluous anyway) and so users can just hit enter after typing in the tag name UPDATE: - modified "LOCKED BY" text in button to be left aligned ### Bug fixes: ### #125 DEFECT: submitting single moved item should also select corresponding deleted item - modified the SubmitFile method in CommandHelper to check to see if the file's action is MoveAdd, and if so, then to get the MovedFile attribute from the metadata (the corresponding delete) and select that too, so the submit dialog will have both items selected. #126 DEFECT: Licensing/version info - created 'About' menu under the 'Help' menu - added licenses to Resources/Licenses - added version information (derived from the project version data) #127 DEFECT: Toolbar items need tooltips - tooltips now available on buttons. note that tooltips are only visible for enabled buttons #128 DEFECT: Unversioned files show strange & useless modification timestamp + version number - modified ListingItemInfoViewModel.cs ModifiedDate method to return the string ---- if the timestamp is zero - modified ListingItemInfoViewModel.cs, adding a Revision property and having the method return {none} if the revision is not greater than zero. #129 DEFECT: Application window should have minimum size - MainWindow now has attributes MinHeight="400" MinWidth="550" which restrict how small the window can be made #130 DEFECT: Date format should be DD.MM.YYYY or YYYY-MM-DD, but not MM.DD.YYYY - modified ListingItemInfoViewModel.cs ModifiedDate method to return a formatted string, rather than having WPF format the date - modified VersionInfo.xaml to format the "CHECKED IN" field using the string formatter "yyyy/MM/dd HH:mm:ss" - modified VersionItem.cs to ensure that the date returned is expressed as local time (time is now retrieved from the metadata instead of the file history to ensure that it matches TZ-wise) #131 DEFECT: When entering Submit message, pressing <ENTER> starts submission instead of creating a new line - added AcceptsReturn="True" AcceptsTab="True" to the Changelist description field in the SubmitForm.xaml dialog #132 DEFECT: In menu bar there is no "Help" item to link to any help page or show support contact information - added help menu - TODO: need URL for help system #133 DEFECT: Tags names do not display underscore - modified tag display in ListingItemInfo.xaml to use TextBlock instead of Label UPDATE: added copyright and cleaned up usings removed unused method UPDATE: - modified favorites, tags, and breadcrumbs to use TextBox instead of Label (dealing with the deleted underscore issue) - removed unused BreadcrumbLabel user control ### Bug fixes: ### #124 DEFECT: add button does not work when creating favorite tag - modified tag display to be TextBox instead of label - modified positioning of add popup (again!) #127 DEFECT: Toolbar items need tooltips - added ToolTipService.ShowOnDisabled="true" to each toolbar button to get around strange issue where enabling/disabling button resulted in blank tooltips. Probably a good idea to have the tooltips always visible anyway (rather than only when buttons are enabled) #134 Defect : Breadcrumbs should also show the underscore sign. - updated to use TextBox instead of Label #130 DEFECT: Date format should be DD.MM.YYYY or YYYY-MM-DD, but not MM.DD.YYYY - modified FolderHistory.xaml to use ContentStringFormat="yyyy/MM/dd HH:mm:ss" for the "CHECKED IN" date format, which should provide consistency across the application now. UPDATE: - fixed error in which changelist could get orphaned if all files submitted were reverted ### Bug fixes: ### #136 Defect: Submit all folder option missing - added menu item "Submit all files" for mapped folders - added handler code for menu item - added CommandHelper SubmitFolder method to submit all files contained in a folder. ** NOTE: this needs to iterate over all files in the changelist, so for a changelist with many files, there could be a delay. #135 Defect: Keyboard navigation refinement - updated keyboard navigation code to provide more "smooth" navigation through the application #135 Defect: File watchdog does not monitor folder deletions - fixed copy/paste typo that existed in the folder deletion code that would cause the system to miss folders that are deleted. UPDATE: Adding code for msi installer generation Fixing dist script to deal with Debug or Release distros Changes to installer definition to create Desktop shortcut - fixes log window reopening that caused an error ### Bug fixes: ### #141 DEFECT: Adding files with strange characters causes crash - modified Add command in PerforceHelper to include the AddFilesCmdFlags.KeepWildcards option UPDATE: - fixed issue in which application would crash if URL supplied and the user was not logged in - added CleanChangelist method to PerforceHelper to cycle through list of changelist files to ensure that all files marked for add still exist on the local filesystem (they may have been deleted since they were added) - workspace watcher logic revamped to remove delays - removed shutdown of watchdog to prevent situations in which file modifications were missed - context menu text updated to "selected files" instead of "all files" ### Bug fixes: ### #151 Defect: On Submission fail, Files are becoming read only - logic now calls the CleanChangelist method before bringing up the submit dialog #145 Defect: Refresh on long folder paths leads to auto selection of random folders - refresh logic revisited -- refresh of a panel has been reworked to proceed one column at a time, synchronously. #149 Defect: Option to submit selected items from pending list and trash list is not available - context menu added for submission of files from Pending and Trash UPDATE: - modified MainWindow.cs and Utility.cs to call CleanChangelist when workspace is first selected - modified CleanChangelist in PerforceHelper.cs to do the following: - for each file in the changelist: - if action is Add, revert if local file no longer exists - if action is Move/Add, revert file and delete original file - if action is Edit, revert the edit and delete ### Bug fixes: ### #149 Defect: Option to submit selected items from pending list and trash list is not available - fixed typo (the font was really small!!) - fixed casting bug that caused Null exception #108 DEFECT? - reconcile on submit - added CleanChangelist method to perform "reconcile" options -- reconcile itself cannot detect when files are added or edited and then deleted locally #139 Defect: Rollback on folder does not delete files - updated PerforceHelper.cs to delete files correctly when a folder is rolled back #153: Defect : Move Action should get default selected if one get selected - fixed typo in context menu - updated SubmitFiles method in ContextMenuHelper.cs to do an fstat on files being submitted and select associated files if the action is MoveAdd or MoveDelete #49 Defect: Desi throws exception when internet connection is lost - updated PerforceHelper to test connection (with 5 second timeout) every time it is requested. #154 Defect: Weird behavior with folders with different upper case are mapped - updated various aspects of the code to make string comparisons case insensitive. #155 Defect : Cannot rename the Favorite Folder name - updated xaml to rearrange elements to make edit box visible again. UPDATE: - added Shanghai and Tokyo to drop down list - replaced IP addresses with hostnames - modified dist.cmd to create installer and copy to dist\Release directory if Release is the specified distribution ### Bug fixes: ### #147 Defect: Installer should add shortcut to start menu - updated Wix configuration to include start menu shortcut #129 DEFECT: Application window should have minimum size - sidebar now has auto-appearing 5-pixel wide scrollbar if the window height is not enough to accommodate the number of things in the sidebar UPDATE: - enlarged submit dialog (cannot make it resizable) - made submit datagrid columns resizable and sortable - added help URL to help menu (opens in default web browser) ### Bug fixes: ### #157 DEFECT: orphaned changelists - application now gathers changelist files when it starts - menu item in File menu to gather changelist files on demand UPDATE: - removed automatic "Gathering changes" functionality ### Bug fixes: ### #158 DEFECT: p4 urls open up new DESI instances - modified App.xml.cs to look for existing DESI processes and to set focus to the existing process and exit if there is already one running - added the P4Listener.cs helper class to create a named pipe to listen for p4:// URLs - modified App.xml.cs to send the URL to the named pipe if it is passed on the command line |
||
#1 | 11255 | alan_petersen | Rename/move file(s) | ||
//guest/perforce_software/piper/windows/Perforce/Utility.cs | |||||
#3 | 11037 | alan_petersen |
UPDATE - reworked initial calls to GetPerforceHelper to avoid the 'alive' check - fixed error in the connection failed logic to launch the dialog using a dispatcher (without this, a threading error occurs if this code was called from a background thread) |
||
#2 | 11032 | alan_petersen |
MEGA UPDATE: - fixed bug in folder rollback was failing due to deleted files - files needed to be re-added with the downgrade (-d) flag - put some checking in to stop/start the background workers when - folder versioning - can select 'show versions' on mapped folders - currently limites the number of changelists displayed to the last 50 - rollback button is disabled/hidden unless there are no files in the path (//path/to/folder/...) that are opened (uses p4 opened -a path) - various fixes for some strange null pointer exceptions - fixed folder items (edit all/revert all) - needs some testing to ensure that it is functioning correctly (e.g. when there are locked files in the path being checked out) - general code clean-up -- primarily using the Utility method to obtain the PerforceHelper, rather than having to cast all the time. - found some stability issues (at least when communicating with a local p4d running in the same virtual machine) so some additional error checking/handling was added - reconcile files action now provides feedback via a wait dialog: while reconcile is running, the dialog is displayed along with a wait indicator, when complete a message is displayed that the reconcile is finished - submit changes - submit now perfomed within a wait dialog: dialog displays message along with a wait indicator, results of the submit are displayed when complete - currently, the 'ok' button is disabled until the submit completes. - looking into providing a progress bar (using the feedback mechanism in the API) to provide some more interesting information (and to give users the sense that something is actually happening when a large changelist is begin submitted) - added copy function to PerforceHelper along with test case - implemented copy (ctrl-c) and paste (ctrl-v) in DESI - limitations: - currently only implemented for FILES (not folders) - to paste, one must select the destination FOLDER - next steps: - get working for folders - implement cut (ctrl-x) - permit paste into a column (more intuitive) - rebuilt using 'Any CPU' target -- not sure if this will fix the error seen by the Win7-64 user -- we may need to switch to separate 32- and 64-bit builds - fixed defect #78: delete and move/delete files are no longer displayed in the server view - fixed defect #76: tags now displayed in version history - added MemoryCache for repository reference -- the repository reference was getting stale and creating strange errors, so a reference is now stored in the MemoryCache with a SlidingExpiration of 2 minutes. - fixes #80: copy checks out file -- remnant of code from the rename logic was checking out the code - fixes #14: mail now opens outlook using office API - fixes #72: submit dialog now waits for results from submit, and if there is an error the error message is displayed, otherwise the changelist number is displayed - fixes #75: folder versioning changes -- restore version button now always displayed, but not connected to anything if the folder has opened items; -- opened items now ignored items marked for Add -- this could result in the folder being re-created if/when the user submits the added files - fixed bug in submit dialog in which changelist number was not displayed correctly - fixed bug in submission of partial changelists -- files moved to new changelist but original not updated, resulting in error - #79 - add file now works correctly, relying on the client path rather than the //dummy_depot_path #41: various changes and refactoring to support 'Recent' view - background sync causes immediate refresh of the recent list - ability to mark items as 'read' -- removed from the recent list and the view is refreshed #43 - udpates to logic to deal with transient threading issues (causing the NoSuchObject exceptions) and sync/refresh of workspace files to added files. #48: submit single file now working -- when submit file is selected, the file is moved to a shiny new changelist, and that changelist is presented in the UI - refactoring of submit pane logic to allow passing in a changelist ID incremental build with partially working toolbar buttons -- still working on the forward/back buttons (they aren't quite working right yet) - toolbar items are now functional: left/right nav, add files, create folder addresses #12: favorite folders -- added favorite folder functionality to the application - favorites are now stored in a workspace-specific property (client_name.favoriteFolders) in the favorites.json file in the user's configuration directory (this file is created if it does not exist) - favorites can be edited by double-clicking on the label, right-clicking the label and selecting 'edit', or clicking on the edit icon - favorites can be deleted by right-clicking on the label and selecting 'delete' update involved various refactoring so enable the hidden 'Favorites' selector and select the appropriate sidebar selector (Workspace or Server) when the favorite is selected - favorite tags implemented, satisfying ticket #18 - favorite tags are stored in a workspace-specific property (client_name.favoriteTags) in the favorites.json file in the user's configuration directory (this file is created if it does not exist) - favorite tags can be added by clicking on the '+' that appears when hovering over the Favorite Tags header in the sidebar - a popup appears with a textfield - ESC cancels the add and closes the popup - Enter or clicking on the add button adds the tag to the property (immediately saved) and updates the Favorite Tags sidebar list and closes the popup - changing focus (ie clicking somewhere else in the application) cancels the add and closes the popup - favorite tags can be selected/deselected with a single click - selected tags have a checkmark in the rightmost column - favorite tags can be deleted by right-clicking on the label and selecting 'delete' - list items in ColumnDisplay.xaml modified - FileItem model class modified with boolean method to determine if the file has a selected tag (matching is case insensitive) - FavoritesHelper caches selected tags (to avoid unnecessary IO and parsing) - FavoriteTagItem modified to - fixing copy/paste functionality: - copy/paste now uses filesystem copy and paste (rather than p4 copy) - CopyDirectory method added to Utility class to assist in copying of entire directory structures - copy enabled from either the server tab or the workspace tab... paste only allowed on the workspace tab - wait dialog implemented for the paste process -- should happen quickly if copy is on local filesystem, but if copy is from the server then copy may take a while if the file(s) being copied are large (they have to be downloaded first) - confirmation dialog when folders selected for the copy (giving user the option of skipping large directories if they were selected accidentally) - implementation of p4 sizes code to determine size/number of files in a given path - implementation of p4 print for a depot path -- by default saves to a temp directory, but in the case of copy/paste the print is performed directly to the target directory Addresses DEFECT #91 -- Desi crashing on viewing old versions - previous refactoring had introduced the VersionItem model class, but there were still some remnants of references to FileHistory around, causing issues (ie. crashing) - changelist cleanup had used the -f (force) flag, which hadn't appeared as an issue because the test cases currently run as an admin user, but that masked the fact that only admins can do 'p4 change -d -f'. Doh #94 DEFECT: Selecting tags causes error in Server view - issue was due to tag attributes not retrieved in HEX format, so hex decoding then failed (because they weren't hex!) - this is now fixed in the PerforceHelper - general code cleanup and optimization - helper methods in the utility class to retrieve common objects from the App context - start sync now first checks the preferences to ensure that sync is actually turned on - background processes now wait for initial workspace selection before starting up #36: DEFECT: Refresh color coding - modifications for #88 fix this too #52: DEFECT: Cannot move files from "My Pending Changes" to "Trash" - modified CommandHelper logic to revert files that are in any state other than 'None' when trying to delete #88: DEFECT: icon should be different for items not on server - logic to determine file status updated - icon sizes bumped up slightly (from 18px to 24px) to make differences more visible.. #96: DEFECT: Adding files double window - this was due to a bug in the AddFilesButton_Click method of ToolBar.xaml.cs... basically ShowDialog() was called twice! DOH!! #99: DEFECT: Refresh color coding - modified logic around refreshing after a paste, seems to have fixed this issue #106: DEFECT: Paste a file in a folder where the name exists and the application crashes - added CopyFileToDirectory method to utility class to check to see if the destination file already exists... if it does, then (Copy) is appended to the filename - if there is already a file named xxx (Copy), then a counter is appended: xxx (Copy 2) - this is repeated until it comes up with a filename that doesn't conflict #104: DEFECT: right click option to open file as read only does not work - Code in ContextMenuHelper's ViewWorkspaceFile method was not wired to the code that opens a file. Now it is! - no specific bugs fixed, just trying to get refresh to be a little more responsive and context menus working a little better - reworked DelegateCommand to permit parameter - reworked various menuitem commands to include item(s) selected as parameters - reworked command methods to get parameter, cast it appropriately to the item(s), perform the operation(s), and then refresh the items as well as associated UI components - reworked some methods in MainWindow to take item(s) as arguments (rather than just trying to get the currently selected item -- sometimes when you right-click on something it isn't fully selected) #107: Defect: Unsync from computer not working - modified code that syncs/unsyncs to refresh items after change -- should make for a more responsive interface - modified PerforceHelper code that sets the client to ensure that rmdir is set as an option - fixed Exit menu item to actually shut down the application (YAY) #49: Defect: Desi throws exception when internet connection is lost - modified the GetPerforceHelper utility method to check for a live server. If the server is unreachable, the user is presented with the option to relaunch the application or shutdown #97: DEFECT: Object error when using navigation buttons - code was checking Perforce server to determine if a path was a directory or file, but when the file was newly created it doesn't exist on the server so it returned false, which later caused a null pointer exception. The PerforceHelper IsDirectory code was modified to check, as a last restort, the client path to see if the file is a directory using System.IO.Directory.exists() - modification to MainWindow.cs to re-enable the filesystem watcher #73: Defect: Checkout and delete file .. appropriate change in status not done - code in filesystem watcher was not handing deletes of opened files correctly... opened files need to be reverted first, then they can be deleted using a p4 delete. Since the file no longer exists on the filesystem, these p4 commands are performed as server-only (-k option). When the file is an Add or MoveAdd, then the server-side revert is just performed. Otherwise, if the file is in any other state (other than none), a server-side revert is performed, then the server-side delete. #92: Defect: Option for unshelving missing - added a button to the file info screen for unshelving. Since unshelving may overwrite changes the user has made, a dialog is presented and the user must confirm the unshelve operation. - application now opens with window displaying the file/folder in question when given a command-line argument in the form p4://... |
||
#1 | 10761 | alan_petersen |
initial drop of Piper for Windows.... this version still has _many_ bugs (er... i mean "unintended features") but I will be updating it over the next week as more stability is added. |