Skip to content
Permalink
Browse files

QuranCode 6.19.1093

  • Loading branch information...
heliwave committed May 28, 2019
1 parent 1add2cb commit c515fadc1d5bf180e534b3669bf23a1506da466d
#endregion
#region ScriptRunner
///////////////////////////////////////////////////////////////////////////////
private Assembly compiled_assembly = null;
private Assembly m_compiled_assembly = null;
private PermissionSet m_permission_set = null;
private string m_script_filename = null;
//private string[] LoadAssemblyMethods(string assembly_name)
}
else
{
compiled_assembly = compiler_results.CompiledAssembly;
if (compiled_assembly != null)
m_compiled_assembly = compiler_results.CompiledAssembly;
if (m_compiled_assembly != null)
{
ScriptOutputTextBox.Text = "Script was compiled successfully.";
ScriptOutputTextBox.Refresh();
if (sender != ScriptRunLabel) this.Cursor = Cursors.WaitCursor;
try
{
if (compiled_assembly != null)
if (m_compiled_assembly != null)
{
object[] args = new object[] { m_client, null };
object result = ScriptRunner.Run(compiled_assembly, args, this.m_permission_set);
object result = ScriptRunner.Run(m_compiled_assembly, args, this.m_permission_set);
if (result is bool)
{
if ((bool)result == true)
BIN +0 Bytes (100%) QuranCode/UserText/UserText4.txt
Binary file not shown.
BIN -73 Bytes (100%) QuranCode1433.Source.zip
Binary file not shown.
BIN -715 Bytes (100%) QuranCode1433.zip
Binary file not shown.
@@ -58,13 +58,13 @@ CD ..\..

MD Files
CD Files
MD Win7
MD Win10
MD NET2
MD NET4
CD ..
COPY /Y NET2\Build\Release\*.exe Files\Win7\
COPY /Y NET2\Build\Release\*.dll Files\Win7\
COPY /Y Build\Release\*.exe Files\Win10\
COPY /Y Build\Release\*.dll Files\Win10\
COPY /Y NET2\Build\Release\*.exe Files\NET2\
COPY /Y NET2\Build\Release\*.dll Files\NET2\
COPY /Y Build\Release\*.exe Files\NET4\
COPY /Y Build\Release\*.dll Files\NET4\
"%PROGRAMFILES%\7-Zip\7z.exe" a -tzip -r -mx5 QuranCode1433.zip Files\*.*
"%PROGRAMFILES%\7-Zip\7z.exe" a -tzip -r -mx5 QuranCode1433.zip Setup.bat
RD /S /Q Files
@@ -8,7 +8,6 @@
using System.Security;
//using System.IO.IsolatedStorage;
//using System.Security.Permissions;
using Model;

public static class ScriptRunner
{
@@ -50,26 +49,28 @@ public static string LoadScript(string filename)
/// <returns></returns>
public static string SaveScript(string filename, string text)
{
string[] parts = filename.Split('~');
if (parts.Length > 1)
if (!String.IsNullOrEmpty(filename))
{
filename = parts[0] + ".cs";
}
if ((filename == "Template.cs") || (filename == "Samples.cs"))
{
filename = filename.Insert(filename.Length - 3, "~" + DateTime.Now.ToString("yyyyMMdd_hhmmss"));
}
string[] parts = filename.Split('~');
if (parts.Length > 1)
{
filename = parts[0] + ".cs";
}
if ((filename == "Template.cs") || (filename == "Samples.cs"))
{
filename = filename.Insert(filename.Length - 3, "~" + DateTime.Now.ToString("yyyyMMdd_hhmmss"));
}

string path = Globals.SCRIPTS_FOLDER + "/" + filename;
if (Directory.Exists(Globals.SCRIPTS_FOLDER))
{
using (StreamWriter writer = new StreamWriter(path, false, Encoding.Unicode))
string path = Globals.SCRIPTS_FOLDER + "/" + filename;
if (Directory.Exists(Globals.SCRIPTS_FOLDER))
{
writer.WriteLine(text);
writer.Close();
using (StreamWriter writer = new StreamWriter(path, false, Encoding.Unicode))
{
writer.WriteLine(text);
writer.Close();
}
}
}

return filename;
}

@@ -81,18 +82,25 @@ public static string SaveScript(string filename, string text)
public static CompilerResults CompileCode(string source_code)
{
CSharpCodeProvider provider = new CSharpCodeProvider();
if (provider != null)
{
CompilerParameters options = new CompilerParameters();
if (options != null)
{
options.GenerateExecutable = false; // generate a Class Library assembly
options.GenerateInMemory = true; // so we don't have to delete it from disk

CompilerParameters options = new CompilerParameters();
options.GenerateExecutable = false; // generate a Class Library assembly
options.GenerateInMemory = true; // so we don;t have to delete it from disk
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
options.ReferencedAssemblies.Add(assembly.Location);
}

Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
options.ReferencedAssemblies.Add(assembly.Location);
return provider.CompileAssemblyFromSource(options, source_code);
}
return null;
}

return provider.CompileAssemblyFromSource(options, source_code);
return null;
}

/// <summary>
@@ -105,10 +113,10 @@ public static object Run(Assembly compiled_assembly, object[] args, PermissionSe
{
if (compiled_assembly != null)
{
// security is not implemented yet !NIY
// using Utilties.PrivateStorage was can save but not display in Notepad
// security is not implemented yet!
// using Utilties.PrivateStorage can save but not display in Notepad
// plus the output is saved in C:\Users\<user>\AppData\Local\IsolatedStorage\...
// no control over where to save make QuranCode unportable applicaton, which is a not acceptable
// no control over where to save make QuranCode unportable applicaton
//// restrict code security
//???permission_set.PermitOnly();

@@ -127,20 +135,11 @@ public static object Run(Assembly compiled_assembly, object[] args, PermissionSe
{
return obj.Run(args);
}
else
{
throw new Exception("Invalid C# code!");
}
throw new Exception("Invalid C# code!");
}
else
{
throw new Exception("No default constructor was found!");
}
}
else
{
throw new Exception("IScriptRunner is not implemented!");
throw new Exception("No default constructor was found!");
}
throw new Exception("IScriptRunner is not implemented!");
}
}

@@ -171,10 +170,7 @@ public static object ExecuteStaticMethod(Assembly compiled_assembly, string meth
{
return method.Invoke(null, args);
}
else
{
throw new Exception("Cannot invoke method :" + methode_name);
}
throw new Exception("Cannot invoke method :" + methode_name);
}
}
}
@@ -204,10 +200,7 @@ public static object ExecuteInstanceMethod(Assembly compiled_assembly, string me
object obj = Activator.CreateInstance(type, null);
return method.Invoke(obj, args);
}
else
{
throw new Exception("Cannot invoke method :" + methode_name);
}
throw new Exception("Cannot invoke method :" + methode_name);
}
}
}
@@ -57,7 +57,6 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WAVMaker, Version=7.29.139.33888, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Tools\WAVMaker\bin\Release\WAVMaker.dll</HintPath>
@@ -69,8 +68,6 @@
<Content Include="Scripts\Samples.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Include="ScriptTester.cs">
</Compile>
<Compile Include="ScriptRunner.cs" />
</ItemGroup>
<ItemGroup>
Binary file not shown.
@@ -14,33 +14,45 @@ private bool MyMethod(Client client)
client.FoundVerses.Clear();
foreach (Verse verse in client.Book.Verses)
{
string text = verse.Text.Simplify28().Trim().Replace(" ", "");
if (text.StartsWith("و"))
{
int sum = 0;
for (int i = 0; i < text.Length; i++)
{
if (text[i] == 'و')
{
sum += (i + 1);
}
}
//string text = verse.Text.Simplify28().Trim().Replace(" ", "");
//if (text.StartsWith("و"))
//{
// int sum = 0;
// for (int i = 0; i < text.Length; i++)
// {
// if (text[i] == 'و')
// {
// sum += (i + 1);
// }
// }

if (sum == 479)
{
client.FoundVerses.Add(verse);
}
}
// if (sum == 479)
// {
// client.FoundVerses.Add(verse);
// }
//}

//if (Numbers.IsPrime(verse.Number)) // 811
//if (Numbers.IsAdditivePrime(verse.Number)) // 408
//if (Numbers.IsNonAdditivePrime(verse.Number)) // 403
//if (Numbers.IsPrime(verse.NumberInChapter)) // 1730
//if (Numbers.IsAdditivePrime(verse.NumberInChapter)) // 1060
//if (Numbers.IsNonAdditivePrime(verse.NumberInChapter)) // 670
//if (Numbers.IsComposite(verse.Number)) // 5424
//if (Numbers.IsAdditiveComposite(verse.Number)) // 3842
//if (Numbers.IsNonAdditiveComposite(verse.Number)) // 1582
//if (Numbers.IsComposite(verse.NumberInChapter)) // 4392
//if (Numbers.IsAdditiveComposite(verse.NumberInChapter)) // 2824
//if (Numbers.IsNonAdditiveComposite(verse.NumberInChapter)) // 1568

//if (Numbers.IsPrime(verse.Number)) // verse number in the Quran is prime
//if ((verse.Number % 19) == 0) // verse number in the Quran is divisble by 19
//if (verse.NumberInChapter == verse.Words.Count) // verse number = verse words
//if (verse.NumberInChapter == verse.LetterCount) // verse number = verse letters
//if (client.CalulateValue(verse) == 114) // verse value = 114 in current Client.NumerologySystem
//if (verse.Text.Simplify29().ContainsWords("تر كتب")) // verse contines whole words in any order
//{
// client.FoundVerses.Add(verse);
//}
if (verse.NumberInChapter == verse.LetterCount) // verse number = verse letters
//if (client.CalculateValue(verse) == 114) // verse value = 114 in current Client.NumerologySystem
//if (verse.Text.Simplify29().ContainsWords("قرء كتب")) // verse contines whole words in any order
{
client.FoundVerses.Add(verse);
}
}
return true; // to close Script window and show client.FoundVerses
}
@@ -16,15 +16,15 @@ if "%VERSION%" == "6.3" echo Windows 8.1
if "%VERSION%" == "6.4" echo Windows 10
if "%VERSION%" == "10.0" echo Windows 10

