本文整理汇总了C#中System.IO.FileInfo.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.FileInfo.ToString方法的具体用法?C# System.IO.FileInfo.ToString怎么用?C# System.IO.FileInfo.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileInfo
的用法示例。
在下文中一共展示了System.IO.FileInfo.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
protected static void Main(string[] args)
{
DateTime buildDate = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).LastWriteTime;
string buildDateStr = buildDate.ToString("G");
Console.Title = "EO Proxy";
Console.WriteLine("EO Proxy =-= Build : " + System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion + " (" + buildDateStr + ")\n");
Console.WriteLine();
Console.WriteLine("Loading Configs\n\n");
IniParser.FileIniDataParser parser = new FileIniDataParser();
parser.CommentDelimiter = '#';
IniData settings = parser.LoadFile("config.ini");
AuthAddress = settings["IP"]["AuthAddress"];
ProxyAddress = settings["IP"]["ProxyAddress"];
Console.WriteLine("Connecting to the Authentication server on: " + AuthAddress);
Console.WriteLine("Proxy is redirecting game server connects to: " + ProxyAddress);
ConsoleLogging = Convert.ToBoolean(settings["Options"]["ConsoleLogging"]);
DebugMode = Convert.ToBoolean(settings["Options"]["DebugMode"]);
WriteToBytes = Convert.ToBoolean(settings["Options"]["WriteToBytes"]);
PacketSniffingPath = settings["Options"]["PacketLocation"];
Console.WriteLine("\nPackets will be saved to: " + PacketSniffingPath);
Console.WriteLine("\nAll Settings Loaded.\n\n\n");
Console.WriteLine("Preparing Connections...\n");
KeyValuePair<ushort, ushort>[] bindings = new KeyValuePair<ushort,ushort>[2];
bindings[0] = new KeyValuePair<ushort, ushort>(4444, 9958); // Again, here are the ports that the client
bindings[1] = new KeyValuePair<ushort, ushort>(4445, 9959); // can use to connect. Make sure that yours is
foreach (KeyValuePair<ushort, ushort> bindpair in bindings)
{
Console.WriteLine(" Launching AuthServer [" + bindpair.Value + "] on " + bindpair.Key + "...");
var server = new AsyncSocket(bindpair.Key, bindpair.Value);
server.ClientConnect += new Action<AsyncWrapper>(accountServer_ClientConnect); // This is initializing the socket
server.ClientReceive += new Action<AsyncWrapper, byte[]>(accountServer_ClientReceive); // system... basic Async. This is
server.ClientDisconnect += new Action<object>(accountServer_ClientDisconnect); // for each auth port.
server.Listen();
}
Console.WriteLine(" Launching GameServer [5816] on 4446...");
var gameServer = new AsyncSocket(WorldPort, 5816);
gameServer.ClientConnect += new Action<AsyncWrapper>(gameServer_ClientConnect); // This is the game server's socket
gameServer.ClientReceive += new Action<AsyncWrapper, byte[]>(gameServer_ClientReceive); // system. Notice the actions... right
gameServer.ClientDisconnect += new Action<object>(gameServer_ClientDisconnect); // click them and say "Go to definition".
gameServer.Listen();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\nProxy is online.\n");
Console.ForegroundColor = ConsoleColor.White;
while (true)
Console.ReadLine();
}
示例2: Process
public virtual void Process()
{
bool exceptionWhenWritingLexerFile = false;
string lexerGrammarFileName = null; // necessary at this scope to have access in the catch below
Stopwatch timer = Stopwatch.StartNew();
// Have to be tricky here when Maven or build tools call in and must new Tool()
// before setting options. The banner won't display that way!
if ( Verbose && showBanner )
{
ErrorManager.Info( "ANTLR Parser Generator Version " + AssemblyInformationalVersion );
showBanner = false;
}
try
{
SortGrammarFiles(); // update grammarFileNames
}
catch ( Exception e )
{
ErrorManager.Error( ErrorManager.MSG_INTERNAL_ERROR, e );
}
foreach ( string grammarFileName in GrammarFileNames )
{
// If we are in make mode (to support build tools like Maven) and the
// file is already up to date, then we do not build it (and in verbose mode
// we will say so).
if ( Make )
{
try
{
if ( !BuildRequired( grammarFileName ) )
continue;
}
catch ( Exception e )
{
ErrorManager.Error( ErrorManager.MSG_INTERNAL_ERROR, e );
}
}
if ( Verbose && !Depend )
{
Console.Out.WriteLine( grammarFileName );
}
try
{
if ( Depend )
{
BuildDependencyGenerator dep = new BuildDependencyGenerator( this, grammarFileName );
#if false
IList<string> outputFiles = dep.getGeneratedFileList();
IList<string> dependents = dep.getDependenciesFileList();
Console.Out.WriteLine( "output: " + outputFiles );
Console.Out.WriteLine( "dependents: " + dependents );
#endif
Console.Out.WriteLine( dep.GetDependencies().Render() );
continue;
}
Grammar rootGrammar = GetRootGrammar( grammarFileName );
// we now have all grammars read in as ASTs
// (i.e., root and all delegates)
rootGrammar.composite.AssignTokenTypes();
//rootGrammar.composite.TranslateLeftRecursiveRules();
rootGrammar.AddRulesForSyntacticPredicates();
rootGrammar.composite.DefineGrammarSymbols();
rootGrammar.composite.CreateNFAs();
GenerateRecognizer( rootGrammar );
if ( PrintGrammar )
{
rootGrammar.PrintGrammar( Console.Out );
}
if (Report)
{
GrammarReport2 greport = new GrammarReport2(rootGrammar);
Console.WriteLine(greport.ToString());
}
if ( Profile )
{
GrammarReport report = new GrammarReport(rootGrammar);
Stats.WriteReport( GrammarReport.GRAMMAR_STATS_FILENAME,
report.ToNotifyString() );
}
// now handle the lexer if one was created for a merged spec
string lexerGrammarStr = rootGrammar.GetLexerGrammar();
//[email protected]("lexer grammar:\n"+lexerGrammarStr);
if ( rootGrammar.type == GrammarType.Combined && lexerGrammarStr != null )
{
lexerGrammarFileName = rootGrammar.ImplicitlyGeneratedLexerFileName;
try
{
TextWriter w = GetOutputFile( rootGrammar, lexerGrammarFileName );
w.Write( lexerGrammarStr );
//.........这里部分代码省略.........
示例3: Main
public static void Main(System.String[] args)
{
bool readOnly = false;
bool add = false;
for (int i = 0; i < args.Length; i++)
{
if ("-ro".Equals(args[i]))
readOnly = true;
if ("-add".Equals(args[i]))
add = true;
}
System.IO.FileInfo indexDir = new System.IO.FileInfo("index");
bool tmpBool;
if (System.IO.File.Exists(indexDir.FullName))
tmpBool = true;
else
tmpBool = System.IO.Directory.Exists(indexDir.FullName);
if (!tmpBool)
{
System.IO.Directory.CreateDirectory(indexDir.FullName);
}
IndexReader.Unlock(FSDirectory.GetDirectory(indexDir, false));
if (!readOnly)
{
IndexWriter writer = new IndexWriter(indexDir, ANALYZER, !add);
SupportClass.ThreadClass indexerThread = new IndexerThread(writer);
indexerThread.Start();
System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 1000));
}
SearcherThread searcherThread1 = new SearcherThread(false);
searcherThread1.Start();
SEARCHER = new IndexSearcher(indexDir.ToString());
SearcherThread searcherThread2 = new SearcherThread(true);
searcherThread2.Start();
SearcherThread searcherThread3 = new SearcherThread(true);
searcherThread3.Start();
}
示例4: CheckAndUpdateDataBaseVersion
/// <summary>
/// Verifica la versión de la base de datos y si es necesario actualiza.
/// </summary>
/// <param name="ignorarFecha">Ignorar la fecha y actualizar siempre.</param>
/// <param name="noTocarDatos">Actualizar sólo la estructura. No incorpora ni modifica datos.</param>
public void CheckAndUpdateDataBaseVersion(bool ignorarFecha, bool noTocarDatos)
{
using (Lfx.Data.Connection Conn = Lfx.Workspace.Master.GetNewConnection("Verificar estructura de la base de datos")) {
Conn.RequiresTransaction = false;
int VersionActual = this.CurrentConfig.ReadGlobalSetting<int>("Sistema.DB.Version", 0);
if (VersionUltima < VersionActual) {
this.RunTime.Toast("Es necesario actualizar Lázaro en esta estación de trabajo. Se esperaba la versión " + VersionUltima.ToString() + " de la base de datos, pero se encontró la versión " + VersionActual.ToString() + " que es demasiado nueva.", "Aviso");
return;
}
// Me fijo si ya hay alguien verificando la estructura
string FechaInicioVerif = Lfx.Workspace.Master.CurrentConfig.ReadGlobalSetting<string>("Sistema.VerificarVersionBd.Inicio", string.Empty);
string FechaInicioVerifMax = Lfx.Types.Formatting.FormatDateTimeSql(System.DateTime.Now.AddMinutes(10).ToUniversalTime());
if (ignorarFecha == false && string.Compare(FechaInicioVerif, FechaInicioVerifMax) > 0)
// Ya hay alguien verificando
return;
DateTime VersionEstructura = Lfx.Types.Parsing.ParseSqlDateTime(this.CurrentConfig.ReadGlobalSetting<string>("Sistema.DB.VersionEstructura", "2000-01-01 00:00:00"));
DateTime FechaLazaroExe = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).LastWriteTime;
TimeSpan Diferencia = FechaLazaroExe - VersionEstructura;
System.Console.WriteLine("Versión estructura: " + VersionEstructura.ToString());
System.Console.WriteLine("Versión Lázaro : " + FechaLazaroExe.ToString() + " (" + Diferencia.ToString() + " más nuevo)");
if ((noTocarDatos || VersionActual == VersionUltima) && (ignorarFecha == false && Diferencia.TotalHours <= 1)) {
// No es necesario actualizar nada
return;
}
Lfx.Types.OperationProgress Progreso = new Types.OperationProgress("Verificando estructuras de datos", "Se está analizando la estructura del almacén de datos y se van a realizar cambios si fuera necesario");
Progreso.Modal = true;
Progreso.Begin();
Lfx.Workspace.Master.CurrentConfig.WriteGlobalSetting("Sistema.VerificarVersionBd.Inicio", Lfx.Types.Formatting.FormatDateTimeSql(Lfx.Workspace.Master.MasterConnection.ServerDateTime.ToUniversalTime()));
Lfx.Workspace.Master.CurrentConfig.WriteGlobalSetting("Sistema.VerificarVersionBd.Estacion", Lfx.Environment.SystemInformation.MachineName);
try {
Conn.ExecuteSql("FLUSH TABLES");
} catch {
// No tengo permiso... no importa
}
if (noTocarDatos == false && VersionActual < VersionUltima && VersionActual > 0) {
//Actualizo desde la versión actual a la última
for (int i = VersionActual + 1; i <= VersionUltima; i++) {
Progreso.ChangeStatus("Pre-actualización " + i.ToString());
InyectarSqlDesdeRecurso(Conn, @"Data.Struct.db_upd" + i.ToString() + "_pre.sql");
}
}
if (ignorarFecha || Diferencia.TotalHours > 1) {
// Lázaro es más nuevo que la BD por más de 1 hora
Progreso.ChangeStatus("Verificando estructuras");
this.CheckAndUpdateDataBaseStructure(Conn, false, Progreso);
if (noTocarDatos == false)
this.CurrentConfig.WriteGlobalSetting("Sistema.DB.VersionEstructura", Lfx.Types.Formatting.FormatDateTimeSql(FechaLazaroExe.ToUniversalTime()));
}
if (noTocarDatos == false && VersionActual < VersionUltima && VersionActual > 0) {
for (int i = VersionActual + 1; i <= VersionUltima; i++) {
Progreso.ChangeStatus("Post-actualización " + i.ToString());
InyectarSqlDesdeRecurso(Conn, @"Data.Struct.db_upd" + i.ToString() + "_post.sql");
this.CurrentConfig.WriteGlobalSetting("Sistema.DB.Version", i);
}
}
Lfx.Workspace.Master.CurrentConfig.WriteGlobalSetting("Sistema.VerificarVersionBd.Inicio", "0");
Progreso.End();
}
}
示例5: setFile
/**
* Sets the file activated by this hyperlink
*
* @param file the file
*/
public virtual void setFile(System.IO.FileInfo file)
{
linkType = fileLink;
url = null;
location = null;
contents = null;
this.file = file;
modified = true;
if (sheet == null)
{
// hyperlink has not been added to the sheet yet, so simply return
return;
}
// Change the label on the sheet
WritableCell wc = sheet.getWritableCell(firstColumn, firstRow);
Assert.verify(wc.getType() == CellType.LABEL);
Label l = (Label)wc;
l.setString(file.ToString());
}