2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 public const cnRefreshTime = 5 ' refresh time in seconds
23 ' filename for file with all pictures and file containing the name of the current picture
24 public const csFilePicture= "picture.txt"
25 public const csFileCurrent= "currpic.txt"
27 ' constants for file-access
32 Dim FILE_LINE_DELIMITER
33 FILE_LINE_DELIMITER = vbCRLF
36 ' * Get data from file using a given separator.
38 function File_getDataVirtual( sFilename, sServerPath, sSeparator )
41 Dim aFSObject, sServerFileName
43 Set aFSObject = CreateObject("Scripting.FileSystemObject")
44 sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
46 File_getDataVirtual = ""
47 if Err.Number = 0 then
48 File_getDataVirtual = File_read( sServerFileName )
49 If Not IsNull(File_getDataVirtual) Then
50 File_getDataVirtual = Replace( File_getDataVirtual, FILE_LINE_DELIMITER, sSeparator)
51 File_getDataVirtual = Split( File_getDataVirtual, sSeparator)
57 ' * Get data from a file
59 function File_read( sFilename )
62 Dim aFSObject, aStream
64 Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
65 Set aStream = aFSObject.OpenTextFile( sFilename, ForReading )
67 while not aStream.AtEndOfStream
68 File_read = File_read + aStream.ReadLine + FILE_LINE_DELIMITER
75 ' * Get data from a file given by filename and virtual pathname
77 Function File_readVirtual(sFileName, sServerPath)
80 Dim aFSObject, sServerFileName
82 Set aFSObject = CreateObject("Scripting.FileSystemObject")
83 sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
86 if Err.Number = 0 then
87 File_readVirtual = File_read( sServerFileName )
92 ' * Write data to a file
94 function File_write( sFileName, sText )
99 Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
100 if Err.Number = 0 then
101 Set aFile = aFSObject.CreateTextFile( sFileName, TRUE )
102 if Err.Number = 0 then
108 File_write = ( Err.Number = 0 )
112 ' * Write data to a file given by filename and virtual pathname
114 function File_writeVirtual( sFileName, sServerPath, sText )
117 Dim aFSObject, aServerFile
119 Set aFSObject = CreateObject( "Scripting.FileSystemObject" )
120 aServerFile = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName )
122 If Err.Number = 0 Then
123 File_writeVirtual = File_write( aServerFile, sText )
125 File_writeVirtual = false