예제 #1
0
		public MprVolume(Volumes.Volume volume, IEnumerable<IMprSliceSet> sliceSets)
		{
			Platform.CheckForNullReference(volume, "volume");

			// MprVolume is the de jure owner of the Volume
			// Everything else (like the SOPs) just hold transient references
			_volume = volume;

			_sliceSets = new ObservableDisposableList<IMprSliceSet>();
			if (sliceSets != null)
			{
				foreach (IMprSliceSet sliceSet in sliceSets)
				{
					if (sliceSet is IInternalMprSliceSet)
						((IInternalMprSliceSet) sliceSet).Parent = this;
					_sliceSets.Add(sliceSet);
				}
			}
			_sliceSets.EnableEvents = true;
			_sliceSets.ItemAdded += OnItemAdded;
			_sliceSets.ItemChanged += OnItemAdded;
			_sliceSets.ItemChanging += OnItemRemoved;
			_sliceSets.ItemRemoved += OnItemRemoved;

			// Generate a descriptive name for the volume
			PersonName patientName = new PersonName(_volume.DataSet[DicomTags.PatientsName].ToString());
			string patientId = _volume.DataSet[DicomTags.PatientId].ToString();
			string seriesDescription = _volume.DataSet[DicomTags.SeriesDescription].ToString();
			if (string.IsNullOrEmpty(seriesDescription))
				_description = string.Format(SR.FormatVolumeLabel, patientName.FormattedName, patientId, seriesDescription);
			else
				_description = string.Format(SR.FormatVolumeLabelWithSeries, patientName.FormattedName, patientId, seriesDescription);
		}
예제 #2
0
		public MprStandardSliceSet(Volumes.Volume volume, IVolumeSlicerParams slicerParams) : base(volume)
		{
			Platform.CheckForNullReference(slicerParams, "slicerParams");
			_slicerParams = slicerParams;

			base.Description = slicerParams.Description;
			this.Reslice();
		}
        /// <summary>
        /// Создать случайным методом котировку.
        /// </summary>
        /// <param name="startPrice">Начальная цена, от которой случайным методом необходимо получить цену котировки.</param>
        /// <param name="side">Направление котировки.</param>
        /// <returns>Случайная котировка.</returns>
        protected QuoteChange CreateQuote(decimal startPrice, Sides side)
        {
            var price = startPrice + (side == Sides.Sell ? 1 : -1) * Steps.Next() * SecurityDefinition.PriceStep;

            if (price <= 0)
            {
                price = SecurityDefinition.PriceStep;
            }

            return(new QuoteChange(side, price, Volumes.Next()));
        }
예제 #4
0
            private async Task PollVolumePerformanceUtilizationAsync()
            {
                const string query = @"
                    SELECT Name,
                           Timestamp_Sys100NS,
                           DiskReadBytesPersec,
                           DiskWriteBytesPersec
                      FROM Win32_PerfRawData_PerfDisk_LogicalDisk";

                var queryTime    = DateTime.UtcNow.ToEpochTime();
                var combinedUtil = new Volume.VolumePerformanceUtilization
                {
                    DateEpoch   = queryTime,
                    ReadAvgBps  = 0,
                    WriteAvgBps = 0
                };

                using (var q = Wmi.Query(Endpoint, query))
                {
                    foreach (var data in await q.GetDynamicResultAsync().ConfigureAwait(false))
                    {
                        var perfData = new PerfRawData(this, data);

                        var name  = perfData.Identifier;
                        var iface = Volumes.Find(i => name == GetCounterName(i.Name));
                        if (iface == null)
                        {
                            continue;
                        }

                        iface.ReadBps  = (float)perfData.GetCalculatedValue("DiskReadBytesPersec", 10000000);
                        iface.WriteBps = (float)perfData.GetCalculatedValue("DiskWriteBytesPersec", 10000000);

                        var util = new Volume.VolumePerformanceUtilization
                        {
                            DateEpoch   = queryTime,
                            ReadAvgBps  = iface.ReadBps,
                            WriteAvgBps = iface.WriteBps
                        };

                        var netData = VolumePerformanceHistory.GetOrAdd(iface.Name, k => new List <Volume.VolumePerformanceUtilization>(1024));
                        UpdateHistoryStorage(netData, util);

                        //if (PrimaryInterfaces.Contains(iface))
                        {
                            combinedUtil.ReadAvgBps  += util.ReadAvgBps;
                            combinedUtil.WriteAvgBps += util.WriteAvgBps;
                        }
                    }
                }

                UpdateHistoryStorage(CombinedVolumePerformanceHistory, combinedUtil);
            }
예제 #5
0
		protected MprSliceSet(Volumes.Volume volume)
		{
			Platform.CheckForNullReference(volume, "volume");
			_volume = volume.CreateReference();

			_sliceSops = new ObservableDisposableList<MprSliceSop>();
			_sliceSops.EnableEvents = true;
			_sliceSops.ItemAdded += OnItemAdded;
			_sliceSops.ItemChanged += OnItemChanged;
			_sliceSops.ItemChanging += OnItemChanging;
			_sliceSops.ItemRemoved += OnItemRemoved;
		}
예제 #6
0
 public VolumeTracker(float ulnaLength)
 {
     kinect = GameObject.Find("KinectManager").GetComponent<KinectManager>();
     transformMatrix = GameControl.Instance.TransformMatrix;
     volumes = new Volumes();
     offset = new Vector3(0.0f, -0.01f, 0.07f);
     if (ulnaLength > 0)
     {
         upperBound = ulnaLength / 100.0f;
         lowerBound = upperBound / 3.0f;
     }
 }
