Ejemplo n.º 1
0
 public LocaleFileInfo( string FileName, LocaleType FileType, string ModuleName, string Path )
 {
     this._LocaleFileName = FileName;
     this._LocaleFileType = FileType;
     this._LocaleModule = ModuleName;
     this._LocalePath = Path;
 }
Ejemplo n.º 2
0
        public AuthChallengeData(ProtocolVersion protocol, GameType game, Expansions expansion, byte majorPatch, byte minorPatch, ClientBuild build, PlatformType platform, OperatingSystemType operatingSystem, LocaleType locale, IPAddress clientIp, string identity)
            : this()
        {
            //TODO: Very long ctor. Maybe use builder in the future.
            Protocol           = protocol;
            Game               = game;
            ExpansionVersionId = (byte)(expansion + 1);
            MajorPatchVersion  = majorPatch;
            MinorPatchVersion  = minorPatch;
            Build              = build;
            Platform           = platform;
            OperatingSystem    = operatingSystem;
            Locale             = locale;

            //Convert IP to bytes
            //TODO: Check size
            ipAddressInBytes = clientIp.GetAddressBytes();             //Trinitycore expects an int32 but an array of bytes should work

            Identity = identity;

            //Now we can compute size. Jackpoz does this with a literal. Trinitycore uses constants. I think we'll just use a literal though.
            size = (ushort)(identity.Length + 30);
        }
Ejemplo n.º 3
0
 private static extern bool EnumSystemLocalesEx(EnumLocalesProcExDelegate pEnumProcEx,
                                                LocaleType dwFlags, int lParam, IntPtr lpReserved);
Ejemplo n.º 4
0
 public FakerBase(LocaleType type)
 {
     this.LocaleType = type;
     this.locale     = LocaleFactory.Create(type);
 }
