)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Default (Ia.Islamic.Koran.Wa.Model.Business)

Public general use code classes and xml files that we've compiled and used over the years:

    1: using System;
    2: using System.Collections;
    3: using System.Collections.Generic;
    4: using System.Linq;
    5: using System.Web;
    6: using System.Data;
    7: using System.Text;
    8: using System.Text.RegularExpressions;
    9: using System.Xml;
   10: using System.Xml.Linq;
   11: using System.Globalization;
   12: using Ia.Islamic.Cl.Model;
   13: using Ia.Islamic.Cl.Model.Ui;
   14:  
   15: namespace Ia.Islamic.Koran.Wa.Model.Business
   16: {
   17:     ////////////////////////////////////////////////////////////////////////////
   18:  
   19:     /// <summary publish="true">
   20:     ///
   21:     /// </summary>
   22:     /// 
   23:     /// <remarks> 
   24:     /// Copyright © 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   25:     ///
   26:     /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   27:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   28:     ///
   29:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   30:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   31:     /// 
   32:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   33:     /// 
   34:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   35:     /// </remarks> 
   36:     public class Default
   37:     {
   38:         ////////////////////////////////////////////////////////////////////////////
   39:  
   40:         /// <summary publish="false">
   41:         /// Koran Reference Network Class Library support functions: Business model
   42:         /// </summary>
   43:         /// <value>
   44:         /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
   45:         /// </value>
   46:         /// <remarks> 
   47:         /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   48:         ///
   49:         /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   50:         /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   51:         ///
   52:         /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   53:         /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   54:         /// 
   55:         /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   56:         /// 
   57:         /// Copyright notice: This notice may not be removed or altered from any source distribution.
   58:         /// </remarks> 
   59:         public Default()
   60:         {
   61:         }
   62:  
   63:         ////////////////////////////////////////////////////////////////////////////
   64:         ////////////////////////////////////////////////////////////////////////////
   65:     }
   66: }
   67:  
   68: /*
   69: 
   70: # below: the following two functions, (unaccent() and small()) are used
   71: # for Western languages only.
   72: 
   73: sub unaccent
   74: {
   75: # This function takes in a word and returns a copy of the word with
   76: # all accent letters changed to standard ASCII ones.
   77: 
   78: my($middle)=$_[0];
   79: $middle=~tr/áàäâúùüûóòöôíìïîéèëêñç/aaaauuuuooooiiiieeeenc/;
   80: $middle=~tr/ÁÀÄÂÚÙÜÛÓÒÖÔÍÌÏÎÉÈËÊÑÇ/AAAAUUUUOOOOIIIIEEEENC/;
   81: $middle=~s/ß/ss/; #? "ss" or "SS"?
   82: 
   83: return $middle;
   84: }
   85: 
   86: sub small
   87: {
   88: # This function takes in a word and returns a copy of the word with
   89: # all capital letters changed to small ones. Even accents are changed,
   90: # from capital accents to small accents.
   91: 
   92: my($middle)=$_[0];
   93: $middle=~tr/A-ZÁÀÄÂÆŒÚÙÜÛÓÒÖÔÍÌÏÎÉÈËÊÑÇ/a-záàäâæœúùüûóòöôíìïîéèëêñç/;
   94: $middle=~s/ß/ss/;
   95: 
   96: return $middle;
   97: }
   98: 
   99: sub basic
  100: {
  101: # For Western languages, this function takes in a word and returns a
  102: # copy of the word with all capital letters changed to small, and all
  103: # accent letters to standard ASCII ones.
  104: 
  105: # For Japanese and Korean, on the other hand, this function is not yet
  106: # defined. It will just return the same argument unchanged, for now.
  107: 
  108: if(($Lang eq "J") or ($Lang eq "K")) { return $_[0]; }
  109: else { return &small(&unaccent($_[0])); }
  110: }
  111: 
  112: #
  113: # Small Subroutines.
  114: #
  115: 
  116: sub to_numeric_string
  117: {
  118: my ($str,$out,$len,$i,$c);
  119: # This is a special function to convert the text string to a numeric
  120: # string representation. The purpose of doing it this way is that
  121: # the Japanese and Korean languages, and possibly other European languages,
  122: # have many characters to represent their words that can not be used as file
  123: # names under Windows (and/or DOS, and possibly UNIX). This function
  124: # will change every single character of the string "str" to an equivalent
  125: # string that has the numeric (numbers) representation of this character.
  126: # This number will be unique for every string, and it will be possible
  127: # to save it as a file name. (It will be rather long for some words, though).
  128: 
  129: $str=$_[0];
  130: $len=length($str);
  131: foreach $i (0..$len)
  132: {
  133: $c=ord(substr($str,$i,1))+256;
  134: # above: "ord" returns that character as a number.
  135: 
  136: # below: I don't believe the first case will become true.
  137: if($c<10) { $out.="00".$c; }
  138: elsif($c<100) { $out.="0";$out.=$c; }
  139: else { $out.=$c; }
  140: }
  141: 
  142: return $out;
  143: }
  144: 
  145: sub numbers_to_location
  146: {
  147: # This function will return the location of the word in the Koran
  148: # by creating a unique representation of the chapter and verse where
  149: # the word is located in a two character format. This two-character
  150: # format will be used in the search machine files. The program below
  151: # will produce verse location representations that could be compared
  152: # lexicographically to indicate whether a location is before of after
  153: # another. This should be more efficient for script files to compare.
  154: # It returns the location string.
  155: 
  156: # According to the arrangement of the number of verses in the chapters of
  157: # the Koran, there will be no problem of X or Y becoming larger than FF.
  158: # X=chapter, Y=verse.
  159: 
  160: # Note that the space character ' ' will not appear in the representation
  161: 
  162: my ($X,$Y);
  163: ($X,$Y)=($_[0],$_[1]);
  164: if($X<50)
  165: {
  166: $X=(2*$X)-1;
  167: if($Y>200) { $X+=1;$Y-=200; }
  168: }
  169: else { $X+=50; }
  170: 
  171: $X+=32;$Y+=32;
  172: 
  173: return (chr($X).chr($Y));
  174: }
  175:  */