Exemplo n.º 1
0
		public bool AddIDsToRefresh(String ID)
			{
			if (IDsToRefresh.Contains(ID.ToLower( )))
				return false;
			IDsToRefresh.Add (ID.ToLower());
			return true;
			}
Exemplo n.º 2
0
        public List<Contact> search(String search, int index, int nbLines)
        {
            if (cache.Count > 0)
            {
                List<Contact> contacts = new List<Contact>();
                for (int i = index; i < index + nbLines; i++)
                {
                    Contact contact = new Contact(cache[i]);
                    //Console.WriteLine(string.Format("{0}", contact.name));
                    if (contact.name.ToLower().Contains(search.ToLower()))
                    {
                        contacts.Add(contact);
                    }
                }
                return contacts;
            }
            else
            {
                List<Contact> contacts = new List<Contact>();
                IEnumerable<string> fileLines = File.ReadLines(dbFileName).Skip(index + 1).Take(10000000);
                foreach (string line in fileLines)
                {
                    Contact contact = new Contact(line);
                    if (contact.name.ToLower().Contains(search.ToLower()))
                    {
                        contacts.Add(contact);
                    }
                }
                return contacts;

            }
        }
Exemplo n.º 3
0
        private static String MakeTinyUrl(String url)
        {
            Debug.Assert(!String.IsNullOrEmpty(url), "!String.IsNullOrEmpty(url)");

            try
            {
                if (url.Length <= 30)
                {
                    return url;
                }

                if (!url.ToLower().StartsWith("http") && !url.ToLower().StartsWith("ftp"))
                {
                    url = String.Format("http://{0}", url);
                }

                var request = WebRequest.Create(String.Format("http://tinyurl.com/api-create.php?url={0}", url));
                var res = request.GetResponse();
                var text = "";
                
                using (var reader = new StreamReader(res.GetResponseStream()))
                {
                    text = reader.ReadToEnd();
                }
                
                return text;
            }
            catch (Exception)
            {
                return url;
            }
        }
Exemplo n.º 4
0
 public static bool HasBuff(this Obj_AI_Base unit, String s)
 {
     return
         unit.Buffs.Any(
             a =>
                 a.Name.ToLower().Contains(s.ToLower()) || a.DisplayName.ToLower().Contains(s.ToLower()));
 }
Exemplo n.º 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pType"></param>
        /// <param name="pRequestedHost"></param>
        /// <param name="pRequestedURL"></param>
        /// <param name="pReplacementHost"></param>
        /// <param name="pReplacementURL"></param>
        /// <param name="pReplacementFullPath"></param>
        public void addRecord(String pType, String pRequestedHost, String pRequestedURL, String pReplacementHost, String pReplacementURL, String pReplacementFullPath)
        {
            if (String.IsNullOrEmpty(pType) || (pType.ToLower() != "inject" && pType.ToLower() != "redirect"))
            throw new Exception("Something is wrong with the injection type.\r\nPossible values are : inject|redirect");
              else if (cDomain.InjectedURLList.Where(s => s.RequestedHost == pRequestedHost && s.RequestedURL == pRequestedURL).Count() > 0)
            throw new Exception(String.Format("A record for this URL already exists."));

              // Redirect
              else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pRequestedHost) || String.IsNullOrWhiteSpace(pRequestedHost) || !Regex.Match(pRequestedHost, @"^[\d\w\-_\.]*[\d\w\-_]+\.[\w]{2,10}$").Success))
            throw new Exception("Something is wrong with the requested URL.\r\nFormat is : www.facebook.com");
              else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pRequestedURL) || String.IsNullOrWhiteSpace(pRequestedURL) || !Regex.Match(pRequestedURL, @"^/.*$").Success))
            throw new Exception("Something is wrong with the requested URL.\r\nFormat is : /login.php?user=user1");
              else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pReplacementHost) || String.IsNullOrWhiteSpace(pReplacementHost) || !Regex.Match(pReplacementHost, @"^[\d\w\-_\.]*[\d\w\-_]+\.[\w]{2,10}$").Success))
            throw new Exception("Something is wrong with the redirect host name.");
              else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pReplacementURL) || String.IsNullOrWhiteSpace(pReplacementURL) || !Regex.Match(pReplacementURL, @"^/.*$").Success))
            throw new Exception("Something is wrong with the redirected URL.\r\nFormat is : /login.php?user=user1");

              // Inject
              else if (pType.ToLower().Contains("inject") && pType.ToLower().Contains("inject") && ((String.IsNullOrEmpty(pReplacementURL) || String.IsNullOrWhiteSpace(pReplacementURL))))
            throw new Exception("Something is wrong with the injected URL.\r\nFormat is : Your_File_Name.pdf");
              else if (pType.ToLower().Contains("inject") && pType.ToLower().Contains("inject") && (!File.Exists(pReplacementFullPath)))
            throw new Exception(String.Format("Injection file doesn't exist"));

              cDomain.addRecord(new InjectedURLRecord(pType, pRequestedHost, pRequestedURL, pReplacementHost, pReplacementURL, pReplacementFullPath));
        }