Ejemplo n.º 5
0
 public Lorem(LocaleType type) : base(type)
 {
 }
        private void GetResourceFiles( LocaleFileCollection ResFileList, string BasePath, string RootPath, string LocaleCode, LocaleType ResType )
        {
            string[] folders;
            try
            {
                folders = Directory.GetDirectories(BasePath);
            }
            catch
            {
                // in case a folder does not exist in DesktopModules (base admin modules)
                // just exit
                return;
            }

            string folder;
            DirectoryInfo objFolder;

            foreach (string tempLoopVar_folder in folders)
            {
                folder = tempLoopVar_folder;
                objFolder = new DirectoryInfo(folder);

                if (objFolder.Name == Localization.LocalResourceDirectory)
                {
                    // found local resource folder, add resources
                    GetLocalResourceFiles(ResFileList, RootPath, LocaleCode, ResType, objFolder);
                    GetLocalSharedResourceFile(ResFileList, RootPath, LocaleCode, ResType, objFolder);
                }
                else
                {
                    GetResourceFiles(ResFileList, folder, RootPath, LocaleCode, ResType);
                }
            }
        }
        private void GetLocalResourceFiles( LocaleFileCollection ResFileList, string RootPath, string LocaleCode, LocaleType ResType, DirectoryInfo objFolder )
        {
            FileInfo objFile;
            FileInfo[] ascxFiles;
            FileInfo[] aspxFiles;

            if (LocaleCode == Localization.SystemLocale)
            {
                // This is the case for en-US which is the default locale
                ascxFiles = objFolder.GetFiles("*.ascx.resx");
                aspxFiles = objFolder.GetFiles("*.aspx.resx");
            }
            else
            {
                ascxFiles = objFolder.GetFiles("*.ascx." + LocaleCode + ".resx");
                aspxFiles = objFolder.GetFiles("*.aspx." + LocaleCode + ".resx");
            }

            foreach (FileInfo tempLoopVar_objFile in ascxFiles)
            {
                objFile = tempLoopVar_objFile;
                ResFileList.Add(GetLocaleFile(ref RootPath, ResType, objFile));
                ProgressLog.AddInfo(string.Format(Localization.GetString("LOG.LangPack.LoadFileName"), objFile.Name));
            }
            foreach (FileInfo tempLoopVar_objFile in aspxFiles)
            {
                objFile = tempLoopVar_objFile;
                ResFileList.Add(GetLocaleFile(ref RootPath, ResType, objFile));
                ProgressLog.AddInfo(string.Format(Localization.GetString("LOG.LangPack.LoadFileName"), objFile.Name));
            }
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            Console.WriteLine("Welcome to the Faker.Net example. Please enter number to choose locale");
            LocaleType chosenLocale = LocaleType.en;
            string     result       = "";

Read_Locale_Input:
            var localeTypes = GetAllLocalType();

            for (int i = 0; i < localeTypes.Count; i++)
            {
                Console.WriteLine("[{0:d2}]: {1}", i, localeTypes.Keys.ElementAt(i));
            }
            int intChosenLocale = 0;

            if (!int.TryParse(Console.ReadLine(), out intChosenLocale) || intChosenLocale >= localeTypes.Count)
            {
                Console.WriteLine("Incorrect number input, please try again.");
                goto Read_Locale_Input;
            }

            chosenLocale = localeTypes[localeTypes.Keys.ElementAt(intChosenLocale)];
            // Create all the fakers with given locale
            var availableFakers = GetAllFakers(chosenLocale);

Read_Faker_Input:
            Console.Clear();
            result = "";
            Console.WriteLine("Please choose a Faker library to explore");
            Console.WriteLine("Enter 0 to return upper level\n[00]: ...");
            int keyCount = 1;

            string[] fakerKeys = new string[availableFakers.Count];
            foreach (var kvp in availableFakers)
            {
                fakerKeys[keyCount - 1] = kvp.Key;
                Console.WriteLine("[{0:d2}]: {1}", keyCount++, kvp.Key);
            }
            int fakerChoice = 0;

            if (!int.TryParse(Console.ReadLine(), out fakerChoice) || fakerChoice > fakerKeys.Length)
            {
                Console.WriteLine("Incorrect number input, please try again.");
                Console.Clear();
                goto Read_Locale_Input;
            }
            if (fakerChoice == 0)
            {
                Console.Clear(); goto Read_Locale_Input;
            }
            var faker = availableFakers[fakerKeys[fakerChoice - 1]];

Read_Write_Method:
            Console.Clear();
            Console.WriteLine("Please choose a method to explore\nOnly methods without parameters are displayed");
            Console.WriteLine("Enter 0 to return upper level\n[00]: ...");
            var methods = GetMethods(faker);

            for (int i = 1; i <= methods.Length; i++)
            {
                Console.WriteLine("[{0:d2}]: {1}", i, methods[i - 1].Name);
            }
            if (!string.IsNullOrWhiteSpace(result))
            {
                Console.WriteLine(result);
            }
            int methodChoice = 0;

            if (!int.TryParse(Console.ReadLine(), out methodChoice) || methodChoice > methods.Length)
            {
                result = "Incorrect number input, please try again.";
                Console.Clear();
                goto Read_Write_Method;
            }
            if (methodChoice == 0)
            {
                Console.Clear(); goto Read_Faker_Input;
            }
            result = string.Format("Result [{0:d2}]:\n{1}", methodChoice, InvokeMethod(methods[methodChoice - 1], faker));
            goto Read_Write_Method;
        }
Ejemplo n.º 9
0
 public LocaleAttribute(LocaleType type)
 {
     this.LocaleType = type;
 }
Ejemplo n.º 10
0
 public string GetValue(string key, LocaleType type)
 {
     return(GetValue(type.Key(), key));
 }
Ejemplo n.º 11
0
        private void GetResourceFiles(LocaleFileCollection ResFileList, string BasePath, string RootPath, string LocaleCode, LocaleType ResType)
        {
            string[] folders;
            try
            {
                folders = Directory.GetDirectories(BasePath);
            }
            catch
            {
                // in case a folder does not exist in DesktopModules (base admin modules)
                // just exit
                return;
            }

            string        folder;
            DirectoryInfo objFolder;

            foreach (string tempLoopVar_folder in folders)
            {
                folder    = tempLoopVar_folder;
                objFolder = new DirectoryInfo(folder);

                if (objFolder.Name == Localization.LocalResourceDirectory)
                {
                    // found local resource folder, add resources
                    GetLocalResourceFiles(ResFileList, RootPath, LocaleCode, ResType, objFolder);
                    GetLocalSharedResourceFile(ResFileList, RootPath, LocaleCode, ResType, objFolder);
                }
                else
                {
                    GetResourceFiles(ResFileList, folder, RootPath, LocaleCode, ResType);
                }
            }
        }
