public void Set(ScrapParameter param) { if (!FlowMap.ContainsKey(param.Code)) { throw new ScraperException("Code is not defined. Please check code of parameter. Code : " + param.Code); } FlowType type = FlowMap[param.Code]; this.flow = Activator.CreateInstance(type.Flow, this, param, type.LoginMode) as IScrapFlow; this.parameter = param; Gecko.LauncherDialog.Download += (sender, e) => { String tempPath = ConfigSystem.ReadConfig("Config", "Temp", "Path"); String file = Path.Combine(tempPath, DateTime.Now.ToString("yyyyMMddHHmmss") + e.Filename); nsILocalFile objTarget = (nsILocalFile)Xpcom.NewNativeLocalFile(file); e.HelperAppLauncher.SaveToDisk(objTarget, false); Action <String, String> action = flow.DownloadProcedure(e.Url); action(e.Url, file); }; timer.Interval = 10 * 1000; timer.Tick += (s, e) => { Ping(parameter.Keycode); }; timer.Start(); this.Navigate(flow.StartPage()); }
static void RegisterChromeDir(string dir) { var chromeDir = (nsIFile)Xpcom.NewNativeLocalFile(dir); var chromeFile = chromeDir.Clone(); chromeFile.Append(new nsAString("chrome.manifest")); Xpcom.ComponentRegistrar.AutoRegister(chromeFile); Xpcom.ComponentManager.AddBootstrappedManifestLocation(chromeDir); }
public void Set(Parameter param) { if (!FlowMap.ContainsKey(param.MallCD)) { throw new ScraperException("The code is not defined. Please check code of parameter. Code : " + param.MallCD); } Type type = FlowMap[param.MallCD]; this.flow = Activator.CreateInstance(type, this, param) as IScrapFlow; this.flow.Initialize(flowModelData); this.parameter = param; Gecko.LauncherDialog.Download += (sender, e) => { String tempPath = ConfigSystem.ReadConfig("Config", "Temp", "Path"); String file = Path.Combine(tempPath, DateTime.Now.ToString("yyyyMMddHHmmss") + e.Filename); nsILocalFile objTarget = (nsILocalFile)Xpcom.NewNativeLocalFile(file); e.HelperAppLauncher.SaveToDisk(objTarget, false); Procedure(new Uri(e.Url), null, file); }; this.Navigate(flow.StartPage(flowModelData)); }
public void Open(string fileName) { _zipReader.Instance.Open(( nsIFile )Xpcom.NewNativeLocalFile(fileName)); }