Exemplo n.º 6
0
 public void fillForm(String date, String myOffice, String office, String name, String position, String organisation, String areaCode, String phoneNo, String emailAddress, String additionalInfo, bool optIn, String leadSource)
 {
     actionHelper.SetTextFieldValue(text_date_locator, date);
     if (myOffice.ToLower().Equals("true"))
     {
         //select client office
         actionHelper.ClickWebElement(radio_myOffice_locator);
         actionHelper.SetTextFieldValue(text_myOffice_locator, office);
     }
     else if (myOffice.ToLower().Equals("false"))
     {
         //select something else
         actionHelper.ClickWebElement(radio_msmOffice_locator);
         actionHelper.SetDropDownValue(select_office_locator, office);
     }
     else
     {
        // select neither location option
     }
     actionHelper.SetTextFieldValue(text_name_locator, name);
     actionHelper.SetTextFieldValue(text_position_locator, position);
     actionHelper.SetTextFieldValue(text_organisation_locator, organisation);
     actionHelper.SetTextFieldValue(text_areacode_locator, areaCode);
     actionHelper.SetTextFieldValue(text_telephonenumber_locator, phoneNo);
     actionHelper.SetTextFieldValue(text_email_locator, emailAddress);
     actionHelper.SetTextFieldValue(textarea_additionalinformation_locator, additionalInfo);
     actionHelper.SetDropDownValue(select_leadsource_locator, leadSource);
     actionHelper.SetCheckboxValue(checkbox_emailoptin_locator, optIn);
     actionHelper.ClickWebElement(submit_submitmyrequest_locator);
 }
 public static String getUsableDriverName(String rawDriverName, String soundsFolderName)
 {
     if (!usableNamesForSession.ContainsKey(rawDriverName))
     {
         String usableDriverName = null;
         if (!rawNamesToUsableNamesFileRead)
         {
             readRawNamesToUsableNamesFile(soundsFolderName);
         }
         if (lowerCaseRawNameToUsableName.ContainsKey(rawDriverName.ToLower()))
         {
             usableDriverName = lowerCaseRawNameToUsableName[rawDriverName.ToLower()];
             Console.WriteLine("Using mapped drivername " + usableDriverName + " for raw driver name " + rawDriverName);
             usableNamesForSession.Add(rawDriverName, usableDriverName);
         }
         else
         {
             usableDriverName = validateAndCleanUpName(rawDriverName);
             if (usableDriverName != null)
             {
                 Boolean usedLastName = false;
                 if (useLastNameWherePossible)
                 {
                     String lastName = getUnambiguousLastName(usableDriverName);
                     if (lastName != null && lastName.Count() > 0)
                     {
                         if (lowerCaseRawNameToUsableName.ContainsKey(lastName.ToLower()))
                         {
                             usableDriverName = lowerCaseRawNameToUsableName[lastName.ToLower()];
                             Console.WriteLine("Using mapped driver last name " + usableDriverName + " for raw driver last name " + lastName);
                             usableNamesForSession.Add(rawDriverName, usableDriverName);
                             usedLastName = true;
                         }
                         else
                         {
                             Console.WriteLine("Using unmapped driver last name " + lastName + " for raw driver name " + rawDriverName);
                             usableDriverName = lastName;
                             usableNamesForSession.Add(rawDriverName, usableDriverName);
                             usedLastName = true;
                         }
                     }
                 }
                 if (!usedLastName)
                 {
                     Console.WriteLine("Using unmapped drivername " + usableDriverName + " for raw driver name " + rawDriverName);
                     usableNamesForSession.Add(rawDriverName, usableDriverName);
                 }
             }
             else
             {
                 Console.WriteLine("Unable to create a usable driver name for " + rawDriverName);
             }
         }
         return usableDriverName;
     }
     else
     {
         return usableNamesForSession[rawDriverName];
     }
 }
Exemplo n.º 8
0
        static Int32 artistCompare(String x, String y)
        {
            x = (x.ToLower().StartsWith("the ") ? x.ToLower().Replace("the ", "") : x);
            y = (y.ToLower().StartsWith("the ") ? y.ToLower().Replace("the ", "") : y);

            return x.CompareTo(y);
        }
Exemplo n.º 9
0
 public static void set_timeout(String timeout_constant)
 {
                
     if (timeout_constant.ToLower().Contains("normal")) timeout = 45000;
     if (timeout_constant.ToLower().Contains("long")) timeout = 90000;
     
 }
 public InlineLink Match(String word, Brush lBrush, IStatusUpdate oStatusUpdate)
 {
     if (word == null) return null;
     bool result = _websymbols.AsParallel().Any(p => p.Key == word.ToLower());
     if (!result) return null;
     return _textProcessorEngine.WebSymbolHelper(_websymbols[word.ToLower()], word);
 }
