本文整理汇总了C#中Storage类的典型用法代码示例。如果您正苦于以下问题:C# Storage类的具体用法?C# Storage怎么用?C# Storage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Storage类属于命名空间,在下文中一共展示了Storage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: Start
void Start()
{
st = transform.root.GetComponent<Storage>();
pc = GameObject.Find("Player").GetComponent<PlayerController>();
startPos = transform.position;
startScale = transform.localScale;
}
示例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));
}
示例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();
}
}
示例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;
}
示例6: CopyFileAction
public CopyFileAction(File source, Storage destinationStorage, string destinationPath, string destinationName)
{
Source = source;
DestinationStorage = destinationStorage;
DestinationPath = destinationPath;
DestinationName = destinationName;
}
示例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;
}
示例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);
}
示例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()
};
}
示例10: Open
public void Open(Storage storage, JabberUser selectedJabberUser)
{
this.mStorage = storage;
wbConversation.DocumentText = "<HTML><BODY></BODY></HTML>";
loadArchiveUsersList(selectedJabberUser.JID);
tbxSearchText.Focus();
}
示例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();
}
示例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;
};
}
示例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;
}
}
示例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);
}
}
}
示例15: Open
public void Open(Storage storage, JabberUser selectedJabberUser)
{
this.mStorage = storage;
ResetHTML();
loadArchiveUsersList(selectedJabberUser);
tbxSearchText.Focus();
}