//load SQLProduct from meta public SQLProduct(string filePath) { SQLProduct p = (SQLProduct)OutputProcessor.DeserializeFromXML <SQLProduct>(filePath); this.msiPackages = p.msiPackages; this.mspPackages = p.mspPackages; if (p != null) { // Controller.gSQLProduct.InitOrAddHashSet(this); } }
}//function public void AddProductSumFromFile(string f) { try { Logger.LogMsg("AddProductSumFromFile:" + f); SQLProductSum sum = OutputProcessor.DataContractDeSerializeToXML <SQLProductSum>(f); this.AddProductSum(sum); } catch (Exception ex) { Logger.LogError("[AddProductSumFromFile]:" + ex.Message); } }
public static void LoadSQLProductFromSetupSrc() { LastSQLSetupSource = SQLSetupSource; // string path = @"D:\SETUP Media\2016"; // path = @"\\sqlbuilds\Released\SQLServer2016\RTM\13.0.1601.5\release\editions\SQLFull_CHS"; UpdateProgress("Scanning MSI/MSP packages from:" + SQLSetupSource, true); // SQLProduct sql2016 = new SQLProduct("SQL2016", SQLSetupSource); // sqlProducts.Add(sql2016); string folder = Utility.CleanFileName(SQLSetupSource); if (folder.Length > 20) { folder = folder.Substring(0, 10) + "..." + folder.Substring(folder.Length - 10); } string name = "Cached_" + folder + System.DateTime.Now.ToString("_yyyy-MM-dd_HH_mm_ss"); SQLProduct sql = new SQLProduct(name, SQLSetupSource); try { //Save it temp folder so that we can copy it to data folder. string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); //string path2 = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); path = Path.Combine(path, "Cache"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } sumFromSetupSrc = new SQLProductSum(name, SQLSetupSource, "By SQLMsiMspScan."); sumFromSetupSrc.InitOrAddHashSet(sql); string file = Path.Combine(path, name + ".sum.xml"); string content = OutputProcessor.DataContractSerializeToXML <SQLProductSum>(sumFromSetupSrc); File.WriteAllText(file, content); } catch (Exception ex) { Logger.LogError(ex.Message); } }