Пример #1
0
        private void SetPathTableRecord(uint extentLocation, ushort parentNumber, byte[] identifier)
        {
            if (Record == null)
            {
                Record = new PathTableRecord();
            }

            Record.Length = (byte)identifier.Length;

            if (identifier.Length > 255)
            {
                throw new Exception("Depasire!");
            }

            Record.Identifier = identifier;

            Record.ExtentLocation = extentLocation;
            Record.ParentNumber   = parentNumber;

            if (m_volumeDescriptorType == VolumeType.Suplementary && (identifier.Length > 1 || identifier[0] != 0))
            {
                m_volumeDescriptorType = VolumeType.Primary;
                VolumeDescriptorType   = VolumeType.Suplementary;
            }
        }
        /// <summary>
        /// Applies the configured observation extents.
        /// </summary>
        protected virtual void ConfigureObserverVolume()
        {
            if (meshSubsystem == null ||
                (oldObserverOrigin == ObserverOrigin &&
                 oldObservationExtents == ObservationExtents &&
                 oldObserverVolumeType == ObserverVolumeType))
            {
                return;
            }

            using (ConfigureObserverVolumePerfMarker.Auto())
            {
                // Update the observer
                switch (ObserverVolumeType)
                {
                case VolumeType.AxisAlignedCube:
                    meshSubsystem.SetBoundingVolume(ObserverOrigin, ObservationExtents);
                    break;

                default:
                    Debug.LogError($"Unsupported ObserverVolumeType value {ObserverVolumeType}");
                    break;
                }

                oldObserverOrigin     = ObserverOrigin;
                oldObservationExtents = ObservationExtents;
                oldObserverVolumeType = ObserverVolumeType;
            }
        }
Пример #3
0
 public Camry(CarModels carmodel, int price, TransmissionType transmission, VolumeType volume) : base(carmodel, price, transmission, volume)
 {
     Transmission = transmission;
     Volume       = volume;
     Price        = price;
     CarModel     = carmodel;
 }
 public VolumeInfo(string name, VolumeType type, int priority, int weight)
 {
     this.name     = name;
     this.type     = type;
     this.priority = priority;
     this.weight   = weight;
 }
Пример #5
0
 public Response(string text, int channel = 0, VolumeType volume = VolumeType.Say, int delay = 500)
 {
     Channel = channel;
     Volume = volume;
     Text = text;
     Delay = delay;
 }
Пример #6
0
        private void SetVolume(VolumeType type)
        {
            Dictionary <IMediaPlayer, int> attached;

            lock (attachedPlayers)
                attached = new Dictionary <IMediaPlayer, int> (attachedPlayers);

            foreach (var kvp in attached)
            {
                int volume;
                if (type == VolumeType.Talking)
                {
                    volume = TalkingVolume;
                    if (UseCurrentPlayerVolume)
                    {
                        lock (attachedPlayers)
                            attachedPlayers[kvp.Key] = kvp.Key.Volume;
                    }
                }
                else
                {
                    volume = (!UseCurrentPlayerVolume) ? NormalVolume : kvp.Value;
                }

                try
                {
                    kvp.Key.Volume = volume;
                }
                catch
                {
                    lock (attachedPlayers)
                        attachedPlayers.Remove(kvp.Key);
                }
            }
        }
Пример #7
0
        public void SetVolume(VolumeType type, float value)
        {
            string name = string.Empty;

            value = Mathf.Clamp(value, 0, 1);
            switch (type)
            {
            case VolumeType.Master:
                name = "Master";
                Settings.VolumeMaster = value;
                break;

            case VolumeType.Music:
                name = "Music";
                Settings.VolumeMusic = value;
                break;

            case VolumeType.SFX:
                name = "SFX";
                Settings.VolumeSfx = value;
                break;

            case VolumeType.Range:
                name = "Range";
                Settings.VolumeRange = value;
                break;
            }

            var level = Mathf.Lerp(-80, 24, value);

            AudioServer.SetBusVolumeDb(AudioServer.GetBusIndex(name), level);
        }
Пример #8
0
        public void updateCheckboxAndTextbox(out VolumeType type, CheckBox chk1, CheckBox chk2, TextBox txt1, TextBox txt2,
                                             Label lbl1, Label lbl2, ClearVolumeError_delegate clear1, ClearRelativeVolumeProportionError_delegate clear2, bool is1Rel)
        {
            if (chk2.Checked)
            {
                type = is1Rel ? VolumeType.Absolute : VolumeType.Relative;
                if (chk1.Checked)
                {
                    chk1.Checked = false;
                }
                clear1();
                clear2();
            }
            else if (chk1.Checked)
            {
                type = is1Rel ? VolumeType.Relative : VolumeType.Absolute;
            }
            else
            {
                type = VolumeType.NotSpecified;
            }

            // toggle checkboxes and labels
            txt2.Visible = chk2.Checked;
            lbl2.Visible = chk2.Checked;
            txt2.Enabled = chk2.Checked;

            txt1.Visible = !chk2.Checked;
            lbl1.Visible = !chk2.Checked;
            txt1.Enabled = chk2.Checked;

            ReportCommandDetailChanged();
        }
