Esempio n. 1
0
        public async Task <ActionResult> Result(IndexFitLocationViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Index", viewModel));
            }


            BoxLocation boxLocation = new BoxLocation()
            {
                Location = new Location()
                {
                    Length = viewModel.LocL,
                    Width  = viewModel.LocW,
                    Height = viewModel.LocH
                },
                Box = new Box()
                {
                    Length = viewModel.BoxL,
                    Width  = viewModel.BoxW,
                    Height = viewModel.BoxH
                }
            };
            string result = await SaveProduct(boxLocation);

            result = result.Trim(new Char[] { ' ', '"' });
            result = result.Replace(@"\n", Environment.NewLine);


            return(View(new ResultFixLocationViewModel()
            {
                Result = result
                         //Result = "Location: LWH\nBox : LWH\n\n52 ÷ 5 = 10 go back\n10 ÷ 5 = 2 go across\n15 ÷ 5 = 3 go up\n\nNumber total of boxes: 60\n\nInches Left\nL: 2\nW: 0\nH: 0\n"
            }));
        }
        public ColorInformationBox(BoxLocation location, SequentialReader sr)
            : base(location)
        {
            ColorType = sr.GetUInt32();

            switch (ColorType)
            {
            case NclxTag:
            {
                ColorPrimaries          = sr.GetUInt16();
                TransferCharacteristics = sr.GetUInt16();
                MatrixCharacteristics   = sr.GetUInt16();
                FullRangeFlag           = (sr.GetByte() & 128) == 128;
                IccProfile = _emptyByteArray;
                break;
            }

            case RICCTag:
            case ProfTag:
            {
                IccProfile = ReadRemainingData(sr);
                break;
            }

            default:
            {
                IccProfile = _emptyByteArray;
                break;
            }
            }
        }
Esempio n. 3
0
        public DecoderConfigurationBox(BoxLocation location, SequentialReader sr) : base(location)
        {
            var bitReader = new BitReader(sr);

            ConfigurationVersion             = bitReader.GetByte(8);
            GeneralProfileSpace              = bitReader.GetByte(2);
            GeneralTierTag                   = bitReader.GetByte(1);
            GeneralProfileIdc                = bitReader.GetByte(5);
            GeneralProfileCompatibilityFlags = bitReader.GetUInt32(32);
            for (int i = 0; i < 6; i++)
            {
                GeneralConstraintIndicatorFlags[i] = bitReader.GetByte(8);
            }

            GeneralLevelIdc = bitReader.GetByte(8);
            bitReader.GetUInt32(4); // reserved should be all 1's
            MinSpacialSegmentationIdc = bitReader.GetUInt16(12);
            bitReader.GetUInt32(6); // reserved should be all 1's
            ParallelismType = bitReader.GetByte(2);
            bitReader.GetUInt32(6); // reserved should be all 1's
            ChromaFormat = bitReader.GetByte(2);
            bitReader.GetUInt32(5); // reserved should be all 1's
            BitDepthLumaMinus8 = bitReader.GetByte(3);
            bitReader.GetUInt32(5); // reserved should be all 1's
            BitDepthChromaMinus8 = bitReader.GetByte(3);
            AvgFrameRate         = bitReader.GetUInt16(16);
            ConstantFrameRate    = bitReader.GetByte(2);
            NumTemporalLayers    = bitReader.GetByte(3);
            TemporalIdNested     = bitReader.GetByte(1);
            LengthSizeMinus1     = bitReader.GetByte(2);
        }
Esempio n. 4
0
    public void CameraEnteredBox(BoxLocation type)
    {
        Debug.Log("Camera entered box with type: " + type);

        switch (type)
        {
        case BoxLocation.empty:
            break;

        case BoxLocation.top:
            break;

        case BoxLocation.bottom:
            break;

        case BoxLocation.forward:
            break;

        case BoxLocation.backward:
            break;

        case BoxLocation.left:
            break;

        case BoxLocation.right:
            break;

        default:
            break;
        }
    }
 public HandlerBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     reader.GetUInt32(); // should be Zero
     HandlerType = reader.GetUInt32();
     reader.GetUInt32(); // should be Zero
     reader.GetUInt32(); // should be Zero
     reader.GetUInt32(); // should be Zero
     TrackType = reader.GetString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
 }
Esempio n. 6
0
        public async Task <IActionResult> BestWayToFit([FromBody] BoxLocation boxLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            BoxWay bestFit = FindTheBestWay(boxLocation.Location, boxLocation.Box);

            return(Ok(bestFit.ToString()));
        }
