本文整理汇总了C#中Parameters类的典型用法代码示例。如果您正苦于以下问题:C# Parameters类的具体用法?C# Parameters怎么用?C# Parameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parameters类属于命名空间,在下文中一共展示了Parameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Serialize
public static List<byte[]> Serialize(Parameters parameters,
int chunkSize)
{
if(chunkSize != int.MaxValue && chunkSize % 4 != 0)
{
throw new System.ArgumentException();
}
List<byte[]> stringCache = new List<byte[]>();
int numberOfBytes = serializationSize(parameters, stringCache);
// allocate all buffers
List<byte[]> buffers = new List<byte[]>();
while (numberOfBytes > 0)
{
int sizeOfBuffer = Math.Min(numberOfBytes, chunkSize);
buffers.Add(new byte[sizeOfBuffer]);
numberOfBytes -= sizeOfBuffer;
}
// fill all buffers with data
BuffersState bufState = new BuffersState();
bufState.buffers = buffers;
bufState.bufferIndex = 0;
bufState.byteIndex = 0;
serialize(bufState, parameters, stringCache);
return buffers;
}
开发者ID:morambro,项目名称:TrainProject,代码行数:31,代码来源:Serialization.cs
示例2: Execute
public override void Execute()
{
List<ControllableUnit> teamAList = BattleComposition.Instance.GetAllTeamAUnits();
List<ControllableUnit> teamBList = BattleComposition.Instance.GetAllTeamBUnits();
foreach(ControllableUnit unit in teamAList) {
Vector3 unitScreenPos = Camera.main.WorldToViewportPoint(unit.transform.position);
Parameters parameters = new Parameters();
parameters.PutObjectExtra(GameHUDScreen.UNIT_POSITION_KEY, unitScreenPos);
parameters.PutObjectExtra(GameHUDScreen.CONTROLLABLE_UNIT_KEY, unit);
EventBroadcaster.Instance.PostEvent(EventNames.ON_RETRIEVE_UNIT_POSITION, parameters);
}
foreach(ControllableUnit unit in teamBList) {
Vector3 unitScreenPos = Camera.main.WorldToViewportPoint(unit.transform.position);
Parameters parameters = new Parameters();
parameters.PutObjectExtra(GameHUDScreen.UNIT_POSITION_KEY, unitScreenPos);
parameters.PutObjectExtra(GameHUDScreen.CONTROLLABLE_UNIT_KEY, unit);
EventBroadcaster.Instance.PostEvent(EventNames.ON_RETRIEVE_UNIT_POSITION, parameters);
}
}
开发者ID:pocket-playlab,项目名称:PocketGodsRPG_Proto,代码行数:27,代码来源:InitHPBarSequence.cs
示例3: ProductFactory
public ProductFactory(Parameters parameters)
{
try
{
using (var server = new VentsCad())
{
switch (parameters.Name)
{
case "spigot":
product = new Spigot(parameters.Type.SubType, parameters.Sizes[0].Width, parameters.Sizes[0].Height);
break;
case "dumper":
var material = new string[] { parameters.Materials[0].Value, parameters.Materials[0].Thikness, parameters.Materials[0].Name, parameters.Materials[0].Code };
product = new Dumper(parameters.Type.SubType, parameters.Sizes[0].Width, parameters.Sizes[0].Height, true, material);
break;
case "montageFrame":
product = new MontageFrame(parameters.Type.SubType, parameters.Sizes[0].Width, parameters.Sizes[0].Lenght, parameters.Sizes[0].Additional1, parameters.Materials[0]);
break;
default:
break;
}
}
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
}
}
开发者ID:GitHubVents,项目名称:AirVentsCad,代码行数:30,代码来源:ProductFactory.cs
示例4: RSSPub
RSSPub(string serverUrl)
{
m_Connector = new Connector();
Parameters p = new Parameters();
p.ServerUrl = serverUrl;
m_Connector.Open(p);
}
开发者ID:kragen,项目名称:mod_pubsub,代码行数:7,代码来源:RSSPub.cs
示例5: ExecuteNoneQuery
public void ExecuteNoneQuery(string procedureName, Parameters parameters)
{
try
{
DbProviderFactory factory = DbProviderFactories.GetFactory(DataSource.ProviderName);
using (DbConnection conn = factory.CreateConnection())
using (DbCommand command = factory.CreateCommand())
{
conn.ConnectionString = DataSource.ConnectionString;
command.Connection = conn;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = procedureName;
InsertCommandParameters(command, parameters);
conn.Open();
command.ExecuteNonQuery();
}
}
catch (SqlException exception)
{
throw new DataException(string.Format("Error executing procedure: {0}", procedureName), exception);
}
catch (Exception exception)
{
throw new DataException(string.Format("Error executing procedure: {0}", procedureName), exception);
}
}
开发者ID:saliyaeranga,项目名称:cec-running-chart,代码行数:26,代码来源:BaseDataProvider.cs
示例6: CountBatteryLife
public override void CountBatteryLife(Parameters pParameters)
{
var realCapacity = Tools.AdjustBatteryCapacitanceToTemperature(pParameters.BatteryCapacitance, pParameters.SleepCurrent); // in mAh
var avarageCurrent = Tools.GetAvaregeCurrent(pParameters.SleepTime, pParameters.TxTime, pParameters.RxTime, pParameters.SleepCurrent / 1e3, pParameters.TxCurrent, pParameters.RxCurrent); // in mA
pParameters.BatteryLife = (realCapacity / (Math.Pow(avarageCurrent, Tools.PeukertNumber) * 60)); // days
}
开发者ID:efixe,项目名称:Engineering-Thesis-Project,代码行数:7,代码来源:AntNodeFactory.cs
示例7: GetSongList
/// <summary>
/// 根据频道和歌曲,得到歌曲列表
/// </summary>
/// <param name="channel"></param>
/// <param name="song"></param>
/// <param name="type">n-New</param>
/// <returns></returns>
public Models.SongList GetSongList(Models.Channel channel, Models.Song song, string type = "n")
{
Parameters parameters = new Parameters();
parameters["from"] = "mainsite";
parameters["context"] = channel.Context;
parameters["sid"] = song != null ? song.SongID : null;
parameters["channel"] = channel.ID.ToString();
parameters["type"] = type;
Random rnd = new Random();
var number = rnd.NextDouble();
parameters["r"] = number.ToString();
string url = ConnectionBase.ConstructUrlWithParameters("http://douban.fm/j/mine/playlist", parameters);
//获取列表
string json = new ConnectionBase().Get(url, @"application/json, text/javascript, */*; q=0.01", @"http://douban.fm");
var songList = Framework.Common.Helpers.JsonHelper.Deserialize<Models.SongList>(json);
//将小图更换为大图
foreach (var s in songList.Songs)
{
s.Picture = new Uri(s.Picture.ToString().Replace("/mpic/", "/lpic/").Replace("//otho.", "//img3."));
}
//去广告
songList.Songs.RemoveAll(s => s.IsAd);
return songList;
}
开发者ID:denghejun,项目名称:music-app,代码行数:36,代码来源:Song.cs
示例8: ToParameters
public Parameters ToParameters() {
var parameters = new Parameters(new DefaultFactory(new TestLogger()));
foreach (var p in _params) {
parameters.Add(p.Key, p.Value);
}
return parameters;
}
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:ParametersBuilder.cs
示例9: AddNewUser
public bool AddNewUser(Core.User user)
{
try
{
Parameters parameters = new Parameters();
parameters.Add("@FirstName", user.FirstName);
parameters.Add("@UserName", user.UserName);
parameters.Add("@Pass", user.Password);
parameters.Add("@RoleId", user.RoleId);
parameters.Add("@IsActive", user.IsActiveUser);
if (string.IsNullOrWhiteSpace(user.LastName))
parameters.Add("@LastName", DBNull.Value);
else
parameters.Add("@LastName", user.LastName);
if (string.IsNullOrWhiteSpace(user.NICNumber))
parameters.Add("@NICNumber", DBNull.Value);
else
parameters.Add("@NICNumber", user.NICNumber);
ExecuteNoneQuery("proc_AddNewUser", parameters);
return true;
}
catch (Exception)
{
throw;
}
}
开发者ID:saliyaeranga,项目名称:cec-running-chart,代码行数:29,代码来源:UserDataProvider.cs
示例10: Run
/// <summary>
/// Runs the specified parameters.
/// </summary>
/// <param name="parameters">The parameters.</param>
/// <returns></returns>
public int Run(Parameters parameters)
{
var exitCode = (int)ExitCode.GeneralError;
var commandType = new BoundCommandFactory().GetCommandType(parameters,
() => GetType().Assembly.GetTypes()
.Where(type => type.Namespace != null && type.Namespace.StartsWith("Aws.Commands"))
.Where(type => type.Name == "Options"));
if (commandType != null)
{
exitCode = Run(commandType, parameters);
}
else
{
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.Write("{0:yyyy-MM-dd HH:mm:ss} : ", DateTime.UtcNow);
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("Unknown command arguments: ");
Console.ForegroundColor = ConsoleColor.Gray;
Console.Write(Arguments);
Console.ResetColor();
}
return exitCode;
}
开发者ID:comsechq,项目名称:aws-cli,代码行数:34,代码来源:AwsConsole.cs
示例11: Main
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
if (args.Length != 2)
{
Console.WriteLine("Wrong number of arguments. Got {0} instead.", args.Length);
return;
}
MyHandler myH = new MyHandler();
Parameters p = new Parameters();
p.ServerUrl = args[0];
Connector c = new Connector();
if (c.Open(p))
{
Message m = new Message();
m.Set("do_method", "notify");
m.Set("kn_to", args[1]);
m.Set("kn_payload", "Hello");
m.Set("nickname", "dotnet");
m.Set("kn_response_format", "simple");
c.Publish(m, myH);
c.Close();
}
}
开发者ID:kragen,项目名称:mod_pubsub,代码行数:30,代码来源:Class1.cs
示例12: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
Random2 rand = new Random2();
double std = param.GetParam<double>("Standard deviation").Value;
int[] inds = param.GetParam<int[]>("Columns").Value;
List<int> mainInds = new List<int>();
List<int> numInds = new List<int>();
foreach (int ind in inds){
if (ind < mdata.ColumnCount){
mainInds.Add(ind);
} else{
numInds.Add(ind - mdata.ColumnCount);
}
}
foreach (int j in mainInds){
for (int i = 0; i < mdata.RowCount; i++){
mdata.Values.Set(i, j, mdata.Values.Get(i, j) + (float) rand.NextGaussian(0, std));
}
}
foreach (int j in numInds){
for (int i = 0; i < mdata.RowCount; i++){
mdata.NumericColumns[j][i] += (float) rand.NextGaussian(0, std);
}
}
}
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:26,代码来源:AddNoise.cs
示例13: FamilyPictureDir
public FamilyPictureDir(Guid id)
{
this.id = id;
dd = DocX.Create("ttt.docx");
pa = new Parameters()
{
PageHeight = 8.5,
PageWidth = 5.5,
MarginLeft = .5,
MarginRight = .3,
MarginTop = .5,
MarginBottom = .3,
FontSizeName = 18.0,
FontSize = 14,
};
pa.CellWidth = pa.PageWidth - pa.MarginLeft - pa.MarginRight;
pa.RowHeight = pa.PageHeight - pa.MarginTop - pa.MarginBottom;
pa.MaxPicHeight = pa.RowHeight * .4;
dd.PageHeight = Pixels(pa.PageHeight);
dd.PageWidth = Pixels(pa.PageWidth);
dd.MarginLeft = Pixels(pa.MarginLeft);
dd.MarginRight = Pixels(pa.MarginRight);
dd.MarginTop = Pixels(pa.MarginTop);
dd.MarginBottom = Pixels(pa.MarginBottom);
}
开发者ID:clearfunction,项目名称:bvcms,代码行数:28,代码来源:FamilyPictureDir.cs
示例14: BaiduMusicSearch
/// <summary>
/// 搜索百度音乐
/// </summary>
/// <param name="keyword">关键词</param>
private static void BaiduMusicSearch(string keyword)
{
Parameters parameters = new Parameters();
parameters["key"] = keyword;
string url = ConnectionBase.ConstructUrlWithParameters("http://music.baidu.com/search", parameters);
UrlHelper.OpenLink(url);
}
开发者ID:alexguo88,项目名称:DoubanFM,代码行数:11,代码来源:DownloadSearch.cs
示例15: Process
public void Process(string[] args)
{
var parameters = new Parameters { Log = Log };
parameters.WriteHeader();
try
{
parameters.Parse(args);
}
catch (Exception e)
{
Output.WriteErrorLine(Log, e.Message);
PrintUsage(parameters);
return;
}
if (args.Length == 0 || parameters.Help)
{
PrintUsage(parameters);
return;
}
ProcessSchema(parameters);
if (parameters.Readline)
{
// '-readLineAtExit' flag: useful when running from Visual Studio
Console.ReadKey();
}
}
开发者ID:Bewolf2,项目名称:GenesisMono,代码行数:31,代码来源:Processor.cs
示例16: CountSignalStrength
public override double CountSignalStrength(double pRange, Parameters pParameters)
{
var dissipation = CountDissipation(pRange, pParameters.CentralFrequency);
Log.Write(LogLevel.Info, string.Format("Tłumienie sygnału nadawanego w odległości {0} m od nadajnika wynosi {1} dB", pRange, dissipation));
return pParameters.SignalStrength + pParameters.Gain - dissipation;//.ToDbm();
}
开发者ID:efixe,项目名称:Engineering-Thesis-Project,代码行数:7,代码来源:OneSlopePropagationModel.cs
示例17: MockTradeFinderFactory
public MockTradeFinderFactory(Map map, Market market, string logFilePath, Parameters parameters) : base("")
{
this.map = map;
this.market = market;
this.logFilePath = logFilePath;
this.parameters = parameters;
}
开发者ID:spiffydudex,项目名称:navbot,代码行数:7,代码来源:MockTradeFinderFactory.cs
示例18: TestRegex
/// <summary>
/// An auxiliary method for testing the action of regular expressions.
/// Limited to a single column, which should be sufficient for this purpose.
/// Multiple rows are allowed to test the effect of one regex on several strings.
/// </summary>
private static void TestRegex(string regexStr, string[] stringsInit, string[] stringsExpect)
{
const string name = "Test";
IMatrixData[] supplTables = null;
IDocumentData[] documents = null;
List<string> stringColumnNames = new List<string>{"Column Name"};
List<string[]> stringColumnsInit = new List<string[]>{stringsInit};
List<string[]> stringColumnsExpect = new List<string[]>{stringsExpect};
Parameters param =
new Parameters(new Parameter[]{
new MultiChoiceParam("Columns", new[]{0}){Values = stringColumnNames},
new StringParam("Regular expression", regexStr), new BoolParam("Keep original columns", false),
new BoolParam("Strings separated by semicolons are independent", false)
});
IMatrixData mdata = PerseusFactory.CreateNewMatrixData();
mdata.Clear();
mdata.Name = name;
mdata.SetAnnotationColumns(stringColumnNames, stringColumnsInit, mdata.CategoryColumnNames, new List<string[][]>(),
mdata.NumericColumnNames, mdata.NumericColumns, mdata.MultiNumericColumnNames, mdata.MultiNumericColumns);
var ptc = new ProcessTextColumns();
ptc.ProcessData(mdata, param, ref supplTables, ref documents, null);
const bool ignoreCase = false;
for (int rowInd = 0; rowInd < stringColumnsInit[0].Length; rowInd++){
Assert.AreEqual(mdata.StringColumns[0][rowInd], stringColumnsExpect[0][rowInd], ignoreCase);
}
}
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:31,代码来源:ProcessTextColumnsTest.cs
示例19: SosForm
public SosForm(Parameters Params)
{
bool fl;
InitializeComponent();
Brokers = new List<Broker>();
RefreshFiles(Params.Path);
foreach (Broker b in Brokers)
{
checkedListBox1.Items.Add(b);
foreach (Symbol s in b.Symbols)
{
fl = true;
foreach (Symbol ExS in checkedListBox2.Items)
{
if (s.Name == ExS.Name)
{
fl = false;
break;
}
}
if (fl)
checkedListBox2.Items.Add(s);
}
}
}
开发者ID:Groxan,项目名称:RepVol,代码行数:26,代码来源:SosForm.cs
示例20: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
const bool rows = false;
bool percentage;
int minValids = PerseusPluginUtils.GetMinValids(param, out percentage);
ParameterWithSubParams<int> modeParam = param.GetParamWithSubParams<int>("Mode");
int modeInd = modeParam.Value;
if (modeInd != 0 && mdata.CategoryRowNames.Count == 0){
processInfo.ErrString = "No grouping is defined.";
return;
}
if (modeInd != 0){
processInfo.ErrString = "Group-wise filtering can only be appled to rows.";
return;
}
FilteringMode filterMode;
double threshold;
double threshold2;
PerseusPluginUtils.ReadValuesShouldBeParams(param, out filterMode, out threshold, out threshold2);
if (modeInd != 0){
//TODO
} else{
PerseusPluginUtils.NonzeroFilter1(rows, minValids, percentage, mdata, param, threshold, threshold2, filterMode);
}
}
开发者ID:JurgenCox,项目名称:perseus-plugins,代码行数:26,代码来源:FilterValidValuesColumns.cs
注:本文中的Parameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论