public static bool PrintRepositoryCodeSheet(
            string repoFn = null, PackageContainerListBase repoDirect = null, string title = "Asset repository")
        {
            List <CodeSheetItem> codeSheetItems = new List <CodeSheetItem>();

            try
            {
                PackageContainerListBase repo = null;

                // load the data
                if (repoFn != null)
                {
                    // from file
                    repo = PackageContainerListLocal.Load <PackageContainerListLocal>(repoFn);
                }

                if (repoDirect != null)
                {
                    // from RAM
                    repo = repoDirect;
                }

                // got something
                if (repo == null)
                {
                    return(false);
                }

                // all assets
                foreach (var fmi in repo.FileMap)
                {
                    if (fmi.AssetIds != null)
                    {
                        foreach (var id in fmi.AssetIds)
                        {
                            var csi = new CodeSheetItem();
                            csi.id          = id;
                            csi.code        = fmi.CodeType2D;
                            csi.description = fmi.Description;
                            csi.normSize    = 1.0; // do not vary
                            codeSheetItems.Add(csi);
                        }
                    }
                }

                // print
                PrintCodeSheet(codeSheetItems.ToArray(), title);
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.Message, "Print AASX file repository");
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public static PackageContainerListBase GuessAndCreateNew(string location)
        {
            // access
            if (!location.HasContent())
            {
                return(null);
            }

            // http based?
            var ll = location.Trim().ToLower();

            if (ll.StartsWith("http://") || ll.StartsWith("https"))
            {
                var repo = new PackageContainerListHttpRestRepository(location);
                return(repo);
            }

            // default
            return(PackageContainerListLocal.Load <PackageContainerListLocal>(location));
        }