if "%VERSION%" == "5.00" COPY Files\Win7\*.* .
if "%VERSION%" == "5.0" COPY Files\Win7\*.* .
if "%VERSION%" == "5.1" COPY Files\Win7\*.* .
if "%VERSION%" == "5.2" COPY Files\Win7\*.* .
if "%VERSION%" == "6.0" COPY Files\Win10\*.* .
if "%VERSION%" == "6.1" COPY Files\Win10\*.* .
if "%VERSION%" == "6.2" COPY Files\Win10\*.* .
if "%VERSION%" == "6.3" COPY Files\Win10\*.* .
if "%VERSION%" == "6.4" COPY Files\Win10\*.* .
if "%VERSION%" == "10.0" COPY Files\Win10\*.* .
if "%VERSION%" == "5.00" COPY Files\NET2\*.* .
if "%VERSION%" == "5.0" COPY Files\NET2\*.* .
if "%VERSION%" == "5.1" COPY Files\NET2\*.* .
if "%VERSION%" == "5.2" COPY Files\NET2\*.* .
if "%VERSION%" == "6.0" COPY Files\NET4\*.* .
if "%VERSION%" == "6.1" COPY Files\NET4\*.* .
if "%VERSION%" == "6.2" COPY Files\NET4\*.* .
if "%VERSION%" == "6.3" COPY Files\NET4\*.* .
if "%VERSION%" == "6.4" COPY Files\NET4\*.* .
if "%VERSION%" == "10.0" COPY Files\NET4\*.* .

endlocal
BIN +12.5 KB (100%) Solution.vs2013.v12.suo
Binary file not shown.

0 comments on commit c515fad

Please sign in to comment.
You can’t perform that action at this time.