Esempio n. 7
0
        public async Task <IActionResult> InchesLeft([FromBody] BoxLocation boxLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            BoxWay bestFit = FindTheBestWay(boxLocation.Location, boxLocation.Box);

            return(Ok(InchesLeft(boxLocation.Location, boxLocation.Box, bestFit)));
        }
 public SingleItemTypeReferenceBox(BoxLocation loc, SequentialReader sr, byte parentVersion) : base(loc)
 {
     FromItemId     = parentVersion == 0 ? sr.GetUInt16() : sr.GetUInt32();
     ReferenceCount = sr.GetUInt16();
     ToItemIds      = new uint[ReferenceCount];
     for (int i = 0; i < ReferenceCount; i++)
     {
         ToItemIds[i] = parentVersion == 0 ? sr.GetUInt16() : sr.GetUInt32();
     }
 }
Esempio n. 9
0
        public FileTypeBox(BoxLocation loc, SequentialReader sr) : base(loc)
        {
            MajorBrand = sr.GetUInt32();
            MinorBrand = sr.GetUInt32();
            var cBrands = new List <uint>();

            CompatibleBrands = cBrands;
            while (sr.IsWithinBox(loc))
            {
                cBrands.Add(sr.GetUInt32());
            }
        }
Esempio n. 10
0
        public ItemReferenceBox(BoxLocation location, SequentialReader reader)
            : base(location, reader)
        {
            var list = new List <SingleItemTypeReferenceBox>();

            while (reader.IsWithinBox(location))
            {
                var box = BoxReader.ReadBox(reader, (l, r) => new SingleItemTypeReferenceBox(l, r, Version));
                if (box != null)
                {
                    list.Add((SingleItemTypeReferenceBox)box);
                }
            }
            Boxes = list;
        }
        private const uint UriTag  = 0x75726920; // fdel

        public ItemInfoEntryBox(BoxLocation location, SequentialReader reader)
            : base(location, reader)
        {
            if (Version <= 1)
            {
                ItemId = reader.GetUInt16();
                ItemProtectionIndex = reader.GetUInt16();
                ItemName            = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
            }

            if (Version == 1)
            {
                ExtensionType = reader.GetUInt32();
                if (ExtensionType == FdelTag)
                {
                    Location       = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
                    MD5            = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
                    ContentLength  = reader.GetUInt64();
                    TransferLength = reader.GetUInt64();
                    GroupIdCount   = reader.GetByte();
                    GroupIds       = new uint[GroupIdCount];
                    for (int i = 0; i < GroupIdCount; i++)
                    {
                        GroupIds[i] = reader.GetUInt32();
                    }
                }
            }

            if (Version >= 2)
            {
                ItemId = Version == 2 ? reader.GetUInt16() : reader.GetUInt32();
                ItemProtectionIndex = reader.GetUInt16();
                ItemType            = reader.GetUInt32();
                ItemName            = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);

                if (ItemType == MimeTag)
                {
                    ContentType     = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
                    ContentEncoding = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
                }

                if (ItemType == UriTag)
                {
                    ItemUri = reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
                }
            }
        }
Esempio n. 12
0
        public ItemLocationBox(BoxLocation location, SequentialReader reader)
            : base(location, reader)
        {
            var bitReader = new BitReader(reader);

            OffsetSize     = bitReader.GetByte(4);
            LengthSize     = bitReader.GetByte(4);
            BaseOffsetSize = bitReader.GetByte(4);
            if (Version == 1 || Version == 2)
            {
                IndexSize = bitReader.GetByte(4);
            }
            else
            {
                bitReader.GetByte(4);
            }

            ItemCount     = Version < 2 ? bitReader.GetUInt32(16) : bitReader.GetUInt32(32);
            ItemLocations = ParseLocationArray(reader);
        }
Esempio n. 13
0
        public async Task <string> SaveProduct(BoxLocation boxLocation)
        {
            string data = "null";

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://hobbylobbysb-dev.us-west-2.elasticbeanstalk.com/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                StringContent content = new StringContent(JsonConvert.SerializeObject(boxLocation), Encoding.UTF8, "application/json");
                // HTTP POST
                HttpResponseMessage response = await client.PostAsync("api/core/v1/CompleteReport", content);

                if (response.IsSuccessStatusCode)
                {
                    data = await response.Content.ReadAsStringAsync();
                }
            }
            return(data);
        }
Esempio n. 14
0
        public async Task <IActionResult> CompleteReport([FromBody] BoxLocation boxLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            BoxWay bestFit = FindTheBestWay(boxLocation.Location, boxLocation.Box);

            string temp = "";

            temp += "Location: LWH\n";
            temp += "Box     : " + bestFit + "\n\n";
            temp += ShowBestWayCalcutions(boxLocation.Location, boxLocation.Box, bestFit) + "\n";
            temp += "Number total of boxes: " + HowManyCanFit(boxLocation.Location, boxLocation.Box, bestFit) + "\n\n";
            Location locationLeft = InchesLeft(boxLocation.Location, boxLocation.Box, bestFit);

            temp += "Inches Left\n";
            temp += "L: " + locationLeft.Length + "\n";
            temp += "W: " + locationLeft.Width + "\n";
            temp += "H: " + locationLeft.Height + "\n";
            return(Ok(temp));
        }