Exemplo n.º 11
0
 public override void RemoveFile(String path)
 {
     Stream data = (Stream)_files[path.ToLower()];
     data.Close();
     data = null;
     _files.Remove(path.ToLower());
 }
        public InlineLink Match(String word, Brush lBrush, IStatusUpdate oStatusUpdate)
        {
            if (word == null) return null;
            var result =
                _acronymSettingsProvider.AcronymMapping.AsParallel().Any(p => p.Acronym.ToLower() == word.ToLower());
            if (!result) return null;

            var newMeaning =
                _acronymSettingsProvider.AcronymMapping.SingleOrDefault(p => p.Acronym.ToLower() == word.ToLower());
            if (newMeaning != null)
            {
                var il = new InlineLink
                             {
                                 FontFamily = _textProcessorEngine.FfDefault,
                                 FontSize = _textProcessorEngine.FsDefault,
                                 Foreground = _textProcessorEngine.BrText,
                                 FontStyle = FontStyles.Italic,
                                 Text = newMeaning.Meaning,
                                 ToolTip = word
                             };
                return il;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 13
0
 public static void ExtractCompressedFile(String compressedArchiveName, String destFolder) 
 {
     if (compressedArchiveName.ToLower().EndsWith(".zip"))
     {
         ExtractZipFile(compressedArchiveName, null, destFolder);
     }
     else if (compressedArchiveName.ToLower().EndsWith(".tar.gz"))
     {
         ExtractTGZ(compressedArchiveName, destFolder);
     }
     else if (compressedArchiveName.ToLower().EndsWith(".gz"))
     {
         ExtractGZip(compressedArchiveName, destFolder);
     }
     else
     {
         string destFile = Path.Combine(destFolder, Path.GetFileName(compressedArchiveName));
         // Ensure that the target does not exist
         if (File.Exists(destFile))
         {
             File.Delete(destFile);
         }
             
         File.Move(compressedArchiveName, destFile);
     }
 }
Exemplo n.º 14
0
        public QueryResult Import(String location, IGraphDBSession graphDBSession, DBContext myDBContext, UInt32 parallelTasks = 1, IEnumerable<string> comments = null, UInt64? offset = null, UInt64? limit = null, VerbosityTypes verbosityType = VerbosityTypes.Errors)
        {
            IEnumerable<String> lines = null;

            #region Read querie lines from location

            try
            {
                if (location.ToLower().StartsWith(@"file:\\"))
                {
                    lines = ReadFile(location.Substring(@"file:\\".Length));
                }
                else if (location.ToLower().StartsWith("http://"))
                {
                    lines = ReadHttpResource(location);
                }
                else
                {
                    return new QueryResult(new Exceptional(new Error_InvalidImportLocation(location, @"file:\\", "http://")));
                }
            }
            catch (Exception ex)
            {
                return new QueryResult(new Exceptional(new Error_ImportFailed(ex)));
            }

            #endregion

            #region Start import using the AGraphDBImport implementation

            return Import(lines, graphDBSession, myDBContext, parallelTasks, comments, offset, limit, verbosityType);

            #endregion
        }
Exemplo n.º 15
0
        public int GetHeaderIndex(String headName)
        {
            if (m_headers.ContainsKey(headName.ToLower()))
                return m_headers[headName.ToLower()];

            return -1;
        }
Exemplo n.º 16
0
 public static Weapon GetWeapon(String weaponName)
 {
     if(_weaponsMap.ContainsKey(weaponName.ToLower()))
     {
         return _weaponsMap[weaponName.ToLower()]();
     }
     return new Weapon();
 }
Exemplo n.º 17
0
 //.SETS FOR ONLY ONE DIE --> CONSTRUCTOR
 public Dice(String selectedDie)
 {
     for(int i = 0 ; i < diceSides.Length ; i++)
         if(this.diceName[i].Equals(selectedDie.ToLower())) {
             this.selectedDice.Add(selectedDie.ToLower());
             break;
         }
 }
Exemplo n.º 18
0
 protected override bool IsValueValid(String value)
 {
     if (value.ToLower() == "true" || value.ToLower() == "false")
     {
         return true;
     }
     return false;
 }
        public static void Check(String message, String user)
        {
            getEmotes();
            if (Ban != true)
                if (SettingsFile.getSetting(BotClient.getChannel(false), "BadwordsChecker").Equals("true"))
                CheckBadWords(message,user);
            if (Ban != true)
                if (SettingsFile.getSetting(BotClient.getChannel(false), "LinkChecker").Equals("true"))
                CheckLink(message,user);
            if (Ban != true)
                if (SettingsFile.getSetting(BotClient.getChannel(false), "EmoteChecker").Equals("true"))
                    checkEmoteSpam(message, user);
            if (Ban != true && Link != true)
                if (SettingsFile.getSetting(BotClient.getChannel(false), "SymbolChecker").Equals("true"))
                checkSymbolSpam(message,user);

            if (Ban)
            {
                if (!Viewers.moderators.Contains(user.ToLower()) && !user.ToLower().Equals(BotClient.getChannel(false)) && !RanksFile.getRank(user).ToLower().Equals("gold") && !user.ToLower().Equals("mjrlegends"))
                {
                    if (banType.Equals("Words"))
                    {
                        BotClient.sendChatMessage("/timeout " + user);
                        BotClient.sendChatMessage("/unban " + user);
                        BotClient.sendChatMessage(user + " " + SettingsFile.getSetting(BotClient.getChannel(false), "LanguageWarning"));
                    }
                    else if (banType.Equals("Emotes"))
                    {
                        if (!RanksFile.getRank(user).ToLower().Equals("sliver"))
                        {
                            BotClient.sendChatMessage("/timeout " + user);
                            BotClient.sendChatMessage("/unban " + user);
                            BotClient.sendChatMessage(user + " " + SettingsFile.getSetting(BotClient.getChannel(false), "EmoteWarning"));
                        }
                    }
                    else if (banType.Equals("Links"))
                    {
                        if (!RanksFile.getRank(user).ToLower().Equals("sliver") && !RanksFile.getRank(user).ToLower().Equals("bronze"))
                        {
                            BotClient.sendChatMessage("/timeout " + user);
                            BotClient.sendChatMessage("/unban " + user);
                            BotClient.sendChatMessage(user + " " + SettingsFile.getSetting(BotClient.getChannel(false), "LinkWarning"));
                        }
                    }
                    else if (banType.Equals("Symbols"))
                    {
                        if (!RanksFile.getRank(user).ToLower().Equals("sliver"))
                        {
                            BotClient.sendChatMessage("/timeout " + user);
                            BotClient.sendChatMessage("/unban " + user);
                            BotClient.sendChatMessage(user + " " + SettingsFile.getSetting(BotClient.getChannel(false), "SymbolWarning"));
                        }
                    }
                    Ban = false;
                    banType = "";
                }
            }
        }
Exemplo n.º 20
0
 public String response(String nick, String destiny)
 {
     if (_bot.Timecounter.getSeconds() - _secs <= 12)
     {
         return "";
     }
     else
     {
         _secs = _bot.Timecounter.getSeconds();
     }
     String final, bodypart;
     if (destiny.ToLower() == "me")
     {
         bodypart = _targets.ElementAt(_bot.random.Next(_targets.Count));
         final = "avoids the rock throwed by " + nick + ", throwing it back with MAXIMUM POWER, hitting " + nick + "'s " + bodypart + ".";
     }
     else if (containsTabaha(destiny.ToLower()))//destiny.ToLower().Contains("tabah"))
     {
         bodypart = _targets.ElementAt(_bot.random.Next(_targets.Count));
         final = "protects his master and throws a rock at 299.792.458m/s targeting " + nick + " and reducing him to ashes.";
     }
     else if (destiny.ToLower() == "you")
     {
         bodypart = _targets.ElementAt(_bot.random.Next(_targets.Count));
         final = "throws a rock at " + nick + " for being so stupid. The rock hits " + nick + "'s " + bodypart + ".";
     }
     else if (destiny.ToLower() == "god")
     {
         final = "watches as god throws a meteorite at " + nick + ", killing and sending him to Hell to spend all the eternity being raped.";
     }
     else if (_bot.random.Next(100) >= 15)
     {
         bodypart = _targets.ElementAt(_bot.random.Next(_targets.Count));
         final = "watches as " + nick + " throws a rock at " + destiny + " and it ";
         if (_bot.random.Next(100) >= 15)
         {
             final += "hits his " + bodypart + ".";
         }
         else
         {
             final += "misses the target completely.";
         }
     }
     else
     {
         bodypart = _targets.ElementAt(_bot.random.Next(_targets.Count));
         final = "watches as " + destiny + " avoids " + nick + "'s rock and throws it back to " + nick;
         if (_bot.random.Next(100) >= 20)
         {
             final += " hitting his " + bodypart + ".";
         }
         else
         {
             final += ", missing the target completely.";
         }
     }
     return final;
 }
Exemplo n.º 21
0
	// Normalize a name.
	// FIXME: This means, we accept invalid names such as "euc_jp"
	private static String Normalize(String name)
			{
			#if ECMA_COMPAT
				return (name.ToLower()).Replace('-', '_');
			#else
				return (name.ToLower(CultureInfo.InvariantCulture))
							.Replace('-', '_');
			#endif
			}
Exemplo n.º 22
0
        public ProjectNamespace GetNamespace(String namespacePath)
        {
            if (this.namespaces.ContainsKey(namespacePath.ToLower()))
            {
                return this.namespaces[namespacePath.ToLower()];
            }

            return null;
        }
Exemplo n.º 23
0
        public ProjectType GetType(String typeName)
        {
            if (this.types.ContainsKey(typeName.ToLower()))
            {
                return this.types[typeName.ToLower()];
            }

            return null;
        }
Exemplo n.º 24
0
        public ProjectMember GetMethod(String methodName)
        {
            if (this.methods.ContainsKey(methodName.ToLower()))
            {
                return this.methods[methodName.ToLower()];
            }

            return null;
        }
Exemplo n.º 25
0
        public JsonResult DataTable_IgnoreGroups(jQueryDataTableParamModel param, List<String> SubjectID = null, List<String> Class = null, List<String> Check = null, String Search = null, String ShowIgnore = null, String ShowNotIgnore = null)
        {
            if (SubjectID != null && Class != null && Check != null)
            {
                OutputHelper.SaveIgnoreGroups(SubjectID, Class, Check, false);
            }
            Dictionary<String, Group> dbGroups = Clone.Dictionary<String, Group>((Dictionary<String, Group>)(CurrentSession.Get("IgnoreGroups") ?? InputHelper.Groups));
            var Groups = from m in dbGroups.Values select m;
            var total = Groups.Count();
            if (!string.IsNullOrEmpty(Search))
            {
                Groups = Groups.Where(m => m.MaMonHoc.ToLower().Contains(Search.ToLower()) || m.TenMonHoc.ToLower().Contains(Search.ToLower()));
            }
            if (ShowIgnore != null && ShowNotIgnore != null)
            {
                if (ShowIgnore == "checked" && ShowNotIgnore != "checked")
                {
                    Groups = Groups.Where(m => m.IsIgnored == true);
                }
                if (ShowIgnore != "checked" && ShowNotIgnore == "checked")
                {
                    Groups = Groups.Where(m => m.IsIgnored == false);
                }
                if (ShowIgnore != "checked" && ShowNotIgnore != "checked")
                {
                    Groups = Groups.Where(m => false);
                }
            }

            var Result = new List<string[]>();

            foreach (var su in Groups.OrderBy(m => m.TenMonHoc).Skip(param.iDisplayStart).Take(param.iDisplayLength))
            {
                Result.Add(new string[] {
                                            su.MaMonHoc,
                                            su.TenMonHoc,
                                            su.TenBoMon,
                                            su.TenKhoa,
                                            su.Nhom.ToString(),
                                            su.SoLuongDK.ToString(),
                                            su.IsIgnored?"checked":"",
                                            //"Xoá"
                                        }
                            );
            }
            return Json(new
                            {
                                sEcho = param.sEcho,
                                iTotalRecords = total,
                                iTotalDisplayRecords = Groups.Count(),
                                //iTotalDisplayedRecords = Subjects.Count(),
                                aaData = Result
                            },
                            JsonRequestBehavior.AllowGet
                        );
        }
Exemplo n.º 26
0
        /// <summary>
        /// Start a new worker thread for ocr decode
        /// </summary>
        /// <param name="sImg">Image file path. Only bmp files</param>
        /// <param name="sLang">Language source es:IT EN FR..</param>
        public String Start(String sFolder, String sImg, String sLang)
        {
            String sRet="";
            try
            {
                sLang = sLang.ToLower();
                _sImgFile = sImg;
                if (sLang.ToLower() == "zh")
                    sLang = "zh-Hant";
                _sLang = sLang;
                _sFolder = sFolder;

                _ocrEngine.LanguageManager.EnableLanguages(new string[] { sLang });
                string[] enabledLanguages = _ocrEngine.LanguageManager.GetEnabledLanguages();
                Console.WriteLine("Current enabled languages in the engine are:");
                foreach (string enabledLanguage in enabledLanguages)
                {
                    // Get the friendly name of this language using the .NET CultureInfo class 
                    CultureInfo ci = new CultureInfo(enabledLanguage);
                    Console.WriteLine("  {0} ({1})", enabledLanguage, ci.EnglishName);
                }
                // spell check
                IOcrSpellCheckManager spellCheckManager = _ocrEngine.SpellCheckManager;
                // Get the spell language supported (languages with a dictionary) 
                string[] spellLanguages = spellCheckManager.GetSupportedSpellLanguages();
                foreach (string spellLanguage in spellLanguages)
                    Console.WriteLine(spellLanguage);
                if (spellCheckManager.IsSpellLanguageSupported(sLang))
                {
                    // Yes, set it 
                    spellCheckManager.SpellLanguage = sLang;
                    spellCheckManager.Enabled = true; 
                    Console.WriteLine("Current spell language: {0}", spellCheckManager.SpellLanguage);
                }
                else
                    spellCheckManager.Enabled = false;

                

                _ocrDocument = _ocrEngine.DocumentManager.CreateDocument();

                RasterImage image = _codecs.Load(sImg);

                _ocrDocument.Pages.Clear();
                _ocrDocument.Pages.AddPage(image, null);
                _ocrDocument.Pages.AutoZone(null);
                _ocrDocument.Pages.UpdateFillMethod();
                sRet = Worker();
            }
            catch (Exception ex)
            {
                Program.MainForm.AddLog(String.Format("Exception Worker:{0}", ex.Message), "");
            }
            return sRet;
        }
Exemplo n.º 27
0
        /// <summary>
        /// 彻底删除磁盘文件
        /// </summary>
        /// <param name="srcPath">相对路径</param>
        public static void DeleteFile( String srcPath )
        {
            if (strUtil.IsNullOrEmpty( srcPath )) return;
            if (srcPath.ToLower().StartsWith( "http://" ) ||
                srcPath.ToLower().StartsWith( "https://" )
                ) return;

            String path = PathHelper.Map( srcPath );
            if (file.Exists( path ))
                wojilu.IO.File.Delete( path );
        }
 public String GetText(String keyWord)
 {
     if (currentLanguage != "" && currentTranslation.ContainsKey(keyWord.ToLower()))
     {
         return currentTranslation[keyWord.ToLower()];
     }
     else
     {
         return "[" + keyWord.ToLower() + "]";
     }
 }
Exemplo n.º 29
0
 public static Boolean TryParse(String lineType, out LineTypes type)
 {
     type = LineTypes.Comment;
     if (lineType.ToLower().Equals("dialogue")) {
         type = LineTypes.Dialogue;
         return true;
     }
     if (!lineType.ToLower().Equals("comment")) return false;
     type = LineTypes.Comment;
     return true;
 }
	// Get or set an item in this string dictionary.
	public virtual String this[String key]
			{
				get
				{
					return (String)(hash[key.ToLower(CultureInfo.InvariantCulture)]);
				}
				set
				{
					hash[key.ToLower(CultureInfo.InvariantCulture)] = value;
				}
			}
Exemplo n.º 31
0
        /// <summary>
        /// 移除数组中的指定项
        /// </summary>
        /// <param name="array">源数组</param>
        /// <param name="RemoveItem">要移除的项</param>
        /// <param name="removeBackspace">是否移除空格</param>
        /// <param name="ignoreCase">是否忽略大小写</param>
        /// <returns></returns>
        public static System.String[] RemoveArrayItem(this System.String[] StringArray, System.String RemoveItem, bool RemoveBackspace, bool ignoreCase)
        {
            if (StringArray != null && StringArray.Length > 0)
            {
                StringBuilder ArrayStr = new StringBuilder();
                if (ignoreCase)
                {
                    RemoveItem = RemoveItem.ToLower();
                }
                System.String temp = "";
                foreach (System.String item in StringArray)
                {
                    if (ignoreCase)
                    {
                        temp = item.ToLower();
                    }
                    else
                    {
                        temp = item;
                    }

                    if (temp != RemoveItem)
                    {
                        ArrayStr.AppendFormat("{0}_", RemoveBackspace ? item.Trim() : item);
                    }
                }

                return(ArrayStr.Remove(ArrayStr.Length - 1, 1).ToString().SplitString("_"));
            }

            return(StringArray);
        }
        /// <summary>
        /// Gets the current element's boolean value.
        /// </summary>
        /// <param name="value">The current element's boolean value.</param>
        /// <returns>True if successful, false otherwise.</returns>
        /// <remarks>
        /// This operation looks for (case insensitive): "true", "t", or "1" for true; "false", "f", or "0" for false.
        /// </remarks>
        public bool getCurrentElementBoolean(ref bool value)
        {
            errorStatus = ErrorStatus.NoError;

            if (currentElement == null)
            {
                errorStatus = ErrorStatus.EmptyDocument;
                return(false);
            }

            NSFString booleanString = currentElement.Text;

            booleanString = booleanString.ToLower();

            if ((booleanString == "true") || (booleanString == "t") || (booleanString == "1"))
            {
                value = true;
                return(true);
            }
            else if ((booleanString == "false") || (booleanString == "f") || (booleanString == "0"))
            {
                value = false;
                return(true);
            }

            errorStatus = ErrorStatus.BadValue;
            return(false);
        }
Exemplo n.º 33
0
        private void FindBGM(object sender, System.EventArgs e)
        {
            try
            {
                System.String query = rc_bgmSearch.Text;
                rc_bgmResult.Items.Clear();

                if (!query.TrimStart().TrimEnd().Equals(""))
                {
                    foreach (var bgm in MatchConfiguration.LoadBGMs())
                    {
                        if (query.ToLower().Equals(bgm.ToLower()) || bgm.ToLower().Contains(query.ToLower()))
                        {
                            rc_bgmResult.Items.Add(bgm);
                        }
                    }
                }

                if (rc_bgmResult.Items.Count > 0)
                {
                    rc_bgmResult.SelectedIndex = 0;
                    return;
                }
            }
            catch (Exception ex)
            {
                L.D("FindBGMError: " + ex);
            }
        }
Exemplo n.º 34
0
    public virtual bool runTest
        ()
    {
        int nErrorBits = 0;

        System.String swrString2 = null;
        System.String swrString4 = null;
        IntlStrings   intl       = new IntlStrings();

        swrString2 = intl.GetString(50, false, true);
        swrString4 = swrString2.ToLower();
        Console.WriteLine(swrString4);
        foreach (Char c in swrString4)
        {
            if (Char.GetUnicodeCategory(c) == UnicodeCategory.UppercaseLetter)
            {
                nErrorBits = nErrorBits | 0x1;
            }
        }
        System.Console.Error.WriteLine(nErrorBits);
        if (nErrorBits == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 35
0
        private void FindRing(object sender, System.EventArgs e)
        {
            try
            {
                System.String query = rc_ringSearch.Text;
                rc_ringResults.Items.Clear();

                if (!query.TrimStart().TrimEnd().Equals(""))
                {
                    foreach (var ring in MatchConfiguration.LoadRings())
                    {
                        if (query.ToLower().Equals(ring.name.ToLower()) || ring.name.ToLower().Contains(query.ToLower()))
                        {
                            rc_ringResults.Items.Add(ring.name);
                        }
                    }
                }

                if (rc_ringResults.Items.Count > 0)
                {
                    rc_ringResults.SelectedIndex = 0;
                    return;
                }
            }
            catch (Exception ex)
            {
                L.D("FindRingError: " + ex);
            }
        }
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_EQUIPMENT_UUID.ToLower(), equipmentUuid);
     xml.WriteElementSafeString(_INSTRUMENT_UUID.ToLower(), instrumentUuid);
     xml.WriteElementSafeString(_ASSET_IDENTIFIER.ToLower(), assetIdentifier);
     xml.WriteElementSafeString(_QUANTITY.ToLower(), quantity);
 }
Exemplo n.º 37
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), ID);
     xml.WriteElementSafeString(_CONNECTOR_TYPE.ToLower(), connectorType);
     xml.WriteElementSafeString(_CONNECTOR_DESCRIPTION.ToLower(), connectorDescription);
     xml.WriteElementSafeString(_PIN_COUNT.ToLower(), pinCount);
 }
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), ID);
     xml.WriteElementSafeString(_ASSET_TYPE.ToLower(), assetType);
     xml.WriteElementSafeString(_ASSET_NUMBER.ToLower(), assetNumber);
     xml.WriteElementSafeString(_UUID.ToLower(), uuid);
 }