Пример #9
0
    public void ToggleMute(VolumeType volumeType)
    {
        if (volumeType == VolumeType.Master)
        {
            _masterIsMuted    = !_masterIsMuted;
            _masterMuteVolume = _masterIsMuted ? 0f : 1f;

            UpdateBGMVolume();
            UpdateSFXVolume();
        }
        else if (volumeType == VolumeType.Music)
        {
            _bgmIsMuted    = !_bgmIsMuted;
            _bgmMuteVolume = _bgmIsMuted ? 0f : 1f;

            UpdateBGMVolume();
        }
        else
        {
            _sfxIsMuted    = !_sfxIsMuted;
            _sfxMuteVolume = _sfxIsMuted ? 0f : 1f;

            UpdateSFXVolume();
        }
    }
 internal SoundSceneryDatumStructBlockBase(BinaryReader binaryReader)
 {
     this.volumeType              = (VolumeType)binaryReader.ReadInt32();
     this.height                  = binaryReader.ReadSingle();
     this.overrideDistanceBounds  = binaryReader.ReadRange();
     this.overrideConeAngleBounds = binaryReader.ReadRange();
     this.overrideOuterConeGainDB = binaryReader.ReadSingle();
 }
 public AudioSliderOption(VolumeType type)
     : base(GetLabel(type), () => GetVolume(type), value => SetVolume(type, value), 0, 100)
 {
     _type          = type;
     _minLabel.Text = "0%";
     _maxLabel.Text = "100%";
     ValueChanged(_slider.GetValue());
 }
Пример #12
0
 public CarBase(int basePrice, CarModel carModel, TransmissionType transmission, VolumeType volume)
 {
     BasePrice    = basePrice;
     CarModel     = carModel;
     Transmission = transmission;
     Volume       = volume;
     Prices       = new Dictionary <string, int>();
 }
Пример #13
0
        /// <summary>
        /// Sets the type of this project to the given type and modifies the project's data
        /// accordingly to ensure the project is valid.
        ///
        /// For example, changing the type to a pkg_ps4_app will create PlayGo data;
        /// changing the type to an AC pkg will create an Entitlement key.
        /// </summary>
        /// <param name="type">The new volume type for the project</param>
        public void SetType(VolumeType type)
        {
            if (volume.volume_type != null && type == volume.Type)
            {
                return;
            }
            switch (type)
            {
            case VolumeType.pkg_ps4_app:
                volume.Package.EntitlementKey = null;
                volume.Package.StorageType    = "digital50";
                volume.Package.AppType        = "full";
                volume.chunk_info             = new ChunkInfo
                {
                    chunks = new List <Chunk>
                    {
                        new Chunk
                        {
                            id       = 0,
                            layer_no = 0,
                            label    = "Chunk #0",
                        }
                    },
                    chunk_count = 1,
                    scenarios   = new Scenarios
                    {
                        default_id = 0,
                        scenarios  = new List <Scenario>
                        {
                            new Scenario
                            {
                                id   = 0,
                                type = "sp",
                                initial_chunk_count = 1,
                                label  = "Scenario #0",
                                chunks = "0",
                            }
                        }
                    },
                    scenario_count = 1
                };
                break;

            case VolumeType.pkg_ps4_ac_data:
                volume.Package.EntitlementKey = "00000000000000000000000000000000";
                volume.Package.StorageType    = null;
                volume.Package.AppType        = null;
                volume.chunk_info             = null;
                break;

            case VolumeType.pkg_ps4_ac_nodata:
                goto case VolumeType.pkg_ps4_ac_data;

            default:
                throw new Exception("Sorry, don't know how to make that project type!");
            }
            volume.Type = type;
        }
 protected override Image GetDriveIcon(DriveInfo drive, char driveChar, VolumeType volumeType, ref Size size)
 {
     Image iconFromCache = this.GetIconFromCache(this.VolumeTypeMap[volumeType], ref size);
     if (iconFromCache == null)
     {
         return base.GetDriveIcon(drive, driveChar, volumeType, ref size);
     }
     return iconFromCache;
 }
Пример #15
0
        public void RemoveVolume(VolumeType type)
        {
            if (volumes.ContainsKey(type))
            {
                throw new ArgumentException(string.Format("collection does not contain a volume of type {0}!", type.ToString()));
            }

            volumes.Remove(type);
        }
Пример #16
0
        public void showVolumeType()
        {
            netClient.Core.APIClient.Instance.InitWebClient();
            netClient.Core.APIClient.Instance.Authenticate(servicesOAuthToken);
            VolumeType vt = VolumeType.show(cloudStackID, cloudStackVTID);

            Assert.IsNotNull(vt);
            netClient.Core.APIClient.Instance.InitWebClient(); //reclean auth on the instance
        }
Пример #17
0
 //新規のもその音量にする
 public void SetSEVolume(VolumeType volumeType)
 {
     for (int i = 0; i < seSources.Count; i++)
     {
         seSources[i].volume = (int)volumeType * 0.01f;
         Debug.Log("volume = " + (int)volumeType * 0.01f);
     }
     SEVolume = (int)volumeType * 0.01f;
 }