예제 #7
0
 public static string ToXML(
     this Volumes v)
 => new[]
 {
     "default",
     "silent",
     "x-soft",
     "soft",
     "medium",
     "loud",
     "x-loud",
 }[(int)v];
예제 #8
0
        //
        // Misc

        private void ListVSSVolumes()
        {
            using (VssClient vss = new VssClient(new VssHost()))
            {
                vss.Initialize(VssSnapshotContext.ClientAccessible, VssBackupType.Incremental);

                cblDriveLetters.Items.AddRange(
                    Volumes.ListVolumes()
                    .Where(v => vss.IsVolumeSupported(v.DeviceID))
                    .ToArray()
                    );
            }
        }
예제 #9
0
파일: CPU.cs 프로젝트: ehrenmurdick/KOS
        public CPU(object parent, string context)
        {
            this.Parent  = parent;
            this.Context = context;

            bindingManager = new BindingManager(this, Context);

            if (context == "ksp")
            {
                archive = new Archive();
                Volumes.Add(archive);
            }
        }
예제 #10
0
        public static string GetAffectedVolume(this VssWMFileDescriptor fileDesc, IUIHost host)
        {
            string expandedPath = AppendBackslash(Environment.ExpandEnvironmentVariables(fileDesc.Path));

            try
            {
                return(Volumes.GetUniqueVolumeNameForPath(host, expandedPath, true));
            }
            catch
            {
                return(expandedPath);
            }
        }
예제 #11
0
 internal List <Volume.VolumePerformanceUtilization> GetVolumePerformanceUtilizationHistory(Volume iface)
 {
     if (iface != null &&
         Volumes.Find(x => x == iface) != null &&
         VolumePerformanceHistory.ContainsKey(iface.Name))
     {
         return(VolumePerformanceHistory[iface.Name]);
     }
     else
     {
         return(new List <Volume.VolumePerformanceUtilization>(0));
     }
 }
예제 #12
0
 /// <summary>Default value.</summary>
 /// <returns>The default value and allocate ~250B of garbage.</returns>
 public static CameraSettings NewDefault() => new CameraSettings
 {
     bufferClearing = BufferClearing.NewDefault(),
     culling        = Culling.NewDefault(),
     renderingPathCustomFrameSettings = FrameSettings.NewDefaultCamera(),
     frustum = Frustum.NewDefault(),
     customRenderingSettings = false,
     volumes                     = Volumes.NewDefault(),
     flipYMode                   = HDAdditionalCameraData.FlipYMode.Automatic,
     invertFaceCulling           = false,
     probeLayerMask              = ~0,
     probeRangeCompressionFactor = 1.0f
 };
예제 #13
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                for (x = 0; (x < _volumes.Count); x = (x + 1))
                {
                    Volumes.Add(new LightVolumeVolumeBlockBlock());
                    Volumes[x].Read(reader);
                }
                for (x = 0; (x < _volumes.Count); x = (x + 1))
                {
                    Volumes[x].ReadChildData(reader);
                }
            }
예제 #14
0
 public void Init(SCIPackage package, ResType type, ushort number, byte resNum, int offset)
 {
     Package = package;
     Type    = type;
     Number  = number;
     if (type == ResType.Message && package.ExternalMessages)
     {
         Volumes.Add(new VolumeOffset(resNum, offset, "RESOURCE.MSG"));
     }
     else
     {
         Volumes.Add(new VolumeOffset(resNum, offset));
     }
 }
        public void AddToVolumes(string productName, int quantity)
        {
            Volume volume = Volumes.FirstOrDefault(v => v.ProductName.Equals(productName));

            if (volume == null)
            {
                volume = new Volume(productName, quantity);
                Volumes.Add(volume);
            }
            else
            {
                volume.TotalQuantity += quantity;
            }
        }
예제 #16
0
파일: CPU.cs 프로젝트: vosechu/KOS
        public override bool SwitchToVolume(string targetVolume)
        {
            foreach (var volume in Volumes.Where(volume => volume.Name.ToUpper() == targetVolume.ToUpper()))
            {
                if (volume.CheckRange())
                {
                    SelectedVolume = volume;
                    return(true);
                }
                throw new KOSException("Volume disconnected - out of range");
            }

            return(false);
        }
예제 #17
0
 public void Init(SCIPackage package, ResType type, ushort number, byte resNum, ResourceFileInfo info)
 {
     Package = package;
     Type    = type;
     Number  = number;
     if (type == ResType.Message && package.ExternalMessages)
     {
         Volumes.Add(new VolumeOffset(resNum, -1, "RESOURCE.MSG"));
     }
     else
     {
         Volumes.Add(new VolumeOffset(resNum, -1));
     }
     _info = info;
 }
예제 #18
0
        public static Volumes GetNodeVolumes(int nodeID)
        {
            Volumes volumes = new Volumes();

            using (SqlCommand textCommand = SqlHelper.GetTextCommand("SELECT * FROM Volumes WHERE NodeID=@NodeId"))
            {
                textCommand.Parameters.Add("@NodeId", SqlDbType.Int).Value = (object)nodeID;
                using (IDataReader reader = SqlHelper.ExecuteReader(textCommand))
                {
                    while (reader.Read())
                    {
                        ((Collection <int, Volume>)volumes).Add(DatabaseFunctions.GetInt32(reader, "VolumeID"), VolumeDAL.CreateVolume(reader));
                    }
                }
            }
            return(volumes);
        }
