/// <summary>
        /// Create Volume Container, with Bandwidth Setting template.
        /// </summary>
        private VolumeContainer CreateVolumeContainer(string deviceName, string volumeContainerName, string encryptionKeyInPlainText, string sacName, string bwsName)
        {
            var sac = this.Client.StorageAccountCredentials.Get(sacName.GetDoubleEncoded(), this.ResourceGroupName, this.ManagerName);
            var bws = this.Client.BandwidthSettings.Get(bwsName.GetDoubleEncoded(), this.ResourceGroupName, this.ManagerName);

            Assert.True(sac != null && sac.Id != null, "Storage account credential name passed for use in volume container doesn't exists.");
            Assert.True(bws != null && bws.Id != null, "Bandwidth setting name passed for use in volume container doesn't exists.");

            var vcToCreate = new VolumeContainer()
            {
                StorageAccountCredentialId = sac.Id,
                BandwidthSettingId         = bws.Id,
                EncryptionKey = this.Client.Managers.GetAsymmetricEncryptedSecret(this.ResourceGroupName, this.ManagerName, encryptionKeyInPlainText)
            };

            var vc = this.Client.VolumeContainers.CreateOrUpdate(
                deviceName.GetDoubleEncoded(),
                volumeContainerName.GetDoubleEncoded(),
                vcToCreate,
                this.ResourceGroupName,
                this.ManagerName);

            Assert.True(vc != null && vc.Name.Equals(volumeContainerName) &&
                        vc.StorageAccountCredentialId.Equals(sac.Id) &&
                        vc.BandwidthSettingId.Equals(bws.Id),
                        "Creation of Volume Container was not successful");

            return(vc);
        }
Exemple #2
0
        public bool Eject(string driveLetter)
        {
            Logger.LogInformation("Ejecting {0}", driveLetter);

            var volume = VolumeContainer.GetVolume(driveLetter);

            Thread.Sleep(Settings.Default.VolumeEjectDelay);

            using (var hDevice = Device.OpenRead(volume.Disk.DeviceName))
            {
                if (!Lock(hDevice) || !Dismount(hDevice))
                {
                    return(false);
                }
            }

            Thread.Sleep(Settings.Default.VolumeEjectDelay);

            try
            {
                return(DoEject(driveLetter));
            }
            catch (Exception ex)
            {
                Logger.LogError(0, ex, "Eject failed");
                return(false);
            }
        }
Exemple #3
0
        public FakeFileSystemBuilder([NotNull] SystemClock systemClock, [NotNull] ILoggedOnUserAccount userAccount)
        {
            Guard.NotNull(systemClock, nameof(systemClock));
            Guard.NotNull(userAccount, nameof(userAccount));

            container = new VolumeContainer(systemClock, changeTracker, userAccount);
        }
Exemple #4
0
        private CardItemViewModel CreateCardItem(CardInfo card)
        {
            try
            {
                if (card.Capacity == null)
                {
                    var volume = VolumeContainer.GetVolume(card.DriveLetter);
                    card.Capacity = volume.Disk.DiskSize;
                }
            }
            catch (FileNotFoundException)
            {
                return(null);
            }

            var partTypes = PartitionService.GetPartitionTypes(card.DriveLetter);

            return(new CardItemViewModel
            {
                Info = card,
                DisplayName = GetDisplayName(card),
                PartitionTypes = partTypes,
                Switched = PartitionService.TestSwitchedPartitions(partTypes),
                Bootable = BootService.TestBootable(card, card.FileSystem),
                Scriptable = ScriptService.TestScriptable(card, card.FileSystem),
            });
        }
Exemple #5
0
 public DirectoryDeleteHandler([NotNull] VolumeContainer container,
                               [NotNull] CurrentDirectoryManager currentDirectoryManager)
     : base(container)
 {
     Guard.NotNull(currentDirectoryManager, nameof(currentDirectoryManager));
     this.currentDirectoryManager = currentDirectoryManager;
 }
Exemple #6
0
 private void UpdateEject()
 {
     if (ViewModel.SelectedItem != null)
     {
         var volume    = VolumeContainer.GetVolume(ViewModel.SelectedItem.Info.DriveLetter);
         var isHotplug = volume.IsHotplugDevice();
         EjectViewModel.IsEject     = !isHotplug;
         EjectViewModel.IsCompleted = isHotplug;
     }
 }
Exemple #7
0
        public DirectoryResolver([NotNull] VolumeContainer container)
        {
            Guard.NotNull(container, nameof(container));
            this.container = container;

            ErrorNetworkShareNotFound     = _ => ErrorFactory.System.NetworkPathNotFound();
            ErrorDirectoryFoundAsFile     = ErrorFactory.System.DirectoryNotFound;
            ErrorLastDirectoryFoundAsFile = ErrorFactory.System.DirectoryNotFound;
            ErrorDirectoryNotFound        = ErrorFactory.System.DirectoryNotFound;
        }
