rem need to modify downloaded_already to use file area input rem Need file area in sort files and file_rec_get sub AllFiles_Txt_Make ////////////////////////////////////////////////////////////////////// dim FileRec as FileRecord dim Rating as real dim Count as long dim File_Name_Area as string dim File_Name as string dim File_Area as long dim Index as long dim SrchRec as SearchRec dim FileAreaRec as FileAreaRecord dim AllFiles_Path as string dim AllFiles_Size as long dim AllFiles_DateTime as DateTime dim New_User_Sec_Profile as SecurityProfile dim NewUserSec_Found as boolean dim File_Sort_All as integer dim File_Num_3 as integer dim Skip_File_Area as boolean ////////////////////////////////////////////////////////////////////// if not GetSecProfile ( New_User_Sec_Profile, MakeWild.NewUserSec ) then ? "Warning: unable to find security profile for "; ? MakeWild.NewUserSec; "!" ? "Delaying 10 seconds..." delay 10 NewUserSec_Found = false else NewUserSec_Found = true end if if not Exists ( Sort_All_Txt ) then ? "Error: "; Sort_All_Txt; " missing!" ? "Aborting creation of "; AllFiles_Txt; "." Delay 10 exit sub end if File_Num_3 = FreeFile open AllFiles_Txt for output as File_Num_3 ? #File_Num_3, "" ? #File_Num_3, "" ? #File_Num_3, " "; AllFiles_Txt; " "; CurrentDateTime AllFiles_DateTime ? #File_Num_3, FormatDate ( AllFiles_DateTime.D, "yyyy-mm-dd" ); " "; ? #File_Num_3, FormatTime ( AllFiles_DateTime.T, "hh:mm" ); " "; ? #File_Num_3, MakeWild.BBSName; " "; MakeWild.Phone ? #File_Num_3, " Created by "; Copyright ? #File_Num_3, "" ? #File_Num_3, " Rating = user evaluation, 1.0 is great, 0.0 is poor." ? #File_Num_3, " Count = number of user evaluations for this file." ? #File_Num_3, " Cost = amount deducted from your account balance to download." ? #File_Num_3, "" for File_Area = 1 to MakeWild.MaxFileAreas ? File_Area; " of "; MakeWild.MaxFileAreas; " file areas" Skip_File_Area = false if GetFileArea ( FileAreaRec, File_Area ) then if New_User_Sec_Profile.AccessFileList ( File_Area ) or \ not NewUserSec_Found then ? #File_Num_3, " ----------------------------------------------------------------------" ? #File_Num_3, " ----------------------------------------------------------------------" ? #File_Num_3, " "; FormatNumber ( File_Area, "@####" ); ": "; ? #File_Num_3, FileAreaRec.Name ? #File_Num_3, " ----------------------------------------------------------------------" ? #File_Num_3, " ----------------------------------------------------------------------" ? #File_Num_3, "" else ? "File Area "; File_Area; " not added to "; AllFiles_Txt; ? " since security profile" ? MakeWild.NewUserSec; " does not have file list access." Skip_File_Area = true end if else Beep ? "Error: unable to get file area name for"; File_Area; "!" end if if not Skip_File_Area then File_Sort_All = FreeFile open Sort_All_Txt for input as File_Sort_All do while not EOF ( File_Sort_All ) input #File_Sort_All, File_Name_Area if Val ( Right ( File_Name_Area, 5 ) ) = File_Area then File_Name = Left ( File_Name_Area, 12 ) Eval_Rec_Get ( Rating, Count, File_Name, Config.Bias_Count ) ? #File_Num_3, " "; File_Name; " "; ? #File_Num_3, FormatNumber ( Rating, "#.#####" ); " "; ? #File_Num_3, FormatNumber ( Count , "@####" ); " "; if File_Record_Found ( FileRec, File_Area, File_Name ) then ? #File_Num_3, LeftPad ( Dollars_Str ( FileRec.Cost ), 6 ); " "; ? #File_Num_3, FileRec.Uploader ? #File_Num_3, " "; Mid ( FileRec.Description, 1, 70 ) ? #File_Num_3, "" else ? #File_Num_3, "" ? #File_Num_3, "" ? "Error: unable to get file info for "; File_Name; "!" end if end if loop close ( File_Sort_All ) end if next File_Area close ( File_Num_3 ) if FindFirst ( AllFiles_Txt, 0, SrchRec ) = 0 then AllFiles_Size = SrchRec.Size else ? "Error: unable to locate "; AllFiles_Txt; "!" AllFiles_Size = 0 end if if GetFileInfo ( FileRec, AllFiles_Txt ) then if File_Path_Found ( AllFiles_Path, FileRec ) then ? "Updating "; AllFiles_Txt; "..." if CopyFile ( AllFiles_Txt, AllFiles_Path + AllFiles_Txt ) then CurrentDateTime ( FileRec.FileTime ) FileRec.Size = AllFiles_Size if not UpdateFile ( FileRec ) then ? "Error: unable to update "; AllFiles_Txt; "!" end if else ? "Error: unable to copy "; AllFiles_Txt; " to "; \ AllFiles_Path + AllFiles_Txt + "!" end if else ? "Error: unable to find path for "; AllFiles_Txt; "." end if else ? "Adding "; AllFiles_Txt; " to File Area 1..." if GetFileArea ( FileAreaRec, 1 ) then if CopyFile ( AllFiles_Txt, FileAreaRec.Path + AllFiles_Txt ) then FileRec.Size = AllFiles_Size FileRec.Name = AllFiles_Txt FileRec.Password = "" CurrentDateTime ( FileRec.FileTime ) CurrentDateTime ( FileRec.LastAccess ) FileRec.Uploader = "EvalFile" FileRec.UploaderID = 0 FileRec.Description = "List of all files on this BBS sorted by EvalFile ratings" FileRec.Flags = 4 FileRec.Downloads = 0 FileRec.Cost = 0 FileRec.Area = 1 FileRec.KeyWords ( 1 ) = "LIST" FileRec.KeyWords ( 2 ) = "ALLFILES" FileRec.KeyWords ( 3 ) = "FILES" FileRec.KeyWords ( 4 ) = "BBS" FileRec.KeyWords ( 5 ) = "EVALFILE" FileRec.KeyWords ( 6 ) = "RATINGS" FileRec.StoredPath = "" FileRec.LongDesc ( 1 ) = "List of all files on this BBS sorting by EvalFile ratings" FileRec.LongDesc ( 2 ) = "" FileRec.LongDesc ( 3 ) = "Files are sorted by file area, rating, and evaluation count." for Index = 4 to 15 FileRec.LongDesc ( Index ) = "" next Index if not AddFile ( FileRec ) then ? "Error: unable to add "; AllFiles_Txt; "!" end if else ? "Error: unable to copy "; AllFiles_Txt; " to "; \ FileAreaRec.Path + AllFiles_Txt + "!" end if else ? "Error: unable to get info on File Area 1!" end if end if end sub sub Config_Init ////////////////////////////////////////////////////////////////////// Config.Mail_Conference = Default_Mail_Conference Config.Bias_Count = Default_Bias_Count Config.Cents_Per_Daily_Downloads = Default_Cents_Per_Daily_Downloads Config.Max_Increase = Default_Max_Increase Config.Max_Decrease = Default_Max_Decrease end sub sub Config_Load ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Line as string ////////////////////////////////////////////////////////////////////// if Exists ( EvalFile_Cfg ) then File_Num = FreeFile open EvalFile_Cfg for input as File_Num if not EOF ( File_Num ) then input #File_Num, Line // Configuration version number would go here. // end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Mail_Conference = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Bias_Count = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Cents_Per_Daily_Downloads = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Max_Increase = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Max_Decrease = Val ( Line ) end if end if close ( File_Num ) else ? EvalFile_Cfg; " configuration file not found." end if end sub sub Config_Save ////////////////////////////////////////////////////////////////////// dim File_Num as integer ////////////////////////////////////////////////////////////////////// File_Num = FreeFile open EvalFile_Cfg for output as File_Num ? #File_Num, "2.0" ? #File_Num, Config.Mail_Conference ? #File_Num, Config.Bias_Count ? #File_Num, Config.Cents_Per_Daily_Downloads ? #File_Num, Config.Max_Increase ? #File_Num, Config.Max_Decrease close ( File_Num ) end sub sub Costs_Update ////////////////////////////////////////////////////////////////////// dim FileRec as FileRecord dim Days as long dim New_Cost as integer ////////////////////////////////////////////////////////////////////// if ( Config.Max_Increase <= 0 ) and ( Config.Max_Decrease <= 0 ) then ? "Bypassing update of file costs since both the maximum file" ? " cost increase and decrease are zero." exit sub end if ? "Updating file costs..." if GetFileInfo ( FileRec, "" ) then do Color ( 10 ) ? Pad ( FileRec.Name, 12 ); " "; FileRec.Cost; " "; if ( not File_Is_Free ( FileRec ) ) or ( FileRec.Cost <> 0 ) then Days = Days_Since ( FileRec.FileTime ) if Days <= 0 then Days = 1 end if New_Cost = \ Config.Cents_Per_Daily_Downloads * FileRec.Downloads / Days if New_Cost < Evalfile_File_Cost_Min then New_Cost = EvalFile_File_Cost_Min end if // if ( FileRec.Cost = 0 ) and ( New_Cost > 0 ) then // Color ( 7 ) // FileRec.Downloads = 1 // FileRec.Cost = 1 // ? FileRec.Cost; " price now non-zero, downloads reset to 1" // elseif New_Cost > FileRec.Cost + Config.Max_Increase then if File_Is_Free ( FileRec ) then Color ( 11 ) FileRec.Cost = 0 ? FileRec.Cost; " set to zero since marked as free file" elseif New_Cost > FileRec.Cost + Config.Max_Increase then Color ( 12 ) FileRec.Cost = FileRec.Cost + Config.Max_Increase ? FileRec.Cost elseif New_Cost > FileRec.Cost then Color ( 4 ) FileRec.Cost = New_Cost ? FileRec.Cost elseif New_Cost < FileRec.Cost - Config.Max_Decrease then Color ( 9 ) FileRec.Cost = FileRec.Cost - Config.Max_Decrease ? FileRec.Cost elseif New_Cost < FileRec.Cost then Color ( 1 ) FileRec.Cost = New_Cost ? FileRec.Cost else ? end if if not UpdateFile ( FileRec ) then ? "unchanged due to error in UpdateFile" end if else ? "unchanged since marked as free file" end if if not GetNextFile ( FileRec ) then exit do end if loop end if end sub function Download_Get ( \ Paid as integer, \ FileRec as FileRecord, \ byval File_Name as string ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Line as string dim User_Data_File as string dim Paid_Real as real ////////////////////////////////////////////////////////////////////// File_Name = UCase ( Trim ( File_Name ) ) Download_Get = false if GetFileInfo ( FileRec, File_Name ) then User_Data_File = UserData_Program_Dir ( \ User.UserID, User.Name, PROGRAM_DIR, false ) \ + "\" + Unevaled_Txt if Exists ( User_Data_File ) then File_Num = FreeFile open ( User_Data_File ) for input as File_Num do while not EOF ( File_Num ) input #File_Num, Line Line = UCase ( Line ) if Trim ( Left ( Line, 12 ) ) = File_Name then Download_Get = true if ( Len ( Line ) >= 20 ) \ and StrToReal ( Mid ( Line, 15, 6 ), Paid_Real ) then Paid = Paid_Real * 100 else Paid = 0 end if exit do end if loop close ( File_Num ) end if end if end function function Download_Strip ( \ byval File_Name as string ) \ as boolean ////////////////////////////////////////////////////////////////////// dim User_Data_File as string dim File_Num_Old, File_Num_New as integer dim Line as string ////////////////////////////////////////////////////////////////////// File_Name = UCase ( Trim ( File_Name ) ) User_Data_File = UserData_Program_Dir ( \ User.UserID, User.Name, PROGRAM_DIR, false ) \ + "\" + Unevaled_Txt Download_Strip = false if not Exists ( User_Data_File ) then exit function end if File_Num_Old = FreeFile open User_Data_File for input as File_Num_Old File_Num_New = FreeFile open WorkFile_Tmp for output as File_Num_New do while not EOF ( File_Num_Old ) input #File_Num_Old, Line Line = UCase ( Line ) if Trim ( Left ( Line, 12 ) ) <> File_Name then print #File_Num_New, Line end if loop close ( File_Num_New ) close ( File_Num_Old ) CopyFile ( WorkFile_Tmp, User_Data_File ) Del ( WorkFile_Tmp ) Download_Strip = true end function function Downloaded_Already ( \ byval File_Name as string, \ byval File_Area as integer ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Download_Name as string*12 dim Download_File as string ////////////////////////////////////////////////////////////////////// Downloaded_Already = false Download_File = UserData_Program_Dir ( User.UserID, User.Name, \ PROGRAM_DIR, false ) + "\" + Download_Txt if Exists ( Download_File ) then File_Num = FreeFile open Download_File for input as File_Num do while not EOF ( File_Num ) input #File_Num, Download_Name Download_Name = Ucase ( Trim ( Left ( Download_Name, 12 ) ) ) if Download_Name = Ucase ( Trim ( File_Name ) ) then Downloaded_Already = true exit do end if loop close ( File_Num ) end if end function function Eval_Rec_Get ( \ Rating as real, \ Count as long, \ byval File_Name as string, \ byval Bias as long ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Eval_ASC as byte dim Eval as string*1 dim Sum as long ////////////////////////////////////////////////////////////////////// Eval_Rec_Get = false Rating = 1.0 Count = 0 if not Exists ( Eval_Dir + "\" + File_Name ) then exit function end if Sum = 0 File_Num = FreeFile open Eval_Dir + "\" + File_Name for binary as File_Num do while not EOF ( File_Num ) get #File_Num, , Eval_ASC Eval = Chr ( Eval_ASC ) Eval = UCase ( Eval ) if Eval = "Y" then Sum = Sum + 1 Count = Count + 1 elseif Eval = "N" then Count = Count + 1 end if loop close ( File_Num ) if Count < Bias then Rating = ( Sum + Bias - Count ) / Bias elseif Count > 0 then Rating = Sum / Count else Rating = 1.0 end if Eval_Rec_Get = true end function sub Eval_Rec_Put ( \ byval File_Name as string, \ byval Eval as string ) ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Eval_ASC as byte ////////////////////////////////////////////////////////////////////// if not Dir_Exists ( Eval_Dir ) then if not Dir_Exists ( TrdParty ) then ? "Making subdirectory "; TrdParty; "..."; MkDir ( TrdParty ) ? "done." end if if not Dir_Exists ( TrdParty + "\" + EvalFile_Dir ) then ? "Making subdirectory "; TrdParty + "\" + EvalFile_Dir; "..."; MkDir ( TrdParty + "\" + EvalFile_Dir ) ? "done." end if if not Dir_Exists ( Eval_Dir ) then ? "Making subdirectory "; Eval_Dir; "..."; MkDir ( Eval_Dir ) ? "done." end if end if File_Num = FreeFile open Eval_Dir + "\" + File_Name for binary as File_Num Eval_ASC = ASC ( UCase ( Eval ) ) put #File_Num, LOF ( File_Num ) + 1, Eval_ASC close #File_Num end sub function EvalFile_FileInfo ( \ byval File_Name as string, \ byval File_Area as integer ) \ as string ////////////////////////////////////////////////////////////////////// dim File_Rec as FileRecord dim Rating as real dim Count as long dim Option as string*1 ////////////////////////////////////////////////////////////////////// if not File_Record_Found ( File_Rec, File_Area, File_Name ) then ? "File record not found." WaitEnter exit function end if if not Eval_Rec_Get ( Rating, Count, File_Name, Config.Bias_Count ) then Rating = 1.0 Count = 0 end if do EvalFile_FileInfo_Show ( File_Rec, Rating, Count ) ? "[B]ypass, [H]elp, [I]nfo, [M]ark, [P]revious,"; ? " [Q]uit, [ENTER] Next: "; input Option Option = UCase ( Option ) if Option = "" then Option = "N" end if if Option = "B" then if InputYesNo ( "Bypass this file in future searches? (Y/n): ", \ true ) then File_Bypass ( File_Name, File_Area ) ? "File will be bypassed." exit do else ? "File bypass aborted." end if WaitEnter elseif Option = "H" then ? ? "[B]ypass.....: skip this file in future suggestions" ? "[H]elp.......: this listing" ? "[I]nfo.......: standard Wildcat! BBS file info" ? "[M]ark.......: mark a file for later download" ? "[N]ext.......: next file suggestion" ? "[P]revious...: previous file suggestion" ? "[Q]uit.......: quit listing file suggestions" ? WaitEnter elseif Option = "I" then FileInfo ( File_Name, File_Area ) elseif Option = "M" then if AddMarkFile ( File_Name, File_Area ) then ? "File marked for download." end if WaitEnter elseif Option = "N" then exit do elseif Option = "P" then exit do elseif Option = "Q" then exit do else Beep end if loop EvalFile_FileInfo = Option end function sub EvalFile_FileInfo_Show ( \ File_Rec as FileRecord, \ byval Rating as real, \ byval Count as long ) ////////////////////////////////////////////////////////////////////// dim Line as integer dim Line_Count as integer ////////////////////////////////////////////////////////////////////// Line_Count = 0 MorePrompt Off Color ( 15 ) ? String ( 79, "=" ) ? "File Name...: "; Color ( 12 ) ? Pad ( File_Rec.Name, 15 ); Color ( 15 ) ? "File Area...: "; File_Rec.Area; " - "; ? File_Area_Name ( File_Rec.Area ) ? "Rating......: "; Color ( 14 ) ? Pad ( FormatNumber ( Rating, "#.#####" ), 15 ); Color ( 15 ) ? "Count.......: "; Count ? "Cost........: "; Color ( 10 ) ? Pad ( Dollars_Str ( File_Rec.Cost ), 15 ); Color ( 15 ) ? "Uploader....: "; File_Rec.Uploader; ? " ("; File_Rec.UploaderID; ")" ? "Size........: "; Pad ( Trim ( \ FormatNumber ( File_Rec.Size, "#,###,###,###" ) ), 15 ); ? "Downloads...: "; File_Rec.Downloads ? "File Date...: "; Pad ( FormatDate ( File_Rec.FileTime.D, DATE_MASK_ISO ), 15 ); ? "Last Access : "; FormatDate ( File_Rec.LastAccess.D, DATE_MASK_ISO ) ? Color ( 13 ) ? File_Rec.Description Color ( 5 ) for Line = 1 to 15 if File_Rec.LongDesc ( Line ) <> "" then Line_Count = Line_Count + 1 ? File_Rec.LongDesc ( Line ) end if next Line if Line_Count < 15 then ? end if Color ( 15 ) end sub sub Evaluate_Files ( Unevaluated as string ) REM ------------------------------------------------------------------ dim File_Name as string dim FileRec as FileRecord dim Uploader as string dim Paid as integer dim Eval as string REM ? "Enter the name of the downloaded file [ENTER="; if Unevaluated = "" then ? "Abort]: "; input File_Name if Trim ( File_Name ) = "" then exit sub end if else ? Unevaluated; "]: "; input File_Name if File_Name = "" then File_Name = Unevaluated Unevaluated = "" end if end if File_Name = UCase ( File_Name ) if not Download_Get ( Paid, FileRec, File_Name ) then if not Download_Strip ( File_Name ) then ? "Error: unable to update personal download record." WaitEnter end if ? ? "Unable to find download record of "; File_Name; "." ? ? "Possible reasons include:" ? "(1) your download has not been recorded yet (try again tomorrow)," ? "(2) you have not downloaded that file," ? "(3) you already evaluated that file," ? "(4) the file has been deleted from the BBS," ? "(5) your download records have been deleted." WaitEnter exit sub end if ? ? FileRec.Name ? ? Mid ( FileRec.Description, 1, 70 ) ? if InputYesNo ( "Did you find this file worth downloading (Y/n)? ", true ) then Eval = "Y" else Eval = "N" end if if not Download_Strip ( File_Name ) then ? "Error: unable to update personal download record." WaitEnter end if Eval_Rec_Put ( File_Name, Eval ) ? "Thank you for your evaluation, "; Trim ( User.Name ); "." if Reward_Evaluator then ? "Your download count has been reduced by one." end if if Eval = "Y" then ? "Our thanks to the uploader, "; Trim ( FileRec.Uploader ); "!" if Paid > 0 then Uploader = FileRec.Uploader if Uploader_Reward ( Uploader, FileRec.UploaderID, Paid, File_Name ) then ? Trim ( FileRec.Uploader ); " has been awarded "; ? Dollars_Str ( Paid ); "." end if end if if UCase ( Mid ( FileRec.Description, 1, 14 ) ) = "NO DESCRIPTION" then ? ? "The uploader of this file did not give it a short description." ? "You may become the uploader of this file by giving it one." ? "You would then be entitled to any subsequent uploader credits." ? if InputYesNo ( \ "Would you like to give this file a short description (y/N)? ", \ false ) then do ? "Please enter a one-line description for this file [ENTER=Abort]." input FileRec.Description if FileRec.Description = "" then exit do end if FileRec.Description = Mid ( FileRec.Description, 1, 70 ) ? ? FileRec.Description loop until \ InputYesNo ( "Is this the way you want it to read (Y/n)? ", true ) if FileRec.Description <> "" then FileRec.Uploader = User.Name FileRec.UploaderID = User.UserID if not UpdateFile ( FileRec ) then Beep ? "Error: unable to update file description." WaitEnter end if end if end if end if end if WaitEnter end sub sub Event_Mode REM ------------------------------------------------------------------ MorePrompt Off Log_Scan_Start ( Registration, Copyright ) Costs_Update Sort_All_Txt_Make AllFiles_Txt_Make // Sort_All_Files Uploader_Payments_Total_Sort end sub sub File_Bypass ( \ byval File_Name as string, \ byval File_Area as integer ) ////////////////////////////////////////////////////////////////////// dim Bypass_File as string dim File_Num as integer ////////////////////////////////////////////////////////////////////// Bypass_File = UserData_Program_Dir ( \ User.UserID, User.Name, PROGRAM_DIR, true ) + "\" + Bypassed_Txt File_Num = FreeFile open Bypass_File for append as File_Num ? #File_Num, Pad ( File_Name, 13 ); ? #File_Num, FormatNumber ( File_Area, "@####" ) close ( File_Num ) end sub function File_Bypassed ( \ byval File_Name as string, \ byval File_Area as integer ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Bypass_File as string dim Bypass_Name_Area as string dim Bypass_Name as string dim Bypass_Area as integer ////////////////////////////////////////////////////////////////////// File_Bypassed = false Bypass_File = UserData_Program_Dir ( \ User.UserID, User.Name, PROGRAM_DIR, false ) + "\" + Bypassed_Txt if Exists ( Bypass_File ) then File_Num = FreeFile open Bypass_File for input as File_Num do while not EOF ( File_Num ) input #File_Num, Bypass_Name_Area Bypass_Name = UCase ( Trim ( Left ( Bypass_Name_Area, 12 ) ) ) if Bypass_Name = Ucase ( Trim ( File_Name ) ) then Bypass_Area = Val ( Mid ( Bypass_Name_Area, 14, 5 ) ) if Bypass_Area = File_Area then File_Bypassed = true exit do end if end if loop close ( File_Num ) end if end function function Find_Unevaluated as string REM ------------------------------------------------------------------ dim File_Found as boolean : File_Found = false dim Download_Usr as string dim File_Num_Download as integer dim File_Name as string*12 dim Line as string REM Find_Unevaluated = "" ? ? "Searching for your unevaluated downloaded files." ? "Press any key to stop searching." ? Download_Usr = UserData_Program_Dir ( \ User.UserID, User.Name, PROGRAM_DIR, false ) \ + "\" + Unevaled_Txt if Exists ( Download_Usr ) then File_Num_Download = FreeFile open Download_Usr for input as File_Num_Download do while not EOF ( File_Num_Download ) input #File_Num_Download, Line if ( Len ( Line ) < 22 ) or ( Line ( 22 ) = " " ) then File_Name = UCase ( Trim ( Left ( Line, 12 ) ) ) Find_Unevaluated = File_Name File_Found = true ? ? File_Name ? if not InputYesNo ( "Continue search? (y/N): ", false ) then exit do end if else ? "."; end if if Inkey <> "" then ? if not InputYesNo ( "Continue search? (y/N): ", false ) then exit do end if ? end if loop close ( File_Num_Download ) end if ? ? ? "Search completed." if not File_Found then ? ? "No unevaluated downloaded files found." ? ? "Possible reasons: " ? "(1) the activity log has not been scanned for your downloads yet," ? "(2) the files have been deleted from the BBS," ? "(3) you have not downloaded any files yet," ? "(4) you have already evaluated your downloaded files." end if WaitEnter end function sub Marked_Files_Ratings ////////////////////////////////////////////////////////////////////// dim File_Index as integer dim File_Name as string*12 dim File_Area as integer dim FileRec as FileRecord dim Rating as real dim Count as long ////////////////////////////////////////////////////////////////////// if GetMarkedFiles = 0 then exit sub end if cls Color ( 2 ) ? Copyright ? Color ( 3 ) ? "You have marked the following files for download." Color ( 4 ) ? "You will have the opportunity to change this list before downloading." Color ( 5 ) ? "You will have $"; ? Trim ( FormatNumber ( User.SubscriptionBalance / 100, "###.##" ) ); ? " remaining in your account balance." ? Color ( 6 ) ? "File Name Rating Cost Count" ? "------------ ------- ------- -----" for File_Index = 1 to GetMarkedFiles File_Name = GetMarkFileName ( File_Index ) File_Area = GetMarkFileArea ( File_Index ) Color ( 9 ) Color ( 13 ) ? Pad ( File_Name, 14 ); if File_Record_Found ( FileRec, File_Area, File_Name ) then Color ( 12 ) Eval_Rec_Get ( Rating, Count, File_Name, Config.Bias_Count ) ? FormatNumber ( Rating, "#.#####" ); " "; if FileRec.Cost > 0 then Color ( 10 ) else Color ( 2 ) end if ? "$"; FormatNumber ( FileRec.Cost / 100, "@##.##" ); " "; Color ( 13 ) ? Count end if next File_Index WaitEnter end sub sub Message_Send_Downloader ( \ User_Name as string, File_List_File as string ) REM ------------------------------------------------------------------ dim MsgHeader as MessageHeader REM ------------------------------------------------------------------ MsgHeader.From = MakeWild.SysOpName MsgHeader.FromTitle = "EVALFILE" MsgHeader.To = User_Name MsgHeader.Subject = "Please evaluate these files using File Menu option K" FlagSet ( MsgHeader.Flags, 1 ) if AddMessage ( MsgHeader, File_List_File, "", Config.Mail_Conference ) then ? "Message placed in conference "; Config.Mail_Conference; " for "; ? User_Name else Beep ? "Error in placing message in conference "; Config.Mail_Conference; ? " for "; User_Name end if end sub sub Sort_All_Txt_Make ////////////////////////////////////////////////////////////////////// dim File_Rec as FileRecord dim Rating as real dim Count as long dim Rating_Str as string dim Count_Str as string dim Cost_Str as string dim Sort_Str as string type File_Name_File_Area_Type File_Name as string*12 File_Area as integer end type dim File_Name_File_Area as File_Name_File_Area_Type dim File_Num, File_Num_Sort as integer dim Counter as long ////////////////////////////////////////////////////////////////////// if not GetFirstFile ( File_Rec ) then ? "Error: unable to get first file." delay 5 exit sub end if File_Num = FreeFile open Sort_All_Tmp for random as File_Num \ len = Len ( File_Name_File_Area_Type ) SortStart Counter = 0 do Eval_Rec_Get ( Rating, Count, File_Rec.Name, Config.Bias_Count ) Rating_Str = FormatNumber ( Rating, "#.#####" ) if Rating_Str = "1.00000" then Rating_Str = "~~~~~" else Rating_Str = Right ( Rating_Str, 5 ) end if Count_Str = FormatNumber ( Count, "@####" ) Cost_Str = FormatNumber ( File_Rec.Cost, "#####" ) Sort_Str = Rating_Str + Count_Str + Cost_Str Counter = Counter + 1 SortAdd ( Sort_Str, Counter ) File_Name_File_Area.File_Name = File_Rec.Name File_Name_File_Area.File_Area = File_Rec.Area put #File_Num, Counter, File_Name_File_Area if Counter mod 100 = 0 then ? Counter; " of "; MasterInfo.TotalFiles; " files" end if loop while GetNextFile ( File_Rec ) File_Num_Sort = FreeFile open Sort_All_Txt for output as File_Num_Sort Counter = SortPrev while Counter > 0 get #File_Num, Counter, File_Name_File_Area ? #File_Num_Sort, Pad ( File_Name_File_Area.File_Name, 13 ); ? #File_Num_Sort, \ FormatNumber ( File_Name_File_Area.File_Area, "@####" ) Counter = SortPrev wend close ( File_Num ) close ( File_Num_Sort ) del Sort_All_Tmp end sub function Reward_Evaluator as boolean REM ------------------------------------------------------------------ dim Random_Number as real REM Reward_Evaluator = false if User.Downloads > 0 then if EvalFile_Reward_Chance < 1.0 then ? "Evaluation Reward Chance: "; ? FormatNumber ( EvalFile_Reward_Chance * 100.0, "###" ); ? "% >= "; Random_Number = Rnd ( -Timer ) ? FormatNumber ( Random_Number * 100, "##.#" ); ? "% "; if ( EvalFile_Reward_Chance >= Random_Number ) then User.Downloads = User.Downloads - 1 ? "You got it." if UpdateUser ( User ) then Reward_Evaluator = true end if else ? "No luck." end if else User.Downloads = User.Downloads - 1 if UpdateUser ( User ) then Reward_Evaluator = true end if end if end if end function sub Suggest_Files ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim File_Name_File_Area ( 20 ) as byte dim File_Name_File_Area_Str as string*18 dim File_Name as string dim File_Area as integer dim File_Rec as FileRecord dim Counter as long dim Step_Counter as integer dim Option as string*1 dim Char as integer dim Bypass_No_Download as boolean dim Bypass_Marked as boolean dim Bypass_Uploads as boolean dim Bypass_Downloads as boolean dim Bypass_Too_Low as boolean dim Bypass_Count_Minimum as integer dim Bypass_Rating_Minimum as real dim Rating as real dim Count as long ////////////////////////////////////////////////////////////////////// ? Bypass_No_Download = InputYesNo ( \ "Bypass file areas where you don't have download access? (Y/n): ", \ true ) Bypass_Marked = InputYesNo ( \ "Bypass files already marked for download? (Y/n): ", \ true ) Bypass_Too_Low = InputYesNo ( \ "Bypass files costing more than your account balance? (Y/n): ", \ true ) Bypass_Uploads = InputYesNo ( \ "Bypass files you uploaded? (Y/n): ", true ) Bypass_Downloads = InputYesNo ( \ "Bypass files you already downloaded? (Y/n): ", true ) Bypass_Count_Minimum = Integer_Ask ( \ "Minimum count of user evaluations? ", \ 0, Config.Bias_Count, 1 ) Bypass_Rating_Minimum = Real_Ask ( \ "Minimum user evaluation rating? ", 0.0, 1.0, 0.5 ) File_Num = FreeFile open Sort_All_Txt for random as File_Num len = 20 Counter = 0 Step_Counter = 1 do while not EOF ( File_Num ) Counter = Counter + Step_Counter if Counter < 1 then ? ? "You have reached the top of the list." ? if InputYesNo ( "Quit? (y/N): ", false ) then exit do end if Counter = 1 Step_Counter = 1 end if if Counter > LOF ( File_Num ) then ? ? "You have reached the bottom of the list." ? if InputYesNo ( "Quit? (y/N): ", false ) then exit do end if Counter = LOF ( File_Num ) Step_Counter = -1 end if get #File_Num, Counter, File_Name_File_Area File_Name_File_Area_Str = "" for Char = 0 to 17 File_Name_File_Area_Str = File_Name_File_Area_Str \ + Chr ( File_Name_File_Area ( Char ) ) next Char File_Name = Left ( File_Name_File_Area_Str, 12 ) File_Area = Val ( Mid ( File_Name_File_Area_Str, 14, 5 ) ) MorePrompt Off if User_Has_AccessFileList ( File_Area ) then ? File_Name; ": "; if User_Has_AccessFileDown ( File_Area ) or not Bypass_No_Download then if File_Record_Found ( File_Rec, File_Area, File_Name ) then if not Bypass_Too_Low or not ( File_Rec.Cost > User.SubscriptionBalance ) then if not Bypass_Uploads or not ( File_Rec.UploaderID = User.UserID ) then if not Bypass_Downloads or not Downloaded_Already ( File_Name, File_Area ) then if not Bypass_Marked or not File_Is_Marked ( File_Rec ) then Eval_Rec_Get ( Rating, Count, File_Name, Config.Bias_Count ) if Count >= Bypass_Count_Minimum then if Rating >= Bypass_Rating_Minimum then if not File_Bypassed ( File_Name, File_Area ) then ? ? Option = EvalFile_FileInfo ( File_Name, File_Area ) ? Color ( 13 ) if Option = "Q" then exit do elseif Option = "P" then Step_Counter = -1 else Step_Counter = 1 end if Color ( 15 ) else ? "previously bypassed." end if else ? "rating too low. Press ENTER to stop search." end if else ? "too few evaluations." end if else ? "marked for download." end if else ? "already downloaded." end if else ? "bypassing your uploads." end if else ? "account balance too low." end if else ? "file record not found." end if else ? "no file area download access." end if else ? "." end if if Inkey <> "" then ? if not InputYesNo ( \ "Key pressed. Continue search? (y/N): ", false ) then exit do end if ? end if loop close ( File_Num ) end sub function Uploader_Payments_Total_Load ( \ byval Uploader_ID as long, \ byval Uploader_Name as string ) \ as integer ////////////////////////////////////////////////////////////////////// dim Payments_File as string dim File_Num as integer ////////////////////////////////////////////////////////////////////// Payments_File = UserData_Program_Dir ( \ Uploader_ID, Uploader_Name, PROGRAM_DIR, false ) \ + "\" + Upld_Pay_Txt if Exists ( Payments_File ) then File_Num = FreeFile open Payments_File for input as File_Num input #File_Num, Uploader_Payments_Total_Load close ( File_Num ) else Uploader_Payments_Total_Load = 0 end if end function sub Uploader_Payments_Total_Save ( \ byval Uploader_ID as long, \ byval Uploader_Name as string, \ byval Payments_Total as integer ) ////////////////////////////////////////////////////////////////////// dim Payments_File as string dim File_Num as integer ////////////////////////////////////////////////////////////////////// Payments_File = UserData_Program_Dir ( \ Uploader_ID, Uploader_Name, PROGRAM_DIR, true ) \ + "\" + Upld_Pay_Txt File_Num = FreeFile open Payments_File for output as File_Num print #File_Num, Payments_Total close ( File_Num ) end sub sub Uploader_Payments_Total_Sort ////////////////////////////////////////////////////////////////////// dim Counter as long : Counter = 0 dim File_Num, File_Num_2 as integer dim Uploader_Rec as UserRecord dim Upld_Pay_Sorted as string dim Sort_Str as string*30 ////////////////////////////////////////////////////////////////////// if not GetFirstUser ( Uploader_Rec, 5 ) then Beep ? "Uploader_Payments_Total_Sort: could not find first user." ? "Delaying 10 seconds..." delay 10 exit sub end if File_Num_2 = FreeFile open WorkFile_Tmp for random as File_Num_2 len = 30 SortStart do ? "."; Sort_Str = FormatNumber ( Uploader_Payments_Total_Load ( \ Uploader_Rec.UserID, Uploader_Rec.Name ), "@####" ) \ + Pad ( Uploader_Rec.Name, 25 ) if Left ( Sort_Str, 5 ) <> "00000" then Counter = Counter + 1 put #File_Num_2, Counter, Sort_Str SortAdd ( Sort_Str, Counter ) end if loop while GetNextUser ( Uploader_Rec, 5 ) ? Upld_Pay_Sorted = TrdParty + "\" + PROGRAM_DIR + "\" + Upld_Pay_Txt File_Num = FreeFile open Upld_Pay_Sorted for output as File_Num do ? "+"; Counter = SortPrev if Counter > -1 then get #File_Num_2, Counter, Sort_Str ? #File_Num, Dollars_Str ( Val ( Left ( Sort_Str, 5 ) ) ); ? #File_Num, " "; ? #File_Num, Right ( Sort_Str, 25 ) end if loop while Counter > -1 ? close ( File_Num ) close ( File_Num_2 ) del WorkFile_Tmp end sub function Uploader_Pay_Owed ( \ byval Uploader_ID as long, \ byval Uploader_Name as string ) \ as boolean ////////////////////////////////////////////////////////////////////// dim Cost as long dim Cost_Owed as integer dim Uploader_Rec as UserRecord dim Log_Str_Reward as string dim Temp as boolean dim File_Num as integer dim Name_File_Owed as string dim Name_File_Uploaded as string ////////////////////////////////////////////////////////////////////// Temp = false if User_Record_Found ( Uploader_Rec, Uploader_Name, Uploader_ID ) then Name_File_Owed = UserData_Program_Dir ( Uploader_Rec.UserID, \ Uploader_Rec.Name, Program_Dir, TRUE ) + "\" + Pay_Owed_Txt if Exists ( Name_File_Owed ) then File_Num = FreeFile open Name_File_Owed for input as File_Num Cost = 0 do while not EOF ( File_Num ) input #File_Num, Cost_Owed input #File_Num, Name_File_Uploaded // Message_Send_Uploader ( \ // Uploader_Name, Uploader_ID, Cost_Owed, Name_File_Uploaded ) Log_Str_Reward = "EvalFile: $" + \ FormatNumber ( Cost_Owed / 100, "@##.##" ) + " reward to " + \ Uploader_Name + " for upload of " + Name_File_Uploaded ActivityLog ( Log_Str_Reward ) Uploader_Payments_Total_Save ( Uploader_Rec.UserID, \ Uploader_Rec.Name, \ Uploader_Payments_Total_Load ( Uploader_Rec.UserID, \ Uploader_Rec.Name ) \ + Cost_Owed ) ? Log_Str_Reward Cost = Cost + Cost_Owed loop close ( File_Num ) // Need to only pay if deletion confirmed here. Del ( Name_File_Owed ) if not Exists ( Name_File_Owed ) then Uploader_Rec.SubscriptionBalance = \ Uploader_Rec.SubscriptionBalance + Cost if User.UserID = Uploader_Rec.UserID then User.SubscriptionBalance = User.SubscriptionBalance + Cost Temp = true elseif UpdateUser ( Uploader_Rec ) then Temp = true end if else Log_Str_Reward = "EvalFile: ERROR! Unable to delete " \ + Name_File_Owed + ". Payments aborted." ActivityLog ( Log_Str_Reward ) ? Log_Str_Reward end if else ? "No unpaid uploader rewards found." end if else ? Uploader_Name; " ["; Uploader_ID; "] not found." end if WaitEnter Uploader_Pay_Owed = Temp end function function Uploader_Reward ( \ byval Uploader_Name as string, \ byval Uploader_ID as long, \ byval Cost as integer, \ byval File_Name as string ) \ as boolean ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Name_File_Owed as string dim Uploader_Rec as UserRecord ////////////////////////////////////////////////////////////////////// Uploader_Reward = FALSE if User_Record_Found ( Uploader_Rec, Uploader_Name, Uploader_ID ) then Name_File_Owed = UserData_Program_Dir ( Uploader_Rec.UserID, \ Uploader_Rec.Name, Program_Dir, TRUE ) + "\" + Pay_Owed_Txt File_Num = FreeFile open Name_File_Owed for append as File_Num ? #File_Num, Cost ? #File_Num, File_Name close ( File_Num ) Uploader_Reward = TRUE end if end function sub EvalFile_Start ( \ byval Registration as string, \ byval Copyright as string ) ////////////////////////////////////////////////////////////////////// ? Copyright ? Config_Init Config_Load if EventRunning then Event_Mode else Uploader_Pay_Owed ( User.UserID, User.Name ) User_Mode end if end sub sub User_Mode REM ------------------------------------------------------------------ dim Option as string dim Unevaluated as string dim Default as string REM ------------------------------------------------------------------ Unevaluated = "" Default = "F" if User.TimesOn = 1 then Default = "A" end if while Option <> "Q" cls color 11 ? Copyright ? ? "EVALFILE MAIN MENU" ? Color ( 12 ) ? "THIS IS NEW. LET ME KNOW OF THE BUGS! -- David Croft" Color ( 11 ) if Default = "1" then Color ( 12 ) else Color ( 11 ) end if if User_Is_SysOp then ? "1 -- SysOp Menu" end if if Default = "A" then Color ( 12 ) else Color ( 11 ) end if ? "A -- download AllFiles.Txt, a list of all downloadable files" if Default = "C" then Color ( 12 ) else Color ( 11 ) end if ? "C -- leave a Comment to the SysOp" if Default = "D" then Color ( 12 ) else Color ( 11 ) end if ? "D -- Download marked files with cost and rating info first" if Default = "E" then Color ( 12 ) else Color ( 11 ) end if ? "E -- Edit list of files marked for download" if Default = "F" then Color ( 12 ) else Color ( 11 ) end if ? "F -- Find your unevaluated files" if Default = "G" then Color ( 12 ) else Color ( 11 ) end if ? "G -- Goodbye (log off the BBS)" if Default = "L" then Color ( 12 ) else Color ( 11 ) end if ? "L -- List files available for download" if Default = "N" then Color ( 12 ) else Color ( 11 ) end if ? "N -- New files available on the BBS" if Default = "P" then Color ( 12 ) else Color ( 11 ) end if ? "P -- Personal File Statistics" if Default = "Q" then Color ( 12 ) else Color ( 11 ) end if ? "Q -- Quit EvalFile" if Default = "R" then Color ( 12 ) else Color ( 11 ) end if ? "R -- Rate files downloaded on a previous day" if Default = "S" then Color ( 12 ) else Color ( 11 ) end if ? "S -- personalized download Suggestions" if Default = "U" then Color ( 12 ) else Color ( 11 ) end if ? "U -- Uploader Menu" ? Color ( 10 ) ? "Account Balance: $"; ? Trim ( FormatNumber ( User.SubscriptionBalance / 100, "###.##" ) ); if User_Over_File_Ratio then Color ( 12 ) else Color ( 10 ) end if ? " File Ratio: "; ? Trim ( FormatNumber ( User_File_Ratio, "#####.#" ) ); ? " Max File Ratio: "; UserSec.MaxRatio Color ( 11 ) ? "Option [ENTER="; Color ( 12 ) ? Default; Color ( 11 ) ? "]: "; input Option Option = UCase ( Option ) if Option = "" then Option = Default end if select case Option case "1" Menu_SysOp case "A" Download ( "ALLFILES.TXT", 1 ) if User.TimesOn = 1 then Default = "N" elseif GetMarkedFiles > 0 then Default = "D" else Default = "U" end if case "C" Comment case "D" Marked_Files_Ratings Download if GetMarkedFiles > 0 then Default = "S" else Default = "U" end if case "E" Marked_Files_Ratings EditMarkList if GetMarkedFiles > 0 then Default = "D" else Default = "S" end if case "F" Unevaluated = Find_Unevaluated if Unevaluated <> "" then Default = "R" else if User_Over_File_Ratio then Default = "U" else Default = "N" end if end if case "G" Goodbye ( true ) case "L" ListFiles if GetMarkedFiles > 0 then Default = "D" else Default = "U" end if case "N" ListFilesDate if GetMarkedFiles > 0 then Default = "D" else Default = "S" end if case "P" FileStats if User_Over_File_Ratio then Default = "U" elseif GetMarkedFiles > 0 then Default = "D" else Default = "S" end if case "Q" ? Copyright case "R" Evaluate_Files ( Unevaluated ) Default = "F" case "S" Suggest_Files Default = "L" case "U" Menu_Uploader Default = "S" case else Beep end select wend end sub