Exemplo n.º 39
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_TYPE_ID.ToLower(), typeId);
     xml.WriteElementSafeString(_TYPE_NAME.ToLower(), typeName);
     xml.WriteElementSafeString(_CONTENT_TYPE.ToLower(), contentType);
     xml.WriteElementSafeString(_OBJECT_EDITABLE.ToLower(), objectEditable);
 }
Exemplo n.º 40
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_EQUIPMENT_UUID.ToLower(), equipmentUuid);
     xml.WriteElementSafeString(_PART_NUMBER.ToLower(), partNumber);
     xml.WriteElementSafeString(_STATION_TYPE.ToLower(), stationType);
     xml.WriteElementSafeString(_ATML.ToLower(), atml);
 }
Exemplo n.º 41
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), ID);
     xml.WriteElementSafeString(_SYMBOL.ToLower(), symbol);
     xml.WriteElementSafeString(_SI_PREFIX.ToLower(), siPrefix);
     xml.WriteElementSafeString(_MULTIPLE.ToLower(), multiple);
 }
Exemplo n.º 42
0
 /// <summary>
 /// Parse a rfc 2822 header field with parameters
 /// </summary>
 /// <param name="field">field name</param>
 /// <param name="fieldbody">field body to parse</param>
 /// <returns>A <see cref="System.Collections.Specialized.StringDictionary" /> from the parsed field body</returns>
 public static System.Collections.Specialized.StringDictionary parseHeaderFieldBody(System.String field, System.String fieldbody)
 {
     if (fieldbody == null)
     {
         return(null);
     }
     // FIXME: rewrite parseHeaderFieldBody to being regexp based.
     fieldbody = anmar.SharpMimeTools.SharpMimeTools.uncommentString(fieldbody);
     System.Collections.Specialized.StringDictionary fieldbodycol = new System.Collections.Specialized.StringDictionary();
     System.String[] words = fieldbody.Split(new Char[] { ';' });
     if (words.Length > 0)
     {
         fieldbodycol.Add(field.ToLower(), words[0].ToLower());
         for (int i = 1; i < words.Length; i++)
         {
             System.String[] param = words[i].Trim(new Char[] { ' ', '\t' }).Split(new Char[] { '=' }, 2);
             if (param.Length == 2)
             {
                 param[0] = param[0].Trim(new Char[] { ' ', '\t' });
                 param[1] = param[1].Trim(new Char[] { ' ', '\t' });
                 if (param[1].StartsWith("\"") && !param[1].EndsWith("\""))
                 {
                     do
                     {
                         param[1] += ";" + words[++i];
                     } while  (!words[i].EndsWith("\"") && i < words.Length);
                 }
                 fieldbodycol.Add(param[0], anmar.SharpMimeTools.SharpMimeTools.parserfc2047Header(param[1].TrimEnd(';').Trim('\"')));
             }
         }
     }
     return(fieldbodycol);
 }