Пример #18
0
        public void indexVolumeTypeView()
        {
            netClient.Core.APIClient.Instance.InitWebClient();
            netClient.Core.APIClient.Instance.Authenticate(servicesOAuthToken);
            List <VolumeType> volTypes = VolumeType.index(cloudStackID, "default");

            Assert.IsNotNull(volTypes);
            Assert.IsTrue(volTypes.Count > 0);
            netClient.Core.APIClient.Instance.InitWebClient(); //reclean auth on the instance
        }
Пример #19
0
        public void indexVolumeTypeRaxOpen()
        {
            netClient.Core.APIClient.Instance.InitWebClient();
            netClient.Core.APIClient.Instance.Authenticate(servicesOAuthToken);
            List <VolumeType> volTypes = VolumeType.index(raxCloudID);

            Assert.IsNotNull(volTypes);
            Assert.IsTrue(volTypes.Count > 0);
            netClient.Core.APIClient.Instance.InitWebClient(); //reclean auth on the instance
        }
 public static double ConvertUnits(int units, VolumeType from, VolumeType to)
 {
     double[][] factor =
     {
         new double[] {   1, 2,  0.25 },
         new double[] { 0.5, 1, 0.125 },
         new double[] {   4, 8,     1 }
     };
     return(units * factor[(int)from][(int)to]);
 }
Пример #21
0
        public void SetVolumeCommandPanelParams2(AbsoluteResourceLocation SourceVial, AbsoluteResourceLocation DestinationVial,
                                                 VolumeType VolumeTypeSpecifier, double RelativeVolumeProportion, int AbsoluteVolume_uL)
        {
            this.SourceVial2          = SourceVial;
            this.DestinationVial2     = DestinationVial;
            this.VolumeTypeSpecifier2 = VolumeTypeSpecifier;


            this.RelativeVolumeProportion2 = RelativeVolumeProportion;
            this.AbsoluteVolume_uL2        = AbsoluteVolume_uL;
        }
 private static int GetVolume(VolumeType type)
 {
     return(type switch
     {
         VolumeType.Master => Globals.Config.MasterVolume,
         VolumeType.SoundEffects => Globals.Config.EffectsVolume,
         VolumeType.Dialog => Globals.Config.VoiceVolume,
         VolumeType.Music => Globals.Config.MusicVolume,
         VolumeType.Positional => Globals.Config.ThreeDVolume,
         _ => throw new ArgumentOutOfRangeException()
     });
Пример #23
0
	void VolumeRelay (VolumeType v)
	{
		switch (v) {
		case VolumeType.Music:
			am.MusicVolume = sliderVolume;
			break;
		case VolumeType.SFX:
			am.SFXVolume = sliderVolume;
			break;
		}
	}
Пример #24
0
 public static float GetVolume(VolumeType volumeType)
 {
     if (volumeList.ContainsKey(volumeType))
     {
         return(volumeList[volumeType]);
     }
     else
     {
         return(0.5f);
     }
 }
Пример #25
0
        public static SoundEffectInstance GetSound(SoundType soundType)
        {
            SoundEffectInstance instance = soundEffects.GetSound(soundType);

            if (instance != null)
            {
                VolumeType volumeType = soundEffects.GetVolumeType(soundType);
                instance.Volume = volumeList[volumeType] * volumeList[VolumeType.Master];
            }
            return(instance);
        }
Пример #26
0
 /// <summary>
 /// Returns volume of given type, scaled by Master if applicable. Use for most cases.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static float getVolume(VolumeType type)
 {
     if (type == VolumeType.Master)
     {
         return(storedPrefs.volumes[0]);
     }
     else
     {
         return(storedPrefs.volumes[(int)type] * storedPrefs.volumes[0]);
     }
 }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            ExecuteClientAction(() =>
            {
                VirtualMachine virtualMachineResponse = (this.ComputeClient.ComputeManagementClient.VirtualMachines.Get(this.ResourceGroupName, this.VMName));

                if ((virtualMachineResponse == null) ||
                    (virtualMachineResponse.StorageProfile == null) ||
                    (virtualMachineResponse.StorageProfile.OsDisk == null))
                {
                    // VM should have been created and have valid storageProfile and OSDisk by now
                    ThrowTerminatingError(
                        new ErrorRecord(
                            new ApplicationException(
                                string.Format(
                                    CultureInfo.CurrentUICulture,
                                    "Disable-AzureDiskEncryption can disable encryption only on a VM that was already created and has appropriate storageProfile and OS disk")),
                            "InvalidResult",
                            ErrorCategory.InvalidResult,
                            null));
                }

                currentOSType = virtualMachineResponse.StorageProfile.OsDisk.OsType;

                if (this.ShouldProcess(VMName, Properties.Resources.DisableDiskEncryptionAction) &&
                    (this.Force.IsPresent ||
                     this.ShouldContinue(Properties.Resources.DisableAzureDiskEncryptionConfirmation, Properties.Resources.DisableAzureDiskEncryptionCaption)))
                {
                    VirtualMachineExtension parameters = GetVmExtensionParameters(virtualMachineResponse);

                    var opExt = this.VirtualMachineExtensionClient.CreateOrUpdateWithHttpMessagesAsync(
                        this.ResourceGroupName,
                        this.VMName,
                        this.Name,
                        parameters).GetAwaiter().GetResult();

                    if (string.IsNullOrWhiteSpace(VolumeType) ||
                        VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeAll, StringComparison.InvariantCultureIgnoreCase) ||
                        VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeOS, StringComparison.InvariantCultureIgnoreCase))
                    {
                        var opVm   = UpdateVmEncryptionSettings();
                        var result = Mapper.Map <PSAzureOperationResponse>(opVm);
                        WriteObject(result);
                    }
                    else
                    {
                        var result = Mapper.Map <PSAzureOperationResponse>(opExt);
                        WriteObject(result);
                    }
                }
            });
        }
