|
So what exact error you are facing on this code? You can debug and share that specific information
modified 20-Sep-20 21:01pm.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using HtmlAgilityPack;
using System.Net;
using System.IO;
namespace DocumentosSubsidios.Infrastructure.RobotBase
{
public abstract class BaseRoboAddress
{
public enum EncodingEnum
{
Default,
UTF8,
ASCII,
ISO_8859_1,
ANSICodePage
}
public BaseRoboAddress() { }
public BaseRoboBaseRoboAddress(WebClientSession webClientSession)
{
this._webClientSession = webClientSession;
}
public delegate void MyMethodInvoker<T>(T t);
public event MyMethodInvoker<string> ResultRequest;
#region [Membros Privados]
private CredentialCache _credentialCache;
private WebClientSession _webClientSession;
private CookieCollection _cookies = null;
private HtmlNodeCollection _inputs = null;
#endregion
#region [Propriedades]
public WebClientSession WebClientSession
{
get
{
if (_webClientSession == null) _webClientSession = new WebClientSession();
return _webClientSession;
}
set
{
_webClientSession = value;
}
}
private CredentialCache mCredentialCache
{
get
{
if (_credentialCache == null) _credentialCache = new CredentialCache();
return _credentialCache;
}
set
{
_credentialCache = value;
}
}
public CookieCollection Cookies
{
get
{
if (_cookies == null)
_cookies = new CookieCollection();
return _cookies;
}
set { _cookies = value; }
}
public HtmlNodeCollection Inputs
{
get
{
if (_inputs == null)
_inputs = new HtmlNodeCollection(null);
return _inputs;
}
set { _inputs = value; }
}
#endregion
#region [Métodos Publicos]
public virtual HtmlDocument Get(string url)
{
return this.Get(url, false, EncodingEnum.UTF8);
}
public HtmlDocument Get(string url, EncodingEnum encoding)
{
return this.Get(url, false, encoding);
}
public HtmlDocument Get(string url, bool fire, EncodingEnum encoding)
{
HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
byte[] pagina = this.WebClientSession.DownloadData(url);
switch (encoding)
{
case EncodingEnum.UTF8:
htmlDocument.LoadHtml(Encoding.UTF8.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.ASCII:
htmlDocument.LoadHtml(Encoding.ASCII.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.Default:
htmlDocument.LoadHtml(Encoding.Default.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.ISO_8859_1:
htmlDocument.LoadHtml(Encoding.GetEncoding("ISO-8859-1").GetString(pagina, 0, pagina.Count()));
break;
}
return htmlDocument;
}
public HtmlDocument Post(string url, NameValueCollection parametros, bool fire)
{
return this.Post(url, parametros, fire, EncodingEnum.UTF8);
}
public HtmlDocument Post(string url, NameValueCollection parametros, EncodingEnum encoding)
{
return this.Post(url, parametros, true, encoding);
}
public HtmlDocument Post(string url, NameValueCollection parametros)
{
return this.Post(url, parametros, true);
}
public HtmlDocument Post(string url, NameValueCollection parametros, bool fire, EncodingEnum encoding)
{
HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
byte[] pagina = this.WebClientSession.UploadValues(url, parametros);
switch (encoding)
{
case EncodingEnum.Default:
htmlDocument.LoadHtml(Encoding.Default.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.UTF8:
htmlDocument.LoadHtml(Encoding.UTF8.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.ASCII:
htmlDocument.LoadHtml(Encoding.ASCII.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.ISO_8859_1:
htmlDocument.LoadHtml(Encoding.GetEncoding("ISO-8859-1").GetString(pagina, 0, pagina.Count()));
break;
}
return htmlDocument;
}
public byte[] PostBinario(string url, NameValueCollection parametros)
{
HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
return this.WebClientSession.UploadValues(url, parametros);
}
public HtmlDocument PostData(string url, IEnumerable<byte> IBody, bool fire)
{
lock (this)
{
HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
byte[] pagina = this.WebClientSession.UploadData(url, "POST", IBody.ToArray());
htmlDocument.LoadHtml(Encoding.UTF8.GetString(pagina, 0, pagina.Count()));
return htmlDocument;
}
}
public HtmlDocument PostData(string url, IEnumerable<byte> IBody)
{
return this.PostData(url, IBody, true);
}
public HtmlDocument PostData(string url, IEnumerable<byte> IBody, EncodingEnum encoding)
{
lock (this)
{
byte[] pagina = this.WebClientSession.UploadData(url, "POST", IBody.ToArray());
HtmlDocument htmlDocument = LoadHtmlDocument(encoding, pagina);
return htmlDocument;
}
}
private HtmlDocument LoadHtmlDocument(EncodingEnum encoding, byte[] pagina)
{
HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
switch (encoding)
{
case EncodingEnum.Default:
htmlDocument.LoadHtml(Encoding.Default.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.UTF8:
htmlDocument.LoadHtml(Encoding.UTF8.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.ASCII:
htmlDocument.LoadHtml(Encoding.ASCII.GetString(pagina, 0, pagina.Count()));
break;
case EncodingEnum.ISO_8859_1:
htmlDocument.LoadHtml(Encoding.GetEncoding("ISO-8859-1").GetString(pagina, 0, pagina.Count()));
break;
}
return htmlDocument;
}
|
|
|
|
|
Correct. It won't.
Now, what would you like us to do about it?
If you have compiler errors, tell us what they are. It makes our lives a whole load easier...
You are missing a #endregion directive, and two close curly brackets, and your parameterized constructor is misspelt:
public BaseRoboBaseRoboAddress(WebClientSession webClientSession)
{
this._webClientSession = webClientSession;
}
Just reading the error messages would have told you that - and fixing them is trivial.
public BaseRoboAddress(WebClientSession webClientSession)
{
this._webClientSession = webClientSession;
}
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the help. The problem was even in the constructor
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nice! "Getters" that update properties ...
Why didn't I think of that.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Thanks for the help. The problem was even in the constructor
|
|
|
|
|
Hi all..
I am working on a project in c#.net for the customer administration in the company where I work. The administration asked me to add a feature for the project which allows for the user of the system (my C#.net project) to connect to the customers by clicking their numbers shown on a list on a window and then the Android phone of the user responses automatically for clicking and do a call to the customer who has the clicked number.. In other words, how to make my c#.net project dials customers' numbers by using android phone's SIM card (GSM or CDMA). I don't know how I start. I have already tried to search in the internet, but I found so rare and insufficient information about this topic.. So, I need to know all requirements and all details in order for this feature works. So I really need a help for this issue. Thanks in advance.
|
|
|
|
|
|
Hi, OriginalGriff
Thank you so much for helping, I will study your suggestions carefully.. thanks again
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Let me see if I have this straight. The code will run on the phone (so I am assuming you are writing this using Xamarin) and you want to dial someone else's phone. Is this correct?
This space for rent
|
|
|
|
|
Hi, Pete O'Hanlon
Thank you so much for your reply.. The code will be run on laptops not on phones, so when a user works on a laptop, which the project will be installed on, and the customers' window will be appearing which has a list of customers' phone numbers, then just by clicking any phone number from the list, the user's android phone directly calls the number which has been clicked on the list.. I hope the idea got clearer, thank you..
|
|
|
|
|
Who is the user, and who is the customer? And how does the laptop send the dial commands to the Android phone?
|
|
|
|
|
Richard MacCutchan wrote: how does the laptop send the dial commands to the Android phone?
That's probably what he's asking!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Yes, but not actually thought about it.
|
|
|
|
|
This isn't a trivial thing to do and is going to require the Android phone being set up to act as a mobile hotspot. Once it is available as a hotspot, the PC is going to have to connect to it and establish a Peer to Peer connection as a background service (the Android samples demonstrate how to find the IP address). Once the connection is established, you're going to send messages from the PC to the phone over this service telling it to make the call (you're going to have to use an Intent here - Google it). To be honest, unless you use Xamarin on the phone, the vast majority of what you are going to do here is going to be Java and you're going to have to get very comfortable with the Android SDK.
This space for rent
|
|
|
|
|
Thank you so much for your help.
I think the suggestions presented by OriginalGriff are good and can help me, but I am still studying them and I will test the solution that I will do based on the suggestions. When the solution works good and accurately, I will share it for all here.. also I consider your suggestion and I will try making a solution base on.. thanks so much, brother
|
|
|
|
|
Doesn't "Skype" handle "click a number and dial" type of calls?
Why does the "user" (i.e. Administration) even need a "phone"?
Is this for a "call center"?
What about VOIP?
(My last "user" wanted me to write a CSV extract because they didn't know how to "split a column" in Excel ... even though they "used Excel a lot". This sounds similar.)
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi,Gerry Schmitz
Thank you for your response..
For Skype, the Skype needs to be connected to the internet, and the policy of the company, where I work, relating to the internet using prevents running internet applications, so Skype is one of them.
The user who will work with my project needs to contact with the customers a lot and executes some another tasks, so he needs to do the calls faster because if he uses the traditional way to contact with customers (dialling the customers' numbers manually), this way will waste time, and will make him under stress. The calls are for customers mobile phones, not for a call center.
For VOIP, this technique is new for me, and I don't know how it works with VC#.NET. If you have any information about how to program it using VC#.NET, please share them..
Thanks
|
|
|
|
|
Your company needs to examine it's "policy".
A "Skype connection" does not imply unfettered internet access.
I'm at the point where I tell users their (outdated) "policies and procedures" need to accommodate the new realities (or find another "yes" man).
It's the user machine configuration that's at the core of this.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Dear
I have futronic fs80 fingerprint scanner and I want to integrate with c# so I searched online but I didn't find any sample code or tutorial how to integrate it with c# also on
futronic website but it didnt give me any obvious way so I need your help?
|
|
|
|
|
Contact the manufacturers; they are most likely to have an SDK that goes with the device. If they don't then demand your money back.
|
|
|
|
|
i have tried array bytes data convert to json format
|
|
|
|
|
Does this have anything to do with C#?
|
|
|
|
|