Ejemplo n.º 12
0
        private void GetLocalSharedResourceFile(LocaleFileCollection ResFileList, string RootPath, string LocaleCode, LocaleType ResType, DirectoryInfo objFolder)
        {
            FileInfo SharedFile;
            string   strFilePath;

            if (LocaleCode == Localization.SystemLocale)
            {
                // This is the case for en-US which is the default locale
                strFilePath = Path.Combine(objFolder.FullName, "SharedResources.resx");
            }
            else
            {
                strFilePath = Path.Combine(objFolder.FullName, "SharedResources." + LocaleCode + ".resx");
            }
            if (File.Exists(strFilePath))
            {
                SharedFile = new FileInfo(strFilePath);

                ResFileList.Add(GetLocaleFile(ref RootPath, ResType, SharedFile));
                ProgressLog.AddInfo(string.Format(Localization.GetString("LOG.LangPack.LoadFileName"), SharedFile.Name));
            }
        }
Ejemplo n.º 13
0
        private void GetLocalResourceFiles(LocaleFileCollection ResFileList, string RootPath, string LocaleCode, LocaleType ResType, DirectoryInfo objFolder)
        {
            FileInfo objFile;

            FileInfo[] ascxFiles;
            FileInfo[] aspxFiles;

            if (LocaleCode == Localization.SystemLocale)
            {
                // This is the case for en-US which is the default locale
                ascxFiles = objFolder.GetFiles("*.ascx.resx");
                aspxFiles = objFolder.GetFiles("*.aspx.resx");
            }
            else
            {
                ascxFiles = objFolder.GetFiles("*.ascx." + LocaleCode + ".resx");
                aspxFiles = objFolder.GetFiles("*.aspx." + LocaleCode + ".resx");
            }

            foreach (FileInfo tempLoopVar_objFile in ascxFiles)
            {
                objFile = tempLoopVar_objFile;
                ResFileList.Add(GetLocaleFile(ref RootPath, ResType, objFile));
                ProgressLog.AddInfo(string.Format(Localization.GetString("LOG.LangPack.LoadFileName"), objFile.Name));
            }
            foreach (FileInfo tempLoopVar_objFile in aspxFiles)
            {
                objFile = tempLoopVar_objFile;
                ResFileList.Add(GetLocaleFile(ref RootPath, ResType, objFile));
                ProgressLog.AddInfo(string.Format(Localization.GetString("LOG.LangPack.LoadFileName"), objFile.Name));
            }
        }
Ejemplo n.º 14
0
 public static void BuildDefaultResource(Assembly assembly, LocaleType localeType)
 {
     _instance = new DefaultDiction(assembly, localeType);
 }
Ejemplo n.º 15
0
 public Image(LocaleType type) : base(type)
 {
 }
Ejemplo n.º 16
0
 protected DefaultDiction(Assembly assembly, LocaleType localeType)
 {
     AddArrayItems(Loader.LoadResources(assembly, localeType));
 }
Ejemplo n.º 17
0
 public PhoneNumber(LocaleType type) : base(type)
 {
     this.factory = new RandomFactory(this.locale, this.LocaleType);
 }
        private LocaleFileInfo GetLocaleFile( ref string RootPath, LocaleType ResType, FileInfo objFile )
        {
            LocaleFileInfo LocaleFile = new LocaleFileInfo();
            LocaleFile.LocaleFileName = objFile.Name;
            LocaleFile.LocalePath = StripCommonDirectory(RootPath, objFile.DirectoryName);
            LocaleFile.LocaleModule = GetModuleName(LocaleFile.LocalePath);
            LocaleFile.LocalePath = StripModuleName(LocaleFile.LocalePath, LocaleFile.LocaleModule);
            LocaleFile.LocaleFileType = ResType;
            LocaleFile.Buffer = GetFileAsByteArray(objFile);

            return LocaleFile;
        }
