2
// dpap-sharp server test program
5
// Andrzej Wytyczak-Partyka <iapart@gmail.com>
7
// Copyright (C) 2008 Andrzej Wytyczak-Partyka
9
// This program is free software; you can redistribute it and/or modify
10
// it under the terms of the GNU General Public License as published by
11
// the Free Software Foundation; either version 2 of the License, or
12
// (at your option) any later version.
14
// This program is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
// GNU General Public License for more details.
19
// You should have received a copy of the GNU General Public License
20
// along with this program; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
using System.Collections.Generic;
28
using System.Collections;
30
using System.Text.RegularExpressions;
42
public static void Main(string[] args)
44
//Regex dbPhotoRegex = new Regex ("/databases/([0-9]*?)/items?session-id=([0-9]*)&meta=.*&query=('dmap.itemid:([0-9]*)')");
46
// string path = "/databases/1/items?session-id=9527&meta=dpap.thumb,dmap.itemid,dpap.filedata&query=('dmap.itemid:35')$";
47
//string path = "'dmap.itemid:35'";
48
// Console.WriteLine("regex:"+rg.IsMatch(path));
50
Console.WriteLine("Starting DPAP server");
51
DPAP.Database database = new DPAP.Database("DPAP");
52
DPAP.Server server = new Server("f-spot photos");
54
server.AuthenticationMethod = AuthenticationMethod.None;
55
int collision_count = 0;
56
server.Collision += delegate {
57
server.Name = "f-spot photos" + " [" + ++collision_count + "]";
60
Photo p = new Photo();
61
p.Thumbnail = "./test3-thumb.jpg";
63
p.FileName = "test3.jpg";
64
p.Path = "./test3.jpg";
70
Photo p1 = new Photo();
71
p1.Thumbnail = "./test2-thumb.jpg";
73
p1.FileName = "test2.jpg";
74
p1.Path = "./test2.jpg";
78
database.AddPhoto(p1);
80
Album a = new Album("test album");
84
Console.WriteLine("Album count is now " + database.Albums.Count);
85
Console.WriteLine("Photo name is " + database.Photos[0].FileName);
86
server.AddDatabase(database);
88
//server.GetServerInfoNode();
91
} catch (System.Net.Sockets.SocketException) {
92
Console.WriteLine("Server socket exception!");
97
//DaapPlugin.ServerEnabledSchema.Set(true);
99
// if(!initial_db_committed) {
101
// initial_db_committed = true;