/// <summary> /// Extracts an a VHD file /// </summary> /// <param name="fileEntry"> </param> /// <returns> </returns> public IEnumerable <FileEntry> Extract(FileEntry fileEntry, ExtractorOptions options, ResourceGovernor governor) { using var disk = new DiscUtils.Vhd.Disk(fileEntry.Content, Ownership.None); LogicalVolumeInfo[]? logicalVolumes = null; try { var manager = new VolumeManager(disk); logicalVolumes = manager.GetLogicalVolumes(); } catch (Exception e) { Logger.Debug("Error reading {0} disk at {1} ({2}:{3})", disk.GetType(), fileEntry.FullPath, e.GetType(), e.Message); } if (logicalVolumes != null) { foreach (var volume in logicalVolumes) { foreach (var entry in DiscCommon.DumpLogicalVolume(volume, fileEntry.FullPath, options, governor, Context, fileEntry)) { yield return(entry); } } } else { if (options.ExtractSelfOnFail) { yield return(fileEntry); } } }
public static void Main4(string[] args) { string label = "Zap!"; long capacity = 2L << 40; int blockSize = 4 << 20; using (var diskStream = File.Create("big.vhdx")) using (var disk = Disk.InitializeDynamic(diskStream, Ownership.Dispose, capacity, blockSize)) { var gpt = GuidPartitionTable.Initialize(disk); gpt.Create(gpt.FirstUsableSector, gpt.LastUsableSector, GuidPartitionTypes.WindowsBasicData, 0, null); var volume = VolumeManager.GetPhysicalVolumes(disk).First(); uint bytesPerSector = (uint)(volume.PhysicalGeometry?.BytesPerSector ?? 512); var clusterCount = 1 << 25;// uint.MaxValue - 16; var clusterSize = capacity / clusterCount; var clusterBits = (int)Math.Ceiling(Math.Log(clusterSize) / Math.Log(2)); if (clusterBits > 18) { clusterBits = 18; } //clusterBits = 20; using (var fs = ExFatFileSystem.Format(volume, new ExFatFormatOptions { SectorsPerCluster = (1u << clusterBits) / bytesPerSector }, label: label)) { } } }
public void pauseGame() { if (GameManager.getLevelName() == "EQUALS") { EnemyFormation enemiesOnScreen = FindObjectOfType <EnemyFormation>(); if (enemiesOnScreen != null) { EnemySpawner.decreaseSpawnedCount(); } } if (!isGamePaused()) { isPaused = true; MusicPlayer.setVolume(0); if (life > 0) { pauseMenuPanel.active = true; } pauseButton.active = false; playerSpawner.active = false; enemySpawner.active = false; if (goalDetector != null) { for (int i = 0; i < goalDetector.Length; i++) { goalDetector[i].active = false; } } if (getLevelName() == "ARCADE" || getLevelName() == "TIME_LAPSE") { bombSpawner.active = false; } } else if (isGamePaused()) { isPaused = false; if (!VolumeManager.getIsMuted()) { MusicPlayer.setVolume(0.5f); } if (life > 0) { pauseMenuPanel.active = false; } pauseButton.active = true; playerSpawner.active = true; enemySpawner.active = true; if (goalDetector != null) { for (int i = 0; i < goalDetector.Length; i++) { goalDetector[i].active = true; } } if (getLevelName() == "ARCADE") { bombSpawner.active = true; } } }
public void SwapVhdxGzip() { SetupHelper.SetupComplete(); using (FileStream fs = File.OpenRead(Path.Combine("..", "..", "..", "Swap", "Data", "swap.zip"))) using (Stream vhdx = ZipUtilities.ReadFileFromZip(fs)) using (var diskImage = new DiskImageFile(vhdx, Ownership.Dispose)) using (var disk = new Disk(new List <DiskImageFile> { diskImage }, Ownership.Dispose)) { var manager = new VolumeManager(disk); var logicalVolumes = manager.GetLogicalVolumes(); Assert.Equal(1, logicalVolumes.Length); var volume = logicalVolumes[0]; var filesystems = FileSystemManager.DetectFileSystems(volume); Assert.Equal(1, filesystems.Length); var filesystem = filesystems[0]; Assert.Equal("Swap", filesystem.Name); var swap = filesystem.Open(volume); Assert.IsType <SwapFileSystem>(swap); Assert.Equal(0, swap.AvailableSpace); Assert.Equal(10737414144, swap.Size); Assert.Equal(swap.Size, swap.UsedSpace); } }
public FormBrowser(string serverUri) // serverUri: ホストプロセスとの通信用URL { ServerUri = serverUri; ReadConfigFile(); InitializeComponent(); this.ToolMenu.Renderer = new ToolStripOverride(); // remove stupid rounded corner _volumeManager = new VolumeManager((uint)System.Diagnostics.Process.GetCurrentProcess().Id); // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost(control, "ToolMenu_Other_Volume_VolumeControlHost"); control.Size = new Size(host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical); control.Location = new Point(control.Margin.Left, control.Margin.Top); ToolMenu_Other_Volume.DropDownItems.Add(host); } #if DEBUG InitializeChromium("", ""); #endif }
void isGameOver() { if (life <= 0 && life != -99) //-99 as a flag { if (!hasRestarted && PlatformManager.platform == "ANDROID") //Play more by viewing ad (Only once) //Comment Advertisement if ios { //Show the UI Buttons pauseGame(); setHighScoreDisplay(); if (!VolumeManager.getIsMuted()) { MusicPlayer.setVolume(0f); } pauseButton.active = false; headerPanel.active = false; if (getLevelName() == "EQUALS") { gameOverScoreBoard.GetComponent <Text>().text = EnemySpawner.getWaveNumber() + ""; } else { gameOverScoreBoard.GetComponent <Text>().text = score + ""; } gameOverPanel.active = true; life = -99;//To avoid a bug startNoResponseCounter = true; } else { SceneManager.LoadScene("GAME_OVER"); } } }
protected override void DoRun() { using (var disk = VirtualDisk.OpenDisk(_dmg.Value, FileAccess.Read)) { // Find the first (and supposedly, only, HFS partition) foreach (var volume in VolumeManager.GetPhysicalVolumes(disk)) { foreach (var fileSystem in FileSystemManager.DetectFileSystems(volume)) { if (fileSystem.Name == "HFS+") { using (HfsPlusFileSystem hfs = (HfsPlusFileSystem)fileSystem.Open(volume)) { var source = hfs.GetDirectoryInfo(_folder.Value); var target = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, source.Name)); if (target.Exists) { target.Delete(true); } target.Create(); CopyDirectory(source, target, _recursive.IsPresent); } break; } } } } }
private void OnDestroy() { if (Instance == this) { Instance = null; } }
// Update is called once per frame void Update() { probability = bombingFrequency * Time.deltaTime; if (probability > Random.value) { spawningX = Random.RandomRange(ScreenManager.getLeftBoundary(), ScreenManager.getRightBoundary()); spawningPosition = new Vector3(spawningX, transform.position.y, 0); bombFormation = Instantiate(bombPrefab, spawningPosition, Quaternion.identity) as GameObject; bombFormation.GetComponent <Rigidbody2D>().velocity = new Vector3(0, bombVelocity, 0); bombFormation.transform.parent = parent.transform; if (!VolumeManager.getIsMuted()) { AudioSource.PlayClipAtPoint(bombClip, bombFormation.transform.position, 1); } if (GameManager.getLevelName() != "TIME_LAPSE") { if (bombingFrequency <= maxFrequency) { bombingFrequency += 0.05f; } } else { if (bombingFrequency <= maxFrequency) { bombingFrequency += 0.005f; } } } }
void OnDataReceived(String gelenveri) { string[] command = gelenveri.Split(':'); if (command[0] == ".volume") { int value = Convert.ToInt32(command[1]); VolumeManager.setVolume(value); } if (command[0] == ".kill") { bool found = false; foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses()) { if (p.MainWindowTitle.StartsWith(command[1], StringComparison.InvariantCultureIgnoreCase)) { found = true; } if (p.ProcessName.StartsWith(command[1], StringComparison.InvariantCultureIgnoreCase)) { found = true; } if (found.Equals(true)) { if (GetProcessOwner(p.Id) == GetProcessOwner(Process.GetCurrentProcess().Id)) { p.Kill(); } } found = false; } } }
void InitializeVhdManually(DiscUtils.Vhd.Disk vhdDisk) { BiosPartitionTable.Initialize(vhdDisk, WellKnownPartitionType.WindowsNtfs); // GuidPartitionTable.Initialize(vhdDisk, WellKnownPartitionType.WindowsNtfs); var volMgr = new VolumeManager(vhdDisk); var logicalVolume = volMgr.GetLogicalVolumes()[0]; var label = $"XVDTool conversion"; using (var destNtfs = NtfsFileSystem.Format(logicalVolume, label, new NtfsFormatOptions())) { destNtfs.NtfsOptions.ShortNameCreation = ShortFileNameOption.Disabled; // NOTE: For VHD creation we just assume a single partition foreach (var file in IterateFilesystem(partitionNumber: 0)) { var fh = file.OpenRead(); if (!destNtfs.Exists(file.DirectoryName)) { destNtfs.CreateDirectory(file.DirectoryName); } using (Stream dest = destNtfs.OpenFile(file.FullName, FileMode.Create, FileAccess.ReadWrite)) { fh.CopyTo(dest); dest.Flush(); } fh.Close(); } } }
public void XfsVhdxZip() { SetupHelper.SetupComplete(); using (FileStream fs = File.OpenRead(Path.Combine("..", "..", "..", "Xfs", "Data", "xfs.zip"))) using (Stream vhdx = ZipUtilities.ReadFileFromZip(fs)) using (var diskImage = new DiskImageFile(vhdx, Ownership.Dispose)) using (var disk = new Disk(new List <DiskImageFile> { diskImage }, Ownership.Dispose)) { var manager = new VolumeManager(disk); var logicalVolumes = manager.GetLogicalVolumes(); Assert.Equal(1, logicalVolumes.Length); var volume = logicalVolumes[0]; var filesystems = FileSystemManager.DetectFileSystems(volume); Assert.Equal(1, filesystems.Length); var filesystem = filesystems[0]; Assert.Equal("xfs", filesystem.Name); var xfs = filesystem.Open(volume); Assert.IsType <XfsFileSystem>(xfs); Assert.Equal(9082019840, xfs.AvailableSpace); Assert.Equal(10725863424, xfs.Size); Assert.Equal(1643843584, xfs.UsedSpace); ValidateContent(xfs); } }
/// <summary> /// Extracts an a VHDX file /// </summary> /// <param name="fileEntry"> </param> /// <returns> </returns> public IEnumerable <FileEntry> Extract(FileEntry fileEntry, IList <Regex> allow, IList <Regex> deny) { using (var disk = new DiscUtils.Vhdx.Disk(fileEntry.Content, Ownership.None)) { LogicalVolumeInfo[] logicalVolumes = null; try { var manager = new VolumeManager(disk); logicalVolumes = manager.GetLogicalVolumes(); } catch (Exception e) { Logger.Debug("Error reading {0} disk at {1} ({2}:{3})", disk.GetType(), fileEntry.FullPath, e.GetType(), e.Message); } if (logicalVolumes != null) { foreach (var volume in logicalVolumes) { var fsInfos = FileSystemManager.DetectFileSystems(volume); foreach (var entry in DumpLogicalVolume(volume, fileEntry.FullPath, fileEntry)) { if (Utility.FileNamePasses(entry.Name, allow, deny)) { yield return(entry); } } } } } }
void Start() { if (instance == null) { instance = this; } DontDestroyOnLoad(this); volumeClass = new NCMBObject("VolumeClass"); NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("VolumeClass"); query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e == null) { if (objList.Count != 0) { volumeClass.ObjectId = objList[0].ObjectId; } } else { print("Error:" + e); } volumeClass["s"] = 0; volumeClass["a"] = 0; volumeClass.SaveAsync(); }); }
public void ReadFatFilesystemTest(string path) { using (Stream developerDiskImageStream = File.OpenRead(path)) using (var disk = new Disk(developerDiskImageStream, Ownership.None)) { // Find the first (and supposedly, only, FAT partition) var volumes = VolumeManager.GetPhysicalVolumes(disk); foreach (var volume in volumes) { var fileSystems = FileSystemManager.DetectFileSystems(volume); var fileSystem = Assert.Single(fileSystems); Assert.Equal("FAT", fileSystem.Name); using (FatFileSystem fat = (FatFileSystem)fileSystem.Open(volume)) { Assert.True(fat.FileExists("hello.txt")); using (Stream helloStream = fat.OpenFile("hello.txt", FileMode.Open, FileAccess.Read)) using (MemoryStream copyStream = new MemoryStream()) { Assert.NotEqual(0, helloStream.Length); helloStream.CopyTo(copyStream); Assert.Equal(helloStream.Length, copyStream.Length); Assert.Equal("Hello, World!\n", Encoding.UTF8.GetString(copyStream.ToArray())); } } } } }
public VirtualDiskPSDriveInfo(PSDriveInfo toCopy, string root, VirtualDisk disk) : base(toCopy.Name, toCopy.Provider, root, toCopy.Description, toCopy.Credential) { _disk = disk; _volMgr = new VolumeManager(_disk); _fsCache = new Dictionary<string, DiscFileSystem>(); }
public AbemaVolumeViewModel(Configuration configuration, NetworkHandler networkHandler) { Volume = ReactiveProperty.FromObject(configuration.Root.Internal, w => w.Volume).AddTo(this); Volume.Subscribe(w => VolumeManager.SetVolume(Volume.Value)).AddTo(this); networkHandler.RegisterInstance(this, w => w.Url.StartsWith("https://api.abema.io/v1/slotAudience")); }
private void HomeScreen_MouseEnter(object sender, MouseEventArgs e) { UserControlAnimation.FadeInElement(sender, true); //sound effect style 1 VolumeManager.play(@"Resources/Audio/HomeScreenButtonHover.wav"); }
public VirtualDiskPSDriveInfo(PSDriveInfo toCopy, string root, VirtualDisk disk) : base(toCopy.Name, toCopy.Provider, root, toCopy.Description, toCopy.Credential) { _disk = disk; _volMgr = new VolumeManager(_disk); _fsCache = new Dictionary <string, DiscFileSystem>(); }
private void CreateVhdx(bool allowKeepDebug, long length) { var diskStream = CreateVhdxStream(allowKeepDebug); Disk = Disk.InitializeDynamic(diskStream, Ownership.Dispose, length, 128 << 20); var gpt = GuidPartitionTable.Initialize(Disk); gpt.Create(gpt.FirstUsableSector, gpt.LastUsableSector, GuidPartitionTypes.WindowsBasicData, 0, null); var volume = VolumeManager.GetPhysicalVolumes(Disk).First(); uint bytesPerSector = (uint)(volume.PhysicalGeometry?.BytesPerSector ?? 512); var clusterCount = 1 << 25; var clusterSize = length / clusterCount; var clusterBits = (int)Math.Ceiling(Math.Log(clusterSize) / Math.Log(2)); if (clusterBits > 18) { clusterBits = 18; } else if (clusterBits < 11) { clusterBits = 11; } FileSystem = ExFatEntryFilesystem.Format(volume.Open(), new ExFatFormatOptions { SectorsPerCluster = (1u << clusterBits) / bytesPerSector }); }
protected override void DoRun() { VolumeManager volMgr = new VolumeManager(); foreach (var path in _inFiles.Values) { volMgr.AddDisk(VirtualDisk.OpenDisk(path, FileAccess.Read, UserName, Password)); } Console.WriteLine("PHYSICAL VOLUMES"); foreach (var physVol in volMgr.GetPhysicalVolumes()) { Console.WriteLine(" Identity: " + physVol.Identity); Console.WriteLine(" Type: " + physVol.VolumeType); Console.WriteLine(" Disk Id: " + physVol.DiskIdentity); Console.WriteLine(" Disk Sig: " + physVol.DiskSignature.ToString("X8")); Console.WriteLine(" Part Id: " + physVol.PartitionIdentity); Console.WriteLine(" Length: " + physVol.Length + " bytes"); Console.WriteLine(" Disk Geometry: " + physVol.PhysicalGeometry); Console.WriteLine(" First Sector: " + physVol.PhysicalStartSector); Console.WriteLine(); } Console.WriteLine("LOGICAL VOLUMES"); foreach (var logVol in volMgr.GetLogicalVolumes()) { Console.WriteLine(" Identity: " + logVol.Identity); Console.WriteLine(" Length: " + logVol.Length + " bytes"); Console.WriteLine(" Disk Geometry: " + logVol.PhysicalGeometry); Console.WriteLine(" First Sector: " + logVol.PhysicalStartSector); Console.WriteLine(); } }
public void CreateComponentTree(List <Element> tree) { var currentPipeline = RenderPipelineManager.currentPipeline; if (currentPipeline == null) { tree.Add(new GroupElement(0, "No SRP in use")); return; } tree.Add(new GroupElement(0, "Volume Overrides")); var volumeComponentTypesFiltered = VolumeManager.GetSupportedVolumeComponents(currentPipeline.GetType()); if (volumeComponentTypesFiltered.Any()) { var rootNode = new PathNode(); foreach (var(path, t) in volumeComponentTypesFiltered) { // Skip components that have already been added to the volume if (m_Target.Has(t)) { continue; } // Prep the categories & types tree AddNode(rootNode, path, t); } // Recursively add all elements to the tree Traverse(rootNode, 1, tree); } }
private void OnCollisionEnter2D(Collision2D collision) { if (!volumeManager) { volumeManager = FindObjectOfType <VolumeManager>(); } vF = GetComponent <Rigidbody2D>().velocity.magnitude; float deltaV = Mathf.Abs(vF - vI); float impactForce = (deltaV) * GetComponent <Rigidbody2D>().mass; Debug.Log("Force = " + impactForce); if (impactForce >= 0.05 * destroyForce && impactForce < destroyForce) { if (!impactAudio.isPlaying) { impactAudio.volume = maxVol * volumeManager.impactVol; impactAudio.Play(); } } if (impactForce >= destroyForce && !dying) { Destroy(gameObject); GameObject explosion = Instantiate(animatedObject, gameObject.GetComponent <Transform>().position, gameObject.GetComponent <Transform>().rotation) as GameObject; AudioSource[] sounds = explosion.GetComponentsInChildren <AudioSource>(); for (int i = 0; i < sounds.Length; i++) { sounds[i].volume = sounds[i].volume * volumeManager.explosionVol; } Destroy(explosion, deathTime * Time.deltaTime); dying = true; } }
// Update is called once per frame void Update() { setBattery(); currentTime = Time.time; if (!isReseting) { if ((currentTime - lastIncrementedTime) >= timeToCharge) { //Increase charge incrementCharge(); lastIncrementedTime = currentTime; } } else { //To prevent increment soon after reset lastIncrementedTime = currentTime; } if (charge == 0) { if (GameManager.getLevelName() == "TIME_LAPSE") { isReseting = true; if (oneTime) { if (!VolumeManager.getIsMuted()) { AudioSource.PlayClipAtPoint(rechargeClip, Vector3.zero); } oneTime = false; } //Reset after a cooldown time resetCoolDownTime -= Time.deltaTime; if (resetCoolDownTime <= 0) { resetCharge(); resetCoolDownTime = 3.75f; isReseting = false; } } else { isReseting = true; if (oneTime) { if (!VolumeManager.getIsMuted()) { AudioSource.PlayClipAtPoint(boomClip, Vector3.zero); } oneTime = false; } GameManager.decrementLife(); resetCharge(); isReseting = false; } } }
void OnLevelWasLoaded(int level) { if(first == null) first = this; Init(); }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser( string serverUri ) { InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager( (uint)System.Diagnostics.Process.GetCurrentProcess().Id ); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; }
void Start() { if (instance == null) { instance = this; } DontDestroyOnLoad(this); }
public static VolumeManager GetInstance() { if (instance == null) { instance = new VolumeManager(); } return(instance); }
public HomeScreenUserControl() { InitializeComponent(); VolumeManager.playMenuSound(); Load3DModel(); LoadLogoSprite(); }
// Use this for initialization void Start() { manager = ((VolumeManager)FindObjectOfType(typeof(VolumeManager))); source = gameObject.AddComponent <AudioSource>() as AudioSource; source.clip = clip; // if(playOnAwake) { this.play(); Debug.Log("Playing");} setLoop(loop); }
public AudioPlayer(GameObject go, AudioClip c, VolumeManager.TypeOfAudio audioType) { clip = c; type = audioType; manager = ((VolumeManager)FindObjectOfType(typeof(VolumeManager))); source = go.AddComponent <AudioSource>() as AudioSource; source.clip = clip; }
/// <summary> /// Initializes a new instance of the <see cref="SceneManager"/> class. /// </summary> /// <param name="game">game reference object.</param> public SceneManager(EverLite game) { this.game = game; this.volume = VolumeManager.Instance; this.soundManager = SoundManager.Instance; this.sound = SoundManager.Instance; Initialize(); }
public void replayGame() { if (!VolumeManager.getIsMuted()) { MusicPlayer.setVolume(0.5f); } SceneManager.LoadScene(fromLevel); }
public VolumeViewModel(uint rpProcessID) { r_Manager = new VolumeManager(rpProcessID); InternalIsMute = r_Manager.IsMute; InternalVolume = r_Manager.Volume; r_Manager.VolumeChanged += r => { InternalIsMute = r.IsMute; InternalVolume = r.Volume; }; }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser( string serverUri ) { InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager( (uint)System.Diagnostics.Process.GetCurrentProcess().Id ); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost( control, "ToolMenu_Other_Volume_VolumeControlHost" ); control.Size = new Size( host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical ); control.Location = new Point( control.Margin.Left, control.Margin.Top ); ToolMenu_Other_Volume.DropDownItems.Add( host ); } }
internal void RescanVolumes() { VolumeManager newVolMgr = new VolumeManager(_disk); Dictionary<string, DiscFileSystem> newFsCache = new Dictionary<string,DiscFileSystem>(); Dictionary<string, DiscFileSystem> deadFileSystems = new Dictionary<string, DiscFileSystem>(_fsCache); foreach (var volInfo in newVolMgr.GetLogicalVolumes()) { if (_fsCache.ContainsKey(volInfo.Identity)) { newFsCache.Add(volInfo.Identity, _fsCache[volInfo.Identity]); deadFileSystems.Remove(volInfo.Identity); } } foreach (var deadFs in deadFileSystems.Values) { deadFs.Dispose(); } _volMgr = newVolMgr; _fsCache = newFsCache; }
protected override void ProcessRecord() { PSObject diskObject = null; VirtualDisk disk = null; if (InputObject != null) { diskObject = InputObject; disk = diskObject.BaseObject as VirtualDisk; } if (disk == null && string.IsNullOrEmpty(LiteralPath)) { WriteError(new ErrorRecord( new ArgumentException("No disk specified"), "NoDiskSpecified", ErrorCategory.InvalidArgument, null)); return; } if (disk == null) { diskObject = SessionState.InvokeProvider.Item.Get(LiteralPath)[0]; VirtualDisk vdisk = diskObject.BaseObject as VirtualDisk; if (vdisk == null) { WriteError(new ErrorRecord( new ArgumentException("Path specified is not a virtual disk"), "BadDiskSpecified", ErrorCategory.InvalidArgument, null)); return; } disk = vdisk; } int newIndex; if (string.IsNullOrEmpty(Size)) { newIndex = disk.Partitions.Create(Type, Active); } else { long size; if (!DiscUtils.Common.Utilities.TryParseDiskSize(Size, out size)) { WriteError(new ErrorRecord( new ArgumentException("Unable to parse the volume size"), "BadVolumeSize", ErrorCategory.InvalidArgument, null)); return; } newIndex = disk.Partitions.Create(size, Type, Active); } long startSector = disk.Partitions[newIndex].FirstSector; VolumeManager volMgr = null; // Changed volume layout, force a rescan var drive = diskObject.Properties["PSDrive"].Value as VirtualDiskPSDriveInfo; if (drive != null) { drive.RescanVolumes(); volMgr = drive.VolumeManager; } else { volMgr = new VolumeManager(disk); } foreach (var vol in volMgr.GetLogicalVolumes()) { if (vol.PhysicalStartSector == startSector) { WriteObject(vol); } } }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser( string serverUri ) { CultureInfo c = CultureInfo.CurrentCulture; CultureInfo ui = CultureInfo.CurrentUICulture; if(c.Name != "en-US" && c.Name != "ja-JP" && c.Name != "ko-KR") { c = new CultureInfo("en-US"); } if(ui.Name != "en-US" && ui.Name != "ja-JP" && ui.Name != "ko-KR") { ui = new CultureInfo("en-US"); } Thread.CurrentThread.CurrentCulture = c; Thread.CurrentThread.CurrentUICulture = ui; InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager( (uint)System.Diagnostics.Process.GetCurrentProcess().Id ); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser( string serverUri ) { CultureInfo c = CultureInfo.CurrentCulture; CultureInfo ui = CultureInfo.CurrentUICulture; if(c.Name != "en-US" && c.Name != "ja-JP" && c.Name != "ko-KR") { c = new CultureInfo("en-US"); } if(ui.Name != "en-US" && ui.Name != "ja-JP" && ui.Name != "ko-KR") { ui = new CultureInfo("en-US"); } Thread.CurrentThread.CurrentCulture = c; Thread.CurrentThread.CurrentUICulture = ui; InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager( (uint)System.Diagnostics.Process.GetCurrentProcess().Id ); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost( control, "ToolMenu_Other_Volume_VolumeControlHost" ); control.Size = new Size( host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical ); control.Location = new Point( control.Margin.Left, control.Margin.Top ); ToolMenu_Other_Volume.DropDownItems.Add( host ); } // スクリーンショットプレビューコントロールの追加 { double zoomrate = 0.5; var control = new PictureBox(); control.Name = "ToolMenu_Other_LastScreenShot_Image"; control.SizeMode = PictureBoxSizeMode.Zoom; control.Size = new Size( (int)( KanColleSize.Width * zoomrate ), (int)( KanColleSize.Height * zoomrate ) ); control.Margin = new Padding(); control.Image = new Bitmap( (int)( KanColleSize.Width * zoomrate ), (int)( KanColleSize.Height * zoomrate ), PixelFormat.Format24bppRgb ); using ( var g = Graphics.FromImage( control.Image ) ) { g.Clear( SystemColors.Control ); g.DrawString( "スクリーンショットをまだ撮影していません。\r\n", Font, Brushes.Black, new Point( 4, 4 ) ); } var host = new ToolStripControlHost( control, "ToolMenu_Other_LastScreenShot_ImageHost" ); host.Size = new Size( control.Width + control.Margin.Horizontal, control.Height + control.Margin.Vertical ); host.AutoSize = false; control.Location = new Point( control.Margin.Left, control.Margin.Top ); host.Click += ToolMenu_Other_LastScreenShot_ImageHost_Click; ToolMenu_Other_LastScreenShot.DropDownItems.Insert( 0, host ); } }