Exemple #1
0
        public long AddExport(GpkExport export)
        {
            lock (exportLock)
            {
                var key = ExportList.Max(x => x.Key) + 1;

                ExportList.Add(key, export);
                Header.ExportCount++;

                GenerateUID(export);
                export.motherPackage = this;
                return(key);
            }
        }
Exemple #2
0
        public string GetObjectName(int index, bool returnNull = false)
        {
            //Import, Export added due to diffrent files appear to have the same object on import and export list

            if (index == 0)
            {
                return("none");
            }
            if (index < 0)
            {
                if (!ImportList.ContainsKey((index * -1) - 1))
                {
                    //not found. return null or we get a exception.
                    if (returnNull)
                    {
                        return(null);
                    }
                }

                return(ImportList[((index * -1) - 1)].UID);
            }
            if (index > 0)
            {
                if (!ExportList.ContainsKey(index - 1))
                {
                    //not found. return null or we get a excaption.
                    if (returnNull)
                    {
                        return(null);
                    }
                }

                GpkExport export = ExportList[index - 1];
                if (export.UID == null)
                {
                    export.ClassName   = GetObjectName(export.ClassIndex);
                    export.SuperName   = GetObjectName(export.SuperIndex);
                    export.PackageName = GetObjectName(export.PackageIndex);
                    export.UID         = GenerateUID(export);
                }
                return(export.UID);
            }

            if (returnNull)
            {
                return(null);
            }

            throw new Exception(string.Format("Object {0} not found!", index));
        }
Exemple #3
0
        public string GenerateUID(GpkExport export)
        {
            if (export.UID != null && export.UID != "")
            {
                UidList.Remove(export.UID);
            }

            string proposedName;

            if (export.PackageName == "none")
            {
                proposedName = export.ObjectName;
            }
            else
            {
                proposedName = export.PackageName + "." + export.ObjectName;
            }

            return(GenerateUID(proposedName, export));
        }