Пример #1
0
            public static MutableString Inspect(RubyContext /*!*/ context, FileSystemInfo /*!*/ self)
            {
                string result = String.Format(
                    "#<File::Stat dev={0}, ino={1}, mode={2}, nlink={3}, uid={4}, gid={5}, rdev={6}, size={7}, blksize={8}, blocks={9}, atime={10}, mtime={11}, ctime={12}",
                    RubySites.Inspect(context, DeviceId(self)), RubySites.Inspect(context, Inode(self)), RubySites.Inspect(context, Mode(self)),
                    RubySites.Inspect(context, NumberOfLinks(self)), RubySites.Inspect(context, UserId(self)), RubySites.Inspect(context, GroupId(self)),
                    RubySites.Inspect(context, DeviceId(self)), RubySites.Inspect(context, Size(self)), RubySites.Inspect(context, BlockSize(self)),
                    RubySites.Inspect(context, Blocks(self)), TimeOps.ToString(AccessTime(self)), TimeOps.ToString(ModifiedTime(self)),
                    TimeOps.ToString(CreateTime(self))
                    );

                return(MutableString.Create(result));
            }
Пример #2
0
 private static DateTime MakeTime(RubyContext /*!*/ context, object obj)
 {
     if (obj == null)
     {
         return(DateTime.Now);
     }
     else if (obj is DateTime)
     {
         return((DateTime)obj);
     }
     else if (obj is int)
     {
         return(TimeOps.Create(typeof(RubyFileOps), (int)obj));
     }
     else
     {
         string name = context.GetClassOf(obj).Name;
         throw RubyExceptions.CreateTypeConversionError(name, "time");
     }
 }
Пример #3
0
 public static int Compare(FileSystemInfo /*!*/ self, FileSystemInfo /*!*/ other)
 {
     return(TimeOps.CompareTo(self.LastWriteTime, other.LastWriteTime));
 }