private bool PopulateSummaryPreChecks(ref AddonPackageSource pSource, out string pErrorText) { pErrorText = null; if (pSource == null) { if (AddonSource == null) { pErrorText = "No addon source specification"; return(false); } pSource = AddonSource; } else { AddonSource = pSource; } if (AddonSource.SourceType == AddonPackageSourceType.Invalid) { pErrorText = "Invalid addon source"; return(false); } return(true); }
public PropModelsSummary(AddonPackageSource pSource, string pTempFolderPath, List <PropModelItem> pPropModelItems, bool pLoadAnimations = true) { AddonSource = pSource; TempFolderPath = pTempFolderPath?.Trim(); PropModelItems = pPropModelItems; LoadAnimations = pLoadAnimations; }
// --------------------------------------------------------------------------------------------------------- public bool PopulateSummary(out string pErrorText, AddonPackageSource pSource = null) { pErrorText = null; if (_initialized) { return(true); } if (!PopulateSummaryPreChecks(ref pSource, out pErrorText)) { return(false); } bool isOk = true; try { Assets = AddonSource.SourceType == AddonPackageSourceType.Folder ? CreateAssetsSummary(AddonSource.SourcePath, out pErrorText) : CreateAssetsSummary(AddonSource.Archiver, out pErrorText); } catch (Exception exception) { pErrorText = $"CuttingRoomAssetsSummary.PopulateSummary() EXCEPTION: {exception.Message}"; isOk = false; } _initialized = isOk; return(isOk); }
// --------------------------------------------------------------------------------------------------------- public bool PopulateSummary(out string pErrorText, AddonPackageSource pSource = null) { pErrorText = null; if (_initialized) { return(true); } if (!PopulateSummaryPreChecks(ref pSource, out pErrorText)) { return(false); } bool isOk = true; try { VerbCollection verbCollection = new VerbCollection(); verbCollection = CreateVerbsSummary(verbCollection, out pErrorText); Verbs = CreateVerbsSummaryFromStateMachine(verbCollection); } catch (Exception exception) { pErrorText = $"VerbsSummary.PopulateSummary() EXCEPTION: {exception.Message}"; isOk = false; } _initialized = isOk; return(isOk); }
public BodyModelsSummary(AddonPackageSource pSource, string pTempFolderPath, List <BodyModelItem> pBodyModels, bool pLoadAnimations = true, bool pListGestureGaitsAnimations = true) { AddonSource = pSource; TempFolderPath = pTempFolderPath?.Trim(); BodyModels = pBodyModels; LoadAnimations = pLoadAnimations; ListGestureGaitsAnimations = pListGestureGaitsAnimations; }
private List <string> GetPuppetTextures(AddonPackageSource pSource) { List <string> candidateFiles = new List <string>(); switch (pSource.SourceType) { case AddonPackageSourceType.Archiver: List <ArchiveFileInfo> filesInfo; pSource.Archiver.ArchivedFileList(out filesInfo); foreach (ArchiveFileInfo fileInfo in filesInfo) { candidateFiles.Add(fileInfo.FileName?.Trim().ToLower()); } break; case AddonPackageSourceType.Folder: string rootFolder = pSource.SourcePath.ToLower(); if (!rootFolder.EndsWith("\\")) { rootFolder += "\\"; } // int rootFolderLength = rootFolder.Length + (rootFolder.EndsWith("\\") ? 0 : 1); foreach (string fileName in Directory.EnumerateFiles(pSource.SourcePath, "*", SearchOption.AllDirectories)) { string file = fileName.ToLower().Replace(rootFolder, ""); candidateFiles.Add(file); } break; } List <string> puppetTextures = new List <string>(); foreach (string filePath in candidateFiles) { if (filePath.StartsWith("data\\puppets\\") && !filePath.Contains("\\thumbs\\") && !filePath.Contains("\\collections\\")) { string extension = Path.GetExtension(filePath); if (!string.IsNullOrEmpty(extension) && _imageExtensionList.Contains(extension)) { puppetTextures.Add(filePath.Replace("\\", "/")); } } } puppetTextures.Sort(); return(puppetTextures); }
public CuttingRoomAssetsSummary(AddonPackageSource pSource) { AddonSource = pSource; }
public VerbsSummary(AddonPackageSource pSource, bool pCompactDupVerbsByName) { AddonSource = pSource; CompactDupVerbsByName = pCompactDupVerbsByName; }
// --------------------------------------------------------------------------------------------------------- public bool PopulateSummary(out string pErrorText, AddonPackageSource pSource = null, string pTempFolderPath = null, List <BodyModelItem> pBodyModels = null) { pErrorText = null; if (_initialized) { return(true); } if (!PopulateSummaryPreChecks(ref pSource, ref pTempFolderPath, ref pBodyModels, out pErrorText)) { return(false); } bool isOk = true; string assetDataFile = null; bool deleteTempAssetDataFile = false; try { if (pSource.SourceType == AddonPackageSourceType.Folder) { assetDataFile = Path.Combine(pSource.SourcePath, AddonPackage.AssetDataFilename); } else { assetDataFile = Path.Combine(pTempFolderPath, AddonPackage.AssetDataFilename); pSource.Archiver.ArchivedFilesExtract(pTempFolderPath, new List <string>() { AddonPackage.AssetDataFilename }); deleteTempAssetDataFile = true; } List <string> puppetTextureList = GetPuppetTextures(pSource); SevenZipArchiver mftArchiver = new SevenZipArchiver(assetDataFile); foreach (BodyModelItem item in pBodyModels) { if (Puppets == null) { Puppets = new BodyModelSumPuppets(mftArchiver); } if (!Puppets.AppendBodyModelItem(item, puppetTextureList, LoadAnimations, out pErrorText)) { isOk = false; break; } } } catch (Exception exception) { pErrorText = $"BodyModelsSummary.PopulateSummary() EXCEPTION: {exception.Message}"; isOk = false; } finally { if (deleteTempAssetDataFile) { File.Delete(assetDataFile); } } _initialized = isOk; return(isOk); }
private bool PopulateSummaryPreChecks(ref AddonPackageSource pSource, ref string pTempFolderPath, ref List <BodyModelItem> pBodyModels, out string pErrorText) { pErrorText = null; if (pSource == null) { if (AddonSource == null) { pErrorText = "No addon source specification"; return(false); } pSource = AddonSource; } else { AddonSource = pSource; } if (AddonSource.SourceType == AddonPackageSourceType.Invalid) { pErrorText = "Invalid addon source"; return(false); } pTempFolderPath = pTempFolderPath?.Trim(); if (string.IsNullOrEmpty(pTempFolderPath)) { if (string.IsNullOrEmpty(TempFolderPath)) { pErrorText = "No temporary folder specification"; return(false); } pTempFolderPath = TempFolderPath; } else { TempFolderPath = pTempFolderPath; } if (!Directory.Exists(pTempFolderPath)) { pErrorText = "Temporary folder not found"; return(false); } if (pBodyModels == null) { if (BodyModels == null) { pErrorText = "No body models specification"; return(false); } pBodyModels = BodyModels; } else { BodyModels = pBodyModels; } return(true); }