本文整理汇总了C#中Functions类的典型用法代码示例。如果您正苦于以下问题:C# Functions类的具体用法?C# Functions怎么用?C# Functions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Functions类属于命名空间,在下文中一共展示了Functions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Method
public JObject Method(Functions funcName, JObject request, MethodCheckRequestParameters check)
{
if (!string.IsNullOrEmpty(Token)) request[FieldKeyword.Token] = Token;
if (!string.IsNullOrEmpty(Language)) request[FieldKeyword.Language] = Language;
JObject response = new JObject();
if (ServerAddr==null|| request == null || (check != null && !check(request)))
{
response[FieldKeyword.Success] = false;
response[FieldKeyword.CommonError] = ErrorNumber.CommonBadParameter.ToString();
return response;
}
var webBinding = new WebHttpBinding();
webBinding.AllowCookies = true;
webBinding.MaxReceivedMessageSize = 1000 * 1024 * 1024;
webBinding.ReaderQuotas.MaxStringContentLength = 1000 * 1024 * 1024;
webBinding.SendTimeout = new TimeSpan(0, 500, 0);
webBinding.ReceiveTimeout = new TimeSpan(0, 500, 0);
using (var factory = new WebChannelFactory<IService>(webBinding, ServerAddr))
{
factory.Endpoint.Behaviors.Add(new WebHttpBehavior());
var session = factory.CreateChannel();
if (session == null || (session as IContextChannel)==null)
{
response[FieldKeyword.Success] = false;
response[FieldKeyword.CommonError] = ErrorNumber.CommonBadContext.ToString();
}
else
using (OperationContextScope scope = new OperationContextScope(session as IContextChannel))
{
var temp = request.ToString();
Stream stream = new MemoryStream(KORT.Util.Tools.GZipCompress(Encoding.UTF8.GetBytes(temp)));
System.Diagnostics.Debug.WriteLine(request.ToString());
try
{
using (var responseStream = session.Method(funcName.ToString(), stream))
{
using (var decompressStream = new MemoryStream())
{
KORT.Util.Tools.GZipDecompress(responseStream, decompressStream);
decompressStream.Position = 0;
StreamReader reader = new StreamReader(decompressStream, Encoding.UTF8);
string text = reader.ReadToEnd();
System.Diagnostics.Debug.WriteLine(text);
response = JObject.Parse(text);
}
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
response[FieldKeyword.Success] = false;
response[FieldKeyword.CommonError] = ErrorNumber.Other.ToString();
response[FieldKeyword.ErrorDetail] = e.Message;
}
}
return response;
}
}
开发者ID:jovijovi,项目名称:kort,代码行数:60,代码来源:KORTClient.cs
示例2: setup
private async void setup()
{
Functions functions = new Functions();
JsonValue list = await functions.getBookings (this.Student.StudentID.ToString());
JsonValue results = list ["Results"];
tableItems = new List<Booking>();
if (list ["IsSuccess"]) {
for (int i = 0; i < results.Count; i++) {
if (DateTime.Parse (results [i] ["ending"]) < DateTime.Now) {
Booking b = new Booking (results [i]);
if (b.BookingArchived == null) {
tableItems.Add (b);
}
}
}
tableItems.Sort((x, y) => DateTime.Compare(x.StartDate, y.StartDate));
this.TableView.ReloadData ();
} else {
createAlert ("Timeout expired", "Please reload view");
}
if (tableItems.Count == 0) {
createAlert ("No Bookings", "You do not have any past bookings");
}
}
开发者ID:SDP2015Group7,项目名称:HELPSMobile,代码行数:25,代码来源:HistoryTableViewController.cs
示例3: setup
private async void setup()
{
Functions functions = new Functions();
JsonValue list;
if (SearchData == null) {
list = await functions.getWorkshops ("WorkshopSetId=" +WorkshopSetID.ToString()+
"&StartingDtBegin=" + DateTime.Now.ToString("yyyy-MM-dd") +
"&StartingDtEnd=" + DateTime.Now.AddYears(1).ToString("yyyy-MM-dd"));
} else {
list = await functions.getWorkshops (SearchData);
}
JsonValue results = list ["Results"];
tableItems = new List<Workshop>();
if (list ["IsSuccess"]) {
for (int i = 0; i < results.Count; i++) {
Workshop w = new Workshop (results [i]);
if (w.Archived == null && w.StartDate > DateTime.Now) {
tableItems.Add (w);
}
}
tableItems.Sort((x, y) => DateTime.Compare(x.StartDate, y.StartDate));
this.TableView.ReloadData ();
} else {
createAlert ("Timeout expired", "Please reload view");
}
if (tableItems.Count == 0) {
createAlert ("Sorry", "There are no workshops available in this set");
}
}
开发者ID:SDP2015Group7,项目名称:HELPSMobile,代码行数:30,代码来源:WorkshopsTableViewController.cs
示例4: AbstractNeuron
public AbstractNeuron(int inputCount, INeuronInitilizer init, Functions.IActivationFunction function)
{
Inputs = inputCount;
Weights = new double[inputCount];
ActivationFunction = function;
Initializer = init;
Initialize();
}
开发者ID:pmatyszok,项目名称:financial-ai,代码行数:8,代码来源:AbstractNeuron.cs
示例5: Manage
/// <summary>
/// Asnyc Manager for handling CSDK memory objects
/// </summary>
/// <param name="func">Type of function provoked</param>
/// <param name="memtypes">Memory type provoking</param>
/// <param name="data">Handler or Memory assigned</param>
/// <param name="name">Name of memory accessing</param>
public async void Manage(Functions func, MemTypes memtypes, Object data, string name = null) {
if (name == null)
return;
if (memtypes == MemTypes.Handler)
await Modify (func, name, (Handler)data);
else
await Modify (func, name, (Memory)data);
}
开发者ID:Ghost53574,项目名称:CSdk,代码行数:15,代码来源:Watcher.cs
示例6: Visit
public override IAliasedExpression Visit(Functions.Exec item)
{
writer.Write(item.MethodName);
writer.Write("('");
//Potential bug if a single is generated inside the parameters
VisitArray(item.Parameters, Visit);
writer.Write("')");
return item;
}
开发者ID:npenin,项目名称:uss,代码行数:9,代码来源:DBExpressionWriter.cs
示例7: Network
public Network(int inputsCount, int layersCount, List<int> neuronsCountInHiddenLayers,
Functions.IActivationFunction function, Neurons.INeuronInitilizer initializer )
{
NetworkInit(inputsCount, layersCount);
if (neuronsCountInHiddenLayers.Count != layersCount)
throw new ApplicationException("Number of layers and provided layer's neuron count do not match!");
layers[0] = new Layer(inputsCount, inputsCount, function, initializer);
for(int i = 1; i < layers.Length; i++)
layers[i] = new Layer(neuronsCountInHiddenLayers[i-1], neuronsCountInHiddenLayers[i], function, initializer);
}
开发者ID:pmatyszok,项目名称:financial-ai,代码行数:10,代码来源:Network.cs
示例8: Layer
public Layer(int inputsCount, int neuronsCount, Functions.IActivationFunction function, INeuronInitilizer initializer)
{
Inputs = inputsCount;
neurons = new Neuron[neuronsCount];
for(int i = 0; i < neuronsCount; ++i)
{
neurons[i] = new Neuron(inputsCount, function, initializer);
}
Output = new double[neuronsCount];
}
开发者ID:pmatyszok,项目名称:financial-ai,代码行数:10,代码来源:Layer.cs
示例9: AddFunction
private static void AddFunction(UserType type, Functions function)
{
if (!_functionMap.ContainsKey(type))
{
_functionMap.Add(type, new List<Functions>());
}
if (!_functionMap[type].Contains(function))
{
_functionMap[type].Add(function);
}
}
开发者ID:jovijovi,项目名称:kort,代码行数:11,代码来源:FunctionKeyword.cs
示例10: GetButton
public Button GetButton(Functions funcName)
{
var fields = _element.GetFields(typeof(IButton));
if (fields.Count == 1)
return (Button) fields[0].GetValue(_element);
var buttons = fields.Select(f => (Button) f.GetValue(_element)).ToList();
var button = buttons.FirstOrDefault(b => b.Function.Equals(funcName));
if (button != null) return button;
var name = funcName.ToString();
button = buttons.FirstOrDefault(b => NamesEqual(ToButton(b.Name), ToButton(name)));
if (button == null)
throw Exception($"Can't find button '{name}' for Element '{ToString()}'");
return button;
}
开发者ID:epam,项目名称:JDI,代码行数:14,代码来源:GetElementClass.cs
示例11: TryToCallTesting
private void TryToCallTesting(Functions invokingMethod) {
if (invokingMethod == callOnMethod) {
if (methodToCall == Method.Pass)
{ IntegrationTest.Pass(gameObject); }
else
{ IntegrationTest.Fail(gameObject); }
afterFrames = 0;
afterSeconds = 0.0f;
startTime = float.PositiveInfinity;
startFrame = int.MinValue;
}
}
开发者ID:675492062,项目名称:behaviac,代码行数:14,代码来源:CallTesting.cs
示例12: BillboardSystem
public BillboardSystem(GraphicsDevice graphicsDevice, Functions.AssetHolder assets, Texture2D texture, Vector2 billboardSize, Vector3[] positions)
{
this.positions = positions;
this.nBillboards = positions.Length;
this.billboardSize = billboardSize;
this.graphicsDevice = graphicsDevice;
this.texture = texture;
greenCircle = assets.Load<Texture2D>("circle");
effect = assets.Load<Effect>("billboardingeffect");
Random r = new Random();
generateBillBoard(positions);
}
开发者ID:Whojoo,项目名称:LittleFlame,代码行数:14,代码来源:BillBoarding.cs
示例13: Mail
public ActionResult Mail(FormCollection form)
{
Functions f = new Functions();
string message = "Someone did something wrong";
if (form.AllKeys.Count() > 3)
{
message = "Name: " + form["name"].ToString() + "\nEmail: " + form["email"].ToString() + "\nWebsite: " + form["website"].ToString() + "\n\nMessage:\n" + form["message"].ToString();
}
f.SendEmail(message, Constants.ContactUsEmail, "Netintercom [Web Request]");
return RedirectToAction("Index");
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:14,代码来源:HomeController.cs
示例14: setup
private async void setup()
{
Functions functions = new Functions();
JsonValue list = await functions.getWorkshopSets ();
JsonValue results = list ["Results"];
tableItems = new List<WorkshopSet>();
List<WorkshopSet> sets = deserialise (results);
int j = 0;
for (int i = 0; i < sets.Count; i++) {
if (sets [i].Archived == null) {
tableItems.Add(sets [i]);
j++;
}
}
this.TableView.ReloadData ();
}
开发者ID:SDP2015Group7,项目名称:HELPSMobile,代码行数:16,代码来源:WorkshopSetTableViewController.cs
示例15: Database
public Database(string typeName, string server, string name, string connectionString)
{
this.typeName = typeName;
this.server = server;
this.name = name;
this.connectionString = connectionString;
connection = new OdbcConnection(this.connectionString);
_tables = new Tables(this);
_views = new Views(this);
_sequences = new Sequences(this);
_storedprocedures = new StoredProcedures(this);
_functions = new Functions(this);
_modules = new Modules(this);
_mqts = new MQTS(this);
}
开发者ID:MunwarMMR,项目名称:Dbdeploy,代码行数:16,代码来源:Database.cs
示例16: Save
public ActionResult Save(IEnumerable<HttpPostedFileBase> attachments)
{
PictureRepository picRep = new PictureRepository();
Functions functions = new Functions();
// The Name of the Upload component is "attachments"
int NewPicID = picRep.GetLastPictureId(Convert.ToInt32(HttpContext.Session["ClientId"]));
NewPicID++;
Picture ins = new Picture();
foreach (var file in attachments)
{
// Some browsers send file names with full path. This needs to be stripped.
var fileName = Path.GetFileName(file.FileName);
var extention = fileName.Substring(fileName.IndexOf('.'));
var newfilename = NewPicID.ToString() + extention;
// Check if Path exsits
string serverpath = Server.MapPath("~/Images/Client/" + HttpContext.Session["ClientId"].ToString() + "/Ads");
if (!Directory.Exists(serverpath))
{
Directory.CreateDirectory(serverpath);
}
var physicalPath = Path.Combine(Server.MapPath("~/Images/Client/" + HttpContext.Session["ClientId"].ToString() + "/Ads"), newfilename);
//...Resize..
Image original = Image.FromStream(file.InputStream, true, true);
Image resized = functions.ResizeImage(original, new Size(500, 500));
resized.Save(physicalPath, ImageFormat.Jpeg);
string finalpath = physicalPath.ToString();
finalpath = finalpath.Substring(finalpath.IndexOf("Images"));
finalpath = finalpath.Replace('\\', '/');
//...Save In DB...
ins.PicUrl = Constants.HTTPPath + finalpath;
ins.ClientId = Convert.ToInt32(HttpContext.Session["ClientId"]);
ins = picRep.InsertPicture(ins);
}
// Return an empty string to signify success
if (ins.PictureId != 0)
return Json(new { status = ins.PictureId.ToString() }, "text/plain");
else
return Json(new { status = "0" }, "text/plain");
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:47,代码来源:ProAdController.cs
示例17: Modify
private async Task<Manager> Modify(Functions func, string name, Memory memory) {
Object data;
switch (func) {
case Functions.Add:
await manager.ModifyMemory (Manager.Command.Add, name, memory);
break;
case Functions.Remove:
await manager.ModifyMemory (Manager.Command.Remove, name, memory);
break;
case Functions.Replace:
await manager.ModifyMemory (Manager.Command.Replace, name, memory);
break;
case Functions.Get:
await manager.ModifyMemory (Manager.Command.Retrieve, name, memory);
break;
}
return null;
}
开发者ID:Ghost53574,项目名称:CSdk,代码行数:18,代码来源:Watcher.cs
示例18: Invoke
public Invoke(int function, int[] arguments)
{
this.function = function;
this.arguments = arguments;
var functions = new Functions();
int x = arguments[0];
var unwrappedX = (IntConstant)ConstantFactory.GetConstant(x);
int y = arguments[1];
var unwrappedY = (IntConstant)ConstantFactory.GetConstant(y);
var func = functions.IdToFunction[this.function];
var result = func.Invoke(unwrappedX.value, unwrappedY.value);
var constant = new ConstantFactory().CreateIntOrBool(result);
this.id = constant.id;
}
开发者ID:kmorcinek,项目名称:HackKrkService,代码行数:20,代码来源:Invoke.cs
示例19: getGift
public void getGift()
{
StringBuilder sb = new StringBuilder();
Hashtable[] gifts;
gifts = myFunctions.giftGet(18);
moyu.Functions myFunction = new Functions();
foreach (Hashtable gift in gifts)
{
try
{
string number = gift["message"].ToString().Split(new char[3] { '|', '|', '|' })[0];
sb.Append("<li>" + gift["message"].ToString().Substring(0, 3) + "**" + number.Substring(number.Length - 2, 2) + "在<span>" + myFunction.kindTime(Convert.ToDateTime(gift["date"])) + "</span>获得了");
sb.Append(gift["gift"]);
sb.Append("</li>");
}
catch
{ }
}
Response.Write(sb);
}
开发者ID:inlost,项目名称:moyo,代码行数:20,代码来源:index.aspx.cs
示例20: Save
public ActionResult Save(IEnumerable<HttpPostedFileBase> attachments)
{
Functions functions = new Functions();
Documents ins = new Documents();
// The Name of the Upload component is "attachments"
foreach (var file in attachments)
{
// Some browsers send file names with full path. This needs to be stripped.
var fileName = Path.GetFileName(file.FileName);
// Check if Path exsits
string serverpath = Server.MapPath("~/Images/Client/" + HttpContext.Session["ClientId"].ToString() + "/Docs");
if (!Directory.Exists(serverpath))
{
Directory.CreateDirectory(serverpath);
}
var physicalPath = Path.Combine(Server.MapPath("~/Images/Client/" + HttpContext.Session["ClientId"].ToString() + "/Docs"), fileName);
file.SaveAs(physicalPath);
string finalpath = physicalPath.ToString();
finalpath = finalpath.Substring(finalpath.IndexOf("Images"));
finalpath = finalpath.Replace('\\', '/');
//...Save In DB...
ins.DocumentName = fileName;
ins.ClientId = Convert.ToInt32(HttpContext.Session["ClientId"]);
ins.PathUrl = Constants.HTTPPath + finalpath;
ins = DocRep.AddDocument(ins);
}
// Return an empty string to signify success
if (ins.DocId != 0)
return Json(new { status = ins.DocId.ToString() }, "text/plain");
else
return Json(new { status = "0" }, "text/plain");
}
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:39,代码来源:DocumentController.cs
注:本文中的Functions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论