/// <summary>
        /// Check if the Drive with the matching supplied letter has the correct DriveTypes value
        /// </summary>
        /// <param name="_driveLetter">Letter of the MediaDrive to check</param>
        /// <param name="_type">Expected DriveTypes value of the drive represented by the letter</param>
        /// <returns>True if drive represented by letter has the provided DriveTypes value, otherwise false.</returns>
        public static bool IsCorrectDriveType(char _driveLetter, DriveTypes _type)
        {
            bool _IsCorrectType = false;

            //do some code

            return(_IsCorrectType);
        }
Esempio n. 2
0
 public PostCategory(string brandName, CarTypes carType, bool isImported, bool isUsed, DriveTypes driveType, TransmissionTypes transmissionType)
 {
     BrandName    = brandName;
     CarType      = carType;
     IsImported   = isImported;
     IsUsed       = isUsed;
     DriveType    = driveType;
     Transmission = transmissionType;
 }
Esempio n. 3
0
 public Computer(ComputerTypes type, Processor processor, string videocard, RamTypes ramType, int driveSize, DriveTypes driveType, string purchaseTime)
 {
     this.type         = type;
     this.processor    = processor;
     this.videocard    = videocard;
     this.ramType      = ramType;
     this.driveSize    = driveSize;
     this.driveType    = driveType;
     this.purchaseTime = purchaseTime;
 }
Esempio n. 4
0
        /// <summary>
        /// Is a FATX drive
        /// </summary>
        /// <param name="xDrive"></param>
        /// <param name="xType"></param>
        /// <returns></returns>
        public static bool IsFATX(ref Drive xDrive, out DriveTypes xType)
        {
            xType = DriveTypes.Unknown;
            if (xDrive == null)
            {
                return(false);
            }
            xDrive.MakeHandle();
            DJsIO xIO = new DriveIO(xDrive, true);

            return(IsFATX(ref xIO, out xType));
        }
