7 public abstract class Move_Tour
: IHammer
{
9 abstract protected FileModel
PickTarget ();
11 public void HammerOnce ()
14 tourist
= PickTarget ();
16 Log
.Spew ("Touring {0} {1}",
17 tourist
.Type
, tourist
.ShortName
);
23 new_parent
= FileModel
.PickAnyDirectory ();
26 new_name
= Token
.GetRandom ();
28 if (tourist
.MoveTo (new_parent
, new_name
)) {
29 Log
.Spew ("{0}: Toured to {1}", count
, tourist
.ShortName
);
36 [Hammer (Name
="Move:TourFile")]
37 public class Move_TourFile
: Move_Tour
{
39 override protected FileModel
PickTarget ()
41 return FileModel
.PickFile ();
45 [Hammer (Name
="Move:TourDirectory")]
46 public class Move_TourDirectory
: Move_Tour
{
48 override protected FileModel
PickTarget ()
50 return FileModel
.PickNonRootDirectory ();
54 /////////////////////////////////////////////////////////////////////
56 public abstract class Move_ShortLived
: IHammer
{
58 abstract protected FileModel
Create ();
60 public void HammerOnce ()
62 FileModel short_lived
;
63 short_lived
= Create ();
64 Log
.Spew ("Created {0} {1}", short_lived
.Type
, short_lived
.ShortName
);
70 new_parent
= FileModel
.PickAnyDirectory ();
73 new_name
= Token
.GetRandom ();
75 if (short_lived
.MoveTo (new_parent
, new_name
)) {
76 Log
.Spew ("Moved to {0}", short_lived
.ShortName
);
81 short_lived
.Delete ();
82 Log
.Spew ("Deleted {0}", short_lived
.ShortName
);
86 [Hammer (Name
="Move:ShortLivedFile")]
87 public class Move_ShortLivedFile
: Move_ShortLived
{
89 override protected FileModel
Create ()
91 FileModel parent
, child
;
93 parent
= FileModel
.PickAnyDirectory ();
94 child
= parent
.NewFile ();
95 } while (child
== null);
100 [Hammer (Name
="Move:ShortLivedDirectory")]
101 public class Move_ShortLivedDirectory
: Move_ShortLived
{
103 override protected FileModel
Create ()
105 FileModel parent
, child
;
107 parent
= FileModel
.PickAnyDirectory ();
108 child
= parent
.NewDirectory ();
109 } while (child
== null);