本文整理汇总了C#中Storage类的典型用法代码示例。如果您正苦于以下问题:C# Storage类的具体用法?C# Storage怎么用?C# Storage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Storage类属于命名空间,在下文中一共展示了Storage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LineIntersects2dObject
public static Storage LineIntersects2dObject(Vector position, Vector feeler,
Vector lineCoordA, Vector lineCoordB,
double distance, Vector pt)
{
Storage tmp = new Storage();
double top = ((position.y() - lineCoordA.y())*(lineCoordB.x() - lineCoordA.x())) -
((position.x() - lineCoordA.x())* (lineCoordB.y()-lineCoordA.y()));
double bot = ((feeler.x()-position.x())*(lineCoordB.y()-lineCoordA.y())) -
((feeler.y()-position.y())*(lineCoordB.x()-lineCoordA.x()));
double topTwo = ((position.y() - lineCoordA.y())*(feeler.x() - position.x())) -
((position.x() - lineCoordA.x())* (feeler.y()-position.y()));
double botTwo = bot;
if(bot == 0)tmp.wasItTrue = false;
double r = top / bot;
double t = topTwo / botTwo;
if( (r > 0) && (r < 1) && (t > 0) && (t < 1)){
Vector temp =feeler - position;
tmp.dist = Mathf.Sqrt((float)temp.lengthSquared());
pt = position + (temp * r);
tmp.wasItTrue = true;
}else {
tmp.dist = 0;
tmp.wasItTrue = false;
}
return tmp;
}
开发者ID:WildernessBob,项目名称:Game,代码行数:29,代码来源:MathExtension.cs
示例2: Start
void Start()
{
st = transform.root.GetComponent<Storage>();
pc = GameObject.Find("Player").GetComponent<PlayerController>();
startPos = transform.position;
startScale = transform.localScale;
}
开发者ID:nakrifati,项目名称:v39s_repo_unity,代码行数:7,代码来源:StorageGUIStack.cs
示例3: Main
static void Main(string[] args)
{
int L = int.Parse(Console.ReadLine());
int H = int.Parse(Console.ReadLine());
int RL = L * 27;
string T = Console.ReadLine();
Storage storage = new Storage(L, H);
for (int i = 0; i < H; i++)
{
string ROW = Console.ReadLine();
int offset = 0;
if (ROW.Length == RL)
for (int j = 0; j < 27; j++)
{
string str = ROW.Substring(offset, L);
offset += L;
for (int ii = 0; ii < str.Length; ii++)
storage[j][i, ii] = str[ii];
}
}
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
Console.WriteLine(storage.GetValue(T));
}
开发者ID:valentingrigorean,项目名称:CodinGame,代码行数:25,代码来源:Program.cs
示例4: Write
public void Write(Storage storage, string fileSpecificPath, string fileWordsPath)
{
var bitmap = new List<byte>();
var words = GenerateWordsStringAndBitmap(bitmap, storage);
if (words == null || words == "")
return;
var bytemap = new List<byte>();
while (bitmap.Count > 0)
{
var oneByte = bitmap.Take(8).ToList();
bitmap = bitmap.Skip(8).ToList();
bytemap.Add(oneByte.Aggregate((byte)0, (result, bit) => (byte)((result << 1) | bit)));
}
using (var streamWriter = new StreamWriter(fileWordsPath))
{
streamWriter.Write(words);
}
using (var fileStream = new FileStream(fileSpecificPath, FileMode.OpenOrCreate))
{
fileStream.Write(bytemap.ToArray(), 0, bytemap.Count);
fileStream.Close();
}
}
开发者ID:peperon,项目名称:NaiveBayesClassifier,代码行数:26,代码来源:StorageWriter.cs
示例5: Load
public Data.Node Load(Storage storage, Data.Node data)
{
if (data is Data.Collection)
for (int i = 0; i < (data as Data.Collection).Nodes.Count; i++)
(data as Data.Collection).Nodes[i] = this.Load(storage, (data as Data.Collection).Nodes[i]);
else if (data is Data.Branch)
{
Kean.Collection.IDictionary<string, Data.Node> nodes = new Kean.Collection.Dictionary<string, Data.Node>((data as Data.Branch).Nodes.Count);
foreach (Data.Node child in (data as Data.Branch).Nodes)
{
Data.Node n = nodes[child.Name];
if (n.IsNull())
nodes[child.Name] = child;
else if (n is Data.Collection)
(n as Data.Collection).Nodes.Add(child.UpdateLocators((string)child.Locator + "[" + (n as Data.Collection).Nodes.Count + "]"));
else
{
Data.Collection collection = new Data.Collection() { Name = child.Name, Locator = child.Locator, Region = child.Region }; // TODO: include all children in region
collection.Nodes.Add(n.UpdateLocators((string)n.Locator + "[0]"));
collection.Nodes.Add(child.UpdateLocators((string)child.Locator + "[1]"));
nodes[child.Name] = collection;
}
}
(data as Data.Branch).Nodes.Clear();
foreach (KeyValue<string, Data.Node> n in nodes)
(data as Data.Branch).Nodes.Add(this.Load(storage, n.Value));
}
return data;
}
开发者ID:imintsystems,项目名称:Kean,代码行数:29,代码来源:Collection.cs
示例6: CopyFileAction
public CopyFileAction(File source, Storage destinationStorage, string destinationPath, string destinationName)
{
Source = source;
DestinationStorage = destinationStorage;
DestinationPath = destinationPath;
DestinationName = destinationName;
}
开发者ID:jbatonnet,项目名称:smartsync,代码行数:7,代码来源:CopyFile.cs
示例7: indent
/// <summary>
/// Execute the indentation
/// </summary>
/// <param name="code">the original code to indent</param>
/// <returns>the indented code</returns>
//Performs indentation to the inputted code
public string indent(string code)
{
NullIndentor list = new NullIndentor();
List<string> lis = new List<string>();
lis = list.convertToList(code);
List<string> fileList = new List<string>();
Storage container = new Storage();
Layers layer = new Layers();
foreach (string line in lis)
{
Regex r = new Regex(@"\s+"); // regular expression which removes extra spaces
string lin = r.Replace(line, @" "); //and replaces it with single space
CharEnumerator Cnum = lin.GetEnumerator();
CharEnumerator Cnum2 = (CharEnumerator)Cnum.Clone();
CommentTokenizer CommentTok = new CommentTokenizer();
string s = CommentTok.CommentRemover(Cnum);
if (s == null)
{
StringTokenizer Stok = new StringTokenizer();
Stok.stringtok(Cnum2);
}
}
file = container.getContainer1();
fileList = layer.setList(file);
code = null;
foreach (string line in fileList)
{
code += line;
}
return code;
}
开发者ID:Logeshkumar,项目名称:Projects,代码行数:39,代码来源:NullIndentor.cs
示例8: Main
static void Main(String[] arguments)
{
var blobAddress = "http://127.0.0.1:10000/devstoreaccount1/";
String sas = null;
using (var sasClient = new SignatureServiceClient())
{
Console.Write("User: ");
var userName = Console.ReadLine();
Console.Write("Password: ");
var oldFore = Console.ForegroundColor;
Console.ForegroundColor = Console.BackgroundColor;
var password = Console.ReadLine();
Console.ForegroundColor = oldFore;
sasClient.ClientCredentials.UserName.UserName = userName;
sasClient.ClientCredentials.UserName.Password = password;
sas = sasClient.GetContainerSharedSignature();
}
Console.WriteLine("Sas = " + sas);
var storage = new Storage(blobAddress, new StorageCredentialsSharedAccessSignature(sas));
new CommandStore().Execute(storage, arguments);
}
开发者ID:davidajulio,项目名称:claims,代码行数:26,代码来源:DriveClient.cs
示例9: GetDirectoryNodeFromStorage
public DirectoryNode GetDirectoryNodeFromStorage(Storage storage)
{
try
{
var st = storage.References[0];
//st.
var eee = storage.References.Clone();
}
catch (Exception)
{
}
return new DirectoryNode(storage.ToString())
{
_audiofile = storage.isAudioFile(),
_canplay = storage.isPlayable(),
_datafile = storage.isDataFile(),
_defaultlocation = storage.isDefault(),
_folder = storage.isFolder(),
_hidden = storage.isHidden(),
_link = storage.isLink(),
_system = storage.isSystem(),
_virtualfile = storage.isVirtual()
};
}
开发者ID:netonjm,项目名称:Mp3TagDirectory,代码行数:26,代码来源:DeviceForm.cs
示例10: Open
public void Open(Storage storage, JabberUser selectedJabberUser)
{
this.mStorage = storage;
wbConversation.DocumentText = "<HTML><BODY></BODY></HTML>";
loadArchiveUsersList(selectedJabberUser.JID);
tbxSearchText.Focus();
}
开发者ID:biddyweb,项目名称:communicator,代码行数:7,代码来源:ArchiveWindow.cs
示例11: Serialize
public static void Serialize(Storage s)
{
String json = s.ToJSON();
TextWriter sw = new StreamWriter(Helper.GetApplicationPath() + "/Storage.xml");
sw.Write(json);
sw.Close();
}
开发者ID:L3tum,项目名称:SlackAPI,代码行数:7,代码来源:Storage.cs
示例12: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
// Snazzy exception dialog
Current.DispatcherUnhandledException += (o, args) =>
{
MetroException.Show(args.Exception);
args.Handled = true;
};
// Create Assembly Storage
MetroIdeStorage = new Storage();
// Create jumplist
JumpLists.UpdateJumplists();
// Set closing method
Current.Exit += (o, args) =>
{
// Update Settings with Window Width/Height
MetroIdeStorage.MetroIdeSettings.ApplicationSizeMaximize =
(MetroIdeStorage.MetroIdeSettings.HomeWindow.WindowState == WindowState.Maximized);
if (MetroIdeStorage.MetroIdeSettings.ApplicationSizeMaximize) return;
MetroIdeStorage.MetroIdeSettings.ApplicationSizeWidth =
MetroIdeStorage.MetroIdeSettings.HomeWindow.Width;
MetroIdeStorage.MetroIdeSettings.ApplicationSizeHeight =
MetroIdeStorage.MetroIdeSettings.HomeWindow.Height;
};
}
开发者ID:ChadSki,项目名称:Quickbeam,代码行数:32,代码来源:App.xaml.cs
示例13: SettingsPage
public SettingsPage()
{
this.InitializeComponent();
Storage storage = new Storage();
string sDataKey = "userDetails";
string uDataKey = "usernameDetails";
string pDataKey = "passwordDetails";
string userData = storage.LoadSettings(sDataKey);
string usernameDetails = storage.LoadSettings(uDataKey);
string passwordDetails = storage.LoadSettings(pDataKey);
if (userData != "Null")
{
var viewModel = new UserDataSource(userData, usernameDetails, passwordDetails);
LoginForm.Visibility = Visibility.Collapsed;
UserData.Visibility = Visibility.Visible;
AccountSettingsPanel.Visibility = Visibility.Visible;
this.DataContext = viewModel;
}
}
开发者ID:TwiggyRJ,项目名称:twiggyrj-clique-app,代码行数:28,代码来源:SettingsPage.xaml.cs
示例14: Download
public async Task Download(Storage storage, Action<int> downloadProgress, Action<int> writeProgressAction, CancellationToken ct, Stream responseStream)
{
using (responseStream)
{
try
{
for (;;)
{
if (!EnoughSpaceInWriteBuffer())
{
FlushBuffer(storage, writeProgressAction);
}
var bytesRead = await responseStream.ReadAsync(_writeBuffer, _writeBufferPosition, MaxPortionSize, ct);
if (bytesRead == 0)
{
FlushBuffer(storage, writeProgressAction);
break;
}
MoveReadBufferPosition(bytesRead);
downloadProgress(bytesRead);
}
}
finally
{
FlushBuffer(storage, writeProgressAction);
}
}
}
开发者ID:klym1,项目名称:ex.ua-client,代码行数:31,代码来源:FileDownloader.cs
示例15: Open
public void Open(Storage storage, JabberUser selectedJabberUser)
{
this.mStorage = storage;
ResetHTML();
loadArchiveUsersList(selectedJabberUser);
tbxSearchText.Focus();
}
开发者ID:biddyweb,项目名称:communicator,代码行数:7,代码来源:ArchiveWindow.cs
示例16: Main
public static void Main(String[] args) {
db = StorageFactory.Instance.CreateStorage();
if (args.Length > 0)
{
db.SetProperty("perst.object.cache.kind", args[0]);
}
db.Open("testconcur.dbs");
L2List list = (L2List)db.Root;
if (list == null) {
list = new L2List();
list.head = new L2Elem();
list.head.next = list.head.prev = list.head;
db.Root = list;
for (int i = 1; i < nElements; i++) {
L2Elem elem = new L2Elem();
elem.count = i;
elem.linkAfter(list.head);
}
}
Thread[] threads = new Thread[nThreads];
for (int i = 0; i < nThreads; i++) {
threads[i] = new Thread(new ThreadStart(run));
threads[i].Start();
}
#if !COMPACT_NET_FRAMEWORK
for (int i = 0; i < nThreads; i++)
{
threads[i].Join();
}
db.Close();
#endif
}
开发者ID:yan122725529,项目名称:TripRobot.Crawler,代码行数:32,代码来源:TestConcur.cs
示例17: SaveNuspec
private async Task<Uri> SaveNuspec(Storage storage, string id, string version, string nuspec, CancellationToken cancellationToken)
{
var relativeAddress = string.Format("{1}/{0}.nuspec", id, version);
var nuspecUri = new Uri(storage.BaseAddress, relativeAddress);
await storage.Save(nuspecUri, new StringStorageContent(nuspec, "text/xml", "max-age=120"), cancellationToken);
return nuspecUri;
}
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:7,代码来源:DnxMaker.cs
示例18: ArtifactLoader_Unittest
public void ArtifactLoader_Unittest() {
var packageDir = new Storage(ArtifactDir + "/loader");
var outputDir = new Storage(ArtifactDir + "/.compilation");
var code = @"
using System;
public class UserWrapper{
public Yanyitec.SSO.Identity GetIdentity(string name){
return new Yanyitec.SSO.Identity(Guid.NewGuid(),name);
}
}
";
var name = "TestLoader";
var projDir = packageDir.GetDirectory("TestLoader", true);
projDir.PutText("UserWrapper.cs", code);
var json = "{\"frameworks\":{\"net450\":{\"dependencies\":{\"Yanyitec\":\"\"}}}";
projDir.PutText("project.json",json);
var loader = new ArtifactLoader(packageDir, outputDir);
var artifact = loader.Load(name);
var type = artifact.Assembly.DefinedTypes.FirstOrDefault(p=>p.Name == "UserWrapper");
var obj = Activator.CreateInstance(type);
var methodInfo = type.GetMethods().FirstOrDefault(p=>p.Name== "GetIdentity");
var result = methodInfo.Invoke(obj, new object[] { "yanyi"});
}
开发者ID:yanyitec,项目名称:Yanyitec,代码行数:26,代码来源:Artifact_Unittest.cs
示例19: EStationStore
public EStationStore(Storage? storage, string path = default(string))
{
ExceptionlessClient.Default.Configuration.ApiKey = "mnPSl8rxo8I4NghVDeLg96OMlGXlfEMSttioT4hc";
IEstation estation;
switch (storage)
{
case Storage.SqlLite:
estation = new EstationSqlLite(path);
break;
case Storage.WebApi:
estation = new EstationWebApi(path);
break;
case Storage.Azure:
estation = new EstationAzure(path);
break;
default:
estation = new EstationSqlServer(path);
break;
}
HumanResource = estation.HumanResource;
Authentication = estation.Authentication;
Economat = estation.Economat;
Documents = estation.Documents;
Oils = estation.Oils;
Meta = estation.Meta;
Sales = estation.Sales;
Citernes = estation.Citernes;
Fuels = estation.Fuels;
Pompes = estation.Pompes;
Customers = estation.Customers;
}
开发者ID:HalidCisse,项目名称:eStation,代码行数:34,代码来源:EStationStore.cs
示例20: CreateNewCatalog
public static async Task CreateNewCatalog(Storage storage, IDictionary<string, IList<JObject>> packages, CancellationToken cancellationToken)
{
IList<KeyValuePair<string, IList<JObject>>> batch = new List<KeyValuePair<string, IList<JObject>>>();
IList<JObject> catalogPages = new List<JObject>();
int packageCount = 0;
foreach (KeyValuePair<string, IList<JObject>> item in packages)
{
batch.Add(item);
packageCount += item.Value.Count;
if (packageCount >= 100)
{
packageCount = 0;
catalogPages.Add(MakeCatalogPage(batch));
batch.Clear();
}
}
if (batch.Count > 0)
{
catalogPages.Add(MakeCatalogPage(batch));
}
JObject catalogIndex = MakeCatalogIndex(storage, catalogPages);
await Save(storage, catalogIndex, catalogPages, cancellationToken);
}
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:32,代码来源:IndexingHelpers.cs
注:本文中的Storage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论