public void Init(XElement xe, XmlConfig config) { //XElement xe; //if (!test) // _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager"); //else //{ // Trace.WriteLine("CreateDownloadAutomateManager init for test"); // _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager_Test"); //} //_test = test; _xeConfig = xe; _version = xe.zXPathValue("Version").zTryParseAs(_version); _useTestManager = xe.zXPathValue("UseTestManager").zTryParseAs(false); _traceLevel = xe.zXPathValue("TraceLevel").zTryParseAs<int?>(); //_dailyPrintManager = xe.zXPathValue("DailyPrintManager").zTryParseAs(false); //_gapDayBefore = xe.zXPathValue("GapDayBefore").zTryParseAs(0); //_gapDayAfter = xe.zXPathValue("GapDayAfter").zTryParseAs(0); //_config = XmlConfig.CurrentConfig; _config = config; _localConfig = _config.GetConfig("LocalConfig"); //_localConfig = _config.GetConfig("LocalConfig", optional: true); _printList1Config = _config.GetConfig("PrintList1Config"); _printList2Config = _config.GetConfig("PrintList2Config"); }
//private static XmlConfig _config = new XmlConfig("pt_config.xml"); public static void Main(string[] args) { try { //Trace.CurrentTrace.SetLogFile(null, LogOptions.LogToConsole); Trace.CurrentTrace.SetViewer(Console.Out.Write); //string log = _config.Get("Log").zRootPath(zapp.GetEntryAssemblyDirectory()); //if (log != null) //{ // //Trace.WriteLine("log to \"{0}\"", log); // //Trace.AddTraceFile(log, LogOptions.IndexedFile); // Trace.CurrentTrace.AddTraceFile(log); //} Trace.CurrentTrace.SetWriter(WriteToFile.Create(_config.Get("Log").zRootPath(zapp.GetEntryAssemblyDirectory()), _config.Get("Log/@option").zTextDeserialize(FileOption.None))); string path = _config.Get("PrintConfig"); if (path != null) { //Trace.WriteLine("load print config \"{0}\"", path); _printConfig = new XmlConfig(path); } pt(args); } catch (Exception ex) { Trace.WriteLine(ex.ToString()); Trace.WriteLine(ex.StackTrace); } }
public RunSourceForm(IRunSource runSource, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _config = config; _runSourceParameters = runSourceParameters; // http://stackoverflow.com/questions/9056418/resources-getobjectthis-icon-crashes-application-on-windows-xp // pour ne pas avoir une exection avec : // this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); // Thread.Sleep(100); // dont work InitializeComponent(); this.Icon = Properties.Resources.app; initGrid(); //initTestMenu(); tb_source.ConfigurationManager.CustomLocation = @"ScintillaNET.xml"; tb_source.ConfigurationManager.Language = "cs"; tc_result.SelectedTab = tab_message; //ActiveControl = me_source; ActiveControl = tb_source; cGrid.Culture = CultureInfo.CurrentUICulture; //_gridMaxWidth = _config.Get<int>("GridMaxWidth"); _gridMaxWidth = _config.Get("GridMaxWidth").zParseAs<int>(); _gridMaxHeight = _config.Get("GridMaxHeight").zParseAs<int>(); _dataTableMaxImageWidth = _config.Get("DataTableMaxImageWidth").zParseAs<int>(); _dataTableMaxImageHeight = _config.Get("DataTableMaxImageHeight").zParseAs<int>(); initRunSource(); InitLog(); SetFileSaved(); }
static void Main() { try { object runSourceRestartParameters = null; while (true) { __config = new XmlConfig(__configFile); Trace.CurrentTrace.SetWriter(__config.Get("Log").zRootPath(zapp.GetAppDirectory()), __config.Get("Log/@option").zTextDeserialize(FileOption.None)); //__traceUpdate = __config.Get("UpdateRunSource/TraceUpdate").zTryParseAs(false); zUpdateFiles.Trace = __config.Get("UpdateRunSource/TraceUpdate").zTryParseAs(false); UpdateRunSourceFiles(); Run(runSourceRestartParameters); // attention récupérer RunSourceRestartParameters avant UpdateRunSourceFiles(), UpdateRunSourceFiles() fait AppDomain.Unload() runSourceRestartParameters = __domain.GetData(__domainRestartParametersName); if (runSourceRestartParameters == null) break; //__domain.DomainUnload += domain_DomainUnload; //Trace.WriteLine("__domain.IsFinalizingForUnload() : {0}", __domain.IsFinalizingForUnload()); //Trace.WriteLine("AppDomain.Unload(__domain)"); AppDomain.Unload(__domain); __domain = null; //Trace.WriteLine("__domain.IsFinalizingForUnload() : {0}", __domain.IsFinalizingForUnload()); } } catch (Exception ex) { zerrf.ErrorMessageBox(ex); } }
//static int Main(string[] args) static void Main() { try { XmlConfig config = new XmlConfig(); FormatInfo.SetInvariantCulture(); Application.CurrentCulture = FormatInfo.CurrentFormat.CurrentCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); RemoteRunSource remoteRunSource = new RemoteRunSource(); remoteRunSource.RunsourceDllFilename = config.GetExplicit("RunsourceDllFilename"); remoteRunSource.RunsourceClassName = config.GetExplicit("RunsourceClassName"); remoteRunSource.TraceClassName = config.GetExplicit("TraceClassName"); // ATTENTION si CreateRunSourceDomain = true runsource.launch.exe ne peut pas mettre à jour runsource.runsource.exe remoteRunSource.CreateRunSourceDomain = config.Get("CreateRunSourceDomain").zTryParseAs<bool>(false); IRunSource runSource = remoteRunSource.GetRunSource(); runSource.AllowMultipleExecution = config.Get("AllowMultipleExecution").zTryParseAs(false); // ATTENTION Trace exists in both 'runsource.runsource.exe' and 'runsource.dll' // donc il faut utiliser RemoteRunSource.GetTrace() ITrace trace = remoteRunSource.GetTrace(); trace.SetWriter(config.Get("Log"), config.Get("Log/@option").zTextDeserialize(FileOption.None)); // ATTENTION appeler DeleteGeneratedAssemblies() après SetRunSourceConfig() //RunSourceForm form = new RunSourceForm(runSource, trace, config, GetRunSourceRestartParameters()); RunSourceForm_v3 form = new RunSourceForm_v3(runSource, trace, config, GetRunSourceRestartParameters()); form.SetRestartRunsource += FormSetRestartRunsource; Application.Run(form); SetRunSourceRestartParameters(); } catch (Exception ex) { zerrf.ErrorMessageBox(ex); } }
public RunSourceForm_copy(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _trace = trace; try { Initialize(); _tabResultMessage = tab_message; _tabResultGrid = tab_result2; _tabResultTree = tab_result4; //this.Icon = Properties.Resources.app; //string title = config.Get("RunsourceTitle"); //if (title != null) // __title = title; //tc_result.SelectedTab = _tabResultMessage; //cGrid.Culture = CultureInfo.CurrentUICulture; //_gridMaxWidth = _config.Get("GridMaxWidth").zParseAs<int>(); //_gridMaxHeight = _config.Get("GridMaxHeight").zParseAs<int>(); //_dataTableMaxImageWidth = _config.Get("DataTableMaxImageWidth").zParseAs<int>(); //_dataTableMaxImageHeight = _config.Get("DataTableMaxImageHeight").zParseAs<int>(); //initRunSource(); //SetFileSaved(); } catch (Exception ex) { _trace.WriteError(ex); zerrf.ErrorMessageBox(ex); } }
public static bool CompileProjects(string projectsFile, Win32ResourceCompiler win32ResourceCompiler, ResourceCompiler resourceCompiler = null, string runsourceSourceDirectory = null, Action<IProjectCompiler> onCompiled = null) { Chrono chrono = new Chrono(); chrono.Start(); int nbProject = 0; try { if (!zFile.Exists(projectsFile)) throw new PBException("projects file dont exists \"{0}\"", projectsFile); XmlConfig projects = new XmlConfig(projectsFile); string projectsDirectory = zPath.GetDirectoryName(projectsFile); //string updateDir = _config.GetExplicit("UpdateRunSource/UpdateDirectory").zRootPath(zapp.GetEntryAssemblyDirectory()); string updateDirectory = projects.Get("UpdateDirectory"); foreach (XElement project in projects.GetElements("Project")) { string projectFile = project.zExplicitAttribValue("value").zRootPath(projectsDirectory); Trace.WriteLine("Compile project \"{0}\"", projectFile); ProjectCompiler compiler = ProjectCompiler.Create(projectFile, win32ResourceCompiler, resourceCompiler); compiler.RunsourceSourceDirectory = runsourceSourceDirectory; compiler.Compile(); //if (onCompiled != null) // onCompiled(compiler); onCompiled?.Invoke(compiler); if (!compiler.Success) return false; string copyOutput = project.zAttribValue("copyOutput").zRootPath(zapp.GetEntryAssemblyDirectory()); if (copyOutput != null) { //Trace.WriteLine(" copy result files to directory \"{0}\"", copyOutput); compiler.CopyResultFilesToDirectory(copyOutput); } if (project.zAttribValue("copyToUpdateDirectory").zTryParseAs(false)) { if (updateDirectory == null) throw new PBException("update directory is not defined"); //Trace.WriteLine(" copy result files to directory \"{0}\"", updateDirectory); compiler.CopyResultFilesToDirectory(updateDirectory); } nbProject++; } } catch (ProjectCompilerException ex) { Error.WriteMessage(ErrorOptions.TraceError, ex.Message); } finally { chrono.Stop(); Trace.WriteLine("{0} project(s) compiled", nbProject); Trace.WriteLine("Process completed {0}", chrono.TotalTimeString); } return true; }
public XmlConfig GetProjectConfig() { if (_projectConfig == null && _projectFile != null && zFile.Exists(_projectFile)) _projectConfig = new XmlConfig(_projectFile); else if (_projectConfig != null && _refreshProjectConfig) _projectConfig.Refresh(); _refreshProjectConfig = false; return _projectConfig; }
//public static PrintTitleManager Create(int version = 3, int gapDayBefore = 0, int gapDayAfter = 0) //{ // CreatePrintTitleManager create = new CreatePrintTitleManager(); // create._version = version; // create._gapDayBefore = gapDayBefore; // create._gapDayAfter = gapDayAfter; // return create._Create(); //} public void Init(XElement xe) { _xeConfig = xe; if (xe != null) { _version = xe.zXPathValue("Version").zTryParseAs(_version); _gapDayBefore = xe.zXPathValue("GapDayBefore").zTryParseAs(0); _gapDayAfter = xe.zXPathValue("GapDayAfter").zTryParseAs(0); } _printList1Config = XmlConfig.CurrentConfig.GetConfig("PrintList1Config"); }
public static Http Login(XXElement xeSource) { XmlConfig localConfig = new XmlConfig(XmlConfig.CurrentConfig.GetExplicit("LocalConfig")); string login = localConfig.GetExplicit("DownloadAutomateManager/Ebookdz/Login"); string hashPassword = Crypt.ComputeMD5Hash(localConfig.GetExplicit("DownloadAutomateManager/Ebookdz/Password")).zToHex(lowercase: true); // <base href="http://www.ebookdz.com/forum/" /> string urlBase = xeSource.XPathValue("//head//base/@href"); //string urlBase = xeSource.XPathValue("//body//base/@href"); //Trace.WriteLine("urlBase : \"{0}\"", urlBase); XXElement xeForm = xeSource.XPathElement("//form[@id='navbar_loginform']"); if (xeForm.XElement == null) { //Trace.WriteLine("element not found \"//form[@id='navbar_loginform']\""); throw new PBException("element form not found \"//form[@id='navbar_loginform']\""); } //Trace.WriteLine("form action : \"{0}\"", xeForm.XPathValue("@action")); string urlForm = zurl.GetUrl(urlBase, xeForm.XPathValue("@action")); string method = xeForm.XPathValue("@method"); //Trace.WriteLine("urlForm : \"{0}\" method {1}", urlForm, method); StringBuilder sb = new StringBuilder(); bool first = true; foreach (XXElement xeInput in xeForm.XPathElements(".//input")) { string name = xeInput.XPathValue("@name"); if (name == null) continue; string value = null; if (name == "vb_login_username") value = login; else if (name == "vb_login_password") value = null; else if (name == "vb_login_md5password" || name == "vb_login_md5password_utf") value = hashPassword; else value = xeInput.XPathValue("@value"); if (!first) sb.Append("&"); sb.AppendFormat("{0}={1}", name, value); first = false; } string content = sb.ToString(); //Trace.WriteLine("content : \"{0}\"", content); HttpRequest httpRequest = new HttpRequest { Url = urlForm, Content = content, Method = Http.GetHttpRequestMethod(method) }; HttpRequestParameters httpRequestParameters = new HttpRequestParameters(); Http http = HttpManager.CurrentHttpManager.Load(httpRequest, httpRequestParameters); //xeSource = new XXElement(http.zGetXmlDocument().Root); //if (!IsLoggedIn(xeSource)) // throw new PBException("unable login to http://www.ebookdz.com/"); return http; }
public Backup() { gTaskName = "Backup"; gTaskTrace = Trace.CurrentTrace; gConfig = new XmlConfig(); //string sPath = gConfig.Get("Backup/Log"); //if (sPath != null) // gTaskTrace.SetLogFile(sPath, LogOptions.IndexedFile); gTaskTrace.SetWriter(gConfig.Get("Backup/Log"), gConfig.Get("Backup/Log/@option").zTextDeserialize(FileOption.None)); gTaskProgress = new Progress(); gTaskProgressDetail = new Progress(); }
public static void GetAllDebribAccount() { if (__login != null) return; string LocalConfigFile = XmlConfig.CurrentConfig.Get("LocalConfig"); if (!zFile.Exists(LocalConfigFile)) throw new PBException("error LocalConfig not found \"{0}\"", LocalConfigFile); XmlConfig localConfig = new XmlConfig(LocalConfigFile); //Trace.WriteLine("LocalConfig : \"{0}\"", RunSource.CurrentRunSource.Config.Get("LocalConfig")); __login = localConfig.GetExplicit("DownloadAutomateManager/Alldebrid/Login"); __password = localConfig.GetExplicit("DownloadAutomateManager/Alldebrid/Password"); //Trace.WriteLine("login : {0}", __login == null ? "login is null" : "login is not null"); //Trace.WriteLine("password : {0}", __password == null ? "password is null" : "password is not null"); }
public RunSourceForm(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _trace = trace; _config = config; _runSourceParameters = runSourceParameters; try { // http://stackoverflow.com/questions/9056418/resources-getobjectthis-icon-crashes-application-on-windows-xp // pour ne pas avoir une exection avec : // this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); // Thread.Sleep(100); // dont work Initialize(); _tabResultMessage = tab_message; _tabResultGrid = tab_result2; _tabResultTree = tab_result4; this.Icon = Properties.Resources.app; string title = config.Get("RunsourceTitle"); if (title != null) __title = title; //tb_source.ConfigurationManager.CustomLocation = "ScintillaNET.xml"; //tb_source.ConfigurationManager.Language = "cs"; //InitScintilla(); Try(InitScintilla); tc_result.SelectedTab = _tabResultMessage; //ActiveControl = tb_source; cGrid.Culture = CultureInfo.CurrentUICulture; _gridMaxWidth = _config.Get("GridMaxWidth").zParseAs<int>(); _gridMaxHeight = _config.Get("GridMaxHeight").zParseAs<int>(); _dataTableMaxImageWidth = _config.Get("DataTableMaxImageWidth").zParseAs<int>(); _dataTableMaxImageHeight = _config.Get("DataTableMaxImageHeight").zParseAs<int>(); initRunSource(); SetFileSaved(); } catch (Exception ex) { _trace.WriteError(ex); zerrf.ErrorMessageBox(ex); } }
static void Main() { try { _config = new XmlConfig(); FormatInfo.SetInvariantCulture(); Application.CurrentCulture = FormatInfo.CurrentFormat.CurrentCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Test_RunSourceForm()); } catch (Exception ex) { zerrf.ErrorMessageBox(ex); } }
//static int Main(string[] args) static void Main() { try { Trace.CurrentTrace.SetLogFile("log.txt", LogOptions.None); XmlConfig config = new XmlConfig(); FormatInfo.SetInvariantCulture(); Application.CurrentCulture = FormatInfo.CurrentFormat.CurrentCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); RemoteRunSource remoteRunSource = new RemoteRunSource(); remoteRunSource.RunsourceDllFilename = config.GetExplicit("RunsourceDllFilename"); remoteRunSource.RunsourceClassName = config.GetExplicit("RunsourceClassName"); //remoteRunSource.CreateRunSourceDomain = config.Get("CreateRunSourceDomain").zTryParseAs<bool>(true); // attention si CreateRunSourceDomain = true runsource.launch.exe ne peut pas mettre à jour runsource.runsourced32.exe remoteRunSource.CreateRunSourceDomain = config.Get("CreateRunSourceDomain").zTryParseAs<bool>(false); RunSourceForm form = new RunSourceForm(remoteRunSource.GetRunSource(), config, GetRunSourceRestartParameters()); //form.UpdateRunsourceFiles += FormUpdateRunsourceFiles; form.SetRestartRunsource += FormSetRestartRunsource; Application.Run(form); //if (_projectFiles != null) SetRunSourceUpdateAndRestartParameters(); //if (_updateProgram) //{ // _updateProgram = false; // return 1; //} //else // return 0; } catch (Exception ex) { zerrf.ErrorMessageBox(ex); //return 0; } }
public RunSourceFormExe(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _trace = trace; _trace.SetViewer(TraceWrited); _config = config; _runSourceParameters = runSourceParameters; _source.TextChanged += source_TextChanged; CreateMenu(); CreateTopTools(); this.InitializeForm(); InitExe(); InitMenu(); UpdateRunSourceStatus(); Try(SetKeyboardShortcuts); this.KeyPreview = true; this.Load += RunSourceForm_Load; this.FormClosing += RunSourceForm_FormClosing; this.FormClosed += RunSourceForm_FormClosed; //this.KeyDown += RunSourceForm_KeyDown; }
public RunSourceForm_v3(IRunSource runSource, ITrace trace, XmlConfig config, RunSourceRestartParameters runSourceParameters) { _runSource = runSource; _trace = trace; _trace.SetViewer(TraceWrited); _config = config; _runSourceParameters = runSourceParameters; this.ClientSize = new Size(1060, 650); CreateMenu(); CreateTopTools(); CreateScintillaControl(); _editPanel.Controls.Add(_source); CreateResultControls(); CreateStatusBar(); this.InitializeForm(); InitExe(); InitMenu(); this.KeyPreview = true; this.Load += RunSourceForm_Load; this.FormClosing += RunSourceForm_FormClosing; this.FormClosed += RunSourceForm_FormClosed; this.KeyDown += RunSourceForm_KeyDown; }
private static Debrider CreateDebriderDebridLinkFr(XmlConfig config) { DebriderDebridLinkFr debrider = new DebriderDebridLinkFr(); debrider.DebridLinkFr = CreateDebridLinkFr(config); return debrider; }
static void Main() { try { XmlConfig config = new XmlConfig(); //Trace.CurrentTrace.SetLogFile("log.txt", LogOptions.None); //string path = config.Get("Log").zSetRootDirectory(); //if (path != null) // _runSource.Trace.SetLogFile(path, LogOptions.IndexedFile); //Trace.WriteLine(config.Get("Log").zSetRootDirectory()); //LogOptions logOptions = config.Get("Log/@LogOptions").zTextDeserialize(LogOptions.None); //Trace.WriteLine(logOptions.ToString()); //Trace.CurrentTrace.SetLogFile(config.Get("Log").zSetRootDirectory(), config.Get("Log/@LogOptions").zTextDeserialize(LogOptions.None)); //Trace.WriteLine(Trace.CurrentTrace.GetLogFile()); FormatInfo.SetInvariantCulture(); Application.CurrentCulture = FormatInfo.CurrentFormat.CurrentCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); RemoteRunSource remoteRunSource = new RemoteRunSource(); remoteRunSource.RunsourceDllFilename = config.GetExplicit("RunsourceDllFilename"); remoteRunSource.RunsourceClassName = config.GetExplicit("RunsourceClassName"); remoteRunSource.TraceClassName = config.GetExplicit("TraceClassName"); //remoteRunSource.CreateRunSourceDomain = config.Get("CreateRunSourceDomain").zTryParseAs<bool>(true); // ATTENTION si CreateRunSourceDomain = true runsource.launch.exe ne peut pas mettre à jour runsource.runsource.exe remoteRunSource.CreateRunSourceDomain = config.Get("CreateRunSourceDomain").zTryParseAs<bool>(false); IRunSource runSource = remoteRunSource.GetRunSource(); runSource.AllowMultipleExecution = config.Get("AllowMultipleExecution").zTryParseAs(false); // ATTENTION Trace exists in both 'runsource.runsource.exe' and 'runsource.dll' // donc il faut utiliser RemoteRunSource.GetTrace() ITrace trace = remoteRunSource.GetTrace(); //trace.SetLogFile(config.Get("Log").zRootPath(zapp.GetAppDirectory()), config.Get("Log/@LogOptions").zTextDeserialize(LogOptions.None)); // .zRootPath(zapp.GetAppDirectory()) trace.SetWriter(config.Get("Log"), config.Get("Log/@option").zTextDeserialize(FileOption.None)); //runSource.GenerateAndExecuteManager.GenerateAssemblyDirectory = config.Get("GenerateAssemblyDirectory", "run").zRootPath(zapp.GetAppDirectory()); // ATTENTION appeler DeleteGeneratedAssemblies() après SetRunSourceConfig() //runSource.DeleteGeneratedAssemblies(); //RunSourceForm_v1 form = new RunSourceForm_v1(runSource, trace, config, GetRunSourceRestartParameters()); RunSourceForm form = new RunSourceForm(runSource, trace, config, GetRunSourceRestartParameters()); //form.UpdateRunsourceFiles += FormUpdateRunsourceFiles; form.SetRestartRunsource += FormSetRestartRunsource; Application.Run(form); //if (_projectFiles != null) SetRunSourceRestartParameters(); //SetRunSourceUpdateParameters(); //if (_updateProgram) //{ // _updateProgram = false; // return 1; //} //else // return 0; //Application.Exit(); } catch (Exception ex) { zerrf.ErrorMessageBox(ex); //return 0; } }
public static void Test_Md5_02() { XmlConfig localConfig = new XmlConfig(XmlConfig.CurrentConfig.GetExplicit("LocalConfig")); Test_Md5_01(localConfig.Get("DownloadAutomateManager/Ebookdz/Password")); }
public FindPrintManager Create() { if (_version < 3 || _version > 6) throw new PBException("bad version {0}", _version); XmlConfig config = XmlConfig.CurrentConfig; _printConfig = config.GetConfig("PrintConfig"); _printList1Config = config.GetConfig("PrintList1Config"); _printList2Config = config.GetConfig("PrintList2Config"); //_printTitleManager = CreatePrintTitleManager.Create(_version, _gapDayBefore, _gapDayAfter); PrintTitleManagerCreator createPrintTitleManager = new PrintTitleManagerCreator(); createPrintTitleManager.Init(_xeConfig); createPrintTitleManager.SetParameters(_parameters); createPrintTitleManager.Version = _version; createPrintTitleManager.GapDayBefore = _gapDayBefore; createPrintTitleManager.GapDayAfter = _gapDayAfter; _printTitleManager = createPrintTitleManager.Create(); _findDayManager = CreateFindDayManager(); _printManager = CreatePrintManager(); _postTypeDirectories = CreatePostTypeDirectories(); _findPrintManager = _CreateFindPrintManager(); return _findPrintManager; }
public static void Test_Login_01(string url) { XmlConfig localConfig = new XmlConfig(XmlConfig.CurrentConfig.GetExplicit("LocalConfig")); string login = localConfig.GetExplicit("DownloadAutomateManager/Ebookdz/Login"); string hashPassword = Crypt.ComputeMD5Hash(localConfig.GetExplicit("DownloadAutomateManager/Ebookdz/Password")).zToHex(lowercase: true); string urlSite = "http://www.ebookdz.com/"; HttpRequestParameters_v1 requestParameters = new HttpRequestParameters_v1(); pb.old.Http_v2.LoadUrl(urlSite, requestParameters); XXElement xeSource = new XXElement(pb.old.Http_v2.HtmlReader.XDocument.Root); Trace.WriteLine("Login : \"{0}\"", Test_GetLogin_01(xeSource)); Trace.WriteLine("Is logged in : \"{0}\"", Test_IsLoggedIn_01(xeSource)); // <base href="http://www.ebookdz.com/forum/" /> string urlBase = xeSource.XPathValue("//head//base/@href"); //string urlBase = xeSource.XPathValue("//body//base/@href"); Trace.WriteLine("urlBase : \"{0}\"", urlBase); XXElement xeForm = xeSource.XPathElement("//form[@id='navbar_loginform']"); if (xeForm.XElement == null) { Trace.WriteLine("element not found \"//form[@id='navbar_loginform']\""); return; } Trace.WriteLine("form action : \"{0}\"", xeForm.XPathValue("@action")); string urlForm = zurl.GetUrl(urlBase, xeForm.XPathValue("@action")); string method = xeForm.XPathValue("@method"); Trace.WriteLine("urlForm : \"{0}\" method {1}", urlForm, method); StringBuilder sb = new StringBuilder(); bool first = true; foreach(XXElement xeInput in xeForm.XPathElements(".//input")) { string name = xeInput.XPathValue("@name"); if (name == null) continue; string value = null; if (name == "vb_login_username") value = login; else if (name == "vb_login_password") value = null; else if (name == "vb_login_md5password" || name == "vb_login_md5password_utf") value = hashPassword; else value = xeInput.XPathValue("@value"); if (!first) sb.Append("&"); sb.AppendFormat("{0}={1}", name, value); first = false; } string content = sb.ToString(); Trace.WriteLine("content : \"{0}\"", content); requestParameters.content = content; requestParameters.method = Http.GetHttpRequestMethod(method); pb.old.Http_v2.LoadUrl(urlForm, requestParameters); //CookieCollection cookies = requestParameters.cookies.GetCookies(new Uri(urlSite)); //Trace.WriteLine("cookies :"); //Trace.WriteLine(cookies.zToJson()); requestParameters.method = HttpRequestMethod.Get; requestParameters.content = null; pb.old.Http_v2.LoadUrl(url, requestParameters); xeSource = new XXElement(pb.old.Http_v2.HtmlReader.XDocument.Root); Trace.WriteLine("Login : \"{0}\"", Test_GetLogin_01(xeSource)); Trace.WriteLine("Is logged in : \"{0}\"", Test_IsLoggedIn_01(xeSource)); string cookiesFile = Path.Combine(XmlConfig.CurrentConfig.GetExplicit("Ebookdz/CookiesDir"), "cookies.txt"); Trace.WriteLine("save cookies to \"{0}\"", cookiesFile); //zfile.CreateFileDirectory(cookiesFile); //CookieCollection cookies = requestParameters.cookies.GetCookies(new Uri(urlSite)); //cookies.zSave(cookiesFile); zcookies.SaveCookies(requestParameters.cookies, urlSite, cookiesFile); //cookies = requestParameters.cookies.GetCookies(new Uri(urlSite)); //Trace.WriteLine("cookies :"); //Trace.WriteLine(cookies.zToJson()); }
public static XmlConfig GetLocalConfig() { if (_localConfig == null) _localConfig = new XmlConfig(XmlConfig.CurrentConfig.Get("LocalConfig")); return _localConfig; }
public void SetRunSourceConfig(string configFile) { _runSourceConfig = new XmlConfig(configFile); _refreshRunSourceConfig = false; //XmlConfigElement projectDefaultValues = _runSourceConfig.GetConfigElement("ProjectDefaultValues"); //if (projectDefaultValues != null) // //_defaultProject = new CompilerProject(projectDefaultValues, _runSourceConfig.ConfigPath); // _defaultProject = new CompilerProject(projectDefaultValues); //else // _defaultProject = null; }
public static Debrider CreateDebrider(XmlConfig config, bool useTestManager = false) { //return CreateDebriderAlldebrid(); Debrider debrider; if (!useTestManager) debrider = CreateDebriderDebridLinkFr(config); else debrider = new DebriderAlldebridTest(); return debrider; }
public XmlConfigElement(XmlConfig config, string xpath, XElement element, XElement elementLocal) { _xpathElement = xpath; _xmlConfig = config; _element = element; _localElement = elementLocal; }
// $$ProjectDefaultValues disable // used to compile without project public CompilerProjectReader GetDefaultProject() { string projectFile = GetRunSourceConfig().Get("DefaultProject"); bool createCompilerProject = false; if (projectFile == null) { _defaultProjectFile = null; _defaultProjectXmlConfig = null; _defaultProject = null; Trace.WriteLine("no default project"); } else if (projectFile != _defaultProjectFile) { _defaultProjectFile = projectFile; _defaultProjectXmlConfig = new XmlConfig(projectFile); createCompilerProject = true; Trace.WriteLine("create default project from \"{0}\"", _defaultProjectFile); } else { createCompilerProject = _defaultProjectXmlConfig.Refresh(); if (createCompilerProject) Trace.WriteLine("refresh default project from \"{0}\"", _defaultProjectFile); } if (createCompilerProject) _defaultProject = CompilerProjectReader.Create(_defaultProjectXmlConfig.GetConfigElement("/AssemblyProject")); return _defaultProject; }
private static DebridLinkFr CreateDebridLinkFr(XmlConfig config) { DebridLinkFr debrider = new DebridLinkFr(); XmlConfig localConfig = config.GetConfig("LocalConfig"); debrider.Login = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/Login"); debrider.Password = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/Password"); debrider.PublicKey = localConfig.GetExplicit("DownloadAutomateManager/DebridLink/PublicKey"); debrider.ConnexionLifetime = DebridLinkFr.GetConnexionLifetime(localConfig.GetExplicit("DownloadAutomateManager/DebridLink/ConnexionLifetime")); debrider.ConnexionFile = config.GetExplicit("DebridLink/ConnexionFile"); //debrider.ServerTimeFile = XmlConfig.CurrentConfig.GetExplicit("DebridLink/ServerTimeFile"); return debrider; }