Exemplo n.º 43
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), ID);
     xml.WriteElementSafeString(_SCHEMA_NAMESPACE.ToLower(), schemaNamespace);
     xml.WriteElementSafeString(_SCHEMA_CONTENT.ToLower(), schemaContent);
     xml.WriteElementSafeString(_ACTIVE_FLAG.ToLower(), activeFlag);
 }
Exemplo n.º 44
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_COUNTRY_ID.ToLower(), countryId);
     xml.WriteElementSafeString(_COUNTRY_NAME.ToLower(), countryName);
     xml.WriteElementSafeString(_COUNTRY_CODE.ToLower(), countryCode);
     xml.WriteElementSafeString(_ACTIVE_FLAG.ToLower(), activeFlag);
 }
Exemplo n.º 45
0
        public void Search(String fileName, Label label)
        {
            File[] temp = new File[1000];

            int count = 0;

            foreach (File f in ListFile)
            {
                if (f.Name.ToLower().Contains(fileName.ToLower()))
                {
                    if (count < temp.Length)
                    {
                        temp[count++] = f;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            label.Text = " Найдено " + count;

            generateList(temp);
        }
Exemplo n.º 46
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), id);
     xml.WriteElementSafeString(_LIBRARY_UUID.ToLower(), libraryUuid);
     xml.WriteElementSafeString(_SIGNAL_NAME.ToLower(), signalName);
     xml.WriteElementSafeString(_SIGNAL_CONTENT.ToLower(), signalContent);
     xml.WriteElementSafeString(_LAST_UPDATE.ToLower(), lastUpdate);
 }
