So das ist mein erstes Projekt!
es ist noch nocht ganz fertig, ich weiß einfach nicht wie man bei mozilla die einstellungen für die benutzung vom proxys macht!
könnt ihr mir helfen???
noobie / Anfänger
C# 8) 8)
Hallo albatros,
stehen die nicht einfach in der user.js?
herbivore
Hallo albatros
Bei mir kommt beim Start der Anwendung ein Ausnahmefehler. Du solltest zumindest um die Application.Run() Anweisung einen try-catch Block legen damit du solche Fehler ausgeben kannst.
Noch was:
In der MainForm.cs steht bei mir in der Methode Main() folgender Code:
Applicatows.Run(new MainForm());
Ähh, was soll hier Applicatows bedeuten? 8o
Gruß,
SimonKnight6600
Original von SimonKnight6600
Applicatows.Run(new MainForm());
Ähh, was soll hier Applicatows bedeuten? 8o
mhhh... auch hier-> noobie am werk
das steht bei mir ^^
public static void Main(string[] args)
{
Application.Run(new MainForm());
}
keine ahnung...
noobie / Anfänger
C# 8) 8)
Original von herbivore
Hallo albatros,stehen die nicht einfach in der user.js?
herbivore
wo liegt die?
noobie / Anfänger
C# 8) 8)
Hallo albatros,
normalerweise unter
c:\Dokumente und Einstellungen<user>\Anwendungsdaten\Mozilla\Firefox\Profiles...
herbivore
eigentölich müsste ich dann ja nur eine Textdatei abspeichern um Mozilla für proxys zu konfigurieren...???
wie macht man das am besten?
noobie / Anfänger
C# 8) 8)
du könntest die Bordsuche benutzen
http://www.mycsharp.de/wbb2/search.php
oder
einfach hier nachsehen
[Tutorial] Alles über Dateien
Wir Arbeiten eigendlich nicht wir nehmen nur das geld
so habe jetzt das richtig so weit hin bekommen!!!
das einzige Manko: der User muss noch Konfigurieren am Anfang!
aber seht selber...
noobie / Anfänger
C# 8) 8)
BTW:
class MozillaFirefoxProxySettings
{
/// <summary>
/// Adresse des eingestellten Proxyservers.
/// </summary>
public static string IP
{
get
{
try
{
string data = read_key("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData");
string[] files = System.IO.Directory.GetDirectories(data + "\\Mozilla\\Firefox\\Profiles");
bool foundProxyName = false;
foreach (string profile in files)
{
StreamReader reader = File.OpenText(profile + "\\prefs.js"); // open file
for (int i = 0; -1 != reader.Peek(); i++) // read file
{
string line = reader.ReadLine();
// search XXX in user_pref("network.proxy.http", "XXX");
if (line.StartsWith("user_pref(\"network.proxy.http\", \""))
{
line = line.Remove(0, "user_pref(\"network.proxy.http\", \"".Length);
line = line.Substring(0, line.Length - 3);
return line;
}
}
reader.Close();
}
throw new Exception("CouldNotFindSettings");
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString() + " StackTrace: " + ex.StackTrace);
throw ex;
}
}
}
/// <summary>
/// Port des eingestellten Proxyservers.
/// </summary>
public static int Port
{
get
{
try
{
string data = read_key("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData");
string[] files = System.IO.Directory.GetDirectories(data + "\\Mozilla\\Firefox\\Profiles");
bool foundProxyName = false;
foreach (string profile in files)
{
StreamReader reader = File.OpenText(profile + "\\prefs.js"); // open file
for (int i = 0; -1 != reader.Peek(); i++) // read file
{
string line = reader.ReadLine();
// search YYY in user_pref("network.proxy.http_port", YYY);
if (line.StartsWith("user_pref(\"network.proxy.http_port\", "))
{
line = line.Remove(0, "user_pref(\"network.proxy.http_port\", ".Length);
return int.Parse(line.Substring(0, line.Length - 2));
}
}
reader.Close();
}
throw new Exception("CouldNotFindSettings");
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString() + " StackTrace: " + ex.StackTrace);
throw ex;
}
}
}
/// <summary>
/// Zum Auslesen von Werten aus der Registrierung.
/// </summary>
/// <param name="subKey">Sub Key.</param>
/// <param name="keyName">Key Name.</param>
/// <returns>Schluesselwert als String oder wenn nicht gefunden "fault".</returns>
static private string read_key(string subKey, string keyName)
{
try
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(subKey, true);
string asdasd = ((string)key.GetValue(keyName, keyName));
return asdasd;
}
catch
{
return "fault";
}
}
}
Beispielprgramm zum testen:
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine(MozillaFirefoxProxySettings.IP);
System.Console.WriteLine(MozillaFirefoxProxySettings.Port);
System.Console.ReadLine();
}
}
sehe kein set dort... genau das ist ja was ich brauchen würde...
noobie / Anfänger
C# 8) 8)
merk dir einfach die Zeilennummer und änder die entsprechende Zeile ab - dürft kein Problem sein - dürfte in 2h programmiert sein