/// <summary> /// Create a 1:1 Clone based on the CRES Name /// </summary> /// <param name="cres"></param> /// <returns></returns> public static SimPe.Packages.GeneratableFile CreatCloneByCres(string cres) { SimPe.Packages.GeneratableFile package = SimPe.Packages.GeneratableFile.CreateNew(); SimPe.Interfaces.IAlias a; Interfaces.Files.IPackedFileDescriptor pfd; uint localgroup; OWCloneSettings cs; ObjectWorkshopHelper.PrepareForClone(package, out a, out localgroup, out pfd, out cs); SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str(); str.FileDescriptor = new SimPe.Packages.PackedFileDescriptor(); str.FileDescriptor.Type = Data.MetaData.STRING_FILE; str.FileDescriptor.LongInstance = 0x85; str.FileDescriptor.Group = 0x7F000000; package.Add(str.FileDescriptor); string name = cres.ToLower().Trim(); if (!name.EndsWith("_cres")) { name += "_cres"; } str.FileName = "Model - Names"; str.Add(new SimPe.PackedFiles.Wrapper.StrToken(0, (byte)Data.MetaData.Languages.English, "", "")); str.Add(new SimPe.PackedFiles.Wrapper.StrToken(1, (byte)Data.MetaData.Languages.English, name, "")); str.SynchronizeUserData(); str.FileDescriptor.MarkForDelete = true; return(ObjectWorkshopHelper.Start(package, a, ref pfd, localgroup, cs, true)); }
protected static void UpdateDescription(OWCloneSettings cs, SimPe.PackedFiles.Wrapper.Str str) { str.ClearNonDefault(); while (str.Items.Length < 2) { str.Add(new SimPe.PackedFiles.Wrapper.StrToken(str.Items.Length, 1, "", "")); } str.Items[0].Title = cs.Title; str.Items[1].Title = cs.Description; str.SynchronizeUserData(); }