示例#1
0
        public static FileId ParseFrom(string fullName)
        {
            var data = new Medusa.CoreProto.FileId
            {
                Name  = FileListFile.GetResourceName(fullName),
                Order = FileListFile.GetResourceOrder(fullName),
                Tag   = PublishInfo.GetPublishInfo(fullName).Tag
            };

            return(new FileId(data));
        }
示例#2
0
        public bool IsInclude(PublishInfo info)
        {
            if ((info.Version & Version) != info.Version)
            {
                return(false);
            }
            if ((info.Device & Device) != info.Device)
            {
                return(false);
            }
            if ((info.Language & Language) != info.Language)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        public static PublishInfo GetPublishInfo(FileInfo file)
        {
            string        resPath = file.Name;
            List <string> tags    = new List <string>();

            int firstIndex = resPath.IndexOf('-');

            if (firstIndex < 0)
            {
                return(new PublishInfo(PublishVersions.all, PublishDevices.all,
                                       PublishLanguages.all));
            }

            string myPath;
            int    lastIndex = resPath.LastIndexOf('.');

            if (lastIndex > 0)
            {
                myPath = resPath.Substring(firstIndex, lastIndex - firstIndex);
            }
            else
            {
                myPath = resPath.Substring(firstIndex);
            }
            var tags1 = myPath.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);

            tags.AddRange(tags1);



            var result = new PublishInfo(PublishVersions.none, PublishDevices.none,
                                         PublishLanguages.none);

            var versionNames  = Enum.GetNames(typeof(PublishVersions));
            var deviceNames   = Enum.GetNames(typeof(PublishDevices));
            var languageNames = Enum.GetNames(typeof(PublishLanguages));

            foreach (var versionName in versionNames)
            {
                if (tags.Contains(versionName))
                {
                    result.Version |= (PublishVersions)Enum.Parse(typeof(PublishVersions), versionName);
                }
            }

            if (result.Version == PublishVersions.none)
            {
                result.Version = PublishVersions.all;
            }

            foreach (var deviceName in deviceNames)
            {
                if (tags.Contains(deviceName))
                {
                    result.Device |= (PublishDevices)Enum.Parse(typeof(PublishDevices), deviceName);
                }
            }


            if (result.Device == PublishDevices.none)
            {
                result.Device = PublishDevices.all;
            }

            foreach (var languageName in languageNames)
            {
                if (tags.Contains(languageName))
                {
                    result.Language |= (PublishLanguages)Enum.Parse(typeof(PublishLanguages), languageName);
                }
            }

            if (result.Language == PublishLanguages.none)
            {
                result.Language = PublishLanguages.all;
            }

            return(result);
        }
示例#4
0
 public void Merge(PublishInfo info)
 {
     Version  |= info.Version;
     Device   |= info.Device;
     Language |= info.Language;
 }
示例#5
0
        public static PublishInfo GetPublishInfo(FileInfo file)
        {
            string resPath = file.Name;
            List<string> tags=new List<string>();

            int firstIndex=resPath.IndexOf('-');
            if (firstIndex<0)
            {
                return new PublishInfo(PublishVersions.all, PublishDevices.all,
                                        PublishLanguages.all);
            }

            string myPath;
            int lastIndex = resPath.LastIndexOf('.');

            if (lastIndex>0)
            {
                myPath=resPath.Substring(firstIndex, lastIndex - firstIndex);
            }
            else
            {
                myPath=resPath.Substring(firstIndex);
            }
            var tags1=myPath.Split(new char[] {'-'}, StringSplitOptions.RemoveEmptyEntries);
            tags.AddRange(tags1);

            var result = new PublishInfo(PublishVersions.none, PublishDevices.none,
                                         PublishLanguages.none);

            var versionNames = Enum.GetNames(typeof (PublishVersions));
            var deviceNames = Enum.GetNames(typeof (PublishDevices));
            var languageNames = Enum.GetNames(typeof (PublishLanguages));

            foreach (var versionName in versionNames)
            {
                if (tags.Contains(versionName))
                {
                    result.Version |= (PublishVersions)Enum.Parse(typeof(PublishVersions), versionName);
                }
            }

            if (result.Version == PublishVersions.none)
            {
                result.Version = PublishVersions.all;
            }

            foreach (var deviceName in deviceNames)
            {
                if (tags.Contains(deviceName))
                {
                    result.Device |= (PublishDevices)Enum.Parse(typeof(PublishDevices), deviceName);
                }
            }

            if (result.Device == PublishDevices.none)
            {
                result.Device = PublishDevices.all;
            }

            foreach (var languageName in languageNames)
            {
                if (tags.Contains(languageName))
                {
                    result.Language |= (PublishLanguages)Enum.Parse(typeof(PublishLanguages), languageName);
                }
            }

            if (result.Language == PublishLanguages.none)
            {
                result.Language = PublishLanguages.all;
            }

            return result;
        }
示例#6
0
 public void Merge(PublishInfo info)
 {
     Version |= info.Version;
     Device |= info.Device;
     Language |= info.Language;
 }
示例#7
0
        public bool IsInclude(PublishInfo info)
        {
            if ((info.Version & Version) != info.Version)
            {
                return false;
            }
            if ((info.Device & Device) != info.Device)
            {
                return false;
            }
            if ((info.Language & Language) != info.Language)
            {
                return false;
            }

            return true;
        }
示例#8
0
        public static void Print()
        {
            FileListGenerator.PrintDirectory(string.Empty);

            Logger.LogInfoLine("FileSystem TagList:");
            foreach (var resourceTagItem in FileSystem.TagItems)
            {
                var info = new PublishInfo(resourceTagItem.Tag);
                Logger.LogInfoLine("\t{0}", info);
                foreach (var resourceMapNameItem in resourceTagItem.NameItems)
                {
                    Logger.LogInfoLine("\t\t{0}", resourceMapNameItem.Name);
                    foreach (var resourceMapOrderItem in resourceMapNameItem.OrderItems)
                    {
                        if (resourceMapOrderItem.TextureRect != null && resourceMapOrderItem.Offset != null &&
                            resourceMapOrderItem.OriginalSize != null)
                        {
                            Logger.LogInfoLine("\t\t\tOrder:{0} in {1} ({2},{3})=>({4},{5},{6},{7})+({8},{9})",
                                               resourceMapOrderItem.Order, resourceMapOrderItem.FileId,
                                               resourceMapOrderItem.OriginalSize.Width,
                                               resourceMapOrderItem.OriginalSize.Height,
                                               resourceMapOrderItem.TextureRect.Origin.X,
                                               resourceMapOrderItem.TextureRect.Origin.Y,
                                               resourceMapOrderItem.TextureRect.Size.Width,
                                               resourceMapOrderItem.TextureRect.Size.Height,
                                               resourceMapOrderItem.Offset.X, resourceMapOrderItem.Offset.Y);
                        }
                        else
                        {
                            Logger.LogInfoLine("\t\t\tOrder:{0} in {1}", resourceMapOrderItem.Order,
                                               resourceMapOrderItem.FileId);
                        }
                    }
                }
            }
        }
 public Dictionary<string, Dictionary<uint, KeyValuePair<string, bool>>> GetOrCreateStringTable(PublishInfo packageInfo)
 {
     if (StringTables.ContainsKey(packageInfo))
     {
         return StringTables[packageInfo];
     }
     var result = new Dictionary<string, Dictionary<uint, KeyValuePair<string, bool>>>();
     StringTables.Add(packageInfo, result);
     return result;
 }