예제 #19
0
        /// <summary>
        /// Should be called after a node is created to set parent referneces
        /// and removed ignored interfaces, volumes, etc.
        ///
        /// This allows interfaces, volumes, etc. to poll through the provider
        /// </summary>
        public void AfterInitialize()
        {
            if (Interfaces != null)
            {
                var ignoredInterfaceRegex = GetSetting(s => s.IgnoredInterfaceRegEx);
                if (ignoredInterfaceRegex != null)
                {
                    Interfaces.RemoveAll(i => ignoredInterfaceRegex.IsMatch(i.Id));
                }

                Interfaces.ForEach(i => i.Node = this);
            }

            Volumes?.ForEach(v => v.Node  = this);
            Apps?.ForEach(a => a.Node     = this);
            Services?.ForEach(s => s.Node = this);
        }
예제 #20
0
        /// <summary>
        /// Загружает исходный текст с переводом в кингу
        /// </summary>
        /// <param name="package"></param>
        /// <returns></returns>
        public async Task Upload(SCIPackage package, string resourceName)
        {
            await CreateContext();

            await ReadVolumes();

            var document = await GetDocumentAsync(_bookUrl);

            Console.WriteLine("Getting strings");
            var res = package.GetResouce(resourceName);

            List <ResStrings> resStrings = new List <ResStrings>();
            var en = res.GetStrings(false);

            if (en == null || en.Length == 0)
            {
                return;
            }
            if (!en.Any(s => s.Length > 0))
            {
                return;                             // Full empty resource
            }
            var tr  = res.GetStrings(true);
            var str = new ResStrings {
                Resource = res, En = en, Tr = tr
            };

            resStrings.Add(str);

            Console.WriteLine($"Create {resStrings.Count} volumes");
            var vol = Volumes.FirstOrDefault(v => v.Name.Equals(res.FileName, StringComparison.OrdinalIgnoreCase));

            if (vol != null)
            {
                str.Url = vol.URL;
            }
            else
            {
                str.Url = await CreateVolume(document, res.FileName);
            }

            var tasks = resStrings
                        .Select(r => UploadRes(r))
                        .ToArray();
            await Task.WhenAll(tasks);
        }
예제 #21
0
        private double Conversion(string MeasurementType, string conversionType, double value)
        {
            Length      length      = new Length();
            Weights     weights     = new Weights();
            Volumes     volume      = new Volumes();
            Temperature temperature = new Temperature();

            if (MeasurementType == "length")
            {
                LengthUnit unit = length.SetUnitAndConvertLength(conversionType);

                if (unit == LengthUnit.FeetToInch || unit == LengthUnit.YardToInch || unit == LengthUnit.CentimeterToInch)
                {
                    return(length.ConvertLength(unit, value));
                }
            }

            if (MeasurementType == "weight")
            {
                WeightsUnit unit = weights.SetUnitAndConvertWeights(conversionType);
                if (unit.Equals(WeightsUnit.KilogramToGrams) || unit.Equals(WeightsUnit.TonneToKilograms))
                {
                    return(weights.ConvertWeigths(unit, value));
                }
            }

            if (MeasurementType == "volume")
            {
                VolumeUnit unit = volume.SetUnitAndConvertVolume(conversionType);
                if (unit.Equals(VolumeUnit.GallonToLiter) || unit.Equals(VolumeUnit.LiterToMilliliter) || unit.Equals(VolumeUnit.MilliliterToLiter))
                {
                    return(volume.ConvertVolumes(unit, value));
                }
            }
            if (MeasurementType == "temperature")
            {
                TemperatureUnit unit = temperature.SetUnitAndConvertTemperature(conversionType);
                if (unit.Equals(TemperatureUnit.CelsiusToFahrenheit))
                {
                    return(temperature.ConvertTemperature(unit, value));
                }
            }

            return(value);
        }
예제 #22
0
        protected HostingSettings GenerateHostingSettings()
        {
            //todo: add attributes for static env configuration
            var createOptions = new Dictionary <string, object>();
            var env           = new List <string> {
                Constants.ModuleNameConfigName + "=" + Name
            };


            if (Volumes.Count > 0)
            {
                var volumes = string.Join(',', Volumes.Select(e => $"\"/env/{e.Key.ToLower()}\": {{ {e.Value} }}"));
                env.Add($", \"Volumes\": {{ {volumes} }}");
            }

            createOptions.Add("Env", env);
            return(new HostingSettings(Name, createOptions));
        }
        public double ConvertMethod(double valueToConvert, Volumes from, Volumes to)
        {
            double ValueToWorkin;

            if (from == Volumes.litre)
            {
                ValueToWorkin = valueToConvert;
            }
            else
            {
                ValueToWorkin = valueToConvert / conversionRate[(int)from];
            }
            if (to != Volumes.litre)
            {
                ValueToWorkin = ValueToWorkin * conversionRate[(int)to];
            }
            return(ValueToWorkin);
        }