Exemple #8
0
        public override void Collect(VolumeContainer container)
        {
            Area defaultArea = PathFinder.GetArea(0);
            Area clearArea   = PathFinder.GetArea(1);

            for (int i = 0; i < _collectedTerrainUsingComputeShader.Count; i++)
            {
                TerrainInfoCSR          info        = _collectedTerrainUsingComputeShader[i];
                TerrainColliderInfoMesh terrainInfo = info.colliderInfo;

                Volume terrainVolume;
                if (terrainInfo.alphaMap != null)
                {
                    terrainVolume = new Volume(template.lengthX_extra, template.lengthZ_extra, terrainInfo.possibleArea);
                }
                else
                {
                    terrainVolume = new Volume(template.lengthX_extra, template.lengthZ_extra, defaultArea);
                }

                terrainVolume.terrain = true;
                //var areaLibrary = PathFinder.settings.areaLibrary;

                info.voxelsTerrain.Read(terrainVolume);
                terrainVolume.SetVolumeMinimum(-1000f);
                SetTerrainArea(terrainVolume, terrainInfo, defaultArea); //apply terrain area info if it exist

                if (info.voxelsTrees != null)
                {
                    //trees
                    Volume treeVolume = new Volume(template.lengthX_extra, template.lengthZ_extra, defaultArea);
                    treeVolume.SetVolumeMinimum(-1000f);
                    foreach (var treeVoxls in info.voxelsTrees)
                    {
                        if (treeVoxls != null)
                        {
                            treeVoxls.Read(treeVolume, clearArea);
                        }
                    }

                    //connecting terrain and trees to single volume
                    terrainVolume.Subtract(treeVolume);
                    terrainVolume.ConnectToItself();
                    terrainVolume.Override(treeVolume);
                }
                else
                {
                    terrainVolume.ConnectToItself();
                }

                container.AddVolume(terrainVolume);
            }
        }
Exemple #9
0
 //in not main thread
 //read voxels to volume
 public override void Collect(VolumeContainer container)
 {
     if (templatesAfterComputeShader == null)
     {
         Debug.LogWarning("expecting to recive things from compute shader but list was null");
         return;
     }
     for (int i = 0; i < templatesAfterComputeShader.Count; i++)
     {
         Volume curInfoVolume = new Volume(template.lengthX_extra, template.lengthZ_extra, templatesAfterComputeShader[i].info.area);
         templatesAfterComputeShader[i].result.Read(curInfoVolume, templatesAfterComputeShader[i].info.area);
         container.AddVolume(curInfoVolume);
     }
 }
Exemple #10
0
            private BackupFileInfo([NotNull] FileEntry tempBackupFile, [NotNull] VolumeContainer container)
            {
                Guard.NotNull(tempBackupFile, nameof(tempBackupFile));

                this.container        = container;
                keepCreationTimeUtc   = tempBackupFile.CreationTimeUtc;
                keepLastWriteTimeUtc  = tempBackupFile.LastWriteTimeUtc;
                keepLastAccessTimeUtc = tempBackupFile.LastAccessTimeUtc;

                FileName   = tempBackupFile.Name;
                Directory  = tempBackupFile.Parent;
                Path       = tempBackupFile.PathFormatter.GetPath();
                IsTempFile = true;
            }
            public override void SetSampleData(NamesList names, int count)
            {
                base.SetSampleData(names, count);

                this.Volume = new VolumeContainer()
                {
                    BonusPeriod = 201410,
                    Results     = new List <VolumeResult>()
                    {
                        new VolumeResult()
                        {
                            BV = 131.13,
                            PV = 140.11
                        }
                    }
                };
            }
Exemple #12
0
            private BackupFileInfo([NotNull] AbsolutePath backupPath, [NotNull] VolumeContainer container)
            {
                Guard.NotNull(backupPath, nameof(backupPath));
                Guard.NotNull(container, nameof(container));

                this.container = container;
                FileName       = backupPath.Components.Last();
                Directory      = ResolveBackupDirectory(backupPath);
                Path           = backupPath;
                IsTempFile     = false;

                if (Exists)
                {
                    FileEntry backupFile = GetExistingFile();
                    keepCreationTimeUtc   = backupFile.CreationTimeUtc;
                    keepLastWriteTimeUtc  = backupFile.LastWriteTimeUtc;
                    keepLastAccessTimeUtc = backupFile.LastAccessTimeUtc;
                }
            }
 public FileCopyHandler([NotNull] VolumeContainer container)
     : base(container)
 {
 }
Exemple #14
0
            public static BackupFileInfo FromTempFile([NotNull] FileEntry backupFile, [NotNull] VolumeContainer container)
            {
                Guard.NotNull(backupFile, nameof(backupFile));
                Guard.NotNull(container, nameof(container));

                return(new BackupFileInfo(backupFile, container));
            }