Exemplo n.º 47
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_CONFIG_ID.ToLower(), configId);
     xml.WriteElementSafeString(_PIN_IDX.ToLower(), pinIdx);
     xml.WriteElementSafeString(_PIN_NAME.ToLower(), pinName);
     xml.WriteElementSafeString(_PIN_DIRECTION.ToLower(), pinDirection);
     xml.WriteElementSafeString(_PIN_DESCRIPTION.ToLower(), pinDescription);
 }
Exemplo n.º 48
0
 /// <summary>
 /// Check if the given string object containing a URL, is that of the
 /// URL root only.  Returns True if so, False if not.  For example:
 ///   "https://cjvandyk.sharepoint.com".IsUrlRootOnly()
 ///   will return True whereas
 ///   "https://cjvandyk.sharepoint.com/sites/Approval".IsUrlRootOnly()
 ///   will return False.
 /// </summary>
 /// <param name="url">The System.String object containing the URL to
 /// be checked.</param>
 /// <returns>True if the URL is a root, False if not.</returns>
 public static bool IsUrlRoot(this System.String url)
 {
     if (url.ToLower().Replace("https://", "").IndexOf('/') == -1)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 49
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_STATE_ID.ToLower(), stateId);
     xml.WriteElementSafeString(_STATE_NAME.ToLower(), stateName);
     xml.WriteElementSafeString(_STATE_CODE.ToLower(), stateCode);
     xml.WriteElementSafeString(_COUNTRY_CODE.ToLower(), countryCode);
     xml.WriteElementSafeString(_STATE_FIPS.ToLower(), stateFips);
 }