Пример #28
0
        /// <summary>
        /// Generic method for crating a GameObject with a AuraVolume component assigned
        /// </summary>
        /// <param name="name">Name of the created GameObject</param>
        /// <param name="shape">Desired volume shape</param>
        /// <returns>The created AuraVolume gameObject</returns>
        public static GameObject CreateGameObject(string name, VolumeType shape)
        {
            GameObject newGameObject = new GameObject(name);

            newGameObject.transform.localScale = Vector3.one * 3.0f;
            AuraVolume auraVolume = newGameObject.AddComponent <AuraVolume>();

            auraVolume.volumeShape.shape = shape;
            SetDefaultValues(auraVolume);

            return(newGameObject);
        }
Пример #29
0
 /// <summary>
 /// Writes the containings of each directory
 /// </summary>
 /// <param name="writer">A binary writer to write the data.</param>
 /// <param name="dirArray">An array of IsoDirectories to be written.</param>
 /// <param name="type">The type of writing to be performed:
 /// Primary - corresponding to the Primary Volume Descriptor (DOS Speciffic - 8 letter ASCII upper case names)
 /// Suplementary - corresponding to the Suplementary Volume Descriptor (Windows speciffic - 101 letter Unicode names)</param>
 private void WriteDirectories(BinaryWriter writer, IsoDirectory[] dirArray, VolumeType type)
 {
     if (dirArray == null)
     {
         return;
     }
     for (int i = 0; i < dirArray.Length; i++)
     {
         dirArray[i].Write(writer, type);
         this.OnProgress((int)(writer.BaseStream.Length / IsoAlgorithm.SectorSize));
     }
 }
Пример #30
0
        public void TestAttachServerVolume()
        {
            IComputeProvider provider = Bootstrapper.CreateComputeProvider();

            IBlockStorageProvider blockStorageProvider = Bootstrapper.CreateBlockStorageProvider();
            VolumeType            volumeType           = UserBlockStorageTests.GetSsdVolumeTypeOrDefault(blockStorageProvider);
            string volumeName = UserBlockStorageTests.UnitTestVolumePrefix + Path.GetRandomFileName();
            Volume volume     = blockStorageProvider.CreateVolume(UserBlockStorageTests.MinimumVolumeSize, displayName: volumeName, volumeType: volumeType != null ? volumeType.Id : null);

            Assert.AreEqual(VolumeState.Available, blockStorageProvider.WaitForVolumeAvailable(volume.Id).Status);

            /* AttachServerVolume
             */
            ServerVolume serverVolume = provider.AttachServerVolume(_server.Id, volume.Id);

            Assert.IsNotNull(serverVolume);
            Assert.IsFalse(string.IsNullOrEmpty(serverVolume.Id));
            Assert.AreEqual(_server.Id, serverVolume.ServerId);
            Assert.AreEqual(volume.Id, serverVolume.VolumeId);

            Assert.AreEqual(VolumeState.InUse, blockStorageProvider.WaitForVolumeState(volume.Id, VolumeState.InUse, new[] { VolumeState.Available, VolumeState.Error }).Status);

            /* ListServerVolumes
             */
            ServerVolume[] serverVolumes = provider.ListServerVolumes(_server.Id).ToArray();
            Assert.IsNotNull(serverVolumes);
            Assert.AreEqual(1, serverVolumes.Length);
            Assert.AreEqual(serverVolume.Id, serverVolumes[0].Id);
            Assert.AreEqual(serverVolume.ServerId, serverVolumes[0].ServerId);
            Assert.AreEqual(serverVolume.VolumeId, serverVolumes[0].VolumeId);

            /* GetServerVolumeDetails
             */
            ServerVolume volumeDetails = provider.GetServerVolumeDetails(_server.Id, volume.Id);

            Assert.IsNotNull(volumeDetails);
            Assert.AreEqual(serverVolume.Id, volumeDetails.Id);
            Assert.AreEqual(serverVolume.ServerId, volumeDetails.ServerId);
            Assert.AreEqual(serverVolume.VolumeId, volumeDetails.VolumeId);

            bool detach = provider.DetachServerVolume(_server.Id, volume.Id);

            Assert.IsTrue(detach);
            provider.WaitForServerActive(_server.Id);
            ServerVolume[] remainingVolumes = provider.ListServerVolumes(_server.Id).ToArray();
            Assert.AreEqual(0, remainingVolumes.Length);

            Assert.AreEqual(VolumeState.Available, blockStorageProvider.WaitForVolumeAvailable(volume.Id).Status);
            bool deleted = blockStorageProvider.DeleteVolume(volume.Id);

            Assert.IsTrue(blockStorageProvider.WaitForVolumeDeleted(volume.Id));
        }
