Example #1
0
 public static Offset <Footer> CreateFooter(FlatBufferBuilder builder,
                                            MetadataVersion version          = MetadataVersion.V1,
                                            Offset <Schema> schemaOffset     = default(Offset <Schema>),
                                            VectorOffset dictionariesOffset  = default(VectorOffset),
                                            VectorOffset recordBatchesOffset = default(VectorOffset))
 {
     builder.StartObject(4);
     Footer.AddRecordBatches(builder, recordBatchesOffset);
     Footer.AddDictionaries(builder, dictionariesOffset);
     Footer.AddSchema(builder, schemaOffset);
     Footer.AddVersion(builder, version);
     return(Footer.EndFooter(builder));
 }
Example #2
0
 public static Offset <Message> CreateMessage(FlatBufferBuilder builder,
                                              MetadataVersion version   = MetadataVersion.V1,
                                              MessageHeader header_type = MessageHeader.NONE,
                                              int headerOffset          = 0,
                                              long bodyLength           = 0)
 {
     builder.StartObject(4);
     Message.AddBodyLength(builder, bodyLength);
     Message.AddHeader(builder, headerOffset);
     Message.AddVersion(builder, version);
     Message.AddHeaderType(builder, header_type);
     return(Message.EndMessage(builder));
 }
 public CommandInfo(MetadataVersion version, Encoding encoding, string mediaType, string schema, string schemaVersion)
 {
     if (version == null)
     {
         throw new ArgumentNullException(nameof(version));
     }
     if (mediaType == null)
     {
         throw new ArgumentNullException(nameof(mediaType));
     }
     Version       = version;
     Encoding      = encoding;
     MediaType     = mediaType;
     Schema        = schema;
     SchemaVersion = schemaVersion;
 }
        private CommandInfo ExtractCommandInfo(NancyContext context)
        {
            var contentType = context.Request.Headers.ContentType;

            if (contentType == null)
            {
                return(null);
            }
            MediaTypeHeaderValue header;

            if (!MediaTypeHeaderValue.TryParse(contentType, out header))
            {
                return(null);
            }
            var encoding = default(Encoding);

            if (header.CharSet != null)
            {
                encoding = Encoding.GetEncoding(header.CharSet);
            }
            var domainModel = header.Parameters.FirstOrDefault(p => p.Name == "domain-model")?.Value;
            var ver         = header.Parameters.FirstOrDefault(p => p.Name == "domain-version")?.Value;

            if (domainModel == null || ver == null)
            {
                return(null);
            }
            DomainVersion domver;

            if (!DomainVersion.TryParse(ver, out domver))
            {
                return(null);
            }
            var version = new MetadataVersion(domainModel, domver);

            return(new CommandInfo(version, encoding,
                                   header.MediaType,
                                   header.Parameters.FirstOrDefault(p => p.Name == "schema")?.Value,
                                   header.Parameters.FirstOrDefault(p => p.Name == "schema-version")?.Value));
        }
Example #5
0
        public static void Reset(bool full)
        {
            if (full)
            {
                root = null;
            }

            type_container_resolve_order = new ArrayList();
            EntryPoint             = null;
            Checked                = false;
            Unsafe                 = false;
            StdLib                 = true;
            StrongNameKeyFile      = null;
            StrongNameKeyContainer = null;
            StrongNameDelaySign    = false;
            MainClass              = null;
            Target                 = Target.Exe;
            TargetExt              = ".exe";
#if GMCS_SOURCE
            Platform = Platform.AnyCPU;
#endif
            Version            = LanguageVersion.Default;
            Documentation      = null;
            impl_details_class = null;
            helper_classes     = null;

#if GMCS_SOURCE
            MetadataCompatibilityVersion = MetadataVersion.v2;
#else
            MetadataCompatibilityVersion = MetadataVersion.v1;
#endif

            //
            // Setup default defines
            //
            AllDefines = new ArrayList();
            AddConditional("__MonoCS__");
        }
Example #6
0
        public static void Reset(bool full)
        {
            impl_details_class = null;
            helper_classes = null;

            if (!full)
                return;

            EntryPoint = null;
            Checked = false;
            Unsafe = false;
            StdLib = true;
            StrongNameKeyFile = null;
            StrongNameKeyContainer = null;
            StrongNameDelaySign = false;
            MainClass = null;
            Target = Target.Exe;
            TargetExt = ".exe";
            Platform = Platform.AnyCPU;
            Version = LanguageVersion.Default;
            Documentation = null;
            impl_details_class = null;
            helper_classes = null;

            #if NET_4_0
            MetadataCompatibilityVersion = MetadataVersion.v4;
            #else
            MetadataCompatibilityVersion = MetadataVersion.v2;
            #endif

            //
            // Setup default defines
            //
            AllDefines = new List<string> ();
            AddConditional ("__MonoCS__");
        }
