Ejemplo n.º 1
0
		internal override bool Upgrade()
		{
			TI.VersionCtorAttribute attr = base.VersionCtorAttributeUsed;
			if (attr.Major == 1)
			{
				// Clear the layout of the old definition
				var old_parts = this[kOldPartsIndex] as TI.Block<global_geometry_part_block>;
				this.Clear();

				// Initialize the new parts
				Parts = new TI.Block<global_geometry_part_block_new>(this, 255);
				Parts.Resize(old_parts.Count);
				for (int x = 0; x < Parts.Count; x++)
					Parts[x].SetFromOld(old_parts[x]);
				old_parts = null;

				// Initialize the subparts
				Subparts = new TI.Block<global_subparts_block>(this, 32768);
				Subparts.Resize(Parts.Count);
				for (int x = 0; x < Parts.Count; x++)
					Subparts[x].SetFrom(Parts[x]);

				// Initialize the layout to the newest definition
				upgrade_build_version2_layout();
			}

			return true;
		}