Esempio n. 5
0
        public DriveInfo(int driveNumber)
        {
            int handle;

            this._driveType = DriveTypes.Unknown;
            SENDCMDINPARAMS  sci = new SENDCMDINPARAMS();
            SENDCMDOUTPARAMS sco = new SENDCMDOUTPARAMS();

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                string file = @"\\.\PhysicalDrive" + driveNumber.ToString();
                handle = CreateFile(file, -1073741824, 3, 0, 3, 0, 0);
            }
            else
            {
                string _Vb_t_string_0 = @"\\.\Smartvsd";
                handle = CreateFile(_Vb_t_string_0, 0, 0, 0, 1, 0, 0);
            }
            if (handle != -1)
            {
                int returnSize;
                sci.DriveNumber            = (byte)driveNumber;
                sci.BufferSize             = Marshal.SizeOf(sco);
                sci.DriveRegs.DriveHead    = (byte)(160 | (driveNumber << 4));
                sci.DriveRegs.Command      = 0xec;
                sci.DriveRegs.SectorCount  = 1;
                sci.DriveRegs.SectorNumber = 1;
                returnSize = 0;
                if (DeviceIoControl(handle, 0x7c088, sci, Marshal.SizeOf(sci), sco, Marshal.SizeOf(sco), ref returnSize, 0) != 0)
                {
                    this._serialNumber    = SwapChars(sco.IDS.SerialNumber);
                    this._model           = SwapChars(sco.IDS.ModelNumber);
                    this._firmware        = SwapChars(sco.IDS.FirmwareRevision);
                    this._numberCylinders = sco.IDS.NumberCylinders;
                    this._numberHeads     = sco.IDS.NumberHeads;
                    this._sectorsPerTrack = sco.IDS.SectorsPerTrack;
                    this._bufferSize      = sco.IDS.BufferSize * 0x200;
                    if ((sco.IDS.GenConfig & 0x80) == 0x80)
                    {
                        this._driveType = DriveTypes.Removable;
                    }
                    else if ((sco.IDS.GenConfig & 0x40) == 0x40)
                    {
                        this._driveType = DriveTypes.Fixed;
                    }
                    else
                    {
                        this._driveType = DriveTypes.Unknown;
                    }
                }
                CloseHandle(handle);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Sets a FATX Drive from an index
        /// </summary>
        /// <param name="DeviceIn"></param>
        public FATXDrive(DeviceReturn DeviceIn)
        {
            Drive xdrive = new Drive(DeviceIn.index, DeviceIn.type);

            if (!xdrive.Accessed)
            {
                throw new Exception("Invalid input");
            }
            //if (!FATXManagement.IsFATX(ref xdrive, out xType))
            //   throw new Exception("Drive is not FATX");
            xType   = DriveTypes.USBFlashDrive;
            xactive = true;
            xDrive  = xdrive;
            LoadPartitions();
        }
Esempio n. 7
0
        /// <summary>
        /// Gets a result of available set of FATX Drives from a set of Indexes
        /// </summary>
        /// <param name="Drives">General drive list</param>
        /// <returns></returns>
        public static DeviceReturn[] GetFATXDrives(DeviceReturn[] Drives)
        {
            List <DeviceReturn> xReturn = new List <DeviceReturn>();

            for (int i = 0; i < Drives.Length; i++)
            {
                Drive      xDrive = new Drive(Drives[i].index, Drives[i].type);
                DriveTypes xType  = DriveTypes.Unknown;
                if (IsFATX(ref xDrive, out xType))
                {
                    xReturn.Add(Drives[i]);
                }
            }
            return(xReturn.ToArray());
        }
 /// <summary>
 /// Required designer variable.
 /// </summary>
 public TreeViewFolderBrowser()
 {
     InitializeComponent();
     // initalize a new helper instance for this tree view.
     _helper = new TreeViewFolderBrowserHelper(this);
     //
     this.ContextMenu        = new ContextMenu();
     this.ContextMenu.Popup += new EventHandler(OnContextMenu_Popup);
     //
     this._driveTypes          = DriveTypes.NoRootDirectory | DriveTypes.RemovableDisk | DriveTypes.LocalDisk | DriveTypes.NetworkDrive | DriveTypes.CompactDisc | DriveTypes.RAMDisk;
     this.RootFolder           = Environment.SpecialFolder.MyComputer;
     this.CheckboxBehaviorMode = CheckboxBehaviorMode.SingleChecked;
     // init bold font
     boldFont_ = new Font(this.Font, FontStyle.Bold);
 }
        private Expression <Func <VehicleToDriveTypeDocument, bool> > AddDriveTypeFilter(
            Expression <Func <VehicleToDriveTypeDocument, bool> > filterEx)
        {
            if (DriveTypes == null || !DriveTypes.Any())
            {
                return(filterEx);
            }
            Expression <Func <VehicleToDriveTypeDocument, bool> > mfrBodyCodeFilterEx = null;

            foreach (var driveType in DriveTypes)
            {
                mfrBodyCodeFilterEx = mfrBodyCodeFilterEx.OrElse(x => x.DriveTypeName == driveType);
            }

            return(filterEx.AndAlso(mfrBodyCodeFilterEx));
        }
Esempio n. 10
0
        public JointData(AssemblyJoint joint, String name)
        {// set all the default values
            Name        = name;
            jointOfType = joint;
            try
            {
                ReferenceKeyManager refKeyMgr = StandardAddInServer.m_inventorApplication.ActiveDocument.ReferenceKeyManager;
                byte[] refKey = new byte[0];
                joint.GetReferenceKey(ref refKey, 0);
                RefKey = refKeyMgr.KeyToString(refKey);
            } catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            Driver        = DriveTypes.NoDriver;
            Wheel         = WheelType.NotAWheel;
            Friction      = FrictionLevel.None;
            Diameter      = InternalDiameter.PointFive;
            Pressure      = Pressure.psi60;
            Stages        = Stages.SingleStageElevator;
            PWMport       = 1;
            PWMport2      = 1;
            CANport       = 1;
            CANport2      = 1;
            DriveWheel    = false;
            PWM           = true;
            InputGear     = 1;
            OutputGear    = 1;
            SolenoidPortA = 1;
            SolenoidPortB = 1;
            RelayPort     = 1;
            HasBrake      = false;
            BrakePortA    = 1;
            BrakePortB    = 1;
            if (joint.Definition.JointType == AssemblyJointTypeEnum.kCylindricalJointType || joint.Definition.JointType == AssemblyJointTypeEnum.kSlideJointType)
            {// if the assembly joint is linear
                Rotating = false;
            }
            else
            {// set the combo box choices to rotating
                Rotating = true;
            }

            HasLimits          = false;
            JointFrictionLevel = 0;
            HasJointFriction   = false;
        }
        /// <summary>
        /// Create a new instance of a media drive from a drive letter and DriveType
        /// </summary>
        /// <param name="_driveLetter">Drive letter to use</param>
        /// <param name="_driveType">DriveTypes.DriveType to use</param>
        public MediaDrive(char _driveLetter, DriveTypes _driveType)
        {
            _drives = GetMediaDrives();

            foreach (Tuple <char, DriveTypes, bool> _item in _drives)
            {
                if (_driveLetter == _item.Item1)
                {
                    DriveType = _item.Item2;

                    if (_item.Item3)
                    {
                        MediaAiringStatus = ShowAiringStatus.ACTIVE;
                    }
                    else
                    {
                        MediaAiringStatus = ShowAiringStatus.ENDED;
                    }
                }
            }
        }
Esempio n. 12
0
 public override void SetAttributes(ComputerTypes computerTypes, RamTypes ramTypes, DriveTypes driveTypes)
 {
     this.CType = ComputerTypes.PC;
     this.DType = driveTypes;
     this.RType = ramTypes;
 }
Esempio n. 13
0
        /// <summary>
        /// Determins if this Index is a FATX drive pointed index
        /// </summary>
        /// <param name="Device">Device to check</param>
        /// <param name="xType">Grabs the FATX type</param>
        /// <returns></returns>
        public static bool IsFATX(DeviceReturn Device, out DriveTypes xType)
        {
            Drive xDrive = new Drive(Device.index, Device.type);

            return(IsFATX(ref xDrive, out xType));
        }
Esempio n. 14
0
 /// <summary>
 /// Determins if a Drive is FATX format
 /// </summary>
 /// <param name="xIO">Stream to check</param>
 /// <param name="xType">Grabs the type of drive</param>
 /// <returns></returns>
 public static bool IsFATX(ref DJsIO xIO, out DriveTypes xType)
 {
     // Tries to read the offsets of Xbox 360 drives to see if the magic's match
     xType = DriveTypes.Unknown;
     try
     {
         xIO.Position = (long)MU.Partition2;
         if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
         {
             xType = DriveTypes.MemoryUnit;
             return(true);
         }
     }
     catch { }
     try
     {
         if (xIO.IOType != DataType.Drive || ((DriveIO)xIO).xDrive.Type != DeviceType.LogicalDrive)
         {
             throw new Exception();
         }
         string dat0 = ((DriveIO)xIO).xDrive.DeviceName + @"\Xbox360\Data0000";
         if (!File.Exists(dat0))
         {
             throw new Exception();
         }
         DJsIO xio = new DJsIO(dat0, DJFileMode.Open, true);
         if (!xio.Accessed)
         {
             throw new Exception();
         }
         xio.Position = (long)USB.Partition1;
         try
         {
             if (xio.ReadUInt32() == (uint)AllMagic.FATX)
             {
                 xType = DriveTypes.USBFlashDrive;
                 xio.Dispose();
                 return(true);
             }
         }
         catch { }
         xio.Dispose();
     }
     catch { }
     try
     {
         xIO.Position = (long)HDD.Partition5;
         if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
         {
             xType = DriveTypes.HardDrive;
             return(true);
         }
     }
     catch { }
     try
     {
         xIO.Position = 8;
         xIO.Position = (xIO.ReadUInt32() * 0x200);
         if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
         {
             xType = DriveTypes.DevHardDrive;
             return(true);
         }
     }
     catch { }
     return(false);
 }
Esempio n. 15
0
 public void SetDriveType(DriveTypes driveType)
 {
     SetNewDriveType.Command.Execute(driveType);
 }
 /// <summary>
 /// Determins if this Index is a FATX drive pointed index
 /// </summary>
 /// <param name="Device">Device to check</param>
 /// <param name="xType">Grabs the FATX type</param>
 /// <returns></returns>
 public static bool IsFATX(DeviceReturn Device, out DriveTypes xType)
 {
     Drive xDrive = new Drive(Device.index, Device.type);
     return IsFATX(ref xDrive, out xType);
 }
 /// <summary>
 ///   Required designer variable.
 /// </summary>
 public TreeViewFolderBrowser()
 {
     InitializeComponent();
       // initalize a new helper instance for this tree view.
       _helper = new TreeViewFolderBrowserHelper(this);
       //
       ContextMenu = new ContextMenu();
       ContextMenu.Popup += OnContextMenu_Popup;
       //
       _driveTypes = DriveTypes.NoRootDirectory | DriveTypes.RemovableDisk | DriveTypes.LocalDisk |
             DriveTypes.NetworkDrive | DriveTypes.CompactDisc | DriveTypes.RAMDisk;
       RootFolder = Environment.SpecialFolder.MyComputer;
       CheckboxBehaviorMode = CheckboxBehaviorMode.SingleChecked;
       // init bold font
       boldFont_ = new Font(Font, FontStyle.Bold);
 }
Esempio n. 18
0
        public PitScoutEditPage2(ParseObject teamData)
        {
            Grid grid = new Grid()
            {
                //Padding = new Thickness(0,20,0,0),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(160, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(160, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            // RobotImage
            try {
                if (teamData ["robotImage"].ToString() != null)
                {
                    ParseFile robotImageURL = (ParseFile)teamData ["robotImage"];
                    // Gets the image from parse and converts it to ParseFile
                    // robotImage.Source = "I"+teamData["teamNumber"]+".jpg"; //Must scale down images manually before upload, & all images must be .jpg
                    // How to write this so caching actually works?

                    robotImage.Source = new UriImageSource {
                        Uri            = robotImageURL.Url,
                        CachingEnabled = true,
                        CacheValidity  = new TimeSpan(7, 0, 0, 0)                     // Caches Images onto your device for a week
                    };
                }
                else
                {
                }
            }
            catch {
                robotImage.Source = "Placeholder_image_placeholder.png";
            }
            robotImage.Aspect = Aspect.AspectFit;             //Need better way to scale an image while keeping aspect ratio, but not overflowing everything else
            // robotImage.GestureRecognizers.Add (imageTap);

            string teamNo;

            try{
                teamNo = teamData ["teamNo"].ToString();
            }
            catch {
                teamNo = "<No Data Recorded>";
            }
            Label title = new Label {
                Text = teamNo + "'s Stats"
            };

            Title = title.Text;

            // Team Number Label
            Label teamNumber = new Label();

            try {
                if (teamData ["teamNumber"] != null)
                {
                    teamNumber.Text = teamData ["teamNumber"].ToString();
                }
                else
                {
                }
            }
            catch {
                teamNumber.Text = "<No Team Number>";
            }
            teamNumber.FontSize = GlobalVariables.sizeTitle;

            // Team Name Label
            Label teamName = new Label();

            try {
                if (teamData ["teamName"] != null)
                {
                    teamName.Text = teamData ["teamName"].ToString();
                }
                else
                {
                }
            } catch {
                teamName.Text = "<No Team Name>";
            }
            teamName.FontSize = GlobalVariables.sizeMedium;

            // Drive Type Picker
            Label driveTypeLabel = new Label {
                Text     = "Drive Type",
                FontSize = GlobalVariables.sizeMedium,
            };

            Picker driveTypePicker = new Picker();

            driveTypePicker.Title = "Choose an Option";
            for (DriveTypes i = DriveTypes.Tank; i <= DriveTypes.Other; i++)
            {
                driveTypePicker.Items.Add(i.ToString());
            }
            ;
            driveTypePicker.SelectedIndexChanged += (sender, e) => {
                driveTypePicker.Title = driveTypePicker.SelectedIndex.ToString();
            };

            // Low Bar Picker
            Label lowBarLabel = new Label {
                Text     = "Can you go under the low bar?:",
                FontSize = GlobalVariables.sizeMedium,
            };

            Picker lowBarPicker = new Picker();

            lowBarPicker.Title = "Choose an Option";
            for (Choice i = Choice.Yes; i <= Choice.No; i++)
            {
                lowBarPicker.Items.Add(i.ToString());
            }
            ;
            lowBarPicker.SelectedIndexChanged += (sender, e) => {
                lowBarPicker.Title = lowBarPicker.SelectedIndex.ToString();
            };

            // Auto Strategy Editor
            Label autoStrategyLabel = new Label {
                Text     = "Auto Strategy",
                FontSize = GlobalVariables.sizeMedium,
            };

            Editor autoStrategyEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Gray
            };

            try{
                if (data[autoStrategy] != null)
                {
                    autoStrategyEditor.Text = data ["autoStrategy"].ToString();
                }
            } catch {
                autoStrategyEditor.Text = "<No Data Recorded>";
            }

            // TeleOp Strategy Editor
            Label teleOpStrategyLabel = new Label {
                Text     = "teleOp Strategy",
                FontSize = GlobalVariables.sizeMedium,
            };

            Editor teleOpStrategyEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Gray
            };

            try{
                if (data["teleOpStrategy"] != null)
                {
                    teleOpStrategyEditor.Text = data ["teleOpStrategy"].ToString();
                }
            } catch {
                teleOpStrategyEditor.Text = "<No Data Recorded>";
            }

            // Additional Notes Editor
            Label notesLabel = new Label {
                Text     = "Additional Notes",
                FontSize = GlobalVariables.sizeMedium,
            };

            Editor notesEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Gray
            };

            try{
                if (data["notes"] != null)
                {
                    notesEditor.Text = data ["notes"].ToString();
                }
            } catch {
                notesEditor.Text = "<No Data Recorded>";
            }

            data = teamData;

            Button updateBtn = new Button()
            {
                Text = "Update Button"
            };

            updateBtn.Clicked += (object sender, EventArgs e) => {
                // UpdateBtn
                try{
                    if (driveTypePicker.Title != "Choose an Option")
                    {
                        data["driveType"] = driveTypePicker.Title.ToString();
                        SaveData();
                    }
                }
                catch {
                    errorString += "driveType, ";
                    error        = true;
                }
                try{
                    if (lowBarPicker.Title != "Choose an Option")
                    {
                        data["lowBarAccess"] = lowBarPicker.Title.ToString();
                        SaveData();
                    }
                }
                catch {
                    errorString += "lowBarAccess, ";
                    error        = true;
                }
                try{
                    if (autoStrategyEditor.Text != "<No Data Recorded>")
                    {
                        data["autoStrategy"] = autoStrategyEditor.Title.ToString();
                        SaveData();
                    }
                }
                catch {
                    errorString += "autoStrategy, ";
                    error        = true;
                }
                try{
                    if (teleOpStrategyEditor.Text != "<No Data Recorded>")
                    {
                        data["teleOpStrategy"] = teleOpStrategyEditor.Title.ToString();
                        SaveData();
                    }
                }
                catch {
                    errorString += "teleOpStrategy, ";
                    error        = true;
                }
                try{
                    if (notesEditor.Text != "<No Data Recorded>")
                    {
                        data["notes"] = notesEditor.Title.ToString();
                        SaveData();
                    }
                }
                catch {
                    errorString += "notes, ";
                    error        = true;
                }

                // DisplayAlert if save did not go through
                if (error == true)
                {
                    errorString -= 2;
                    DisplayAlert("Error", errorString, "OK");
                    errorString = errorStringDefault;
                    error       = false;
                }
            };

            Button refreshBtn = new Button()
            {
                Text            = "Refresh",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            refreshBtn.Clicked += (object sender, EventArgs e) => {
                Navigation.PushModalAsync(new PitScoutingEditPage(teamData));
            };

            //Back Button
            Button backBtn = new Button()
            {
                Text            = "Back",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            backBtn.Clicked += (object sender, EventArgs e) => {
                Navigation.PopModalAsync();
            };

            StackLayout side = new StackLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,

                Children =
                {
                    teamNumber,
                    teamName
                }
            };
            StackLayout info = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,


                Children =
                {
                    driveTypeLabel,
                    driveTypePicker,
                    lowBarLabel,
                    lowBarPicker,
                    autoStrategyLabel,
                    autoStrategyEditor,
                    teleOpStrategyLabel,
                    teleOpStrategyEditor,
                    notesLabel,
                    notesEditor
                }
            };

            StackLayout navigationBtns = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Color.Green,

                Children =
                {
                    backBtn,
                    driveTypeLabel,
                    driveTypePicker,
                    refreshBtn,
                    updateBtn
                }
            };

            //grid.Children.Add (robotImage, 0, 0);
            grid.Children.Add(side, 1, 0);
            grid.Children.Add(info, 0, 2, 1, 2);
            grid.Children.Add(navigationBtns, 0, 2, 2, 3);

            this.Content = new ScrollView {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,

                Content = grid
            };
        }