Example #7
0
		public static void Reset (bool full)
		{
			if (!full)
				return;
			
			Checked = false;
			Unsafe = false;
			StdLib = true;
			StrongNameKeyFile = null;
			StrongNameKeyContainer = null;
			StrongNameDelaySign = false;
			MainClass = null;
			Target = Target.Exe;
			TargetExt = ".exe";
			Platform = Platform.AnyCPU;
			Version = LanguageVersion.Default;
			VerifyClsCompliance = true;
			Optimize = true;
			Documentation = null;
			GenerateDebugInfo = false;
			Win32IconFile = null;
			Win32ResourceFile = null;
			Resources = null;
			LoadDefaultReferences = true;
			AssemblyReferences = new List<string> ();
			AssemblyReferencesAliases = new List<Tuple<string, string>> ();
			Modules = new List<string> ();
			ReferencesLookupPaths = new List<string> ();

#if NET_4_0
			MetadataCompatibilityVersion = MetadataVersion.v4;
#else
			MetadataCompatibilityVersion = MetadataVersion.v2;
#endif

			//
			// Setup default defines
			//
			AllDefines = new List<string> ();
			AddConditional ("__MonoCS__");
		}
Example #8
0
 public static void AddVersion(FlatBufferBuilder builder, MetadataVersion version)
 {
     builder.AddShort(0, (short)version, 0);
 }
		public static void Reset (bool full)
		{
			if (full)
				root = null;
			
			type_container_resolve_order = new ArrayList ();
			EntryPoint = null;
			Checked = false;
			Unsafe = false;
			StdLib = true;
			StrongNameKeyFile = null;
			StrongNameKeyContainer = null;
			StrongNameDelaySign = false;
			MainClass = null;
			Target = Target.Exe;
			TargetExt = ".exe";
#if GMCS_SOURCE
			Platform = Platform.AnyCPU;
#endif
			Version = LanguageVersion.Default;
			Documentation = null;
			impl_details_class = null;
			helper_classes = null;

#if GMCS_SOURCE
			MetadataCompatibilityVersion = MetadataVersion.v2;
#else
			MetadataCompatibilityVersion = MetadataVersion.v1;
#endif

			//
			// Setup default defines
			//
			AllDefines = new ArrayList ();
			AddConditional ("__MonoCS__");
		}
        public static Depthkit_Metadata CreateFromJSON(string jsonString)
        {
            Depthkit_Metadata metadata;
            MetadataVersion   mdVersion = JsonUtility.FromJson <MetadataVersion>(jsonString);

            // Read and upgrade old single perspective format.
            if (mdVersion._versionMajor == 0 && mdVersion._versionMinor < 3)
            {
                MetadataSinglePerspective md = JsonUtility.FromJson <MetadataSinglePerspective>(jsonString);

                //for version 1.0 (from Depthkit Visualize) fill in defaults for missing parameters
                if (mdVersion.format == "perpixel" && mdVersion._versionMinor == 1)
                {
                    //set final image dimensions
                    md.textureWidth  = (int)(md.depthImageSize.x);
                    md.textureHeight = (int)(md.depthImageSize.y) * 2;

                    //calculate bounds
                    md.boundsCenter = new Vector3(0f, 0f, (md.farClip - md.nearClip) / 2.0f + md.nearClip);
                    md.boundsSize   = new Vector3(md.depthImageSize.x * md.farClip / md.depthFocalLength.x,
                                                  md.depthImageSize.y * md.farClip / md.depthFocalLength.y,
                                                  md.farClip - md.nearClip);

                    md.numAngles = 1;

                    // check if we have a zero'd crop (is this possible?), if so default to full window
                    if (md.crop.x <= eps && md.crop.y <= eps && md.crop.z <= eps && md.crop.w <= eps)
                    {
                        md.crop = new Vector4(0.0f, 0.0f, 1.0f, 1.0f);
                    }

                    md.extrinsics = Matrix4x4.identity;
                }

                if (md.clipEpsilon < eps)
                {
                    md.clipEpsilon = 0.005f; // default depth clipping epsilon, set for older versions of metadata
                }

                metadata = Depthkit_Metadata.FromSinglePerspective(md);

                // Inverse all extrinsics matrices
                for (int i = 0; i < metadata.perspectives.Length; ++i)
                {
                    metadata.perspectives[i].extrinsics = Matrix4x4.Inverse(metadata.perspectives[i].extrinsics);
                }
            }
            else
            {
                // Read multiperspective format.
                metadata = JsonUtility.FromJson <Depthkit_Metadata>(jsonString);
                metadata.boundsCenter.z *= -1;

                for (int i = 0; i < metadata.perspectives.Length; ++i)
                {
                    //unity's coordinate space is mirrored from what Depthkit produces, apply a simple inversion here
                    Matrix4x4 mirror = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1.0f, 1.0f, -1.0f));

                    metadata.perspectives[i].extrinsics    = mirror * metadata.perspectives[i].extrinsics;
                    metadata.perspectives[i].extrinsicsInv = metadata.perspectives[i].extrinsics.inverse;

                    metadata.perspectives[i].cameraCenter = (metadata.perspectives[i].extrinsics * new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
                    metadata.perspectives[i].cameraNormal = (metadata.perspectives[i].extrinsics * new Vector4(0.0f, 0.0f, 1.0f, 0.0f)).normalized;
                }
            }

            return(metadata);
        }