Subversion Repositories Code-Repo

Rev

Rev 48 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 48 Rev 50
Line 232... Line 232...
232
        {
232
        {
233
            DirectoryInfo dir = new DirectoryInfo(Settings_Form.sharedFolderLocation + @"\" + username);
233
            DirectoryInfo dir = new DirectoryInfo(Settings_Form.sharedFolderLocation + @"\" + username);
234
            long size = GetDirSize(dir);
234
            long size = GetDirSize(dir);
235
            return size;
235
            return size;
236
        }
236
        }
237
        private static long GetDirSize(DirectoryInfo input)
-
 
238
        {
-
 
239
            try
-
 
240
            {
-
 
241
                if (input.Exists)
-
 
242
                {
-
 
243
                    long size = 0;
-
 
244
                    FileInfo[] files = input.GetFiles();
-
 
245
                    foreach (FileInfo file in files)
-
 
246
                    {
-
 
247
                        size += file.Length;
-
 
248
                    }
-
 
249
                    DirectoryInfo[] dirs = input.GetDirectories();
-
 
250
                    foreach (DirectoryInfo dir in dirs)
-
 
251
                    {
-
 
252
                        size += GetDirSize(dir);
-
 
253
                    }
-
 
254
                    return size;
-
 
255
                }
-
 
256
                else 
-
 
257
                    return 0;
-
 
258
            }
-
 
259
            catch (Exception e)
-
 
260
            {
-
 
261
                MessageBox.Show(e.ToString(), "Error");
-
 
262
                return 0;
-
 
263
            }
-
 
264
        }
-
 
265
        public static void ChangeUserPassword(string username, string password)
237
        public static void ChangeUserPassword(string username, string password)
266
        {
238
        {
267
            try
239
            try
268
            {
240
            {
269
                Process netProcess = new Process();
241
                Process netProcess = new Process();
Line 308... Line 280...
308
            {
280
            {
309
                MessageBox.Show(e.ToString(), "Error");
281
                MessageBox.Show(e.ToString(), "Error");
310
            }
282
            }
311
            return sessionsOpen;
283
            return sessionsOpen;
312
        }
284
        }
-
 
285
        private static long GetDirSize(DirectoryInfo entry)
-
 
286
        {
-
 
287
            try
-
 
288
            {
-
 
289
                if (entry.Exists)
-
 
290
                {
-
 
291
                    long size = 0;
-
 
292
                    FileInfo[] files = entry.GetFiles();
-
 
293
                    foreach (FileInfo file in files)
-
 
294
                    {
-
 
295
                        size += file.Length;
-
 
296
                    }
-
 
297
                    DirectoryInfo[] dirs = entry.GetDirectories();
-
 
298
                    foreach (DirectoryInfo dir in dirs)
-
 
299
                    {
-
 
300
                        size += GetDirSize(dir);
-
 
301
                    }
-
 
302
                    return size;
-
 
303
                }
-
 
304
                else
-
 
305
                    return 0;
-
 
306
            }
-
 
307
            catch (Exception e)
-
 
308
            {
-
 
309
                MessageBox.Show(e.ToString(), "Error");
-
 
310
                return 0;
-
 
311
            }
-
 
312
        }
313
        private static void SetSharePermissions(string username)
313
        private static void SetSharePermissions(string username)
314
        {
314
        {
315
            string combinationString = "";
315
            string combinationString = "";
316
            foreach (string systemUser in Settings_Form.systemAccounts)
316
            foreach (string systemUser in Settings_Form.systemAccounts)
317
            {
317
            {