Esempio n. 19
0
        public PitScoutingEditPage(ParseObject teamData)
        {
            data = teamData;

            Grid topGrid = new Grid()
            {
                BackgroundColor = Color.Black,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = new GridLength(130, GridUnitType.Absolute)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(150, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            Grid grid = new Grid()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            addRobotImage();

            // Team Number Label
            Label teamNumber = new Label()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                TextColor       = Color.White,
                BackgroundColor = Color.Black,
                FontSize        = GlobalVariables.sizeTitle
            };

            try {
                if (teamData ["teamNumber"] != null)
                {
                    teamNumber.Text = "Team " + teamData ["teamNumber"].ToString();
                }
                else
                {
                }
            }
            catch {
                teamNumber.Text = "<No Team Number>";
            }

            // Team Name Label
            Label teamName = new Label()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                FontSize        = GlobalVariables.sizeMedium,
                BackgroundColor = Color.Black
            };

            try {
                if (teamData ["teamName"] != null)
                {
                    teamName.Text = teamData ["teamName"].ToString();
                }
                else
                {
                }
            } catch {
                teamName.Text = "<No Team Name>";
            }

            // Drive Type Picker
            Label driveTypeLabel = new Label {
                Text      = "Drive Type:",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Picker driveTypePicker = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            try{
                if (teamData["driveType"] != null)
                {
                    driveTypePicker.Title = teamData["driveType"].ToString();
                }
            }
            catch {
                driveTypePicker.Title = "Choose an Option";
            }
            for (DriveTypes i = DriveTypes.Tank; i <= DriveTypes.Other; i++)
            {
                driveTypePicker.Items.Add(i.ToString());
            }
            ;
            driveTypePicker.SelectedIndexChanged += (sender, e) => {
                DriveTypes type = (DriveTypes)driveTypePicker.SelectedIndex;
                driveTypePicker.Title = type.ToString();
            };

            // Low Bar Picker
            Label lowBarLabel = new Label {
                Text      = "Can you go under the low bar?:",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Picker lowBarPicker = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            try{
                if (teamData["lowBarAccess"] != null)
                {
                    lowBarPicker.Title = teamData["lowBarAccess"].ToString();
                }
            }
            catch {
                lowBarPicker.Title = "Choose an Option";
            }
            for (Choice i = Choice.Yes; i <= Choice.No; i++)
            {
                lowBarPicker.Items.Add(i.ToString());
            }
            ;
            lowBarPicker.SelectedIndexChanged += (sender, e) => {
                Choice type = (Choice)lowBarPicker.SelectedIndex;
                lowBarPicker.Title = type.ToString();
            };

            // Intake Picker
            Label intakeLabel = new Label {
                Text      = "Can you shoot/outtake opposite of your intake?:",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Picker intakePicker = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            try{
                if (teamData["intakePos"] != null)
                {
                    intakePicker.Title = teamData["intakePos"].ToString();
                }
            }
            catch {
                intakePicker.Title = "Choose an Option";
            }
            for (Choice i = Choice.Yes; i <= Choice.No; i++)
            {
                intakePicker.Items.Add(i.ToString());
            }
            ;
            intakePicker.SelectedIndexChanged += (sender, e) => {
                Choice type = (Choice)intakePicker.SelectedIndex;
                intakePicker.Title = type.ToString();
            };

            // Auto Strategy Editor
            Label autoStrategyLabel = new Label {
                Text      = "Auto Strategy",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Editor autoStrategyEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Silver
            };

            try{
                if (teamData["autoStrategy"] != null)
                {
                    autoStrategyEditor.Text = data ["autoStrategy"].ToString();
                }
            } catch {
                autoStrategyEditor.Text = "<No Data Recorded>";
            }

            // TeleOp Strategy Editor
            Label teleOpStrategyLabel = new Label {
                Text      = "TeleOp Strategy",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Editor teleOpStrategyEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Silver
            };

            try{
                if (teamData["teleOpStrategy"] != null)
                {
                    teleOpStrategyEditor.Text = data ["teleOpStrategy"].ToString();
                }
            } catch {
                teleOpStrategyEditor.Text = "<No Data Recorded>";
            }

            // Additional Notes Editor
            Label notesLabel = new Label {
                Text      = "Additional Notes",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Editor notesEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Silver
            };

            try{
                if (teamData["notes"] != null)
                {
                    notesEditor.Text = data ["notes"].ToString();
                }
            } catch {
                notesEditor.Text = "<No Data Recorded>";
            }

            // Additional Notes Editor
            Label matchNotesLabel = new Label {
                Text      = "Match Notes",
                TextColor = Color.Black,
                FontSize  = GlobalVariables.sizeMedium,
            };

            Editor matchNotesEditor = new Editor()
            {
                HeightRequest   = 200,
                BackgroundColor = Color.Silver
            };

            try{
                if (teamData["matchNotes"] != null)
                {
                    matchNotesEditor.Text = data ["matchNotes"].ToString();
                }
            } catch {
            }

            data = teamData;

            Button updateBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Update Button",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            updateBtn.Clicked += (object sender, EventArgs e) => {
                if (new CheckInternetConnectivity().InternetStatus())
                {
                    // UpdateBtn
                    errorHandling("driveType", driveTypePicker.Title);
                    errorHandling("lowBarAccess", lowBarPicker.Title);
                    errorHandling("intakePos", intakePicker.Title);
                    errorHandling("autoStrategy", autoStrategyEditor.Text.ToString());
                    errorHandling("teleOpStrategy", teleOpStrategyEditor.Text.ToString());
                    errorHandling("notes", notesEditor.Text.ToString());
                    errorHandling("matchNotes", matchNotesEditor.Text.ToString());

                    // DisplayAlert if save did not go through
                    if (error == true)
                    {
                        errorString.Remove(errorString.Length - 2);
                        DisplayAlert("Error", errorString, "OK");
                        errorString = errorStringDefault;
                        error       = false;
                    }
                    else
                    {
                        Navigation.PopModalAsync();
                    }
                }
            };

            Button refreshBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Refresh",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            refreshBtn.Clicked += (object sender, EventArgs e) => {
                //Change this
                if (new CheckInternetConnectivity().InternetStatus())
                {
                    Navigation.PushModalAsync(new PitScoutingEditPage(data));
                }
            };

            //Back Button
            Button backBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Back",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            backBtn.Clicked += (object sender, EventArgs e) => {
                Navigation.PopModalAsync();
            };

            StackLayout info = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.Gray,
                Padding           = 3,


                Children =
                {
                    driveTypeLabel,
                    driveTypePicker,
                    lowBarLabel,
                    lowBarPicker,
                    intakeLabel,
                    intakePicker,
                    autoStrategyLabel,
                    autoStrategyEditor,
                    teleOpStrategyLabel,
                    teleOpStrategyEditor,
                    notesLabel,
                    notesEditor,
                    matchNotesLabel,
                    matchNotesEditor
                }
            };


            ScrollView infoScroll = new ScrollView()
            {
                Content = info
            };

            StackLayout navigationBtns = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Color.Green,
                Padding           = 5,

                Children =
                {
                    backBtn,
                    refreshBtn,
                    updateBtn
                }
            };

            topGrid.Children.Add(robotImage, 0, 1, 0, 2);
            topGrid.Children.Add(teamNumber, 1, 2, 0, 1);
            topGrid.Children.Add(teamName, 1, 2, 1, 2);
            grid.Children.Add(infoScroll, 0, 1);
            grid.Children.Add(topGrid, 0, 0);
            grid.Children.Add(navigationBtns, 0, 2);

            this.Content = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,

                Children =
                {
                    grid
                }
            };
        }
 /// <summary>
 /// Is a FATX drive
 /// </summary>
 /// <param name="xDrive"></param>
 /// <param name="xType"></param>
 /// <returns></returns>
 public static bool IsFATX(ref Drive xDrive, out DriveTypes xType)
 {
     xType = DriveTypes.Unknown;
     if (xDrive == null)
         return false;
     xDrive.MakeHandle();
     DJsIO xIO = new DriveIO(xDrive, true);
     return IsFATX(ref xIO, out xType);
 }
        /// <summary>
        /// Determins if a Drive is FATX format
        /// </summary>
        /// <param name="xIO">Stream to check</param>
        /// <param name="xType">Grabs the type of drive</param>
        /// <returns></returns>
        public static bool IsFATX(ref DJsIO xIO, out DriveTypes xType)
        {
            // Tries to read the offsets of Xbox 360 drives to see if the magic's match
            xType = DriveTypes.Unknown;

            try
            {
                if (xIO.IOType != DataType.Drive || ((DriveIO)xIO).xDrive.Type != DeviceType.LogicalDrive)
                    throw new Exception();
                string dat0 = ((DriveIO)xIO).xDrive.DeviceName + @"\Xbox360\Data0000";
                if (!File.Exists(dat0))
                    throw new Exception();

                var fa = File.GetAttributes(dat0);
                if ((fa & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    return false;
                }
                DJsIO xio = new DJsIO(dat0, DJFileMode.Open, true);
                if (!xio.Accessed)
                    throw new Exception();
                xio.Position = (long)USB.Partition1;
                try
                {
                    if (xio.ReadUInt32() == (uint)AllMagic.FATX)
                    {
                        xType = DriveTypes.USBFlashDrive;
                        xio.Dispose();
                        return true;
                    }
                }
                catch { }
                xio.Dispose();
            }
            catch { }

            try
            {
                xIO.Position = (long)MU.Partition2;
                if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
                {
                    xType = DriveTypes.MemoryUnit;
                    return true;
                }
            }
            catch { }
            try
            {
                xIO.Position = (long)HDD.Partition5;
                if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
                {
                    xType = DriveTypes.HardDrive;
                    return true;
                }
            }
            catch { }
            try
            {
                xIO.Position = 8;
                xIO.Position = (xIO.ReadUInt32() * 0x200);
                if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
                {
                    xType = DriveTypes.DevHardDrive;
                    return true;
                }
            }
            catch { }
            return false;
        }
Esempio n. 22
0
 public override void SetAttributes(ComputerTypes computerTypes, RamTypes ramTypes, DriveTypes driveTypes)
 {
     this.CType = ComputerTypes.Server;
     this.RType = RamTypes.ddr5;
     this.DType = DriveTypes.shdd;
 }
 /// <summary>
 /// Sets a FATX Drive from an index
 /// </summary>
 /// <param name="DeviceIn"></param>
 public FATXDrive(DeviceReturn DeviceIn)
 {
     Drive xdrive = new Drive(DeviceIn.index, DeviceIn.type);
     if (!xdrive.Accessed)
         throw new Exception("Invalid input");
     //if (!FATXManagement.IsFATX(ref xdrive, out xType))
     //   throw new Exception("Drive is not FATX");
     xType = DriveTypes.USBFlashDrive;
     xactive = true;
     xDrive = xdrive;
     LoadPartitions();
 }
Esempio n. 24
0
 public IEnumerable <FSItemModel> GetDrives(DriveTypes driveTypes)
 => _driveService.GetDrives(driveTypes).Select(GetFSItemModel);
Esempio n. 25
0
 public IEnumerable <string> GetDrives(DriveTypes driveTypes) => Directory.GetLogicalDrives()
 .Where(drive => driveTypes.HasFlag(_mapper.Map <DriveTypes>(GetDriveType(drive))));
Esempio n. 26
0
 public abstract void SetAttributes(ComputerTypes computerTypes, RamTypes ramTypes, DriveTypes driveTypes);