29 private static string _acHomeFolder;
51 if (String.IsNullOrEmpty(tmpFile))
57 using (StreamReader reader =
new StreamReader(tmpFile))
59 XElement doc = XElement.Load(reader);
60 bool ignoreWhitespace = (bool)doc.Element(
"diffIgnoreWhitespace");
61 bool ignoreWhitespaceChanges = (bool)doc.Element(
"diffIgnoreWhitespaceChanges");
62 bool ignoreCase = (bool)doc.Element(
"diffIgnoreCase");
63 arr =
new bool[] { ignoreWhitespace, ignoreWhitespaceChanges, ignoreCase };
69 AcDebug.
Log($
"Exception caught and logged in AcPreferences.getIgnoreOptionsAsync{Environment.NewLine}{ecx.Message}");
74 if (!String.IsNullOrEmpty(tmpFile))
90 if (String.IsNullOrEmpty(tmpFile))
93 bool? useIgnoreElemsOptimization = null;
96 using (StreamReader reader =
new StreamReader(tmpFile))
98 XElement doc = XElement.Load(reader);
99 useIgnoreElemsOptimization = (bool)doc.Element(
"USE_IGNORE_ELEMS_OPTIMIZATION");
103 catch (Exception ecx)
105 AcDebug.
Log($
"Exception caught and logged in AcPreferences.getUseIgnoreElemsOptimizationAsync{Environment.NewLine}{ecx.Message}");
110 if (!String.IsNullOrEmpty(tmpFile))
111 File.Delete(tmpFile);
114 return useIgnoreElemsOptimization;
125 if (_acHomeFolder == null)
128 if (String.IsNullOrEmpty(tmpFile))
133 using (StreamReader reader =
new StreamReader(tmpFile))
135 XElement doc = XElement.Load(reader);
136 string home = (string) doc.Element(
"HOME");
137 _acHomeFolder = Path.Combine(home,
".accurev");
141 catch (Exception ecx)
143 AcDebug.
Log($
"Exception caught and logged in AcPreferences.getAcHomeFolderAsync{Environment.NewLine}{ecx.Message}");
148 if (!String.IsNullOrEmpty(tmpFile))
149 File.Delete(tmpFile);
153 return _acHomeFolder;
182 string tempFile = null;
186 if (r != null && r.
RetVal == 0)
188 tempFile = Path.GetTempFileName();
189 using (StreamWriter writer =
new StreamWriter(tempFile))
196 catch (AcUtilsException ecx)
198 AcDebug.Log($
"AcUtilsException caught and logged in AcPreferences.getPreferencesAsync{Environment.NewLine}{ecx.Message}");
201 catch (Exception ecx)
203 AcDebug.Log($
"Exception caught and logged in AcPreferences.getPreferencesAsync{Environment.NewLine}{ecx.Message}");
static async Task< bool[]> getIgnoreOptionsAsync()
Get the user's Diff/Merge and Ignore Options (AccuRev Diff only) preferences.
AccuRev program return value and command result.
Get user preferences retrieved by way of the getpref command.
string CmdResult
The command result (usually XML) emitted by AccuRev.
int RetVal
The AccuRev program return value for the command, otherwise minus one (-1) on error.
static void Log(string message, bool formatting=true)
Write the message text to STDOUT, to weekly log files located in %LOCALAPPDATA%\AcTools\Logs, and to trigger.log in the AccuRev server's ..storage\site_slice\logs folder in the case of triggers.
static async Task< string > getAcHomeFolderAsync()
Get the AccuRev home folder for the current user.
static async Task< bool?> getUseIgnoreElemsOptimizationAsync()
Get the user's USE_IGNORE_ELEMS_OPTIMIZATION setting.
AccuRev command processing.
static async Task< AcResult > runAsync(string command, ICmdValidate validator=null)
Run the AccuRev command asynchronously with non-blocking I/O.
Use to log and display error and general purpose text messages, and to save the XML param data sent b...
static async Task< string > getPreferencesAsync()
Get user preferences retrieved by way of the getpref command.