|
The directory/folder structure itself is recursive and as far as I know there is no such information stored in any folder. Technically it could be done but if a file changes one should update this information of all the parent folders and that could make it quite expensive.
You could a tree structure containing this size information yourself and have it kept up to date by means of a service. Then you only need to ask that service for the size and you would have the answer immediately. But this is far more complex than the recursive algorithm. A unwanted side effect is that such service would take up CPU time and probably would decrease the performance of your disks. Do you have any requirement that ask for instantanious information?
If you just want to avoid recursion you could make an iterative directory walking algorithm but that would imply you should keep track on a stack where you have been. It might be a bit faster but it is harder to code.
regards,
rob tillaart
|
|
|
|
|
Thanks Rob.
But, Yes, My App does require Instantanious Information. It is something like (Treesize), but also adds that it can actually operate on the files and folders. And, Since it uses a Chart and by it's Very Nature, changes the information about directories often, it does need instantinous Information...
And, I suppose I'd be doing some benchmarks about the time required to get the size of them by Recursion and iteration, but I think that It'd take a lot of time, especially for rather big Folders like the Program Files folder....
Simply Yuvi
Don't Argue with a Fool : People looking will not know the difference
|
|
|
|
|
Well, I did run some tests, and it showed that it needs 1 minute 20 seconds to find the size of my primary partition, which is 13 gb full.... And, if i need to get the size of the Program Files Folder inside it, all the Files and Folders Sizes would be queried again! Sure, I could construct a Tree with the Folders and their Sizes, but i suppose there should be a better way....
Simply Yuvi
Don't Argue with a Fool : People looking will not know the difference
|
|
|
|
|
Hi Yuvi,
Two ideas:
1) Monitor 'hot' folders with an other frequency than 'cold' folders. The folder program files is big but does hardly change where the temp folder may be far more active.
2) Use WMI.
You can get all kind of events from the OS. Maybe you can subscribe to file (create append delete) events. Then you know where the changes are. I have no experience with it but check http://www.codeproject.com/csharp/WMIproviderGuide.asp[^]
for a good backgrounder.
regards,
rob
|
|
|
|
|
Thanks for the Ideas, Rob. Will Sure check WMI out....
Simply Yuvi
Don't Argue with a Fool : People looking will not know the difference
|
|
|
|
|
Hello!
I want to run another application from mine... How can I do it?
Thanks in advance!
|
|
|
|
|
Hi,
You do not state the language but in .NET you could use the Proces class and specific the start method. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic3.asp
for details or google: process class .NET
have faith,
rob
|
|
|
|
|
using this method Diagnostics.Process.Start(....)
<< >>
|
|
|
|
|
I create win32 service project, that creates Remoting service. After that win32 service running successfully, but remoting service doesn't work - I can't connect to it.
Also I must say, that in console programm this remoting service works well.
Is there anyone, who saw this problem? What is happening?
|
|
|
|
|
I have code that allows me to basically write the contents of a richtextbox to a bitmap (sending a EM_FORMATRANGE using SendMessage). This code works fine, but it always draws the text "normal size" regardless of the setting of ZoomFactor in the RichTextBox. How can I get the "zoomed" verison of the text into a bitmap?
Thanks in advance!
|
|
|
|
|
Hello, i'm doing sort of graphics editor.
I'm stunned with how to implement 2 things
a) draw a dotted line, or whatever not-solid
b) make a paint bucket tool - where i can fill closed curve, drawn with different primitives
|
|
|
|
|
hi all,
I would like to know whether windows application like c#.net be implemented using MVC Architecture.
Or any other architecture can be followed? if so please help me with sample of ur application.
hope i ll get help.
Regards,
Sarayu.
|
|
|
|
|
Of course. It's a design pattern, not something mistical only Java can use. All you have to do is Google for "mvc c#" and you'll come up with all kinds of stuff. Even this[^] example here on Code Project.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi,
I have imported a project from VS 6.0 in VS.Net 2005.
When I compile it, it raise a link error:
LINK : fatal error LNK1104: cannot open file 'mfc42ud.lib'
With .Net 2005 should it use mfc80ud.lib ?? How I can specify it ?
Best regards,
============================
Martin Bonneville
Software programmer-analyst
|
|
|
|
|
I dunno. But if you have VS 6 then try specificy library path or copy to the VS2005 library path. Check Project settink.
|
|
|
|
|
How I can see what user open session in a computers of a domain (without Active Directory)?
Thank
Sory for my english.
|
|
|
|
|
Hi!
If you are using a windows system, you just need to use the win32-api GetUserName:
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, ByRef nSize As Integer) As Integer
Public Function GetCurrentUser() As String
Dim liReturn As Integer
Dim lsUserName As String
lsUserName = New String(CChar(" "), 250)
liReturn = GetUserName(lsUserName, 250)
GetCurrentUser= lsUserName.Substring(0, lsUserName.IndexOf(Chr(0)))
End Function
The imported function GetUserName require two parameters:
1. The destination string-buffer for output
2. The size of the username
Then, with substring and indexof, we cut all character "0" off and return the username.
Marcel Erz
|
|
|
|
|
You can get the user name associated with the current thread using SystemInformation.UserName.
|
|
|
|
|
How to set Textbox text on a crystal report at runtime ?
Dim cr As CRAXDDRT20.TextObject
cr = crReport.Section1.ReportObjects.Item("Text3")
cr.SetText(strEmpName)
a.CrystalReportViewer1.ReportSource = crReport
a.Show()
error : specified cast is not valid
Farah
|
|
|
|
|
How to set the text of a text box on a crystal report at run time?
Dim strEmpName As String
strEmpName = TextBox1.Text
Dim a As Form2
a = New Form2
Dim crReport As CrystalReport1
crReport = New CrystalReport1
Dim cr As CRAXDDRT20.TextObject
cr = crReport.Section1().ReportObjects.Item("Text3")
cr.SetText(strEmpName)
a.CrystalReportViewer1.ReportSource = crReport
a.Show()
Farah
|
|
|
|
|
hi everybody,
I have a small question concerning the use of ToWords() method that is embeded within Crystal Report.This function translates numeric values into their coresponding words value ex:150 --> One handred and fifty.
The problem I got is that I got an automatic english conversion of my numeric values where I need french corresponing string value. Is there any way I can swish it to french? Or how can I add my function, that does the french translation, to the crystal report embeded functions?
If anyone can help pls do.
|
|
|
|
|
Does the Compact Framework support .Net Remoting?
Short and sweet
Thank you...
|
|
|
|
|
Short question, so a short answer: No its not supported by the framework.
You could try using Web Services, but its not adviced.
|
|
|
|
|
Anyone have code for a simple app to test if a computer has dot net framework or not?
Anyone know of one that runs straight from a browser?
Thanks,
RABB17
|
|
|
|