Ejemplo n.º 19
0
 internal RandomFactory(Object obj, LocaleType type)
 {
     this.obj             = obj;
     this.localeType      = type;
     this.fakerDictionary = new Dictionary <string, FakerBase>();
 }
        private void GetLocalSharedResourceFile( LocaleFileCollection ResFileList, string RootPath, string LocaleCode, LocaleType ResType, DirectoryInfo objFolder )
        {
            FileInfo SharedFile;
            string strFilePath;
            if (LocaleCode == Localization.SystemLocale)
            {
                // This is the case for en-US which is the default locale
                strFilePath = Path.Combine(objFolder.FullName, "SharedResources.resx");
            }
            else
            {
                strFilePath = Path.Combine(objFolder.FullName, "SharedResources." + LocaleCode + ".resx");
            }
            if (File.Exists(strFilePath))
            {
                SharedFile = new FileInfo(strFilePath);

                ResFileList.Add(GetLocaleFile(ref RootPath, ResType, SharedFile));
                ProgressLog.AddInfo(string.Format(Localization.GetString("LOG.LangPack.LoadFileName"), SharedFile.Name));
            }
        }
Ejemplo n.º 21
0
        public static ItemResource[] LoadResources(Assembly assembly, LocaleType localeType)
        {
            string _Locale = localeType.ToString();
            string[] names = assembly.GetManifestResourceNames();

            List<string> lst = new List<string>();
            string locale = string.Format(".{0}.", _Locale);
            foreach (string s in names)
            {
                if (s.EndsWith(".lng") && s.Contains(locale))
                    lst.Add(s);
            }

            names = lst.ToArray();

            List<ItemResource> lstResult = new List<ItemResource>();

            foreach (String resourcename in names)
            {
                ItemResource[] res = LoadResourceByName(assembly, resourcename);
                lstResult.AddRange(res);
            }

            return lstResult.ToArray();
        }
Ejemplo n.º 22
0
 public MessagePlain(string messagePreset, LocaleType locale)
 {
     MessageType = MessageType.Type_Preset_Message;
     Message     = messagePreset;
     Locale      = locale;
 }
Ejemplo n.º 23
0
 protected DefaultDiction(Assembly assembly, LocaleType localeType)
 {
     AddArrayItems(Loader.LoadResources(assembly,localeType));
 }
Ejemplo n.º 24
0
 public Date(LocaleType type) : base(type)
 {
 }
Ejemplo n.º 25
0
 public static void BuildDefaultResource(Assembly assembly, LocaleType localeType)
 {
     _instance = new DefaultDiction(assembly, localeType);
 }
Ejemplo n.º 26
0
 public Hacker(LocaleType type) : base(type)
 {
     this.factory = new RandomFactory(this.locale, this.LocaleType);
 }
Ejemplo n.º 27
0
 public static void BuildDefaultResource(LocaleType localeType)
 {
     _instance = new DefaultDiction(typeof(DefaultDiction).Assembly, localeType);
 }
Ejemplo n.º 28
0
 private static extern bool EnumSystemLocalesEx(EnumLocalesProcExDelegate pEnumProcEx, LocaleType dwFlags, int lParam, IntPtr lpReserved);
Ejemplo n.º 29
0
 public Company(LocaleType type) : base(type)
 {
     this.factory = new RandomFactory(this.locale, this.LocaleType);
 }
Ejemplo n.º 30
0
 public Finance(LocaleType type) : base(type)
 {
     this.factory = new RandomFactory(this.locale, this.LocaleType);
 }
Ejemplo n.º 31
0
 public Address(LocaleType type) : base(type)
 {
     this.factory = new RandomFactory(this.locale, this.LocaleType);
 }
Ejemplo n.º 32
0
 public static void BuildDefaultResource(LocaleType localeType)
 {
     _instance = new DefaultDiction(typeof(DefaultDiction).Assembly, localeType);
 }
Ejemplo n.º 33
0
 public Internet(LocaleType type) : base(type)
 {
 }
Ejemplo n.º 34
0
 public static extern string ucol_getLocaleByType(RuleBasedCollator.Handle collator,
                                                  LocaleType type,
                                                  out ErrorCode status);
Ejemplo n.º 35
0
 public LocaleData(LocaleType localeType, string data)
 {
     this.localeType = localeType;
     this.data       = data;
 }