2 using System.Collections.Generic;
5 using System.Diagnostics;
6 using Seci.Definitions;
18 private static String _SSuser =
"seci";
19 private static String _SSserver =
"$/labview/seci/seciconfigs/";
29 internal static void saveToSourceSafe(String fileName)
32 _SSexe = Status.SSexe;
33 _SSlocation = Status.SSlocation;
34 _SSuser = Status.SSuser;
35 _SSserver = Status.SSserver;
37 _SSbat = Status.ExecutionDir +
"\\SS.bat";
53 createSourceSafeProject();
69 String fileList = Status.ExecutionDir +
"\\SSfilelist.txt";
72 using (StreamWriter SW =
new StreamWriter(_SSbat,
false))
75 SW.WriteLine(
"set ssdir=" + _SSserver);
76 SW.WriteLine(
"set ssuser=" + _SSuser);
79 SW.WriteLine(
"\"" + _SSexe +
"\" directory \"" + _SSlocation + Status.Instrument +
"\" -NL > \"" + fileList +
"\"" );
86 FileInfo fi =
new FileInfo(fileList);
90 using (StreamReader SR =
new StreamReader(fileList))
92 while (SR.Peek() >= 0)
94 String line = SR.ReadLine();
96 if (line == _filename.Substring(_filename.LastIndexOf(
"\\") + 1))
117 using (StreamWriter SW =
new StreamWriter(_SSbat,
false))
120 SW.WriteLine(
"set ssdir=" + _SSserver);
121 SW.WriteLine(
"set ssuser=" + _SSuser);
124 SW.WriteLine(
"\"" + _SSexe +
"\" workfold " +
"\"" + _SSlocation + Status.Instrument +
"/\" \"" + _filename.Substring(0, _filename.LastIndexOf(
'\\')) +
"\"");
127 SW.WriteLine(
"chdir \"" + _filename.Substring(0, _filename.LastIndexOf(
"\\")) +
"\"");
130 SW.WriteLine(
"\"" + _SSexe +
"\" checkout \"" + _SSlocation + Status.Instrument +
"/" + _filename.Substring(_filename.LastIndexOf(
"\\") + 1) +
"\" -GWR -G- -I-");
143 using (StreamWriter SW =
new StreamWriter(_SSbat,
false))
146 SW.WriteLine(
"set ssdir=" + _SSserver);
147 SW.WriteLine(
"set ssuser=" + _SSuser);
150 SW.WriteLine(
"\"" + _SSexe +
"\" workfold " +
"\"" + _SSlocation + Status.Instrument
151 +
"/\" \"" + _filename.Substring(0, _filename.LastIndexOf(
'\\')) +
"\"");
154 SW.WriteLine(
"chdir \"" + _filename.Substring(0, _filename.LastIndexOf(
"\\")) +
"\"");
157 SW.WriteLine(
"\"" + _SSexe +
"\" checkin \"" + _SSlocation + Status.Instrument
158 +
"/" + _filename.Substring(_filename.LastIndexOf(
"\\") + 1) +
"\" -I-");
172 using (StreamWriter SW =
new StreamWriter(_SSbat,
false))
175 SW.WriteLine(
"set ssdir=" + _SSserver);
176 SW.WriteLine(
"set ssuser=" + _SSuser);
179 SW.WriteLine(
"\"" + _SSexe +
"\" CP " +
"\"" + _SSlocation + Status.Instrument +
"/\"");
182 SW.WriteLine(
"\"" + _SSexe +
"\" add \"" + _filename +
"\" -I-");
196 using (StreamWriter SW =
new StreamWriter(_SSbat,
false))
199 SW.WriteLine(
"set ssdir=" + _SSserver);
200 SW.WriteLine(
"set ssuser=" + _SSuser);
203 SW.WriteLine(
"\"" + _SSexe +
"\" create \"" + _SSlocation + Status.Instrument +
"\" -I-");
216 using (StreamWriter SW =
new StreamWriter(_SSbat,
false))
219 SW.WriteLine(
"set ssdir=" + _SSserver);
220 SW.WriteLine(
"set ssuser=" + _SSuser);
223 String time = DateTime.Now.ToString();
224 time = time.Replace(
' ',
'_');
226 SW.WriteLine(
"\"" + _SSexe +
"\" label \"" + _SSlocation + Status.Instrument +
"/" + _filename.Substring(_filename.LastIndexOf(
"\\") + 1) +
"\" -I- -L" + time);
238 Process proc =
new Process();
239 proc.StartInfo.FileName =
"C:\\windows\\system32\\cmd.exe";
240 proc.StartInfo.Arguments =
" /c \"" + _SSbat +
"\"";
241 proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
242 proc.StartInfo.UseShellExecute =
true;
249 FileInfo bat =
new FileInfo(_SSbat);
static void runBatchFile()
Runs a created batch file. Spawns a hidden process.
static void addFile()
Add the new configuration file to the project.
Class for saving configurations into SourceSafe. Works by creating batch files then running them...
static Boolean projectExists()
Checks to see if the project exists in SourceSafe.
static void labelInSourceSafe()
Labels the saved configuration with the date and time of saving.
static void checkOutSourceSafe()
Check-out the existing version in SourceSafe. Does not overwrite the local copy.
static void checkInSourceSafe()
Check-in the updated project.
static void createSourceSafeProject()
Create a new project in SourceSafe - this happens the first ever time a configuration is saved on the...
static String _SSlocation