Пример #1
0
        /// <summary>
        /// Load a file
        /// </summary>
        /// <param name="filename">File name</param>
        /// <returns>File loaded or null if file not found</returns>
        internal protected CFile LoadFile(String filename)
        {
            var h = OnLoadFile;

            if (h != null)
            {
                var e = new LoadFileEventArgs(filename);
                h(this, e);
                if (e.File == null)
                {
                    return(null);
                }
                return(new CFile(e.File, DefaultEncoding));
            }
            return(null);
        }
Пример #2
0
 static void swe_OnLoadFile(object sender, LoadFileEventArgs e)
 {
     if (e.FileName.StartsWith("[ephe]")) {
         e.File = SearchFile(e.FileName.Replace("[ephe]", string.Empty));
     } else {
         var f = e.FileName;
         if (System.IO.File.Exists(f))
             e.File = new System.IO.FileStream(f, System.IO.FileMode.Open, System.IO.FileAccess.Read);
     }
 }
Пример #3
0
 /// <summary>
 /// Load a file
 /// </summary>
 /// <param name="filename">File name</param>
 /// <returns>File loaded or null if file not found</returns>
 protected internal CFile LoadFile(String filename)
 {
     var h = OnLoadFile;
     if (h != null) {
         var e = new LoadFileEventArgs(filename);
         h(this, e);
         if (e.File == null) return null;
         return new CFile(e.File, DefaultEncoding);
     }
     return null;
 }
Пример #4
0
 static void sweph_OnLoadFile(object sender, LoadFileEventArgs e) {
     String fname = e.FileName.Replace("[ephe]", "").Trim('/', '\\');
     String[] paths = String.IsNullOrWhiteSpace(ephepath) ? new String[] { "" } : ephepath.Split(';');
     foreach (var path in paths) {
         String f = System.IO.Path.Combine(path, fname);
         if (System.IO.File.Exists(f)) {
             e.File = new System.IO.FileStream(f, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
         }
     }
 }