This file is indexed.

/usr/share/gnome-sharp2-examples/TestVfs.cs is in gnome-sharp2-examples 2.24.2-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
//
// TestVfs.cs: Test for Gnome.Vfs bindings.
//
// Author:
//        Tamara Roberson (foxxygirltamara@gmail.com)
//
// (C) 2004 Tamara Roberson
//

using System;
using System.Text;
using System.IO;

class FileDialog : Gtk.FileChooserDialog {

        public FileDialog (string title, Gtk.FileChooserAction action) 
        : base (title, null, action, "gnome-vfs")
        {
                this.LocalOnly = false;

                this.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
                this.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok);

                this.DefaultResponse = Gtk.ResponseType.Ok;
        }

        public Gnome.Vfs.Uri GetUri ()
        {
                int resp = this.Run ();
                
                this.Hide ();
                        
                if (resp != (int) Gtk.ResponseType.Ok)
                        throw new Exception ("No File Selected.");

                return new Gnome.Vfs.Uri (this.Uri);
        }


        public static Gnome.Vfs.Uri OpenFile (string title)
        {
                FileDialog fd = new FileDialog (title, Gtk.FileChooserAction.Open);
                return fd.GetUri ();
        }

        public static Gnome.Vfs.Uri SaveFile(string title)
        {
                FileDialog fd = new FileDialog (title, Gtk.FileChooserAction.Save);
                return fd.GetUri ();
        }
}


public class TestVfs
{
        public TestVfs ()
        {
                ShowFileInfo ();
                WriteFile ();
                ReadFile ();
                OpenAsync ();
                CreateAsync ();
        }


        private void ShowFileInfo()
        {
                // Ask for a file
                Gnome.Vfs.Uri uri = FileDialog.OpenFile ("Show File Info");
                Console.WriteLine ("Selected uri\t= {0}", uri.ToString ());
                
                // MimeType
                string mimeType = Gnome.Vfs.MimeType.GetMimeTypeForUri (uri.ToString ());
                Console.WriteLine ("Mimetype\t= {0}", mimeType);
        
                // IsLocal
                Gnome.Vfs.FileInfoOptions options = Gnome.Vfs.FileInfoOptions.Default;
                Gnome.Vfs.FileInfo info = new Gnome.Vfs.FileInfo (uri.ToString (), options);
                
                Console.WriteLine ("IsLocal\t\t= {0}", info.IsLocal);
        }
        
        private void WriteFile ()
        {
                // Ask for a file
                Gnome.Vfs.Uri uri = FileDialog.SaveFile ("Write to File");
        
                // Create Stream
                Gnome.Vfs.VfsStream vs = new Gnome.Vfs.VfsStream (uri.ToString (), FileMode.CreateNew);
        
                // Write to the file
                UTF8Encoding utf8 = new UTF8Encoding ();
                byte [] buf = utf8.GetBytes ("Testing 1 2 3, asdjfaskjdhfkajshdf");
                vs.Write (buf, 0, buf.Length);
        
                // Close the file
                vs.Close();
        }
        
        private void ReadFile()
        {
                // Ask for a file
                Gnome.Vfs.Uri uri = FileDialog.OpenFile ("Read File");
        
                // Create Stream
                Gnome.Vfs.VfsStream vs = new Gnome.Vfs.VfsStream (uri.ToString (), FileMode.Open);
        
                // Read File byte by byte
                while (true) {
                        int c = vs.ReadByte ();
        
                        if (c < 0) {
                                Console.WriteLine ("EOF");
                                break;
                        }
        
                        Console.Write ((char) c);
                }
        
                // Close File
                vs.Close ();
        }
        
        private void OpenAsync ()
        {
                // Ask for a file
                Gnome.Vfs.Uri uri = FileDialog.OpenFile ("Open File Asynchronously");
        
                // Open the file Asynchronously
                Gnome.Vfs.AsyncCallback openCallback = new Gnome.Vfs.AsyncCallback (OnUriOpen);
                Gnome.Vfs.Async.Open (uri.ToString (), Gnome.Vfs.OpenMode.Read, 0, openCallback);
        }
        
        private void CreateAsync ()
        {
                // Ask for a file
                Gnome.Vfs.Uri uri = FileDialog.SaveFile ("Create File Asynchronously");
                
                // Create a file Asynchronously
                Gnome.Vfs.FilePermissions perms =
                        Gnome.Vfs.FilePermissions.UserRead  |
                        Gnome.Vfs.FilePermissions.UserWrite |
                        Gnome.Vfs.FilePermissions.GroupRead |
                        Gnome.Vfs.FilePermissions.OtherRead;
                                
                Gnome.Vfs.AsyncCallback createCallback = new Gnome.Vfs.AsyncCallback (OnUriCreate);
                Gnome.Vfs.Async.Create (uri, Gnome.Vfs.OpenMode.Write, false, perms, 0, createCallback);
        }
        
        static void OnUriOpen (Gnome.Vfs.Handle handle, Gnome.Vfs.Result result)
        {
                Console.WriteLine ("Async.Open result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString (result), result);
        
                Gnome.Vfs.AsyncReadCallback readCallback = new Gnome.Vfs.AsyncReadCallback (OnUriRead);

                byte [] buffer = new byte [128];
                Gnome.Vfs.Async.Read (handle, out buffer [0], 128, readCallback);
        }
                
        public static void OnUriRead (Gnome.Vfs.Handle handle, Gnome.Vfs.Result result, 
                                      byte [] buffer, ulong bytesRequested, ulong bytesRead)
        {
                Console.WriteLine ("Async.Read result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString(result), result);
        
                if (result != Gnome.Vfs.Result.Ok)
                        return;

                Console.WriteLine ("bytesRequested\t\t= {0}", bytesRequested);
                Console.WriteLine ("bytesRead\t\t= {0}", bytesRead);

                Console.Write("bytes\t\t\t= ");
                for (int i = 0; i < (int) bytesRead; i++)
                        Console.Write ((char) buffer [i]);
                Console.WriteLine ();

                Gnome.Vfs.AsyncReadCallback readCallback = new Gnome.Vfs.AsyncReadCallback (OnUriRead);

                byte [] buf = new byte [128];
                Gnome.Vfs.Async.Read (handle, out buf [0], 128, readCallback);
        }
                
        public void OnUriCreate (Gnome.Vfs.Handle handle, Gnome.Vfs.Result result)
        {
                Console.WriteLine ("Async.Create result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString (result), result);
                        
                if (result != Gnome.Vfs.Result.Ok)
                        return;
                UTF8Encoding utf8 = new UTF8Encoding ();
                byte [] buffer = utf8.GetBytes ("Testing 1 2 3 asdlfjalsjdfksjdf \nGustavo Giráldez\n");
                Gnome.Vfs.AsyncWriteCallback writeCallback = new Gnome.Vfs.AsyncWriteCallback (OnUriWrite);
                Gnome.Vfs.Async.Write (handle, out buffer [0], (uint) buffer.Length, writeCallback);
        }
                
        public static void OnUriWrite (Gnome.Vfs.Handle handle, Gnome.Vfs.Result result, 
                                       byte [] buffer, ulong bytesRequested, ulong bytesWritten)
        {
                Console.WriteLine ("Async.Write result\t= {0} ({1})", Gnome.Vfs.Vfs.ResultToString (result), result);
        }
        
        
        static void Main (string [] args)
        {
                // Initialize Gtk
                Gtk.Application.Init ();

                new TestVfs ();

                // Run!                        
                Gtk.Application.Run ();
        }        
}