Пример #1
0
        private void CreatePartition(Partition pPartition)
        {
            GPTfdisk GPTfdiskEditor = new GPTfdisk();

            GPTfdiskEditor.FileSystemBlockSize = iDevice.NandBlockSize;
            string PartitionLastSectorTempString;
            int    PartitionLastSector;
            int    PreviousPartitionNumber = Convert.ToInt16(pPartition.Number) - 1;
            string CommandOutput           = "";
            int    PositionLastSector;

            CommandOutput                 = SSH.ExecuteRemoteCommandWithOutput(GPTfdiskEditor.getConsoleOutputPartitionInfo(Convert.ToString(PreviousPartitionNumber)));
            PositionLastSector            = CommandOutput.IndexOf("Last");
            PartitionLastSectorTempString = CommandOutput.Substring(PositionLastSector + 13, 7);
            PartitionLastSector           = Convert.ToInt32(PartitionLastSectorTempString.TrimEnd());
            SSH.ExecuteRemoteCommand(GPTfdiskEditor.CreateNewPartition(pPartition.Name, pPartition.Number, PartitionLastSector, pPartition.Size));
        }
Пример #2
0
        private void btnCreatePartition_Click(object sender, EventArgs e)
        {
            PartitionCount++;
            GPTfdisk GPTfdiskEditor = new GPTfdisk();

            GPTfdiskEditor.FileSystemBlockSize = 8192;
            string PartitionLastSectorTempString;
            int    PartitionLastSector;
            string CommandOutput = "";
            int    PositionLastSector;

            CommandOutput                 = SSH.ExecuteRemoteCommandWithOutput(GPTfdiskEditor.getConsoleOutputPartitionInfo(Convert.ToString(PartitionCount - 1)));
            PositionLastSector            = CommandOutput.IndexOf("Last");
            PartitionLastSectorTempString = CommandOutput.Substring(PositionLastSector + 13, 7);
            PartitionLastSector           = Convert.ToInt32(PartitionLastSectorTempString.TrimEnd());
            SSH.ExecuteRemoteCommand(GPTfdiskEditor.CreateNewPartition(txtPartitionName.Text, Convert.ToString(PartitionCount), PartitionLastSector, Convert.ToInt32(txtNewPartitionSize.Text)));
        }