Exemplo n.º 50
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_SIGNAL_ID.ToLower(), signalId);
     xml.WriteElementSafeString(_SIGNAL_NAME.ToLower(), signalName);
     xml.WriteElementSafeString(_PARENT_SIGNAL_ID.ToLower(), parentSignalId);
     xml.WriteElementSafeString(_XMLNS.ToLower(), xmlns);
     xml.WriteElementSafeString(_UUID.ToLower(), uuid);
 }
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), id);
     xml.WriteElementSafeString(_SOURCE_TYPE.ToLower(), sourceType);
     xml.WriteElementSafeString(_SOURCE_NAME.ToLower(), sourceName);
     xml.WriteElementSafeString(_TARGET_TYPE.ToLower(), targetType);
     xml.WriteElementSafeString(_TARGET_NAME.ToLower(), targetName);
 }
Exemplo n.º 52
0
 private static Occurrences WordOccurrences(Word word)
 {
     return(word
            .ToLower()
            .GroupBy(c => c)
            .Select(g => Tuple.Create(g.Key, g.Count()))
            .OrderBy(tuple => tuple.Item1));
 }
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_SIGNAL_ATTRIBUTE_ID.ToLower(), signalAttributeId);
     xml.WriteElementSafeString(_SIGNAL_ID.ToLower(), signalId);
     xml.WriteElementSafeString(_ATTRIBUTE_NAME.ToLower(), attributeName);
     xml.WriteElementSafeString(_DEFAULT_VALUE.ToLower(), defaultValue);
     xml.WriteElementSafeString(_TYPE.ToLower(), type);
     xml.WriteElementSafeString(_FIXED_VALUE.ToLower(), fixedValue);
 }
