/***********************************************************************/ // Functionality Section /***********************************************************************/ /// <summary> /// Check the args given by the user. /// </summary> /// <param name="args"></param> /// <returns></returns> static bool CheckArgs(string[] args) { foreach (var arg in args) { if (arg == "newxml") { XmlClass xClass = new XmlClass(); xClass.CreateDefault(); return true; } else if (arg == "testdb") { Console.WriteLine("User ID: "); string UserId = Console.ReadLine(); Console.WriteLine("Password: "******"Privilege: "); string Privilege = Console.ReadLine(); TestDbConnection(UserId, Password, Privilege); return true; } else if (arg == "version") { Console.WriteLine("Version - " + Assembly.GetEntryAssembly().GetName().Version.ToString()); return true; } else if (arg == "help") { ShowHelp(); return true; } else { Console.WriteLine("Invalid Entry!"); return true; } } return false; }
/***********************************************************************/ // Create Upgrade Package Section /***********************************************************************/ /// <summary> /// Run the batch file to update TFS with latest. /// </summary> static void UpdateGit() { Console.WriteLine("Get the latest code from git.exe."); XmlClass xClass = new XmlClass(); xClass.ReadFile(); ProcessStartInfo pInfo = new ProcessStartInfo(); pInfo.FileName = xClass.XmlValues["GitLocation"]; pInfo.Arguments = "pull"; pInfo.WorkingDirectory = xClass.XmlValues["RepoLocation"]; pInfo.UseShellExecute = false; pInfo.CreateNoWindow = true; pInfo.RedirectStandardError = true; pInfo.RedirectStandardOutput = true; Process p = new Process(); p.StartInfo = pInfo; p.OutputDataReceived += new DataReceivedEventHandler(Display); p.ErrorDataReceived += new DataReceivedEventHandler(Display); p.Start(); p.BeginOutputReadLine(); p.BeginErrorReadLine(); p.WaitForExit(); }
/// <summary> /// Get the locations from the xml file. /// </summary> static void GetLocations() { XmlClass xClass = new XmlClass(); xClass.ReadFile(); StartLocation = xClass.XmlValues["StartLocation"]; OracleLocation = xClass.XmlValues["OracleLocation"]; using (var sr = new StreamReader(StartLocation + "\\Current Edition.txt")) { CurrentEdition = sr.ReadLine(); NextEdition = sr.ReadLine(); } }
/// <summary> /// Get the code lynx folder paths and store them. /// </summary> /// <returns></returns> public List<string> GetCodeLynxFolders() { try { // Get Location // XmlClass xClass = new XmlClass(); xClass.ReadFile(); string baseFolder = xClass.XmlValues["StartLocation"]; // Count number of schemas // List<string> lynxFolderHold = new List<string>(); string folderPath = baseFolder + "\\20_Code"; string[] dir = Directory.GetDirectories(folderPath); foreach (string s in dir) { if (s.IndexOf("lynx", StringComparison.OrdinalIgnoreCase) != -1) lynxFolderHold.Add(s); } return lynxFolderHold; } catch (Exception e) { Console.WriteLine(e.Message); return null; } }
/// <summary> /// Get the structure lynx folder paths and store them. /// </summary> /// <returns></returns> public List<string> GetStructureLynxFolders() { try { // Get Location // XmlClass xClass = new XmlClass(); xClass.ReadFile(); string baseFolder = xClass.XmlValues["StartLocation"]; // Get the current and next Edition // using (var sr = new StreamReader(baseFolder + "\\Current Edition.txt")) { currentEdition = sr.ReadLine(); nextEdition = sr.ReadLine(); } // Count number of schemas // List<string> lynxFolderHold = new List<string>(); string folderPath = baseFolder + "\\10_Structure\\" + currentEdition; string[] dir = Directory.GetDirectories(folderPath); foreach (string s in dir) { if (s.IndexOf("lynx", StringComparison.OrdinalIgnoreCase) != -1) lynxFolderHold.Add(s); } return lynxFolderHold; } catch (Exception e) { Console.WriteLine(e.Message); return null; } }
private Timer _ReadDbTimer; // there will be multiple of these for each, so can check when finished #endregion Fields #region Constructors /// <summary> /// Constructor /// </summary> public OracleClass() { xmlFile = new XmlClass(); }