Hej Lasse
Lige en ting jeg så...
public static void Load(string givenPath)
25. {
26. if (!Directory.Exists("properties"))
27. Directory.CreateDirectory("properties");
28. string newPath = "properties/" + givenPath + ".properties";
29. string rndchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
30. Random rnd = new Random();
31. for (int i = 0; i < 16; ++i) { Server.salt += rndchars[rnd.Next(rndchars.Length)]; }
32.
33. if (File.Exists(newPath))
34. {
35. string[] lines = File.ReadAllLines(newPath);
Din string newPath har extention .properties?
Kunne dette være fejlen?
Nej, ".properties" er fil typen, som den læser.
Jeg har prøvet at lade den læse fra en ".txt", ingen forskel...
det der sker er at efter jeg har redigeret i filen med mit ""Properties" Vindue" i mit program, kan den ikke læse filen mere, fordi den bliver brugt af en anden process, det jeg gerne ville se om nogen kunne hjælpe med, var at finde noget jeg kunne erstatte, så den stadig kunne læse filen/lukke filen efter den er gemt.
erroren er:
Processen kan ikke få adgang til filen "BLAHBLAHBLAH\mcquai\properties\server.properties".
Fordi den bliver brugt af en anden proces.
************** Undtagelsestekst **************
System.IO.IOException: Processen kan ikke få adgang til filen 'C:\Users\Lasse\Desktop\minecraft stuff\mcquai\open\MCQuai.Gui\bin\Release\properties\rank.properties', fordi den bliver brugt af en anden proces.
ved System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
ved System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
ved System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
ved System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
ved System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
ved System.IO.StreamReader..ctor(String path, Encoding encoding)
ved System.IO.File.ReadAllLines(String path, Encoding encoding)
ved MCQuai.Properties.Load(String givenPath)
ved MCQuai.Gui.PropertiesWindow.btnSave_Click(Object sender, EventArgs e) i C:\Users\Lasse\Desktop\minecraft stuff\mcquai\open\MCQuai.Gui\PropertiesWindow.cs:linje 566
ved System.Windows.Forms.Control.OnClick(EventArgs e)
ved System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
ved System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
ved System.Windows.Forms.Control.WndProc(Message& m)
ved System.Windows.Forms.ButtonBase.WndProc(Message& m)
ved System.Windows.Forms.Button.WndProc(Message& m)
ved System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
ved System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Indlæste assemblies **************
mscorlib
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
MCQuai Gui
Assemblyversion: 1.0.0.0
Win32-version: 1.0.0.0
CodeBase: file:///C:/Users/Lasse/Desktop/minecraft%20stuff/mcquai/open/MCQuai.Gui/bin/Release/MCQuai%20Gui.exe
----------------------------------------
System.Windows.Forms
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
MCQuai_
Assemblyversion: 1.0.210.0
Win32-version: 1.0.210.0
CodeBase: file:///C:/Users/Lasse/Desktop/minecraft%20stuff/mcquai/open/MCQuai.Gui/bin/Release/MCQuai_.DLL
----------------------------------------
System.Configuration
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.resources
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.resources/2.0.0.0_da_b77a5c561934e089/System.resources.dll
----------------------------------------
mscorlib.resources
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
System.Windows.Forms.resources
Assemblyversion: 2.0.0.0
Win32-version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_da_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
Indlæg senest redigeret d. 25.12.2010 22:52 af Bruger #16191