Exemple #15
0
 private bool HasVolumeData <T>(VolumeContainer <T> container) where T : struct
 {
     return(container != null && container.HasData);
 }
Exemple #16
0
        //threaded
        public override void Collect(VolumeContainer container)
        {
            float maxSlopeCos = Mathf.Cos((float)((double)template.maxSlope * Math.PI / 180.0));

            foreach (var colTemplate in templates)
            {
                Area   area   = colTemplate.area;
                Volume volume = new Volume(template.lengthX_extra, template.lengthZ_extra, area);

                Vector3[] templateVerts = colTemplate.verts;
                Vector3[] verts         = new Vector3[templateVerts.Length];
                Matrix4x4 matrix        = colTemplate.matrix;

                for (int i = 0; i < templateVerts.Length; i++)
                {
                    verts[i] = matrix.MultiplyPoint3x4(templateVerts[i]);
                }

                int[] tris = colTemplate.tris;

                for (int t = 0; t < colTemplate.tris.Length; t += 3)
                {
                    Vector3 A = verts[tris[t]];
                    Vector3 B = verts[tris[t + 1]];
                    Vector3 C = verts[tris[t + 2]];

                    bool        unwalkableBySlope = !CalculateWalk(A, B, C, maxSlopeCos);
                    Passability currentPassability;

                    if (area.id == 1)//id of clear Area all time
                    {
                        currentPassability = Passability.Unwalkable;
                    }
                    else if (unwalkableBySlope)
                    {
                        currentPassability = Passability.Slope;
                    }
                    else
                    {
                        currentPassability = Passability.Walkable;
                    }

#if UNITY_EDITOR
                    if (currentPassability > Passability.Slope && Debuger_K.doDebug && Debuger_K.debugOnlyNavMesh == false)
                    {
                        Debuger_K.AddWalkablePolygon(template.gridPosX, template.gridPosZ, template.properties, A, B, C);
                    }
#endif

                    base.RasterizeTriangle(
                        volume, A, B, C,
                        template.voxelSize,
                        template.startX_extra,
                        template.endX_extra,
                        template.startZ_extra,
                        template.endZ_extra,
                        area, currentPassability);
                }

                container.AddVolume(volume);
            }
        }
Exemple #17
0
 public void SetData(Volume <TileData> tiles)
 {
     tileData = new VolumeContainer <TileData>(tiles);
 }
Exemple #18
0
 public void SetData(Volume <VariantData3D> variants)
 {
     variantData3D = new VolumeContainer <VariantData3D>(variants);
 }
            public override void SetSampleData(NamesList names, int count)
            {
                base.SetSampleData(names, count);

                this.Volume = new VolumeContainer() {
                    BonusPeriod = 201410,
                    Results = new List<VolumeResult>() {
                        new VolumeResult() {
                            BV = 131.13,
                            PV = 140.11
                        }
                    }
                };
            }
Exemple #20
0
 public EntryGetMetadataHandler([NotNull] VolumeContainer container)
     : base(container)
 {
 }
Exemple #21
0
 public FileGetTimeHandler([NotNull] VolumeContainer container)
     : base(container)
 {
 }
Exemple #22
0
        //all this awesome pipeline
        //threaded
        public override void Work()
        {
            if (profiler != null)
            {
                profiler.AddLog("start thread", Color.green);
                profiler.StartThreadStuff();
            }

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            VolumeContainer volumes = new VolumeContainer(this);

            if (profiler != null)
            {
                profiler.AddLog("start collecting volumes", Color.green);
            }
            _terrainCollector.Collect(volumes);
            if (profiler != null)
            {
                profiler.AddLog("terrain collected");
            }
            _primitivesCollector.Collect(volumes);
            if (profiler != null)
            {
                profiler.AddLog("collected");
            }


            hashData = PathFinder.CloneHashData();

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            if (profiler != null)
            {
                profiler.AddLog("volumes container start doing stuff");
            }
            volumes.DoStuff();
            if (profiler != null)
            {
                profiler.AddLog("volumes container end doing stuff");
            }

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            if (profiler != null)
            {
                profiler.AddLog("graph generator start doing stuff", Color.green);
            }
            GraphGenerator generator = new GraphGenerator(volumes, this);
            Graph          graph     = generator.MakeGraph();

            if (profiler != null)
            {
                profiler.AddLog("graph generator end making graph");
            }

            if (stop)
            {
                if (profiler != null)
                {
                    profiler.Abort();
                }
                return;
            }

            if (profiler != null)
            {
                profiler.AddLog("end thread", Color.green);
                profiler.EndThreadStuff();
                profiler.EndProfile();
                profiler.DebugLog(ProfilderLogMode.log);
            }

            GC.Collect();


            //Graph graph = new Graph(chunk, properties);
            if (onEndCallBack != null)
            {
                onEndCallBack.Invoke(graph);
            }
        }