Пример #31
0
 /// <summary>
 /// Initializes a new instance of the Volume class.
 /// </summary>
 /// <param name="sizeInBytes">The size of the volume in bytes.</param>
 /// <param name="volumeType">The type of the volume. Possible values
 /// include: 'Tiered', 'Archival', 'LocallyPinned'</param>
 /// <param name="accessControlRecordIds">The IDs of the access control
 /// records, associated with the volume.</param>
 /// <param name="volumeStatus">The volume status. Possible values
 /// include: 'Online', 'Offline'</param>
 /// <param name="monitoringStatus">The monitoring status of the volume.
 /// Possible values include: 'Enabled', 'Disabled'</param>
 /// <param name="id">The path ID that uniquely identifies the
 /// object.</param>
 /// <param name="name">The name of the object.</param>
 /// <param name="type">The hierarchical type of the object.</param>
 /// <param name="kind">The Kind of the object. Currently only
 /// Series8000 is supported. Possible values include:
 /// 'Series8000'</param>
 /// <param name="volumeContainerId">The ID of the volume container, in
 /// which this volume is created.</param>
 /// <param name="operationStatus">The operation status on the volume.
 /// Possible values include: 'None', 'Updating', 'Deleting',
 /// 'Restoring'</param>
 /// <param name="backupStatus">The backup status of the volume.
 /// Possible values include: 'Enabled', 'Disabled'</param>
 /// <param name="backupPolicyIds">The IDs of the backup policies, in
 /// which this volume is part of.</param>
 public Volume(long sizeInBytes, VolumeType volumeType, IList <string> accessControlRecordIds, VolumeStatus volumeStatus, MonitoringStatus monitoringStatus, string id = default(string), string name = default(string), string type = default(string), Kind?kind = default(Kind?), string volumeContainerId = default(string), OperationStatus?operationStatus = default(OperationStatus?), BackupStatus?backupStatus = default(BackupStatus?), IList <string> backupPolicyIds = default(IList <string>))
     : base(id, name, type, kind)
 {
     SizeInBytes            = sizeInBytes;
     VolumeType             = volumeType;
     VolumeContainerId      = volumeContainerId;
     AccessControlRecordIds = accessControlRecordIds;
     VolumeStatus           = volumeStatus;
     OperationStatus        = operationStatus;
     BackupStatus           = backupStatus;
     MonitoringStatus       = monitoringStatus;
     BackupPolicyIds        = backupPolicyIds;
 }
Пример #32
0
        public void VolumeTypeShowCloudStack()
        {
            netClient.Core.APIClient.Instance.InitWebClient();
            netClient.Core.APIClient.Instance.Authenticate(servicesOAuthToken);
            VolumeType vt = VolumeType.show(cloudStackID, cloudStackVTID);

            Assert.IsNotNull(vt);
            Cloud cl = vt.cloud;

            Assert.IsNotNull(cl);
            Assert.IsTrue(cl.name.Length > 0);
            netClient.Core.APIClient.Instance.InitWebClient(); //reclean auth on the instance
        }
Пример #33
0
        public int WritePathTable(BinaryWriter writer, bool isRoot, Endian endian, VolumeType type)
        {
            UInt32 extent = (type == VolumeType.Primary) ? Extent1 : Extent2;
            string name   = (type == VolumeType.Primary) ? ShortName : LongName;

            var pathTableRecord = new PathTableRecordWrapper(extent, Parent.Number, isRoot ? "." : name)
            {
                VolumeDescriptorType = type,
                Endian = endian
            };

            return(pathTableRecord.Write(writer));
        }
Пример #34
0
        public ItemView()
        {
            itemIcons = new ItemIcons(this);
            loadingIcon = this.RenderIcon(Icons.Icon.Stock_Find, ICON_SIZE);

            HeadersClickable = true;

            database = null;
            currentVolumeType = (VolumeType)(-1);
            item_col = -1;

            // event handlers
            RowExpanded			+= OnRowExpanded;
            ButtonPressEvent	+= OnButtonPressEvent;
        }
Пример #35
0
		public VolumeRecord(byte[] buffer, int offset)
		{
			byte[] temp = new byte[2];
			BootIndicator = (VolumeStatus)buffer[offset];
			StartingHead = buffer[offset + 1];
			StartingSector = (byte)((buffer[offset + 2] & (byte)0xFC) >> 2);
			// not sure if this stuff is right, but not really used atm.
			temp[0] = (byte)((byte)((byte)buffer[offset + 2] & (byte)0x03) << 6);
			temp[1] = buffer[offset + 3];
			StartingCylinder = (ushort)(BitConverter.ToUInt16(temp, 0) >> 6);
			VolumeType = (VolumeType)buffer[offset + 4];
			EndingHead = buffer[offset + 5];
			EndingSector = (byte)((buffer[offset + 6] & (byte)0xFC) >> 2);
			temp[0] = (byte)((byte)((byte)buffer[offset + 6] & (byte)0x03) << 6);
			temp[1] = buffer[offset + 7];
			EndingCylinder = (ushort)(BitConverter.ToUInt16(temp, 0) >> 6);
			FirstSector = BitConverter.ToUInt32(buffer, offset + 8);
			TotalSectors = BitConverter.ToUInt32(buffer, offset + 12);
		}