Esempio n. 15
0
        }                             // rotation is anti-clockwise and valid values are 0,90,180, and 270

        public ImageRotationBox(BoxLocation boxLocation, SequentialReader sr) : base(boxLocation)
        {
            Rotation = (uint)((sr.GetByte() & 3) * 90);
        }
Esempio n. 16
0
    private void Start()
    {
        if (OccupiedBoxes.Contains(gameObject.name)) {
            _boxcond = BoxCondition.Occupied;
            _furniture = gameObject;
            //GetComponent<Renderer>().enabled = true;
            //GetComponent<Renderer>().material.color = Color.red;
        }

        if (gameObject.name.Contains(", 0")) {
            _boxloc = BoxLocation.South;
        } else if (gameObject.name.Contains(", 7")) {
            _boxloc = BoxLocation.North;
        } else if (gameObject.name.Contains("7, ")) {
            _boxloc = BoxLocation.East;
        } else if (gameObject.name.Contains("0, ")) {
            _boxloc = BoxLocation.West;
        } else {
            _boxloc = BoxLocation.Middle;
        }
    }
Esempio n. 17
0
            public override async void OnLocationResult(LocationResult result)
            {
                base.OnLocationResult(result);

                try
                {
                    if (result == null)
                    {
                        return;
                    }
                    StaticBox.Latitude  = result.LastLocation.Latitude;
                    StaticBox.Longitude = result.LastLocation.Longitude;

                    s_longitude.Text = result.LastLocation.Latitude.ToString();
                    s_latitude.Text  = result.LastLocation.Longitude.ToString();
                    s_date_time.Text = DateTime.Now.ToString();

                    // Получаю информацию о клиенте.
                    BoxLocation gpsLocation = new BoxLocation
                    {
                        id   = StaticBox.DeviceId,
                        lat1 = result.LastLocation.Latitude.ToString().Replace(",", "."),
                        lon1 = result.LastLocation.Longitude.ToString().Replace(",", "."),
                        date = DateTime.Now,
                    };

                    int signal = 0;

                    var myHttpClient = new HttpClient();
                    // var uri = new Uri("http://iot-tmc-cen.1gb.ru/api/container/setcontainerlocation?id=" + gpsLocation.id + "&lat1=" + gpsLocation.lat1 + "&lon1=" + gpsLocation.lon1 + "&date=" + gpsLocation.date);
                    var uri2 = new Uri("http://smartboxcity.ru:8003/imitator/geo");


                    //json структура.
                    FormUrlEncodedContent formUrlEncodedContent = new FormUrlEncodedContent(new Dictionary <string, string>
                    {
                        { "Id", gpsLocation.id },
                        { "Lon1", gpsLocation.lon1.ToString().Replace(",", ".") },
                        { "Lat1", gpsLocation.lat1.ToString().Replace(",", ".") },
                        { "Date", DateTime.Now.ToString() }
                    });
                    var formContent = formUrlEncodedContent;

                    // HttpResponseMessage response = await myHttpClient.PostAsync(uri.ToString(), formContent);// !!!!
                    HttpResponseMessage responseFromAnotherServer = await myHttpClient.PostAsync(uri2.ToString(), formContent);

                    AuthApiData <BaseResponseObject> o_data = new AuthApiData <BaseResponseObject>();

                    //string s_result;
                    //using (HttpContent responseContent = response.Content)
                    //{
                    //    s_result = await responseContent.ReadAsStringAsync();
                    //}

                    string s_result_from_another_server;
                    using (HttpContent responseContent = responseFromAnotherServer.Content)
                    {
                        s_result_from_another_server = await responseContent.ReadAsStringAsync();
                    }

                    if (responseFromAnotherServer.IsSuccessStatusCode)
                    {
                        o_data = JsonConvert.DeserializeObject <AuthApiData <BaseResponseObject> >(s_result_from_another_server);
                        Toast.MakeText(Application.Context, o_data.Message, ToastLength.Short).Show();
                    }
                    else
                    {
                        ErrorResponseObject error = new ErrorResponseObject();
                        error = JsonConvert.DeserializeObject <ErrorResponseObject>(s_result_from_another_server);
                        Toast.MakeText(Application.Context, error.Errors[0], ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(Application.Context, ex.Message, ToastLength.Short).Show();
                }
            }
 protected FullBox(BoxLocation location, SequentialReader reader)
     : base(location)
 {
     _typeAndFlags = reader.GetUInt32();
 }
 public ItemDataBox(BoxLocation location, SequentialReader sr)
     : base(location)
 {
     Data = ReadRemainingData(sr);
 }
 public PixelInformationBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     ChannelCount   = reader.GetByte();
     BitsPerChannel = reader.GetBytes(ChannelCount);
 }
Esempio n. 21
0
            public override async void OnLocationResult(LocationResult result)
            {
                base.OnLocationResult(result);

                try
                {
                    StaticBox.Latitude  = result.LastLocation.Latitude;
                    StaticBox.Longitude = result.LastLocation.Longitude;
                    StaticBox.Signal    = 0;
                    StaticBox.Date      = DateTime.Now;



                    // Получаю информацию о клиенте.
                    BoxLocation gpsLocation = new BoxLocation
                    {
                        id     = StaticBox.SmartBoxId,
                        lat1   = StaticBox.Latitude,
                        lon1   = StaticBox.Longitude,
                        signal = StaticBox.Signal,
                        date   = StaticBox.Date
                    };



                    var myHttpClient = new HttpClient();
                    var uri          = new Uri("http://iot-tmc-cen.1gb.ru/api/container/setcontainerlocation?id=" + gpsLocation.id + "&lat1=" + gpsLocation.lat1 + "&lon1=" + gpsLocation.lon1 + "&signal=" + gpsLocation.signal + "&date=" + gpsLocation.date);
                    var uri2         = new Uri("http://81.177.136.11:8003/geo?id=" + gpsLocation.id + "&lat1=" + gpsLocation.lat1 + "&lon1=" + gpsLocation.lon1 + "&signal=" + gpsLocation.signal + "&date=" + gpsLocation.date);
                    //json структура.
                    var formContent = new FormUrlEncodedContent(new Dictionary <string, string>
                    {
                        { "Id", gpsLocation.id },
                        { "Lon1", gpsLocation.lon1.ToString() },
                        { "Lat1", gpsLocation.lat1.ToString() },
                        { "Signal", "0" },
                        { "Date", DateTime.Now.ToString() }
                    });

                    HttpResponseMessage response = await myHttpClient.PostAsync(uri.ToString(), formContent);// !!!!

                    HttpResponseMessage responseFromAnotherServer = await myHttpClient.PostAsync(uri2.ToString(), new StringContent(JsonConvert.SerializeObject(gpsLocation), Encoding.UTF8, "application/json"));

                    AuthApiData <BaseResponseObject> o_data = new AuthApiData <BaseResponseObject>();

                    string s_result;
                    using (HttpContent responseContent = response.Content)
                    {
                        s_result = await responseContent.ReadAsStringAsync();
                    }

                    string s_result_from_another_server;
                    using (HttpContent responseContent = responseFromAnotherServer.Content)
                    {
                        s_result_from_another_server = await responseContent.ReadAsStringAsync();
                    }

                    o_data = JsonConvert.DeserializeObject <AuthApiData <BaseResponseObject> >(s_result);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
Esempio n. 22
0
 public DataInformationBox(BoxLocation loc, SequentialReader sr)
     : base(loc)
 {
     Boxes = BoxReader.ReadBoxes(sr, loc);
 }
 public ImageSpatialExtentsBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     X = reader.GetUInt32();
     Y = reader.GetUInt32();
 }
Esempio n. 24
0
 public DataReferenceBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     BoxCount = reader.GetUInt32();
     Boxes    = BoxReader.ReadBoxes(reader, location);
 }
Esempio n. 25
0
 public ItemInformationBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     Count = Version == 0 ? reader.GetUInt16() : reader.GetUInt32();
     Boxes = BoxReader.ReadBoxes(reader, location);
 }
Esempio n. 26
0
 public ItemPropertyAssociationBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     EntryCount = reader.GetUInt32();
     Entries    = ParseEntries(reader);
 }
Esempio n. 27
0
 public DataEntryLocationBox(BoxLocation location, SequentialReader reader, bool hasName)
     : base(location, reader)
 {
     Name     = hasName ? reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8) : "";
     Location = !reader.IsWithinBox(location) ? "" : reader.GetNullTerminatedString((int)reader.BytesRemainingInBox(location), Encoding.UTF8);
 }
Esempio n. 28
0
 public PrimaryItemBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     PrimaryItem = Version == 0 ? reader.GetUInt16() : reader.GetUInt32();
 }
Esempio n. 29
0
 public ItemPropertyBox(BoxLocation loc, SequentialReader sr) : base(loc)
 {
     Boxes = BoxReader.ReadBoxes(sr, loc);
 }
 public MetaBox(BoxLocation location, SequentialReader reader)
     : base(location, reader)
 {
     Boxes = BoxReader.ReadBoxes(reader, location);
 }