예제 #24
0
        public async Task <BookResponse> GetBookDetailAsync(string id)
        {
            BooksService googleApiBooksService = await _authenticationService.Authenticate();

            var book      = new BookResponse();
            var bookselve = await googleApiBooksService.Mylibrary.Bookshelves.List().ExecuteAsync();

            if (bookselve.Items == null)
            {
                return(await Task.FromResult(book));
            }

            var booksShelfItem = bookselve.Items.First();

            if (booksShelfItem.VolumeCount <= 0)
            {
                return(await Task.FromResult(book));
            }

            MylibraryResource.BookshelvesResource.VolumesResource.ListRequest request = googleApiBooksService.Mylibrary.Bookshelves.Volumes.List(booksShelfItem.Id.ToString());
            Volumes inBookshelf = await request.ExecuteAsync();

            if (inBookshelf.Items == null)
            {
                return(await Task.FromResult(book));
            }

            Volume bookDetail = inBookshelf.Items.FirstOrDefault(b => b.Id.Equals(id));

            if (bookDetail != null)
            {
                book = new BookResponse
                {
                    Id          = bookDetail.Id,
                    Title       = bookDetail.VolumeInfo?.Title,
                    Description = bookDetail.VolumeInfo?.Description,
                    Thumbnail   = bookDetail?.VolumeInfo?.ImageLinks.Thumbnail,
                    Author      = string.Join(",", bookDetail.VolumeInfo?.Authors ?? new List <string>()),
                    PublishDate = bookDetail.VolumeInfo?.PublishedDate
                };
            }

            return(await Task.FromResult(book));
        }
예제 #25
0
        public async Task <IEnumerable <BookResponse> > SearchBooksAsync(string searchTerm)
        {
            BooksService googleApiBooksService = await _authenticationService.Authenticate();

            var books     = Enumerable.Empty <BookResponse>();
            var bookselve = await googleApiBooksService.Mylibrary.Bookshelves.List().ExecuteAsync();

            if (bookselve.Items == null)
            {
                return(await Task.FromResult(books));
            }

            var booksShelfItem = bookselve.Items.First();

            if (booksShelfItem.VolumeCount <= 0)
            {
                return(await Task.FromResult(books));
            }

            MylibraryResource.BookshelvesResource.VolumesResource.ListRequest request = googleApiBooksService.Mylibrary.Bookshelves.Volumes.List(booksShelfItem.Id.ToString());
            Volumes inBookshelf = await request.ExecuteAsync();

            if (inBookshelf.Items == null)
            {
                return(await Task.FromResult(books));
            }

            IEnumerable <Volume> volumes = searchTerm == "all" ? inBookshelf.Items :
                                           inBookshelf.Items.Where(b => b.VolumeInfo.Title.Contains(searchTerm) ||
                                                                   b.VolumeInfo.Authors.Contains(searchTerm));

            books = volumes.Select(b => new BookResponse
            {
                Id             = b?.Id,
                Title          = b?.VolumeInfo?.Title,
                Description    = b?.VolumeInfo?.Description,
                SmallThumbnail = b?.VolumeInfo?.ImageLinks.SmallThumbnail,
                Author         = string.Join(",", b?.VolumeInfo?.Authors ?? new List <string>()),
                PublishDate    = b?.VolumeInfo?.PublishedDate
            });

            return(await Task.FromResult(books));
        }
예제 #26
0
    private void Awake()
    {
        // Make this persistent
        if (GameObject.FindGameObjectsWithTag("Persistent").Length > 1)
        {
            Destroy(gameObject);
            return;
        }
        DontDestroyOnLoad(gameObject);
        Globals.persistend = this;

        var sound_coll = new SoundCollection("sounds");

        SetCursor();
        UpdateOnMenu();

        Volumes.Initialize(Globals.settings.GetChild("sound volume"));
        DeveloppmentTools.Testing();
    }
예제 #27
0
            private async Task GetAllVolumes()
            {
                const string query = @"
SELECT Caption,
       DeviceID,
       Description,
       FreeSpace,
       Name,
       Size,
       VolumeSerialNumber
  FROM Win32_LogicalDisk
 WHERE DriveType = 3"; //fixed disks

                using (var q = Wmi.Query(Name, query))
                {
                    foreach (var disk in await q.GetDynamicResult())
                    {
                        var id = $"{disk.DeviceID}";
                        var v  = Volumes.FirstOrDefault(x => x.Id == id);
                        if (v == null)
                        {
                            v = new Volume();
                            Volumes.Add(v);
                        }

                        v.Id          = $"{disk.DeviceID}";
                        v.Available   = disk.FreeSpace;
                        v.Caption     = disk.VolumeSerialNumber;
                        v.Description = disk.Name + " - " + disk.Description;
                        v.Name        = disk.Name;
                        v.NodeId      = Id;
                        v.Size        = disk.Size;
                        v.Type        = "Fixed Disk";
                        v.Status      = NodeStatus.Active;
                        v.Used        = v.Size - v.Available;
                        if (v.Size > 0)
                        {
                            v.PercentUsed = (float)(100 * v.Used / v.Size);
                        }
                    }
                }
            }
예제 #28
0
            private async Task GetAllVolumesAsync()
            {
                const string query = @"
SELECT Caption,
       DeviceID,
       Description,
       FreeSpace,
       Name,
       Size,
       VolumeSerialNumber
  FROM Win32_LogicalDisk
 WHERE DriveType = 3"; //fixed disks

                using (var q = Wmi.Query(Endpoint, query))
                {
                    foreach (var disk in await q.GetDynamicResultAsync().ConfigureAwait(false))
                    {
                        var id = $"{disk.DeviceID}";
                        var v  = Volumes.Find(x => x.Id == id) ?? new Volume();

                        v.Id          = $"{disk.DeviceID}";
                        v.Available   = disk.FreeSpace;
                        v.Caption     = disk.VolumeSerialNumber;
                        v.Description = disk.Name + " - " + disk.Description;
                        v.Name        = disk.Name;
                        v.NodeId      = Id;
                        v.Size        = disk.Size;
                        v.Type        = "Fixed Disk";
                        v.Status      = NodeStatus.Active;
                        v.Used        = v.Size - v.Available;
                        if (v.Size > 0)
                        {
                            v.PercentUsed = 100 * v.Used / v.Size;
                        }
                        if (v.Node == null)
                        {
                            v.Node = this;
                            Volumes.Add(v);
                        }
                    }
                }
            }