Пример #36
0
        internal Volume(VolumeDatabase database, VolumeType volumeType)
            : base(tableName, primarykeyFields)
        {
            this.volumeID		= 0L;
            this.title			= null;
            this.added			= DateTime.MinValue;
            this.isHashed		= false;

            this.archiveNo		= null;
            this.driveType		= VolumeDriveType.Unknown;
            this.loanedTo		= null;
            this.loanedDate		= DateTime.MinValue;
            this.returnDate		= DateTime.MinValue;
            this.category		= null;
            this.description	= null;
            this.keywords		= null;
            //this.clientAppData  = null;

            this.database		= database;

            this.volumeType		= volumeType;
        }
 protected override Image GetVolumeIcon(VolumeType volumeType, char driveChar, ref Size size)
 {
     Image iconFromCache = this.GetIconFromCache(this.VolumeTypeMap[volumeType], ref size);
     if (iconFromCache == null)
     {
         iconFromCache = base.GetVolumeIcon(volumeType, driveChar, ref size);
     }
     return iconFromCache;
 }
Пример #38
0
        private void InitView(VolumeType volType, out TreeModel model)
        {
            currentVolumeType = volType;
            TreeViewColumn col;

            switch (volType) {
                case VolumeType.FileSystemVolume:
                    HeadersVisible = false;

                    CellRendererPixbuf pix = new CellRendererPixbuf();
                    CellRendererText txt = new CellRendererText();

                    col = new TreeViewColumn();
                    col.PackStart(pix, false);
                    col.PackStart(txt, false);
                    col.SetAttributes(pix, "pixbuf", 0);
                    col.SetAttributes(txt, "text", 1);
                    col.SetCellDataFunc(txt, CellDataFunc);
                    AppendColumn(col);

                    // set up store
                    model = new TreeStore(typeof(Gdk.Pixbuf),
                                      typeof(string),
                                      /* VolumeItem - not visible */
                                      typeof(FileSystemVolumeItem));

                    item_col = 2;
                    break;
                case VolumeType.AudioCdVolume:
                    HeadersVisible = true;

                    col = new TreeViewColumn(string.Empty, new CellRendererPixbuf(), "pixbuf", 0);
                    col.Resizable = false;
                    col.Expand = false;
                    AppendColumn(col);

                    var tmp = new CellRendererText();
                    col = new TreeViewColumn(S._("Name"), tmp, "text", 1);
                    col.Resizable = true;
                    col.Expand = true;
                    col.SetCellDataFunc(tmp, CellDataFunc);
                    AppendColumn(col);

                    col = new TreeViewColumn(S._("Artist"), new CellRendererText(), "text", 2);
                    col.Resizable = true;
                    col.Expand = true;
                    AppendColumn(col);

                    col = new TreeViewColumn(S._("Duration"), new CellRendererText(), "text", 3);
                    col.Resizable = true;
                    col.Expand = false;
                    AppendColumn(col);

                    // set up store
                    model = new ListStore(typeof(Gdk.Pixbuf),
                                      typeof(string),
                                      typeof(string),
                                      typeof(string),
                                      /* VolumeItem - not visible */
                                      typeof(AudioTrackVolumeItem));

                    item_col = 4;
                    break;
                default:
                    throw new NotImplementedException("View initialization has not been implemented for this volumetype");
            }
        }
Пример #39
0
		/// <summary>
		/// Writes the containings of each directory
		/// </summary>
		/// <param name="writer">A binary writer to write the data.</param>
		/// <param name="dirArray">An array of IsoDirectories to be written.</param>
		/// <param name="type">The type of writing to be performed:
		/// Primary - corresponding to the Primary Volume Descriptor (DOS Speciffic - 8 letter ASCII upper case names)
		/// Suplementary - corresponding to the Suplementary Volume Descriptor (Windows speciffic - 101 letter Unicode names)</param>
		private void WriteDirectories( BinaryWriter writer, IsoDirectory[] dirArray, VolumeType type ) {
			if ( dirArray == null ) {
				return;
			}
			for ( int i=0; i<dirArray.Length; i++ ) {
				dirArray[i].Write(writer, type);
				this.OnProgress( (int)(writer.BaseStream.Length/IsoAlgorithm.SectorSize) );
			}
		}