Exemplo n.º 54
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), id);
     xml.WriteElementSafeString(_LIBRARY_NAME.ToLower(), libraryName);
     xml.WriteElementSafeString(_CONTENT.ToLower(), content);
     xml.WriteElementSafeString(_FILE_NAME.ToLower(), fileName);
     xml.WriteElementSafeString(_LAST_UPDATE.ToLower(), lastUpdate);
     xml.WriteElementSafeString(_TARGET_NAMESPACE.ToLower(), targetNamespace);
 }
Exemplo n.º 55
0
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_INSTRUMENT_UUID.ToLower(), instrumentUuid);
     xml.WriteElementSafeString(_INSTRUMENT_NAME.ToLower(), instrumentName);
     xml.WriteElementSafeString(_MODEL_NAME.ToLower(), modelName);
     xml.WriteElementSafeString(_ATML.ToLower(), atml);
     xml.WriteElementSafeString(_DESCRIPTION.ToLower(), description);
     xml.WriteElementSafeString(_PART_NUMBER.ToLower(), partNumber);
 }
Exemplo n.º 56
0
        private static bool allowParam(String paramName)
        {
            String canonParamName = paramName.ToLower();

            return(!(canonParamName.StartsWith("oauth") ||
                     canonParamName.StartsWith("xoauth") ||
                     canonParamName.StartsWith("opensocial")) &&
                   ALLOWED_PARAM_NAME.IsMatch(canonParamName));
        }
Exemplo n.º 57
0
        /// <summary> Read the specified boolean property.
        /// Converts a property value like "true" or "1" to its boolean value.
        /// <p>
        /// Returns false if the property doesn't exist or can't be converted to a
        /// boolean.
        /// *
        /// </summary>
        /// <param name="key">the name of the property
        /// </param>
        /// <returns> the property value
        ///
        /// </returns>
        public static bool getBooleanProperty(System.Configuration.AppSettingsReader properties, System.Object key)
        {
            System.String string_Renamed = (System.String)properties.GetValue(key.ToString(), Type.GetType("System.String"));

            if (string_Renamed == null)
            {
                System.Console.Error.WriteLine("WARN: couldn't find boolean value under '" + key + "'");
                return(false);
            }

            if (string_Renamed.ToLower().Equals("true") || string_Renamed.ToLower().Equals("on") || string_Renamed.ToLower().Equals("yes") || string_Renamed.ToLower().Equals("1"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public override void writeXML(UTRSXmlWriter xml)
 {
     xml.WriteElementSafeString(_ID.ToLower(), ID);
     xml.WriteElementSafeString(_EXTENSION.ToLower(), extension);
     xml.WriteElementSafeString(_ASCII.ToLower(), ascii);
     xml.WriteElementSafeString(_SIGNATURE.ToLower(), signature);
     xml.WriteElementSafeString(_OFFSET.ToLower(), offset);
     xml.WriteElementSafeString(_SIZE.ToLower(), size);
     xml.WriteElementSafeString(_CONTENT_TYPE.ToLower(), contentType);
 }
Exemplo n.º 59
0
        /// <summary> Read the specified boolean property.
        /// Converts a property value like "true" or "1" to its boolean value.
        /// <p>
        /// Returns false if the property doesn't exist or can't be converted to a
        /// boolean.
        ///
        /// </summary>
        /// <param name="key">the name of the property
        /// </param>
        /// <returns> the property value
        /// </returns>
        //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.Properties' and 'System.Collections.Specialized.NameValueCollection' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
        public static bool getBooleanProperty(System.Collections.Specialized.NameValueCollection properties, System.Object key)
        {
            System.String string_Renamed = (System.String)properties[(System.String)key];

            if (string_Renamed == null)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                System.Console.Error.WriteLine("WARN: couldn't find boolean value under '" + key + "'");
                return(false);
            }

            if (string_Renamed.ToLower().Equals("true") || string_Renamed.ToLower().Equals("on") || string_Renamed.ToLower().Equals("yes") || string_Renamed.ToLower().Equals("1"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 60
0
 private String DesCapitalize(System.String str)
 {
     if (str.Length <= 1)
     {
         return(str.ToLower());
     }
     else
     {
         return(str.Substring(0, (1) - (0)).ToLower() + str.Substring(1));
     }
 }