예제 #29
0
        public CPU(object parent, string context)
        {
            this.Parent  = parent;
            this.Context = context;

            bindingManager = new BindingManager(this, Context);

            if (context == "ksp")
            {
                RunType = kOSRunType.KSP;

                archive = new Archive(Vessel);
                Volumes.Add(archive);
            }
            else
            {
                RunType = kOSRunType.WINFORMS;
            }

            this.RegisterkOSExternalFunction(new object[] { "test2", this, "testFunction", 2 });
        }
예제 #30
0
        //This method will filter out the book results such that only the books where all the needed fields are non-null are returned such that it can be used to create a book list without encoutering any errors
        //This method works by interating through each book from the results(passed into the method's arguments) and creating a new GoogleBookModel instance where it populates its attributes(properties) with the book data
        //retrieved from the Google book api. If no exception were thrown while populating the attributes then it is added to the list of GoogleBookModels. If an exception is thrown then don't add to that list. After
        //iterating through each book, the method returns the list of GoogleBooksModel which may be empty.
        private List <GoogleBookModel> GetBookListFromResults(Volumes results)
        {
            List <GoogleBookModel> books = new List <GoogleBookModel>();

            foreach (var book in results.Items)
            {
                GoogleBookModel googleBookModel = new GoogleBookModel();
                try
                {
                    googleBookModel.Title                    = (string)HandleNull(book.VolumeInfo.Title, DataType.String);
                    googleBookModel.Authors                  = (List <string>)HandleNull(book.VolumeInfo.Authors, DataType.StringList);
                    googleBookModel.ThumbnailUrl             = (string)HandleNull(book.VolumeInfo.ImageLinks.SmallThumbnail, DataType.String);
                    googleBookModel.IndustryIdentifiersDatas = (List <IndustryIdentifiersData>)HandleNull(book.VolumeInfo.IndustryIdentifiers, DataType.IndustryIdentifiersDataList);
                    books.Add(googleBookModel);
                }
                catch (Exception e) {
                    //Don't add that book to the list cause on the data attributes were null
                }
            }

            return(books);
        }
예제 #31
0
        public DeadWater(Volumes volume) : base(Power, IsRenewable)
        {
            switch (volume)
            {
            case Volumes.Large:
                _intVolume = 50;
                break;

            case Volumes.Normal:
                _intVolume = 25;
                break;

            case Volumes.Small:
                _intVolume = 10;
                break;

            default:
                _intVolume = 25;
                break;
            }
            _power = Power;
        }
예제 #32
0
        //Read the Settings.xml file.
        public void ReadSettings()
        {
            if (File.Exists("Settings.xml"))
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load("Settings.xml");

                Volumes loadVolumes = new Volumes();
                string  s, m, u, v;
                s = xDoc.SelectSingleNode("Settings/Volume/sfx").InnerText;
                m = xDoc.SelectSingleNode("Settings/Volume/music").InnerText;
                u = xDoc.SelectSingleNode("Settings/Volume/ui").InnerText;
                v = xDoc.SelectSingleNode("Settings/Volume/voice").InnerText;

                //Try loading the XML file
                try
                {
                    loadVolumes.sfx   = Convert.ToSingle(s);
                    loadVolumes.music = Convert.ToSingle(m);
                    loadVolumes.ui    = Convert.ToSingle(u);
                    loadVolumes.voice = Convert.ToSingle(v);
                }
                catch
                {
                    //If the converter fails on any node, rewrite the whole settings file and retry
                    WriteDefaultSettings();
                    return;
                }
                finally
                {
                    //If successful, commit the loaded variables into the global variables
                    Volume = loadVolumes;
                }
            }
            else
            {
                WriteDefaultSettings();
            }
        }
예제 #33
0
        public AquaVitae(Volumes volume) : base(_Power, IsRenewable)
        {
            switch (volume)
            {
            case Volumes.Large:
                _intVolume = 50;
                break;

            case Volumes.Normal:
                _intVolume = 25;
                break;

            case Volumes.Small:
                _intVolume = 10;
                break;

            default:
                _intVolume = 25;
                break;
            }

            _power = _Power;
        }
예제 #34
0
		protected static void ValidateVolumeSlicePoints(Volumes.Volume volume, IVolumeSlicerParams slicerParams, IList<KnownSample> expectedPoints)
		{
			ValidateVolumeSlicePoints(volume, slicerParams, expectedPoints, 0, 0, false);
		}
예제 #35
0
		public MprViewerComponent(Volumes.Volume volume) : this()
		{
			_volumes.Add(new MprVolume(volume));
		}
예제 #36
0
 /// <summary>Ensures that two axis aligned boxes are equal</summary>
 /// <param name="expected">Expected box</param>
 /// <param name="actual">Actual box</param>
 /// <param name="deltaUlps">Allowed deviation in representable floating point values</param>
 public static void AreAlmostEqual(
   Volumes.AxisAlignedBox3 expected, Volumes.AxisAlignedBox3 actual, int deltaUlps
 ) {
   AreAlmostEqual(expected, actual, deltaUlps, null);
 }
예제 #37
0
		public static MprStaticSliceSet CreateIdentitySliceSet(Volumes.Volume volume)
		{
			return new MprStaticSliceSet(volume, VolumeSlicerParams.Identity);
		}
예제 #38
0
    /// <summary>Ensures that two axis aligned boxes are equal</summary>
    /// <param name="expected">Expected box</param>
    /// <param name="actual">Actual box</param>
    /// <param name="deltaUlps">Allowed deviation in representable floating point values</param>
    /// <param name="message">Message to display when the boxes are not equal</param>
    public static void AreAlmostEqual(
      Volumes.AxisAlignedBox3 expected, Volumes.AxisAlignedBox3 actual,
      int deltaUlps, string message
    ) {

      bool almostEqual =
        FloatHelper.AreAlmostEqual(expected.Min.X, actual.Min.X, deltaUlps) &&
        FloatHelper.AreAlmostEqual(expected.Min.Y, actual.Min.Y, deltaUlps) &&
        FloatHelper.AreAlmostEqual(expected.Min.Z, actual.Min.Z, deltaUlps) &&
        FloatHelper.AreAlmostEqual(expected.Max.X, actual.Max.X, deltaUlps) &&
        FloatHelper.AreAlmostEqual(expected.Max.Y, actual.Max.Y, deltaUlps) &&
        FloatHelper.AreAlmostEqual(expected.Max.Z, actual.Max.Z, deltaUlps);

      if(almostEqual)
        return;

      // Now we already know that the two boxes are not equal even within the allowed
      // deviation (delta argument). In order to force NUnit to output a good error
      // message, we now let NUnit do the job again fully well knowing that it will
      // fail. This allows for deltas and good NUnit integration at the same time.
      Assert.AreEqual(expected, actual, message);

    }
예제 #39
0
    // Update is called once per frame
    void Update()
    {
        if (KinectManager.Instance.GetUsersCount() > 0)
        {
            timer += Time.deltaTime;
            if (timer > 3.0f)
            {
                if (!playing && timer - 3.0f < UserContainer.Instance.time)
                {
                    message = Languages.Instance.GetTranslation("PLAYING GAME");
                    StartGame();
                    startBell.Play();
                }
                else
                {
                    tracker.Update();
                    volumes = tracker.GetVolumes();
                }
            }
            else
            {
                message = Languages.Instance.GetTranslation("SETTING UP GAME");
                countdown.enabled = true;
                // Spawn Gems
                generator.enabled = true;

            }
            if (timer - 3.0f > UserContainer.Instance.time)
            {
                if (!DebugMode)
                {
                    GUIon = false;
                    endStats.enabled = true;
                    playing = false;
                    GameControl.Instance.IsPlaying = false;
                    GameControl.Instance.InGame = false;
                }
            }
            if (timer - 3.0f == UserContainer.Instance.time - 1.0f)
            {
                GameControl.Instance.CollectGem();
            }
        }
        else
        {
            message = Languages.Instance.GetTranslation("SKELETON NOT FOUND");
            return;
        }

        TimedScreenResize();
    }
예제 #40
0
		public VolumeSlicer(Volumes.Volume volume, IVolumeSlicerParams slicerParams)
		{
			_volume = volume.CreateReference();
			_slicerParams = slicerParams;
		}
예제 #41
0
		private static IEnumerable<IMprSliceSet> CreateDefaultSliceSets(Volumes.Volume volume)
		{
			// The default slice sets consist of a fixed view of the original image plane,
			// and three mutable slice sets showing the other two planes perpendicular to the original
			// plus one oblique slice set halfway in between these two perpendicular planes.
			if (volume != null)
			{
				yield return MprStaticSliceSet.CreateIdentitySliceSet(volume);
				yield return new MprStandardSliceSet(volume, VolumeSlicerParams.OrthogonalX);
				yield return new MprStandardSliceSet(volume, new VolumeSlicerParams(90, 0, 270));
				yield return new MprStandardSliceSet(volume, new VolumeSlicerParams(90, 0, 315));
			}
		}
예제 #42
0
		private static IEnumerable<IMprSliceSet> CreateStandardSliceSets(Volumes.Volume volume, IEnumerable<IVolumeSlicerParams> slicerParams)
		{
			if (volume != null && slicerParams != null)
			{
				foreach (IVolumeSlicerParams slicerParam in slicerParams)
					yield return new MprStandardSliceSet(volume, slicerParam);
			}
		}
예제 #43
0
		public MprVolume(Volumes.Volume volume) : this(volume, CreateDefaultSliceSets(volume)) {}
예제 #44
0
		public MprVolume(Volumes.Volume volume, IEnumerable<IVolumeSlicerParams> slicerParams) : this(volume, CreateStandardSliceSets(volume, slicerParams)) {}
예제 #45
0
		protected static void ValidateVolumeSlicePoints(Volumes.Volume volume, IVolumeSlicerParams slicerParams, IList<KnownSample> expectedPoints,
		                                                double xAxialGantryTilt, double yAxialGantryTilt, bool gantryTiltInDegrees)
		{
			if (gantryTiltInDegrees)
			{
				xAxialGantryTilt *= Math.PI/180;
				yAxialGantryTilt *= Math.PI/180;
			}

			Trace.WriteLine(string.Format("Using slice plane: {0}", slicerParams.Description));
			using (VolumeSlicer slicer = new VolumeSlicer(volume, slicerParams))
			{
				foreach (ISopDataSource slice in slicer.CreateSliceSops())
				{
					using (ImageSop imageSop = new ImageSop(slice))
					{
						foreach (IPresentationImage image in PresentationImageFactory.Create(imageSop))
						{
							IImageGraphicProvider imageGraphicProvider = (IImageGraphicProvider) image;
							DicomImagePlane dip = DicomImagePlane.FromImage(image);

							foreach (KnownSample sample in expectedPoints)
							{
								Vector3D patientPoint = sample.Point;
								if (xAxialGantryTilt != 0 && yAxialGantryTilt == 0)
								{
									float cos = (float) Math.Cos(xAxialGantryTilt);
									float sin = (float) Math.Sin(xAxialGantryTilt);
									patientPoint = new Vector3D(patientPoint.X,
									                            patientPoint.Y*cos + (xAxialGantryTilt > 0 ? 100*sin : 0),
									                            patientPoint.Z/cos - patientPoint.Y*sin - (xAxialGantryTilt > 0 ? 100*sin*sin/cos : 0));
								}
								else if (yAxialGantryTilt != 0)
								{
									Assert.Fail("Unit test not designed to work with gantry tilts about Y (i.e. slew)");
								}

								Vector3D slicedPoint = dip.ConvertToImagePlane(patientPoint);
								if (slicedPoint.Z > -0.5 && slicedPoint.Z < 0.5)
								{
									int actual = imageGraphicProvider.ImageGraphic.PixelData.GetPixel((int) slicedPoint.X, (int) slicedPoint.Y);
									Trace.WriteLine(string.Format("Sample {0} @{1} (SLICE: {2}; PATIENT: {3})", actual, FormatVector(sample.Point), FormatVector(slicedPoint), FormatVector(patientPoint)));
									Assert.AreEqual(sample.Value, actual, "Wrong colour sample @{0}", sample.Point);
								}
							}

							image.Dispose();
						}
					}
					slice.Dispose();
				}
			}
		}
예제 #46
0
        private void ReadFromIni(ACBrIniFile iniData)
        {
            iniData.ReadFromIni(ProcNFe, "procNFe");
            iniData.ReadFromIni(InfNFe, "infNFe");
            iniData.ReadFromIni(Identificacao, "Identificacao");

            var   i = 0;
            NFRef nfRef;

            do
            {
                i++;
                nfRef = iniData.ReadFromIni <NFRef>($"NFRef{i:000}");
                if (nfRef == null)
                {
                    continue;
                }

                Identificacao.NFref.Add(nfRef);
            } while (nfRef != null);

            iniData.ReadFromIni(Emitente, "Emitente");
            iniData.ReadFromIni(Avulsa, "Avulsa");
            iniData.ReadFromIni(Destinatario, "Destinatario");
            iniData.ReadFromIni(Retirada, "Retirada");
            iniData.ReadFromIni(Entrega, "Entrega");

            i = 0;
            AutXML autXml;

            do
            {
                i++;
                autXml = iniData.ReadFromIni <AutXML>($"autXML{i:00}");
                if (autXml == null)
                {
                    continue;
                }

                AutXml.Add(autXml);
            } while (autXml != null);

            i = 0;
            ProdutoNFe produto;

            do
            {
                i++;
                produto = iniData.ReadFromIni <ProdutoNFe>($"Produto{i:000}");
                if (produto == null)
                {
                    continue;
                }

                var    k = 0;
                NVENFe nveItem;
                do
                {
                    k++;
                    nveItem = iniData.ReadFromIni <NVENFe>($"NVE{i:000}{k:000}");
                    if (nveItem == null)
                    {
                        continue;
                    }

                    produto.NVE.Add(nveItem);
                } while (nveItem != null);

                k = 0;
                DINFe diItem;
                do
                {
                    k++;
                    diItem = iniData.ReadFromIni <DINFe>($"DI{i:000}{k:000}");
                    if (diItem == null)
                    {
                        continue;
                    }

                    var     j = 0;
                    LADINFe ladiItem;
                    do
                    {
                        j++;
                        ladiItem = iniData.ReadFromIni <LADINFe>($"DI{i:000}{k:000}{j:000}");
                        if (ladiItem != null)
                        {
                            diItem.LADI.Add(ladiItem);
                        }
                    } while (ladiItem != null);

                    produto.DI.Add(diItem);
                } while (diItem != null);

                k = 0;
                RastroNFe rastroItem;
                do
                {
                    k++;
                    rastroItem = iniData.ReadFromIni <RastroNFe>($"rastro{i:000}{k:000}");
                    if (rastroItem == null)
                    {
                        continue;
                    }

                    produto.Rastro.Add(rastroItem);
                } while (rastroItem != null);

                k = 0;
                MedicamentoNFe medItem;
                do
                {
                    k++;
                    medItem = iniData.ReadFromIni <MedicamentoNFe>($"Medicamento{i:000}{k:000}");
                    if (medItem == null)
                    {
                        continue;
                    }

                    produto.Medicamento.Add(medItem);
                } while (medItem != null);

                k = 0;
                ArmaNFe armaItem;
                do
                {
                    k++;
                    armaItem = iniData.ReadFromIni <ArmaNFe>($"Arma{i:000}{k:000}");
                    if (armaItem == null)
                    {
                        continue;
                    }

                    produto.Arma.Add(armaItem);
                } while (armaItem != null);

                iniData.ReadFromIni(produto.ImpostoDevol, $"impostoDevol{i:000}");
                iniData.ReadFromIni(produto.Veiculo, $"Veiculo{i:000}");
                iniData.ReadFromIni(produto.Combustivel, $"Combustivel{i:000}");
                iniData.ReadFromIni(produto.Combustivel.CIDE, $"CIDE{i:000}");
                iniData.ReadFromIni(produto.Combustivel.Encerrante, $"encerrante{i:000}");
                iniData.ReadFromIni(produto.ICMS, $"ICMS{i:000}");
                iniData.ReadFromIni(produto.IPI, $"IPI{i:000}");
                iniData.ReadFromIni(produto.II, $"II{i:000}");
                iniData.ReadFromIni(produto.PIS, $"PIS{i:000}");
                iniData.ReadFromIni(produto.PISST, $"PISST{i:000}");
                iniData.ReadFromIni(produto.COFINS, $"COFINS{i:000}");
                iniData.ReadFromIni(produto.COFINSST, $"COFINSST{i:000}");
                iniData.ReadFromIni(produto.ISSQN, $"ISSQN{i:000}");

                Produtos.Add(produto);
            } while (produto != null);

            iniData.ReadFromIni(Total, "Total");
            iniData.ReadFromIni(ISSQNtot, "ISSQNtot");
            iniData.ReadFromIni(RetTrib, "retTrib");
            iniData.ReadFromIni(Transportador, "Transportador");

            i = 0;
            ReboqueNFe reboque;

            do
            {
                i++;
                reboque = iniData.ReadFromIni <ReboqueNFe>($"Reboque{i:000}");
                if (reboque == null)
                {
                    continue;
                }

                Transportador.Reboque.Add(reboque);
            } while (reboque != null);

            i = 0;
            VolumeNFe volume;

            do
            {
                i++;
                volume = iniData.ReadFromIni <VolumeNFe>($"Volume{i:000}");
                if (volume == null)
                {
                    continue;
                }

                var       k = 0;
                LacresNFe lacre;
                do
                {
                    k++;
                    lacre = iniData.ReadFromIni <LacresNFe>($"Lacre{i:000}{k:000}");
                    if (lacre == null)
                    {
                        continue;
                    }

                    volume.Lacres.Add(lacre);
                } while (lacre != null);

                Volumes.Add(volume);
            } while (volume != null);

            iniData.ReadFromIni(Fatura, "Fatura");

            i = 0;
            DuplicataNFe duplicata;

            do
            {
                i++;
                duplicata = iniData.ReadFromIni <DuplicataNFe>($"Duplicata{i:000}");
                if (duplicata == null)
                {
                    continue;
                }

                Duplicatas.Add(duplicata);
            } while (duplicata != null);

            i = 0;
            PagamentoNFe pag;

            do
            {
                i++;
                pag = iniData.ReadFromIni <PagamentoNFe>($"pag{i:000}");
                if (pag == null)
                {
                    continue;
                }

                Pagamentos.Add(pag);
            } while (pag != null);

            iniData.ReadFromIni(DadosAdicionais, "DadosAdicionais");

            i = 0;
            InfoAdicionalNfe info;

            do
            {
                i++;
                info = iniData.ReadFromIni <InfoAdicionalNfe>($"obsCont{i:000}");
                if (info == null)
                {
                    continue;
                }

                DadosAdicionais.ObsCont.Add(info);
            } while (info != null);

            i = 0;
            do
            {
                i++;
                info = iniData.ReadFromIni <InfoAdicionalNfe>($"obsFisco{i:000}");
                if (info == null)
                {
                    continue;
                }

                DadosAdicionais.ObsFisco.Add(info);
            } while (info != null);

            i = 0;
            ProcRefNFe procRef;

            do
            {
                i++;
                procRef = iniData.ReadFromIni <ProcRefNFe>($"procRef{i:000}");
                if (procRef == null)
                {
                    continue;
                }

                DadosAdicionais.ProcRef.Add(procRef);
            } while (procRef != null);

            iniData.ReadFromIni(Exporta, "Exporta");
            iniData.ReadFromIni(Compra, "compra");
            iniData.ReadFromIni(Cana, "cana");

            i = 0;
            ForDiaNFe forDia;

            do
            {
                i++;
                forDia = iniData.ReadFromIni <ForDiaNFe>($"forDia{i:000}");
                if (forDia == null)
                {
                    continue;
                }

                Cana.forDia.Add(forDia);
            } while (forDia != null);

            i = 0;
            DeducNFe deduc;

            do
            {
                i++;
                deduc = iniData.ReadFromIni <DeducNFe>($"deduc{i:000}");
                if (deduc == null)
                {
                    continue;
                }

                Cana.deduc.Add(deduc);
            } while (deduc != null);

            iniData.ReadFromIni(InfRespTec, "infRespTec");
        }
예제 #47
0
    void Start()
    {
        tracker = new VolumeTracker(UserContainer.Instance.UserDictionary[UserContainer.Instance.currentUser].UlnaLength);
        volumes = new Volumes();

        GameObject[] backs = GameObject.FindGameObjectsWithTag("Back");
        foreach (GameObject back in backs)
        {
            back.transform.localPosition += new Vector3(0, 0.05f, 0);
        }

        timer = 0.0f;
        nativeVerticalResolution = 1080.0f;
        scaledResolutionWidth = nativeVerticalResolution / Screen.height * Screen.width;
        GUIon = true;
        if (UserContainer.Instance.UserDictionary[UserContainer.Instance.currentUser].Gender)
        {
            character = (GameObject)Instantiate(Resources.Load<GameObject>("Male"));
        }
        else
        {
            character = (GameObject)Instantiate(Resources.Load<GameObject>("Female"));
        }
        rightHand = GameObject.Find("RightHand").GetComponent<RightHandBehaviour>();
        leftHand = GameObject.Find("LeftHand").GetComponent<LeftHandBehaviour>();
        generator = GameObject.Find("GemGenerator").GetComponent<GemGenerator>();
        GameControl.Instance.ResetGemCount();
    }