Пример #40
0
		/// <summary>
		/// Writes a path table corresponding to a given directory structure.
		/// The order of the directories is as following (ISO 9660 standard):
		/// 1. If two directories are on different levels, then the one on the lowest level comes first;
		/// 2. If the directories are on the same level, but have different parents, then they are ordered in the same order as their parents.
		/// 3. If the directories have the same parent, then they are sorted according to their name (lexicographic).
		/// </summary>
		/// <param name="writer">A binary writer to write the data.</param>
		/// <param name="dirArray">An array of IsoDirectories representing the directory structure.</param>
		/// <param name="endian">The byte order of numbers (little endian or big endian).</param>
		/// <param name="type">The type of writing to be performed:
		/// Primary - corresponding to the Primary Volume Descriptor (DOS Speciffic - 8 letter ASCII upper case names)
		/// Suplementary - corresponding to the Suplementary Volume Descriptor (Windows speciffic - 101 letter Unicode names)</param>
		/// <returns>An integer representing the total number of bytes written.</returns>
		private int WritePathTable( BinaryWriter writer, IsoDirectory[] dirArray, Endian endian, VolumeType type ) {
			if ( dirArray == null ) {
				return 0;
			}

			int bytesWritten = 0;
			for ( int i=0; i<dirArray.Length; i++ ) {
				// The directory list is sorted according to the ISO 9660 standard, so the first one (0) should be the root.
				bytesWritten += dirArray[i].WritePathTable( writer, ( i==0 ), endian, type );
			}

			// A directory must ocupy a number of bytes multiple of 2048 (the sector size).
			writer.Write( new byte[IsoAlgorithm.SectorSize - ( bytesWritten%IsoAlgorithm.SectorSize )] );

			return bytesWritten;
		}
        protected virtual Image GetVolumeIcon(VolumeType volumeType, char driveChar, ref Size size)
        {
            int iconIndex = 0;
            SHSTOCKICONID siid = SHSTOCKICONID.SIID_DRIVEUNKNOWN;
            switch (volumeType)
            {
                case VolumeType.Removable:
                    if ((driveChar != 'A') && (driveChar != 'B'))
                    {
                        iconIndex = 7;
                        siid = SHSTOCKICONID.SIID_DRIVEREMOVE;
                        break;
                    }
                    iconIndex = 6;
                    siid = SHSTOCKICONID.SIID_DRIVE35;
                    break;

                case VolumeType.Fixed:
                    iconIndex = 8;
                    siid = SHSTOCKICONID.SIID_DRIVEFIXED;
                    break;

                case VolumeType.Network:
                    iconIndex = 9;
                    siid = SHSTOCKICONID.SIID_DRIVENET;
                    break;

                case VolumeType.CDRom:
                    iconIndex = 11;
                    siid = SHSTOCKICONID.SIID_DRIVECD;
                    break;

                case VolumeType.Ram:
                    iconIndex = 12;
                    siid = SHSTOCKICONID.SIID_DRIVERAM;
                    break;

                case VolumeType.DVDRom:
                    iconIndex = 0xb1;
                    siid = SHSTOCKICONID.SIID_DRIVEDVD;
                    break;

                case VolumeType.Floppy3:
                    iconIndex = 6;
                    siid = SHSTOCKICONID.SIID_DRIVE35;
                    break;

                case VolumeType.Floppy5:
                    iconIndex = 5;
                    siid = SHSTOCKICONID.SIID_DRIVE525;
                    break;

                case VolumeType.Flash:
                    iconIndex = OS.IsWinXP ? 0xbd : 7;
                    siid = SHSTOCKICONID.SIID_MEDIACOMPACTFLASH;
                    break;
            }
            if (OS.IsWinVista)
            {
                SHSTOCKICONINFO shstockiconinfo;
                shstockiconinfo = new SHSTOCKICONINFO {
                    cbSize = Marshal.SizeOf(shstockiconinfo)
                };
                if (HRESULT.SUCCEEDED(Shell32.SHGetStockIconInfo(siid, SHGSI.SHGSI_ICONLOCATION, ref shstockiconinfo)))
                {
                    return LoadIconFromLocation2(new IconLocation(shstockiconinfo.szPath, shstockiconinfo.iIcon), ref size);
                }
            }
            return LoadShellDllIcon(iconIndex, size);
        }
 protected virtual Image GetDriveIcon(DriveInfo drive, char driveChar, VolumeType volumeType, ref Size size)
 {
     Image image = null;
     IconLocation iconLocation = null;
     if (iconLocation == null)
     {
         iconLocation = LoadDefaultDriveIcon(Registry.LocalMachine, string.Format(@"Software\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\{0}\DefaultIcon", driveChar));
     }
     if (iconLocation == null)
     {
         iconLocation = LoadDefaultDriveIcon(Registry.CurrentUser, string.Format(@"Applications\Explorer.exe\Drives\{0}\DefaultIcon", driveChar));
     }
     if (iconLocation == null)
     {
         iconLocation = LoadDefaultDriveIcon(Registry.ClassesRoot, string.Format(@"Applications\Explorer.exe\Drives\{0}\DefaultIcon", driveChar));
     }
     if (iconLocation != null)
     {
         image = LoadIconFromLocation2(iconLocation, ref size);
     }
     if (image == null)
     {
         image = this.GetVolumeIcon(volumeType, driveChar, ref size);
     }
     return image;
 }
		private void SetDirectoryRecord( UInt64 extentLocation, UInt64 dataLength, BinaryDateRecord date, sbyte timeZone, byte fileFlags, byte[] fileIdentifier ) {
			if ( m_record == null ) {
				m_record = new DirectoryRecord();
			}

			m_record.ExtentLocation = extentLocation;
			m_record.DataLength = dataLength;

			m_record.Date = date;

			m_record.TimeZone = timeZone;
			m_record.FileFlags = fileFlags;

			m_record.LengthOfFileIdentifier = (byte)fileIdentifier.Length;
			m_record.FileIdentifier = fileIdentifier;

			m_record.Length = (byte)( m_record.LengthOfFileIdentifier+33 );
			if ( m_record.Length%2 == 1 ) {
				m_record.Length++;
			}

			if ( fileIdentifier.Length > 255 ||
				m_record.LengthOfFileIdentifier+33 > 255 ) {

				throw new Exception( "Depasire!" );
			}

			if ( m_volumeDescriptorType == VolumeType.Suplementary && 
				( ( fileFlags & 2 ) == 0 || 
				  fileIdentifier.Length != 1 || fileIdentifier[0] > 1 ) ) {

				m_volumeDescriptorType = VolumeType.Primary;
				this.VolumeDescriptorType = VolumeType.Suplementary;
			}
		}
        void OnGUI()
        {
            GUIStyle textBlock = new GUIStyle(GUI.skin.label);
            textBlock.wordWrap = true;
            textBlock.alignment = TextAnchor.MiddleCenter;

            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(20);
            EditorGUILayout.LabelField("To create a new world choose the world name, type, and seed and click create.", textBlock);
            GUILayout.Space(20);
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(15);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(10);
            GUILayout.Label("World Name:", GUILayout.Width(80));
            worldName = EditorGUILayout.TextField(worldName, EditorStyles.textField, GUILayout.Width(150));
            GUILayout.Space(10);
            GUILayout.Label("Seed:", GUILayout.Width(50));
            seed = EditorGUILayout.TextField(seed, EditorStyles.textField, GUILayout.Width(50));
            GUILayout.Space(10);
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(10);
            GUILayout.Label("World Type:", GUILayout.Width(80));
            type = (VolumeType)EditorGUILayout.EnumPopup(type, GUILayout.Width(150));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(40);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            if (GUILayout.Button("Create World", GUILayout.Width(120)))
            {
                OnCreateButton();
            }
            GUILayout.Space(40);
            if (GUILayout.Button("Cancel", GUILayout.Width(120)))
            {
                OnCancelButton();
            }
            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();
        }