Exemple #23
0
 public PathGetTempFileNameHandler([NotNull] VolumeContainer container, [NotNull] Random randomNumberGenerator)
     : base(container)
 {
     Guard.NotNull(randomNumberGenerator, nameof(randomNumberGenerator));
     this.randomNumberGenerator = randomNumberGenerator;
 }
 public DirectoryExistsHandler([NotNull] VolumeContainer container)
     : base(container)
 {
 }
Exemple #25
0
 public FileGetAttributesHandler([NotNull] VolumeContainer container)
     : base(container)
 {
 }
Exemple #26
0
        //not main thread
        public override void Collect(VolumeContainer container)
        {
            Area defaultArea = PathFinder.GetArea(0);

            foreach (var terrain in _terrainsInfo)
            {
                //terrain
                Volume terrainVolume;

                if (terrain.alphaMap != null)
                {
                    terrainVolume = new Volume(template.lengthX_extra, template.lengthZ_extra, terrain.possibleArea);
                }
                else
                {
                    terrainVolume = new Volume(template.lengthX_extra, template.lengthZ_extra, defaultArea);
                }

                terrainVolume.terrain = true;

                float[][] heightMap      = terrain.heightMap;
                int[][]   passabilityMap = terrain.passabilityMap;

                var areaLibrary = PathFinder.settings.areaLibrary;

                //apply terrain area info if it exist
                //SetTerrainArea(terrainVolume, terrain, defaultArea);
                if (terrain.alphaMap != null)
                {
                    int[][] areaMap = ProcessAlphaMap(terrain);

                    for (int x = 0; x < template.lengthX_extra; x++)
                    {
                        for (int z = 0; z < template.lengthZ_extra; z++)
                        {
                            terrainVolume.SetVoxel(x, z, heightMap[x][z], areaLibrary[areaMap[x][z]], passabilityMap[x][z]);

                            if (areaMap[x][z] == 1)
                            {
                                terrainVolume.SetPassability(x, z, Passability.Unwalkable);
                            }
                        }
                    }
                }
                else
                {
                    for (int x = 0; x < template.lengthX_extra; x++)
                    {
                        for (int z = 0; z < template.lengthZ_extra; z++)
                        {
                            terrainVolume.SetVoxel(x, z, heightMap[x][z], defaultArea, passabilityMap[x][z]);
                        }
                    }
                }

                terrainVolume.SetVolumeMinimum(-1000f);

                //trees
                Volume treeVolume = base.CollectTrees(terrain);

                //connecting terrain and trees to single volume
                if (treeVolume != null)
                {
                    terrainVolume.Subtract(treeVolume);
                    terrainVolume.ConnectToItself();
                    terrainVolume.Override(treeVolume);
                }

                //sent terrain to container
                container.AddVolume(terrainVolume);
                //container.AddVolume(treeVolume);
            }
        }
 public DirectoryEnumerateEntriesHandler([NotNull] VolumeContainer container)
     : base(container)
 {
 }
 //abstract
 public abstract void Collect(VolumeContainer container);
Exemple #29
0
            public static BackupFileInfo FromPath([CanBeNull] AbsolutePath backupPath, [NotNull] VolumeContainer container)
            {
                Guard.NotNull(container, nameof(container));

                return(backupPath == null ? null : new BackupFileInfo(backupPath, container));
            }
Exemple #30
0
 /// <summary>
 /// Creates or updates the volume container.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='deviceName'>
 /// The device name
 /// </param>
 /// <param name='volumeContainerName'>
 /// The name of the volume container.
 /// </param>
 /// <param name='parameters'>
 /// The volume container to be added or updated.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name
 /// </param>
 /// <param name='managerName'>
 /// The manager name
 /// </param>
 public static VolumeContainer BeginCreateOrUpdate(this IVolumeContainersOperations operations, string deviceName, string volumeContainerName, VolumeContainer parameters, string resourceGroupName, string managerName)
 {
     return(operations.BeginCreateOrUpdateAsync(deviceName, volumeContainerName, parameters, resourceGroupName, managerName).GetAwaiter().GetResult());
 }
Exemple #31
0
 /// <summary>
 /// Creates or updates the volume container.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='deviceName'>
 /// The device name
 /// </param>
 /// <param name='volumeContainerName'>
 /// The name of the volume container.
 /// </param>
 /// <param name='parameters'>
 /// The volume container to be added or updated.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name
 /// </param>
 /// <param name='managerName'>
 /// The manager name
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <VolumeContainer> BeginCreateOrUpdateAsync(this IVolumeContainersOperations operations, string deviceName, string volumeContainerName, VolumeContainer parameters, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, volumeContainerName, parameters, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }