zoukankan
html css js c++ java
读写独立存储库
//
独立存储库(Isolated Storage),它是硬盘的一个分区,如果你在硬盘上执行搜索并包含隐藏文件,你找不到
//
在此库中创建的文件.
private
static
void
RWStorage()
{
IsolatedStorageFile isoStore;
isoStore
=
IsolatedStorageFile.GetStore(IsolatedStorageScope.Assembly
|
IsolatedStorageScope.User ,
null
,
null
);
//
|| IsolatedStorageScope.User
string
[] FileNames
=
isoStore.GetFileNames(
"
mySecretStuff.secret
"
) ;
DateTime installDate
=
DateTime.Now ;
if
(FileNames.Length
==
0
)
{
//
创建一个新的 存储文件
StreamWriter writer
=
new
StreamWriter(
new
IsolatedStorageFileStream(
"
mySecretStuff.secret
"
,FileMode.CreateNew ,isoStore));
writer.WriteLine(DateTime.Now ) ;
writer.WriteLine(
"
mrfu
"
);
writer.Close();
}
else
{
StreamReader reader
=
new
StreamReader(
new
IsolatedStorageFileStream(
"
mySecretStuff.secret
"
,FileMode.Open ,isoStore));
string
tempStr
=
reader.ReadLine();
string
myName
=
reader.ReadLine();
installDate
=
DateTime.Parse(tempStr);
MessageBox.Show(tempStr
+
"
\n
"
+
myName) ;
}
DateTime dateExpires
=
installDate.AddDays(
60
) ;
System.TimeSpan diff1 ;
diff1
=
dateExpires.Subtract(DateTime.Now );
MessageBox.Show(dateExpires.ToShortDateString()
+
"
\n
"
+
diff1.Days.ToString() ) ;
}
查看全文
相关阅读:
JavaScript 数组操作函数--转载+格式整理
Python之__str__类的特殊方法
Django 模板层(Template)
jquery基础
Django基础(web框架)
前端基础之JavaScript对象
前端基础之JavaScript
MySQL数据库之索引
MySQL数据库之多表查询
MySQL 数据库之单表查询
原文地址:https://www.cnblogs.com/furenjun/p/442115.html
最新文章
[数据结构与算法]06 数组( Array )
[碎碎念]不知道该起什么题目的一篇文章
解决Resharper在Core项目中无法执行单元测试的问题
写业务代码时犯的错误记录
MongoDB复杂查询语句记录
Oracle 查询单挑语句运行时间
Ignite cahce 存储object类型数据和object类型数据序列化后string存储区别
试用期三个月的状态
Kafka消费不到数据的特殊情况
Kafka使用多个分区时 consumer的Assign配置
热门文章
C#中Using里使用单例的问题
数据库关于物化视图的思考
Session挂起
C# 打印webBrowser打开的页面
解决使用webbrowser请求url时数据传递丢失问题
C#:使用WebRequest类请求数据
C# 获取当前目录上一级目录
Unity中LoadLevel与LoadLevelAsync的区别
C#:判断当前线程所处状态&委托
Android开发随手记
Copyright © 2011-2022 走看看