Пример #45
0
 public VolumeSource( VolumeType volumeType )
 {
     mVolumeType = volumeType;
 }
		private void SetPathTableRecord( UInt32 extentLocation, UInt16 parentNumber, byte[] identifier ) {
			if ( m_record == null ) {
				m_record = new PathTableRecord();
			}

			m_record.Length = (byte)identifier.Length;

			if ( identifier.Length > 255 ) {
				throw new Exception( "Depasire!" );
			}

			m_record.Identifier = identifier;

			m_record.ExtentLocation = extentLocation;
			m_record.ParentNumber = parentNumber;

			if ( m_volumeDescriptorType == VolumeType.Suplementary && ( identifier.Length>1 || identifier[0]!=0 ) ) {
				m_volumeDescriptorType = VolumeType.Primary;
				this.VolumeDescriptorType = VolumeType.Suplementary;
			}
		}
Пример #47
0
        private void SetVolume(VolumeType type)
        {
            Dictionary<IMediaPlayer, int> attached;
            lock (attachedPlayers)
                attached = new Dictionary<IMediaPlayer, int> (attachedPlayers);

            foreach (var kvp in attached)
            {
                int volume;
                if (type == VolumeType.Talking)
                {
                    volume = TalkingVolume;
                    if (UseCurrentPlayerVolume)
                    {
                        lock (attachedPlayers)
                            attachedPlayers[kvp.Key] = kvp.Key.Volume;
                    }
                }
                else
                    volume = (!UseCurrentPlayerVolume) ? NormalVolume : kvp.Value;

                try
                {
                    kvp.Key.Volume = volume;
                }
                catch
                {
                    lock (attachedPlayers)
                        attachedPlayers.Remove (kvp.Key);
                }
            }
        }
Пример #48
0
 internal static Volume CreateInstance(VolumeType type, VolumeDatabase database)
 {
     Volume volume = null;
     switch (type) {
         case VolumeType.FileSystemVolume:
             volume = new FileSystemVolume(database);
             break;
         case VolumeType.AudioCdVolume:
             volume = new AudioCdVolume(database);
             break;
         default:
             throw new NotImplementedException(string.Format("Instanciation of type {0} is not implemented", type.ToString()));
     }
     return volume;
 }
Пример #49
0
 public SoundSceneryDatumStruct(BinaryReader binaryReader)
 {
     this.volumeType = (VolumeType)binaryReader.ReadInt32();
     this.height = binaryReader.ReadSingle();
     this.overrideDistanceBounds = binaryReader.ReadRange();
     this.overrideConeAngleBounds = binaryReader.ReadRange();
     this.overrideOuterConeGainDb = binaryReader.ReadSingle();
 }