Here are the examples of the csharp api string.ToLower() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
13592 Examples
19
Source : Form1.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
private string generateIDs(int length)
{
String ret = "";
for (int x = 0; x< length; x++)
{
if(GetRandomNumber(0,100) < 60)
{
ret += "" + GetRandomNumber(0,9);
}
else
{
ret += ("" + (char)GetRandomNumber(97, 122)).ToLower();
}
//int val = 86;
//do
//{
// val = GetRandomNumber(48,90);
//} while (val >= 58 && val <=64);
//ret += ("" + (char)val).ToLower();
}
return ret;
}
19
Source : AccountController.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
public static void addAccount(String paraUsername, String paraPreplacedword, bool paraDesktopAuth)
{
bool found = false;
foreach (var item in userAccounts)
{
UserAccount temp = (UserAccount)item;
if (temp.username.ToLower().Equals(paraUsername.ToLower()))
{
found = true;
}
}
if (!found)
{
userAccounts.Add(new UserAccount { username = paraUsername, preplacedword = paraPreplacedword, desktopAuth = paraDesktopAuth });
}
}
19
Source : AccountController.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
public static UserAccount getAccount(String username)
{
foreach (var item in userAccounts)
{
UserAccount temp = (UserAccount)item;
if (temp.username.ToLower().Equals(username.ToLower()))
{
return temp;
}
}
return null;
}
19
Source : AccountController.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
public void AddFriend(Friend item)
{
bool found = false;
foreach (Friend var in friendArray)
{
Friend temp = (Friend)var;
if (temp.steamFrindsID.ToLower().Equals(item.steamFrindsID.ToLower()))
{
found = true;
}
}
if (!found)
{
friendArray.Add(item);
}
}
19
Source : LocalSteamController.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
private static void killSteam()
{
Process[] proc = Process.GetProcesses();
foreach (Process item in proc)
{
if (item.ProcessName.ToLower().Equals("steam") || item.ProcessName.Equals("gameOverlayui"))
{
item.Kill();
}
}
}
19
Source : Settings.xaml.cs
with GNU General Public License v3.0
from 00000vish
with GNU General Public License v3.0
from 00000vish
public void Show(string cond)
{
Show();
updateGUI();
switch (cond.ToLower())
{
case "find steam": SteamLink.Content = "Click here to locate Steam.exe"; break;
default: break;
}
}
19
Source : Configuration.ValueConfig.cs
with GNU Affero General Public License v3.0
from 0ceal0t
with GNU Affero General Public License v3.0
from 0ceal0t
private bool DrawCombo(string id, T[] comboOptions, T currentValue, out T value) {
value = currentValue;
if (ImGui.BeginCombo(id, $"{currentValue}", ImGuiComboFlags.HeightLargest)) {
if (ShowSearch) {
ImGui.SetNexreplacedemWidth(ImGui.GetWindowContentRegionWidth() - 50);
ImGui.InputText("Search##Combo", ref SearchInput, 256);
}
if (ShowSearch) ImGui.BeginChild("Child##Combo", new Vector2(ImGui.GetWindowContentRegionWidth(), 200), true);
var idx = 0;
foreach (T option in comboOptions) {
if (ShowSearch && !string.IsNullOrEmpty(SearchInput)) {
var optionString = option.ToString();
if (!optionString.ToLower().Contains(SearchInput.ToLower())) continue;
}
if (ImGui.Selectable($"{option}##Combo{idx}", option.Equals(currentValue))) {
value = option;
if (ShowSearch) ImGui.EndChild();
ImGui.EndCombo();
return true;
}
idx++;
}
if (ShowSearch) ImGui.EndChild();
ImGui.EndCombo();
}
return false;
}
19
Source : RequestObject.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private void Parse(string data)
{
string key,value, tagEnd;
int beg=-1, end=0;
beg = data.IndexOf("<", beg+1);
while (beg != -1)
{
end = data.IndexOf(">", beg);
if (end == -1)
break;
beg++;
key = data.Substring(beg, end - beg);
tagEnd = string.Format("</{0}>", key);
beg = end + 1;
end = data.IndexOf(tagEnd, beg);
if (end == -1)
break;
value = data.Substring(beg, end - beg);
items.Add(key.ToLower(), NormalizeValue(value));
beg = data.IndexOf("<", end + 1);
}
}
19
Source : Watchdog.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private bool IsWatchableProcess(Process proc)
{
return watchList.Contains(proc.ProcessName.ToLower());
}
19
Source : Watchdog.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private IEnumerable<Process> Intersect(WatchdogState ws)
{
if (ws.FirstSnapshot.Count == 0)
yield break;
foreach (var fsp in ws.FirstSnapshot)
{
foreach (var ssp in ws.SecondSnapshot)
{
if (fsp.ProcessName.ToLower() == ssp.ProcessName.ToLower())
{
yield return fsp;
break;
}
}
}
}
19
Source : EdisFace.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private void RequestHandler(IAsyncResult result)
{
Dictionary<string, string> form;
string objectName,path;
HttpListenerContext ctx;
if (!this.httpListener.IsListening)
return;
try
{
ctx = this.httpListener.EndGetContext(result);
}
catch (Exception e)
{
Log.Error("request completion error: " + e.Message);
RegisterRequestWaiter(null);
return;
}
form = BuildForm(ctx);
objectName = ctx.Request.Url.LocalPath;
var ext = Path.GetExtension(objectName);
objectName = Path.GetFileNameWithoutExtension(objectName);
objectName = objectName.
Replace(".", "").
Replace("/","").
Replace("\\","");
if (string.IsNullOrEmpty(objectName))
objectName = "\\";
else
objectName = "\\" + objectName + ext;
path = Config.Get().HtmlContentRoot + objectName;
RegisterRequestWaiter(null);
if (objectName == "\\")
{
if (ctx.Request.HttpMethod.ToLower() == "post")
{
HandlePost(ctx, form);
}
else
ReplyIndex(ctx, string.Empty);
}
else
{
ReplyWithFile(ctx, path);
}
ctx.Response.Close();
}
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public static MemcachedInstance FindInstance(string name)
{
name = name.ToLower();
if (_MemcachedInstances.ContainsKey(name))
{
return _MemcachedInstances[name] as MemcachedInstance;
}
return null;
}
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private bool IsInstanceExists(string instanceName)
{
return _MemcachedInstances.ContainsKey(instanceName.ToLower());
}
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private bool PutInstance(MemcachedInstance instance, string name)
{
lock (_InstanceListLock)
{
if (IsInstanceExists(name))
return false;
_MemcachedInstances.Add(name.ToLower(), instance);
}
return true;
}
19
Source : MemcachedInstance.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private void RemoveInstance(string name)
{
lock (_InstanceListLock)
{
if (IsInstanceExists(name))
{
_MemcachedInstances.Remove(name.ToLower());
}
}
}
19
Source : SozlukDataStore.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public static Suser GetSuser(string suser)
{
string query = string.Format(GET_SUSER_SQL, suser.Trim().ToLower());
Suser suserObject = null;
if (!CacheManager.TryGetCachedQueryResult<Suser>(query,out suserObject))
{
SqlServerIo sql = SqlServerIo.Create();
if (sql.Execute(false, query))
{
if (sql.Read())
{
suserObject = new Suser(
0,
sql.GetValueOfColumn<string>("Suser"),
sql.GetValueOfColumn<string>("Preplacedword")
);
}
}
SqlServerIo.Release(sql);
}
return suserObject;
}
19
Source : SozlukRequestHandlerBase.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public T GetValue<T>(string key, bool sanitSql=true)
{
T val = this.req.Gereplacedem<T>(key);
if (typeof(T) == typeof(string))
{
string sval = (string)(object)val;
if (sval == null)
return default(T); //null
sval = sval.ToLower();
if (sanitSql)
sval = InputHelper.SanitizeForSQL(sval);
return (T)(object)sval;
}
return val;
}
19
Source : Suser.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public static string FixPreplacedword(string pwd)
{
return pwd.ToLower();
}
19
Source : RequestObject.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public bool HasItem(string key)
{
return items.ContainsKey(key.ToLower());
}
19
Source : InternalTalk.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public Dictionary<string, string> Parse(byte[] data, int length)
{
Dictionary<string, string> talkInfo = new Dictionary<string, string>();
string s = Encoding.ASCII.GetString(data,0,length);
var items = s.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
Log.Verbose(s);
foreach (var item in items)
{
var kv = item.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
if (!talkInfo.ContainsKey(kv[0].ToLower()))
talkInfo.Add(kv[0].ToLower(), kv[1]);
}
return talkInfo;
}
19
Source : SozlukDataStore.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public static SearchAndIndexQueryResult FetchBasliks(string index, int pageNumber, string pagerHash)
{
DateTime begin, end;
//fresh contents
if (string.IsNullOrEmpty(index))
{
GetTodaysDateRange(out begin, out end);
return FetchBasliksUsingSearch(true,string.Empty, string.Empty, begin, end, pageNumber,pagerHash,true);
}
index = index.ToLower();
if (index == "all")
return FetchBasliksIndexed(pageNumber,'.',pagerHash);
if (index == "*")
return FetchBasliksIndexed(pageNumber, '*',pagerHash);
if (index[0] >= 'a' && index[0] <= 'z')
return FetchBasliksIndexed(pageNumber, index[0],pagerHash);
return new SearchAndIndexQueryResult();
}
19
Source : RequestObject.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public T Gereplacedem<T>(string key)
{
object val;
if (!HasItem(key))
{
return default(T);
}
val = items[key.ToLower()];
try
{
val = Convert.ChangeType(val, typeof(T));
}
catch
{
return default(T);
}
return (T)val;
}
19
Source : SQLite.cs
with GNU General Public License v3.0
from 0xfd3
with GNU General Public License v3.0
from 0xfd3
public string GetValue(int row_num, string field)
{
int num = -1;
int length = this.field_names.Length - 1;
for (int i = 0; i <= length; i++)
{
if (this.field_names[i].ToLower().CompareTo(field.ToLower()) == 0)
{
num = i;
break;
}
}
if (num == -1)
{
return null;
}
return this.GetValue(row_num, num);
}
19
Source : Program.cs
with GNU General Public License v3.0
from 0xthirteen
with GNU General Public License v3.0
from 0xthirteen
static void Main(string[] args)
{
if (args.Length < 2)
{
Usage();
return;
}
var arguments = new Dictionary<string, string>();
foreach (string argument in args)
{
int idx = argument.IndexOf('=');
if (idx > 0)
arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
}
string username = "";
string preplacedword = "";
if (arguments.ContainsKey("username"))
{
if (!arguments.ContainsKey("preplacedword"))
{
Usage();
return;
}
else
{
username = arguments["username"];
preplacedword = arguments["preplacedword"];
}
}
if (arguments.ContainsKey("preplacedword") && !arguments.ContainsKey("username"))
{
Usage();
return;
}
if (arguments.ContainsKey("computername"))
{
string[] computerNames = arguments["computername"].Split(',');
string eventName = "Debug";
string location = "local";
string droplocation = @"C:\Windows\Temp";
string wnamespace = "root\\CIMv2";
string filename = string.Empty;
string valuename = string.Empty;
string keypath = string.Empty;
string clreplacedname = string.Empty;
foreach (string computerName in computerNames)
{
if (arguments.ContainsKey("eventname"))
{
eventName = arguments["eventname"];
}
if (arguments.ContainsKey("location"))
{
location = arguments["location"];
}
if (arguments.ContainsKey("droplocation"))
{
droplocation = arguments["droplocation"];
}
if (arguments.ContainsKey("filename"))
{
filename = arguments["filename"];
}
if (arguments.ContainsKey("clreplacedname"))
{
clreplacedname = arguments["clreplacedname"];
}
if (arguments.ContainsKey("keypath"))
{
keypath = arguments["keypath"];
}
if (arguments.ContainsKey("valuename"))
{
valuename = arguments["valuename"];
}
if (arguments.ContainsKey("wminamespace"))
{
wnamespace = arguments["wminamespace"];
}
if (arguments.ContainsKey("writetype"))
{
if (arguments["writetype"].ToLower() == "wmi")
{
GetFileContent(location, droplocation, filename, "flat");
WriteToFileWMI(computerName, eventName, username, preplacedword);
}
else if (arguments["writetype"].ToLower() == "smb")
{
WriteToFileSMB(computerName, droplocation, filename, location);
}
else if(arguments["writetype"].ToLower() == "registry")
{
if (valuename == string.Empty)
{
Console.WriteLine("[-] Valuename is required");
return;
}
GetFileContent(location, droplocation, filename, "nonflat");
WriteToRegKey(computerName, username, preplacedword, keypath, valuename);
}
else if (arguments["writetype"].ToLower() == "wmiclreplaced")
{
GetFileContent(location, droplocation, filename, "nonflat");
WriteToWMIClreplaced(computerName, username, preplacedword, wnamespace, clreplacedname);
}
else if (arguments["writetype"].ToLower() == "removewmiclreplaced")
{
RemoveWMIClreplaced(computerName, username, preplacedword, wnamespace, clreplacedname);
}
else if (arguments["writetype"].ToLower() == "removeregkey")
{
RemoveRegValue(computerName, username, preplacedword, keypath, valuename);
}
else
{
Usage();
return;
}
}
else
{
Usage();
}
}
}
else
{
Usage();
return;
}
}
19
Source : ExcelDCOM.cs
with GNU General Public License v3.0
from 0xthirteen
with GNU General Public License v3.0
from 0xthirteen
static void Main(string[] args)
{
var arguments = new Dictionary<string, string>();
foreach (string argument in args)
{
int idx = argument.IndexOf('=');
if (idx > 0)
arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
}
if(!arguments.ContainsKey("computername"))
{
Console.WriteLine("[-] Error: computername arg is required");
return;
}
else
{
string arch = "x86";
string target = arguments["computername"];
if (arguments.ContainsKey("arch"))
{
if(arguments["arch"].ToLower() == "x64" || arguments["arch"] == "64")
{
arch = "x64";
}
}
ExecExcelDCOM(target, arch);
}
}
19
Source : Client.cs
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
private void RunRun()
{
if(runtype == "taskmgr")
{
Console.WriteLine("[+] Running task manager");
Thread.Sleep(500);
SendText("taskmgr");
Thread.Sleep(1000);
Thread.Sleep(500);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
SendElement("Alt+F");
Thread.Sleep(1000);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
Thread.Sleep(500);
}
Console.WriteLine("[+] Executing {0}", cmd.ToLower());
SendText(cmd.ToLower());
Thread.Sleep(1000);
if (runtype == "taskmgr")
{
SendElement("Tab");
Thread.Sleep(500);
SendElement("Space");
Thread.Sleep(500);
}
if(runtype == "winr")
{
//Currently bugged - does not run elevated
SendElement("Ctrl+Shift+down");
Thread.Sleep(500);
SendElement("Enter+down");
Thread.Sleep(250);
SendElement("Enter+up");
Thread.Sleep(500);
SendElement("Ctrl+Shift+up");
Thread.Sleep(500);
}
else
{
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
Thread.Sleep(250);
}
if (isdrive == true)
{
SendElement("Left");
Thread.Sleep(500);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
}
if (runtype == "winr")
{
SendElement("Left");
Thread.Sleep(500);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
}
if (runtype == "taskmgr")
{
Thread.Sleep(250);
SendElement("Alt+F4");
}
}
19
Source : Client.cs
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
private void RunConsole(string consoletype)
{
if (runtype == "taskmgr")
{
Console.WriteLine("[+] Executing task manager");
Thread.Sleep(500);
SendText("taskmgr");
Thread.Sleep(1000);
Thread.Sleep(500);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
SendElement("Alt+F");
Thread.Sleep(1000);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
Thread.Sleep(500);
}
Console.WriteLine("[+] Executing {0} from {1}", cmd.ToLower(), consoletype);
SendText(consoletype);
Thread.Sleep(1000);
if (runtype == "taskmgr")
{
SendElement("Tab");
Thread.Sleep(500);
SendElement("Space");
Thread.Sleep(250);
}
if (runtype == "winr")
{
//Currently bugged - does not run elevated
SendElement("Ctrl+Shift+down");
Thread.Sleep(500);
SendElement("Enter+down");
Thread.Sleep(250);
SendElement("Enter+up");
Thread.Sleep(500);
SendElement("Ctrl+Shift+up");
Thread.Sleep(500);
}
else
{
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
Thread.Sleep(250);
}
Thread.Sleep(500);
SendText(cmd.ToLower());
Thread.Sleep(1000);
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
Thread.Sleep(500);
SendText("exit");
SendElement("Enter+down");
Thread.Sleep(500);
SendElement("Enter+up");
if(runtype == "taskmgr")
{
Thread.Sleep(250);
SendElement("Alt+F4");
Thread.Sleep(250);
}
}
19
Source : Program.cs
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
static void Main(string[] args)
{
AppDomain.CurrentDomain.replacedemblyResolve += (sender, argtwo) => {
replacedembly thisreplacedembly = replacedembly.GetEntryreplacedembly();
String resourceName = string.Format("SharpRDP.{0}.dll.bin",
new replacedemblyName(argtwo.Name).Name);
var replacedembly = replacedembly.GetExecutingreplacedembly();
using (var rs = replacedembly.GetManifestResourceStream(resourceName))
using (var zs = new DeflateStream(rs, CompressionMode.Decompress))
using (var ms = new MemoryStream())
{
zs.CopyTo(ms);
return replacedembly.Load(ms.ToArray());
}
};
var arguments = new Dictionary<string, string>();
foreach (string argument in args)
{
int idx = argument.IndexOf('=');
if (idx > 0)
arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
}
string username = string.Empty;
string domain = string.Empty;
string preplacedword = string.Empty;
string command = string.Empty;
string execElevated = string.Empty;
string execw = "";
bool connectdrive = false;
bool takeover = false;
bool nla = false;
if (arguments.ContainsKey("username"))
{
if (!arguments.ContainsKey("preplacedword"))
{
Console.WriteLine("[X] Error: A preplacedword is required");
return;
}
else
{
if (arguments["username"].Contains("\\"))
{
string[] tmp = arguments["username"].Split('\\');
domain = tmp[0];
username = tmp[1];
}
else
{
domain = ".";
username = arguments["username"];
}
preplacedword = arguments["preplacedword"];
}
}
if (arguments.ContainsKey("preplacedword") && !arguments.ContainsKey("username"))
{
Console.WriteLine("[X] Error: A username is required");
return;
}
if ((arguments.ContainsKey("computername")) && (arguments.ContainsKey("command")))
{
Client rdpconn = new Client();
command = arguments["command"];
if (arguments.ContainsKey("exec"))
{
if (arguments["exec"].ToLower() == "cmd")
{
execw = "cmd";
}
else if (arguments["exec"].ToLower() == "powershell" || arguments["exec"].ToLower() == "ps")
{
execw = "powershell";
}
}
if (arguments.ContainsKey("elevated"))
{
if(arguments["elevated"].ToLower() == "true" || arguments["elevated"].ToLower() == "win+r" || arguments["elevated"].ToLower() == "winr")
{
execElevated = "winr";
}
else if(arguments["elevated"].ToLower() == "taskmgr" || arguments["elevated"].ToLower() == "taskmanager")
{
execElevated = "taskmgr";
}
else
{
execElevated = string.Empty;
}
}
if (arguments.ContainsKey("connectdrive"))
{
if(arguments["connectdrive"].ToLower() == "true")
{
connectdrive = true;
}
}
if (arguments.ContainsKey("takeover"))
{
if (arguments["takeover"].ToLower() == "true")
{
takeover = true;
}
}
if (arguments.ContainsKey("nla"))
{
if (arguments["nla"].ToLower() == "true")
{
nla = true;
}
}
string[] computerNames = arguments["computername"].Split(',');
foreach (string server in computerNames)
{
rdpconn.CreateRdpConnection(server, username, domain, preplacedword, command, execw, execElevated, connectdrive, takeover, nla);
}
}
else
{
HowTo();
return;
}
}
19
Source : SQLite.cs
with GNU General Public License v3.0
from 0xfd3
with GNU General Public License v3.0
from 0xfd3
public bool ReadTable(string TableName)
{
int index = -1;
int length = this.master_table_entries.Length - 1;
for (int i = 0; i <= length; i++)
{
if (this.master_table_entries[i].item_name.ToLower().CompareTo(TableName.ToLower()) == 0)
{
index = i;
break;
}
}
if (index == -1)
{
return false;
}
string[] strArray = this.master_table_entries[index].sql_statement.Substring(this.master_table_entries[index].sql_statement.IndexOf("(") + 1).Split(new char[] { ',' });
int num6 = strArray.Length - 1;
for (int j = 0; j <= num6; j++)
{
strArray[j] = (strArray[j]).TrimStart();
int num4 = strArray[j].IndexOf(" ");
if (num4 > 0)
{
strArray[j] = strArray[j].Substring(0, num4);
}
if (strArray[j].IndexOf("UNIQUE") == 0)
{
break;
}
this.field_names = (string[])Utils.CopyArray((Array)this.field_names, new string[j + 1]);
this.field_names[j] = strArray[j];
}
return this.ReadTableFromOffset((ulong)((this.master_table_entries[index].root_num - 1L) * this.page_size));
}
19
Source : Program.cs
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
with BSD 3-Clause "New" or "Revised" License
from 0xthirteen
static void Main(string[] args)
{
if (args.Length < 1)
{
HowTo();
return;
}
var arguments = new Dictionary<string, string>();
foreach (string argument in args)
{
int idx = argument.IndexOf('=');
if (idx > 0)
arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
}
if (arguments.ContainsKey("command"))
{
CleanSingle(arguments["command"]);
}
else if (args[0].ToLower() == "clearall")
{
Clereplacedl();
}
else if (args[0].ToLower() == "query")
{
QueryReg();
}
else
{
HowTo();
return;
}
}
19
Source : Program.cs
with MIT License
from 13xforever
with MIT License
from 13xforever
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage:");
Console.WriteLine(" gvas-converter path_to_save_file|path_to_json");
return;
}
var ext = Path.GetExtension(args[0]).ToLower();
if (ext == ".json")
{
Console.WriteLine("Not implemented atm");
}
else
{
Console.WriteLine("Parsing UE4 save file structure...");
Gvas save;
using (var stream = File.Open(args[0], FileMode.Open, FileAccess.Read, FileShare.Read))
save = UESerializer.Read(stream);
Console.WriteLine("Converting to json...");
var json = JsonConvert.SerializeObject(save, new JsonSerializerSettings{Formatting = Formatting.Indented});
Console.WriteLine("Saving json...");
using (var stream = File.Open(args[0] + ".json", FileMode.Create, FileAccess.Write, FileShare.Read))
using (var writer = new StreamWriter(stream, new UTF8Encoding(false)))
writer.Write(json);
}
Console.WriteLine("Done.");
Console.ReadKey(true);
}
19
Source : ICachingKeyGenerator.Default.cs
with MIT License
from 1100100
with MIT License
from 1100100
private string MD5(byte[] bytes)
{
using (MD5 md5 = new MD5CryptoServiceProvider())
{
var hash = md5.ComputeHash(bytes);
md5.Clear();
return BitConverter.ToString(hash).Replace("-", "").ToLower();
}
}
19
Source : ApiExplorerGroupPerVersionConvention.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
public void Apply(ControllerModel controller)
{
if (controller.ControllerType.Namespace.IsNull())
return;
string[] array = controller.ControllerType.FullName.Split('.');
controller.ApiExplorer.GroupName = array[2].ToLower();
}
19
Source : CommonExtensions.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
public static bool ToBool(this object s)
{
if (s == null)
return false;
s = s.ToString().ToLower();
if (s.Equals(1) || s.Equals("1") || s.Equals("true") || s.Equals("是") || s.Equals("yes"))
return true;
if (s.Equals(0) || s.Equals("0") || s.Equals("false") || s.Equals("否") || s.Equals("no"))
return false;
Boolean.TryParse(s.ToString(), out bool result);
return result;
}
19
Source : ConfigurationHelper.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
public IConfiguration Load(string configFileName, string environmentName = "", bool reloadOnChange = false)
{
var filePath = Path.Combine(AppContext.BaseDirectory, "config");
if (!Directory.Exists(filePath))
return null;
var builder = new ConfigurationBuilder()
.SetBasePath(filePath)
.AddJsonFile(configFileName.ToLower() + ".json", true, reloadOnChange);
if (environmentName.NotNull())
{
builder.AddJsonFile(configFileName.ToLower() + "." + environmentName + ".json", true, reloadOnChange);
}
return builder.Build();
}
19
Source : DbAdapterAbstract.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
public string AppendQuote(string value)
{
var val = value?.Trim();
if (val != null && SqlLowerCase)
val = val.ToLower();
return $"{LeftQuote}{val}{RightQuote}";
}
19
Source : StringExtensions.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
public static string FirstCharToLower(this string s)
{
if (string.IsNullOrEmpty(s))
return s;
string str = s.First().ToString().ToLower() + s.Substring(1);
return str;
}
19
Source : EntityDescriptor.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
private void SetTableName()
{
var tableArr = EnreplacedyType.GetCustomAttribute<TableAttribute>(false);
if (tableArr != null && tableArr.Name.NotNull())
{
TableName = tableArr.Name;
}
else
{
//去掉Enreplacedy后缀
TableName = Name;
//给表名称添加分隔符
if (DbContext.Options.TableNameSeparator.NotNull())
{
var matchs = Regex.Matches(TableName, "[A-Z][^A-Z]+");
TableName = string.Join(DbContext.Options.TableNameSeparator, matchs);
}
}
var setPrefix = tableArr?.SetPrefix ?? true;
//设置前缀
if (setPrefix && DbContext.Options.TableNamePrefix.NotNull())
{
TableName = DbContext.Options.TableNamePrefix + TableName;
}
//设置自动创建表
AutoCreate = tableArr?.AutoCreate ?? true;
//表名称小写
if (DbContext.Adapter.SqlLowerCase)
{
TableName = TableName.ToLower();
}
}
19
Source : REG.cs
with MIT License
from 20chan
with MIT License
from 20chan
public override string ToString()
{
return _exp.ToString().ToLower();
}
19
Source : TextFindForm.cs
with Apache License 2.0
from 214175590
with Apache License 2.0
from 214175590
public bool FindStr()
{
bool finds = false;
string text = text_res.Text;
info.Text = "";
if (text != "")
{
string content = getContent();
bool caseDx = cb_case.Checked;
bool whole = cb_whole.Checked;
bool regex = cb_regex.Checked;
if (tempCont != content || text != tempStr)
{
string fmt = null;
if (whole)
{
fmt = "[^\u4e00-\u9fa50-9a-zA-Z]+{0}[^\u4e00-\u9fa50-9a-zA-Z]+";
}
reg1 = new Regex(fmt == null ? text : string.Format(fmt, text));
reg2 = null;
if (caseDx)
{
if (text.ToUpper() != text.ToLower())
{
reg1 = new Regex(fmt == null ? text.ToUpper() : string.Format(fmt, text.ToUpper()));
reg2 = new Regex(fmt == null ? text.ToLower() : string.Format(fmt, text.ToLower()));
}
}
match1 = reg1.Match(content);
match2 = null;
if (reg2 != null)
{
match2 = reg2.Match(content);
}
}
else
{
match1 = reg1.Match(content, match1.Index + match1.Length);
if (reg2 != null)
{
match2 = reg2.Match(content, match2.Index + match2.Length);
}
}
if (null != match1 && match1.Success) //当查找成功时候
{
tempCont = content;
tempStr = text;
addFindHisItem(text);
finds = true;
findCall(text, match1.Index);
}
else if (null != match2 && match2.Success) //当查找成功时候
{
tempCont = content;
tempStr = text;
addFindHisItem(text);
finds = true;
findCall(text, match2.Index);
}
else
{
info.Text = "没有找到结果";
}
}
return finds;
}
19
Source : TsCreator.cs
with MIT License
from 279328316
with MIT License
from 279328316
public TsResultModel GetTsResultModel(string itemId, string itemType = "")
{
TsResultModel result = null;
if (itemType.ToLower() == TsCreateType.Controller.ToString().ToLower())
{
ControllerModel controller = JcApiHelper.GetController(itemId);
if (controller == null)
{
throw new Exception("无效的ItemId.");
}
result = GetTsResultModel(controller);
}
else if (itemType.ToLower() == TsCreateType.Action.ToString().ToLower())
{
ActionModel action = JcApiHelper.GetAction(itemId);
if (action == null)
{
throw new Exception("无效的ItemId.");
}
result = GetTsResultModel(action);
}
else
{
PTypeModel ptype = JcApiHelper.GetPTypeModel(itemId);
if (ptype == null)
{
throw new Exception("无效的ItemId.");
}
result = GetTsResultModel(ptype);
}
return result;
}
19
Source : TsCreator.cs
with MIT License
from 279328316
with MIT License
from 279328316
private string GetTsType(string typeName)
{
string tsTypeStr = "";
List<string> numberTypeList =
("int,int?,int16,int16?,int32,int32?,int64,int64?,decimal,decimal?," +
"double,double?,byte,byte?,long,long?,single,single?").Split(',').ToList();
List<string> boolTypeList = ("bool,bool?,boolean,boolean?").Split(',').ToList();
List<string> stringTypeList =
("string,guid,guid?").Split(',').ToList();
List<string> dateTimeTypeList =
("datetime,datetime?").Split(',').ToList();
if (boolTypeList.Contains(typeName.ToLower()))
{
tsTypeStr = "boolean";
}
else if (stringTypeList.Contains(typeName.ToLower()))
{
tsTypeStr = "string";
}
else if (dateTimeTypeList.Contains(typeName.ToLower()))
{
tsTypeStr = "Date";
}
else if (numberTypeList.Contains(typeName.ToLower()))
{
tsTypeStr = "number";
}
else
{
tsTypeStr = typeName;
#region 去掉Dto,Model命名
if (tsTypeStr.EndsWith("Dto"))
{ //参数类型名称 去掉末尾Dto,Model命名
tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Dto"));
}
else if (tsTypeStr.EndsWith("Dto>"))
{
tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Dto")) + ">";
}
else if (tsTypeStr.EndsWith("Model"))
{
tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Model"));
}
else if (tsTypeStr.EndsWith("Model>"))
{
tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Model")) + ">";
}
#endregion
}
return tsTypeStr;
}
19
Source : XmlHelper.cs
with MIT License
from 279328316
with MIT License
from 279328316
public T DeserializeNode<T>(XmlNode node = null) where T : clreplaced, new()
{
T model = new T();
XmlNode firstChild;
if (node == null)
{
node = root;
}
firstChild = node.FirstChild;
Dictionary<string, string> dict = new Dictionary<string, string>();
XmlAttributeCollection xmlAttribute = node.Attributes;
if (node.Attributes.Count > 0)
{
for (int i = 0; i < node.Attributes.Count; i++)
{
if (!dict.Keys.Contains(node.Attributes[i].Name))
{
dict.Add(node.Attributes[i].Name, node.Attributes[i].Value);
}
}
}
if (!dict.Keys.Contains(firstChild.Name))
{
dict.Add(firstChild.Name, firstChild.InnerText);
}
XmlNode next = firstChild.NextSibling;
while (next != null)
{
if (!dict.Keys.Contains(next.Name))
{
dict.Add(next.Name, next.InnerText);
}
else
{
throw new Exception($"重复的属性Key:{next.Name}");
}
next = next.NextSibling;
}
#region 为对象赋值
Type modelType = typeof(T);
List<PropertyInfo> piList = modelType.GetProperties().Where(pro => (pro.PropertyType.Equals(typeof(string)) || pro.PropertyType.IsValueType) && pro.CanRead && pro.CanWrite).ToList();
foreach (PropertyInfo pi in piList)
{
string dictKey = dict.Keys.FirstOrDefault(key => key.ToLower() == pi.Name.ToLower());
if (!string.IsNullOrEmpty(dictKey))
{
string value = dict[dictKey];
TypeConverter typeConverter = TypeDescriptor.GetConverter(pi.PropertyType);
if (typeConverter != null)
{
if (typeConverter.CanConvertFrom(typeof(string)))
pi.SetValue(model, typeConverter.ConvertFromString(value));
else
{
if (typeConverter.CanConvertTo(pi.PropertyType))
pi.SetValue(model, typeConverter.ConvertTo(value, pi.PropertyType));
}
}
}
}
#endregion
return model;
}
19
Source : JcApiHelperUIMiddleware.cs
with MIT License
from 279328316
with MIT License
from 279328316
public async Task Invoke(HttpContext httpContext)
{
string httpMethod = httpContext.Request.Method;
string path = httpContext.Request.Path.Value.ToLower();
if (httpMethod == "GET" && Regex.IsMatch(path, $"/apihelper/"))
{
if (Regex.IsMatch(path, $"/apihelper/index.html"))
{ //index.html特殊处理
await RespondWithIndexHtml(httpContext.Response);
return;
}
else
{
string resourceName = path.Replace($"/apihelper/", "")
.Replace("/", ".");
if (!apiResources.Any(a => a.ToLower() == $"{embeddedFileNamespace}.{resourceName}".ToLower()))
{ // 处理刷新界面
await RespondWithIndexHtml(httpContext.Response);
return;
}
}
}
await staticFileMiddleware.Invoke(httpContext);
}
19
Source : TsCreator.cs
with MIT License
from 279328316
with MIT License
from 279328316
private string FirstToLower(string str)
{
if (!string.IsNullOrEmpty(str))
{
str = str.Substring(0, 1).ToLower() + str.Substring(1);
}
return str;
}
19
Source : ConnectionStringBuilder.cs
with MIT License
from 2881099
with MIT License
from 2881099
public static ConnectionStringBuilder Parse(string connectionString)
{
var ret = new ConnectionStringBuilder();
if (string.IsNullOrEmpty(connectionString)) return ret;
//支持密码中带有逗号,将原有 split(',') 改成以下处理方式
var vs = Regex.Split(connectionString, @"\,([\w \t\r\n]+)=", RegexOptions.Multiline);
ret.Host = vs[0].Trim();
for (var a = 1; a < vs.Length; a += 2)
{
var kv = new[] { Regex.Replace(vs[a].ToLower().Trim(), @"[ \t\r\n]", ""), vs[a + 1] };
switch (kv[0])
{
case "ssl": if (kv.Length > 1 && kv[1].ToLower().Trim() == "true") ret.Ssl = true; break;
case "protocol": if (kv.Length > 1 && kv[1].ToUpper().Trim() == "RESP3") ret.Protocol = RedisProtocol.RESP3; break;
case "userid":
case "user": if (kv.Length > 1) ret.User = kv[1].Trim(); break;
case "preplacedword": if (kv.Length > 1) ret.Preplacedword = kv[1]; break;
case "database":
case "defaultdatabase": if (kv.Length > 1 && int.TryParse(kv[1].Trim(), out var database) && database > 0) ret.Database = database; break;
case "prefix": if (kv.Length > 1) ret.Prefix = kv[1].Trim(); break;
case "name":
case "clientname": if (kv.Length > 1) ret.ClientName = kv[1].Trim(); break;
case "encoding": if (kv.Length > 1) ret.Encoding = Encoding.GetEncoding(kv[1].Trim()); break;
case "idletimeout": if (kv.Length > 1 && long.TryParse(kv[1].Trim(), out var idleTimeout) && idleTimeout > 0) ret.IdleTimeout = TimeSpan.FromMilliseconds(idleTimeout); break;
case "connecttimeout": if (kv.Length > 1 && long.TryParse(kv[1].Trim(), out var connectTimeout) && connectTimeout > 0) ret.ConnectTimeout = TimeSpan.FromMilliseconds(connectTimeout); break;
case "receivetimeout": if (kv.Length > 1 && long.TryParse(kv[1].Trim(), out var receiveTimeout) && receiveTimeout > 0) ret.ReceiveTimeout = TimeSpan.FromMilliseconds(receiveTimeout); break;
case "sendtimeout": if (kv.Length > 1 && long.TryParse(kv[1].Trim(), out var sendTimeout) && sendTimeout > 0) ret.SendTimeout = TimeSpan.FromMilliseconds(sendTimeout); break;
case "poolsize":
case "maxpoolsize": if (kv.Length > 1 && int.TryParse(kv[1].Trim(), out var maxPoolSize) && maxPoolSize > 0) ret.MaxPoolSize = maxPoolSize; break;
case "minpoolsize": if (kv.Length > 1 && int.TryParse(kv[1].Trim(), out var minPoolSize) && minPoolSize > 0) ret.MinPoolSize = minPoolSize; break;
case "retry": if (kv.Length > 1 && int.TryParse(kv[1].Trim(), out var retry) && retry > 0) ret.Retry = retry; break;
}
}
return ret;
}
19
Source : TemplateEngin.cs
with MIT License
from 2881099
with MIT License
from 2881099
void ViewDirChange(object sender, FileSystemEventArgs e) {
string filename = e.FullPath.ToLower();
lock (_cache_lock) {
_cache.Remove(filename);
}
}
19
Source : TemplateEngin.cs
with MIT License
from 2881099
with MIT License
from 2881099
private static string htmlSyntax(string tplcode, int num) {
while (num-- > 0) {
string[] arr = _reg_syntax.Split(tplcode);
if (arr.Length == 1) break;
for (int a = 1; a < arr.Length; a += 4) {
string tag = string.Concat('<', arr[a]);
string end = string.Concat("</", arr[a], '>');
int fc = 1;
for (int b = a; fc > 0 && b < arr.Length; b += 4) {
if (b > a && arr[a].ToLower() == arr[b].ToLower()) fc++;
int bpos = 0;
while (true) {
int fa = arr[b + 3].IndexOf(tag, bpos);
int fb = arr[b + 3].IndexOf(end, bpos);
if (b == a) {
var z = arr[b + 3].IndexOf("/>");
if ((fb == -1 || z < fb) && z != -1) {
var y = arr[b + 3].Substring(0, z + 2);
if (_reg_htmltag.IsMatch(y) == false)
fb = z - end.Length + 2;
}
}
if (fa == -1 && fb == -1) break;
if (fa != -1 && (fa < fb || fb == -1)) {
fc++;
bpos = fa + tag.Length;
continue;
}
if (fb != -1) fc--;
if (fc <= 0) {
var a1 = arr[a + 1];
var end3 = string.Concat("{/", a1, "}");
if (a1.ToLower() == "else") {
if (_reg_blank.Replace(arr[a - 4 + 3], "").EndsWith("{/if}", StringComparison.CurrentCultureIgnoreCase) == true) {
var idx = arr[a - 4 + 3].IndexOf("{/if}");
arr[a - 4 + 3] = string.Concat(arr[a - 4 + 3].Substring(0, idx), arr[a - 4 + 3].Substring(idx + 5));
//如果 @else="有条件内容",则变换成 elseif 条件内容
if (_reg_blank.Replace(arr[a + 2], "").Length > 0) a1 = "elseif";
end3 = "{/if}";
} else {
arr[a] = string.Concat("指令 @", arr[a + 1], "='", arr[a + 2], "' 没紧接着 if/else 指令之后,无效. <", arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
}
}
if (arr[a + 1].Length > 0) {
if (_reg_blank.Replace(arr[a + 2], "").Length > 0 || a1.ToLower() == "else") {
arr[b + 3] = string.Concat(arr[b + 3].Substring(0, fb + end.Length), end3, arr[b + 3].Substring(fb + end.Length));
arr[a] = string.Concat("{", a1, " ", arr[a + 2], "}<", arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
} else {
arr[a] = string.Concat('<', arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
}
}
break;
}
bpos = fb + end.Length;
}
}
if (fc > 0) {
arr[a] = string.Concat("不严谨的html格式,请检查 ", arr[a], " 的结束标签, @", arr[a + 1], "='", arr[a + 2], "' 指令无效. <", arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
}
}
if (arr.Length > 0) tplcode = string.Join(string.Empty, arr);
}
return tplcode;
}
19
Source : RazorModel.cs
with MIT License
from 2881099
with MIT License
from 2881099
public string GetCsName(string name)
{
name = Regex.Replace(name.TrimStart('@', '.'), @"[^\w]", "_");
name = char.IsLetter(name, 0) ? name : string.Concat("_", name);
if (task.OptionsEnreplacedy01) name = UFString(name);
if (task.OptionsEnreplacedy02) name = UFString(name.ToLower());
if (task.OptionsEnreplacedy03) name = name.ToLower();
if (task.OptionsEnreplacedy04) name = string.Join("", name.Split('_').Select(a => UFString(a)));
return name;
}
19
Source : RazorModel.cs
with MIT License
from 2881099
with MIT License
from 2881099
public string GetColumnAttribute(DbColumnInfo col, bool isInsertValueSql = false)
{
var sb = new List<string>();
if (GetCsName(col.Name) != col.Name)
sb.Add("Name = \"" + col.Name + "\"");
if (col.CsType != null)
{
var dbinfo = fsql.CodeFirst.GetDbInfo(col.CsType);
if (dbinfo != null && string.Compare(dbinfo.dbtypeFull.Replace("NOT NULL", "").Trim(), col.DbTypeTextFull, true) != 0)
{
#region StringLength 反向
switch (fsql.Ado.DataType)
{
case DataType.MySql:
case DataType.OdbcMySql:
switch (col.DbTypeTextFull.ToLower())
{
case "longtext": sb.Add("StringLength = -2"); break;
case "text": sb.Add("StringLength = -1"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^varchar\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
case DataType.SqlServer:
case DataType.OdbcSqlServer:
switch (col.DbTypeTextFull.ToLower())
{
case "nvarchar(max)": sb.Add("StringLength = -2"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^nvarchar\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
case DataType.PostgreSQL:
case DataType.OdbcPostgreSQL:
case DataType.OdbcKingbaseES:
case DataType.ShenTong:
switch (col.DbTypeTextFull.ToLower())
{
case "text": sb.Add("StringLength = -2"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^varchar\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
case DataType.Oracle:
case DataType.OdbcOracle:
switch (col.DbTypeTextFull.ToLower())
{
case "nclob": sb.Add("StringLength = -2"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^nvarchar2\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
case DataType.Dameng:
case DataType.OdbcDameng:
switch (col.DbTypeTextFull.ToLower())
{
case "text": sb.Add("StringLength = -2"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^nvarchar2\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
case DataType.Sqlite:
switch (col.DbTypeTextFull.ToLower())
{
case "text": sb.Add("StringLength = -2"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^nvarchar\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
case DataType.MsAccess:
switch (col.DbTypeTextFull.ToLower())
{
case "longtext": sb.Add("StringLength = -2"); break;
default:
var m_stringLength = Regex.Match(col.DbTypeTextFull, @"^varchar\s*\((\w+)\)$", RegexOptions.IgnoreCase);
if (m_stringLength.Success) sb.Add($"StringLength = {m_stringLength.Groups[1].Value}");
else sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
break;
}
break;
}
#endregion
}
if (col.IsPrimary)
sb.Add("IsPrimary = true");
if (col.IsIdenreplacedy)
sb.Add("IsIdenreplacedy = true");
if (dbinfo != null && dbinfo.isnullable != col.IsNullable)
{
if (col.IsNullable && fsql.DbFirst.GetCsType(col).Contains("?") == false && col.CsType.IsValueType)
sb.Add("IsNullable = true");
if (col.IsNullable == false && fsql.DbFirst.GetCsType(col).Contains("?") == true)
sb.Add("IsNullable = false");
}
if (isInsertValueSql)
{
var defval = GetColumnDefaultValue(col, false);
if (defval == null) //c#默认属性值,就不需要设置 InsertValueSql 了
{
defval = GetColumnDefaultValue(col, true);
if (defval != null)
{
sb.Add("InsertValueSql = \"" + defval.Replace("\"", "\\\"") + "\"");
sb.Add("CanInsert = false");
}
}
else
sb.Add("CanInsert = false");
}
}
if (sb.Any() == false) return null;
return "[Column(" + string.Join(", ", sb) + ")]";
}
See More Examples