add moneyserver
parent
38d2a30da1
commit
185da85155
31
README.md
31
README.md
|
@ -1,2 +1,31 @@
|
|||
# MoneyServer
|
||||
# OpenSimCurrencyServer-2020
|
||||
For the new OpeSimulator 0.9.2.0.200+ DEV
|
||||
|
||||
DTL/NSL Money Server by Fumi.Iseki and NSL http://www.nsl.tuis.ac.jp , here is my revision.
|
||||
|
||||
This is working.
|
||||
testing opensim-0.9.2.0Dev-353-g51bc19f
|
||||
|
||||
copy all to opensim
|
||||
|
||||
Linux: (Ubuntu 18.04 test server)
|
||||
|
||||
./runprebuild.sh
|
||||
msbuild /p:Configuration=Release
|
||||
|
||||
Windows: (Windows 10, Visual Studio 2019 Community)
|
||||
|
||||
runprebuild.bat
|
||||
start Visual studio with OpenSim.sln
|
||||
or run compile.bat
|
||||
|
||||
INFO: On Windows and Visual Studio, the Money Server only starts when mysql is running and MoneyServer.ini is set.
|
||||
|
||||
## Todo:
|
||||
If a message comes to the LocalConsole, the prompt is gone.
|
||||
|
||||
No color is displayed in the LocalConsole.
|
||||
|
||||
BuyLand
|
||||
|
||||
buyCurrency
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Data.MySQL.MySQLMoneyDataWrapper
|
||||
{
|
||||
public interface IMoneyManager
|
||||
{
|
||||
int getBalance(string userID);
|
||||
|
||||
//int getBalanceStatus(string userID);
|
||||
|
||||
//bool updateBalanceStatus(string userID,int status);
|
||||
|
||||
bool withdrawMoney(UUID transactionID,string senderID, int amount);
|
||||
|
||||
bool giveMoney(UUID transactionID,string receiverID, int amount);
|
||||
|
||||
bool addTransaction(TransactionData transaction);
|
||||
|
||||
bool updateTransactionStatus(UUID transactionID, int status,string description);
|
||||
|
||||
TransactionData FetchTransaction(UUID transactionID);
|
||||
|
||||
TransactionData[] FetchTransaction(string userID, int startTime, int endTime, uint index,uint retNum);
|
||||
|
||||
int getTransactionNum(string userID, int startTime, int endTime);
|
||||
|
||||
bool addUser(string userID, int balance, int status, int type);
|
||||
|
||||
bool SetTransExpired(int deadTime);
|
||||
|
||||
bool ValidateTransfer(string secureCode, UUID transactionID);
|
||||
|
||||
bool addUserInfo(UserInfo user);
|
||||
|
||||
UserInfo fetchUserInfo(string userID);
|
||||
|
||||
bool updateUserInfo(UserInfo user);
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenSim.Data.MySQL.MySQLMoneyDataWrapper
|
||||
{
|
||||
// This bit of code is from OpenSim.Data.MySQLSuperManager
|
||||
public class MySQLSuperManager
|
||||
{
|
||||
public bool Locked;
|
||||
private readonly Mutex m_lock = new Mutex(false);
|
||||
public MySQLMoneyManager Manager;
|
||||
public string Running;
|
||||
|
||||
public void GetLock()
|
||||
{
|
||||
Locked = true;
|
||||
m_lock.WaitOne();
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
m_lock.ReleaseMutex();
|
||||
Locked = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Data.MySQL.MySQLMoneyDataWrapper")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("OpenSim.Data.MySQL.MySQLMoneyDataWrapper")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("03f4a266-2e30-47e4-b785-ff02cdb4bbb9")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
||||
namespace OpenSim.Data.MySQL.MySQLMoneyDataWrapper
|
||||
{
|
||||
public class TransactionData
|
||||
{
|
||||
UUID m_uuid;
|
||||
string m_sender = string.Empty;
|
||||
string m_receiver = string.Empty;
|
||||
int m_amount;
|
||||
int m_senderBalance;
|
||||
int m_receiverBalance;
|
||||
int m_type;
|
||||
int m_time;
|
||||
int m_status;
|
||||
string m_objectID = UUID.Zero.ToString();
|
||||
// string m_objectID = "00000000-0000-0000-0000-000000000000";
|
||||
string m_objectName = string.Empty;
|
||||
string m_regionHandle = string.Empty;
|
||||
string m_regionUUID = string.Empty;
|
||||
string m_secureCode = string.Empty;
|
||||
string m_commonName = string.Empty;
|
||||
string m_description = string.Empty;
|
||||
|
||||
/*
|
||||
public TransactionData(string uuid, string sender, string receiver,
|
||||
int amount, int time, int status, string description)
|
||||
{
|
||||
this.m_uuid = uuid;
|
||||
this.m_sender = sender;
|
||||
this.m_receiver = receiver;
|
||||
this.m_amount = amount;
|
||||
}
|
||||
*/
|
||||
|
||||
public UUID TransUUID
|
||||
{
|
||||
get { return m_uuid; }
|
||||
set { m_uuid = value; }
|
||||
}
|
||||
|
||||
public string Sender
|
||||
{
|
||||
get { return m_sender; }
|
||||
set { m_sender = value; }
|
||||
}
|
||||
|
||||
public string Receiver
|
||||
{
|
||||
get { return m_receiver; }
|
||||
set { m_receiver = value; }
|
||||
}
|
||||
|
||||
public int Amount
|
||||
{
|
||||
get { return m_amount; }
|
||||
set { m_amount = value; }
|
||||
}
|
||||
|
||||
public int SenderBalance
|
||||
{
|
||||
get { return m_senderBalance; }
|
||||
set { m_senderBalance = value; }
|
||||
}
|
||||
|
||||
public int ReceiverBalance
|
||||
{
|
||||
get { return m_receiverBalance; }
|
||||
set { m_receiverBalance = value; }
|
||||
}
|
||||
|
||||
public int Type
|
||||
{
|
||||
get { return m_type; }
|
||||
set { m_type = value; }
|
||||
}
|
||||
|
||||
public int Time
|
||||
{
|
||||
get { return m_time; }
|
||||
set { m_time = value; }
|
||||
}
|
||||
|
||||
public int Status
|
||||
{
|
||||
get { return m_status; }
|
||||
set { m_status = value; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return m_description; }
|
||||
set { m_description = value; }
|
||||
}
|
||||
|
||||
public string ObjectUUID
|
||||
{
|
||||
get { return m_objectID; }
|
||||
set { m_objectID = value; }
|
||||
}
|
||||
|
||||
public string ObjectName
|
||||
{
|
||||
get { return m_objectName; }
|
||||
set { m_objectName = value; }
|
||||
}
|
||||
|
||||
public string RegionHandle
|
||||
{
|
||||
get { return m_regionHandle; }
|
||||
set { m_regionHandle = value; }
|
||||
}
|
||||
|
||||
public string RegionUUID
|
||||
{
|
||||
get { return m_regionUUID; }
|
||||
set { m_regionUUID = value; }
|
||||
}
|
||||
|
||||
public string SecureCode
|
||||
{
|
||||
get { return m_secureCode; }
|
||||
set { m_secureCode = value; }
|
||||
}
|
||||
|
||||
public string CommonName
|
||||
{
|
||||
get { return m_commonName; }
|
||||
set { m_commonName = value; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum Status
|
||||
{
|
||||
SUCCESS_STATUS = 0,
|
||||
PENDING_STATUS = 1,
|
||||
FAILED_STATUS = 2,
|
||||
ERROR_STATUS = 9
|
||||
}
|
||||
|
||||
|
||||
public enum AvatarType
|
||||
{
|
||||
LOCAL_AVATAR = 0,
|
||||
HG_AVATAR = 1,
|
||||
NPC_AVATAR = 2,
|
||||
GUEST_AVATAR = 3,
|
||||
FOREIGN_AVATAR = 8,
|
||||
UNKNOWN_AVATAR = 9
|
||||
}
|
||||
|
||||
|
||||
public class UserInfo
|
||||
{
|
||||
string m_userID = string.Empty;
|
||||
string m_simIP = string.Empty;
|
||||
string m_avatarName = string.Empty;
|
||||
string m_passwordHash = string.Empty;
|
||||
int m_avatarType = (int)AvatarType.LOCAL_AVATAR;
|
||||
int m_avatarClass = (int)AvatarType.LOCAL_AVATAR;
|
||||
string m_serverURL = string.Empty;
|
||||
|
||||
public string UserID
|
||||
{
|
||||
get { return m_userID; }
|
||||
set { m_userID = value; }
|
||||
}
|
||||
|
||||
public string SimIP
|
||||
{
|
||||
get { return m_simIP; }
|
||||
set { m_simIP = value; }
|
||||
}
|
||||
|
||||
public string Avatar
|
||||
{
|
||||
get { return m_avatarName; }
|
||||
set { m_avatarName = value; }
|
||||
}
|
||||
|
||||
public string PswHash
|
||||
{
|
||||
get { return m_passwordHash; }
|
||||
set { m_passwordHash = value; }
|
||||
}
|
||||
|
||||
public int Type
|
||||
{
|
||||
get { return m_avatarType; }
|
||||
set { m_avatarType = value; }
|
||||
}
|
||||
|
||||
public int Class
|
||||
{
|
||||
get { return m_avatarClass; }
|
||||
set { m_avatarClass = value; }
|
||||
}
|
||||
|
||||
public string ServerURL
|
||||
{
|
||||
get { return m_serverURL; }
|
||||
set { m_serverURL = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" ?>
|
||||
<Project frameworkVersion="v4_6" name="OpenSim.Data.MySQL.MySQLMoneyDataWrapper" path="addon-modules/OpenSim-Data-MySQL-MySQLMoneyDataWrapper" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../bin/</ReferencePath>
|
||||
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Runtime.Remoting"/>
|
||||
<Reference name="Nini" path="../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../bin/"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="XMLRPC" path="../../bin/"/>
|
||||
<Reference name="MySql.Data" path="../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/, http://www.nsl.tuis.ac.jp/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data.MySQL.MySQLMoneyDataWrapper;
|
||||
|
||||
|
||||
namespace OpenSim.Grid.MoneyServer
|
||||
{
|
||||
public interface IMoneyDBService
|
||||
{
|
||||
int getBalance(string userID);
|
||||
|
||||
bool withdrawMoney(UUID transactionID, string senderID, int amount);
|
||||
|
||||
bool giveMoney(UUID transactionID, string receiverID, int amount);
|
||||
|
||||
bool addTransaction(TransactionData transaction);
|
||||
|
||||
bool addUser(string userID, int balance, int status, int type);
|
||||
|
||||
bool updateTransactionStatus(UUID transactionID, int status, string description);
|
||||
|
||||
bool SetTransExpired(int deadTime);
|
||||
|
||||
bool ValidateTransfer(string secureCode, UUID transactionID);
|
||||
|
||||
TransactionData FetchTransaction(UUID transactionID);
|
||||
|
||||
TransactionData FetchTransaction(string userID, int startTime, int endTime, int lastIndex);
|
||||
|
||||
int getTransactionNum(string userID, int startTime, int endTime);
|
||||
|
||||
bool DoTransfer(UUID transactionUUID);
|
||||
|
||||
bool DoAddMoney(UUID transactionUUID); // Added by Fumi.Iseki
|
||||
|
||||
bool TryAddUserInfo(UserInfo user);
|
||||
|
||||
UserInfo FetchUserInfo(string userID);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
using Nini.Config;
|
||||
|
||||
|
||||
namespace OpenSim.Grid.MoneyServer
|
||||
{
|
||||
public interface IMoneyServiceCore
|
||||
{
|
||||
BaseHttpServer GetHttpServer();
|
||||
Dictionary<string, string> GetSessionDic();
|
||||
Dictionary<string, string> GetSecureSessionDic();
|
||||
Dictionary<string, string> GetWebSessionDic();
|
||||
|
||||
//
|
||||
IConfig GetServerConfig();
|
||||
IConfig GetCertConfig();
|
||||
bool IsCheckClientCert();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,598 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/, http://www.nsl.tuis.ac.jp/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Data.MySQL.MySQLMoneyDataWrapper;
|
||||
using OpenSim.Modules.Currency;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
||||
namespace OpenSim.Grid.MoneyServer
|
||||
{
|
||||
class MoneyDBService: IMoneyDBService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private string m_connect;
|
||||
//private MySQLMoneyManager m_moneyManager;
|
||||
private long TicksToEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
|
||||
|
||||
// DB manager pool
|
||||
protected Dictionary<int, MySQLSuperManager> m_dbconnections = new Dictionary<int, MySQLSuperManager>(); // Lock付
|
||||
private int m_maxConnections;
|
||||
|
||||
public int m_lastConnect = 0;
|
||||
|
||||
|
||||
public MoneyDBService(string connect)
|
||||
{
|
||||
m_connect = connect;
|
||||
Initialise(m_connect,10);
|
||||
}
|
||||
|
||||
|
||||
public MoneyDBService()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void Initialise(string connectionString, int maxDBConnections)
|
||||
{
|
||||
m_connect = connectionString;
|
||||
m_maxConnections = maxDBConnections;
|
||||
if (connectionString != string.Empty) {
|
||||
//m_moneyManager = new MySQLMoneyManager(connectionString);
|
||||
|
||||
//m_log.Info("Creating " + m_maxConnections + " DB connections...");
|
||||
for (int i=0; i<m_maxConnections; i++) {
|
||||
//m_log.Info("Connecting to DB... [" + i + "]");
|
||||
MySQLSuperManager msm = new MySQLSuperManager();
|
||||
msm.Manager = new MySQLMoneyManager(connectionString);
|
||||
m_dbconnections.Add(i, msm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_log.Error("[MONEY DB]: Connection string is null, initialise database failed");
|
||||
throw new Exception("Failed to initialise MySql database");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Reconnect()
|
||||
{
|
||||
for (int i=0; i<m_maxConnections; i++) {
|
||||
MySQLSuperManager msm = m_dbconnections[i];
|
||||
msm.Manager.Reconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private MySQLSuperManager GetLockedConnection()
|
||||
{
|
||||
int lockedCons = 0;
|
||||
while (true) {
|
||||
m_lastConnect++;
|
||||
|
||||
// Overflow protection
|
||||
if (m_lastConnect==int.MaxValue) m_lastConnect = 0;
|
||||
|
||||
MySQLSuperManager msm = m_dbconnections[m_lastConnect%m_maxConnections];
|
||||
if (!msm.Locked) {
|
||||
msm.GetLock();
|
||||
return msm;
|
||||
}
|
||||
|
||||
lockedCons++;
|
||||
if (lockedCons>m_maxConnections) {
|
||||
lockedCons = 0;
|
||||
System.Threading.Thread.Sleep(1000); // Wait some time before searching them again.
|
||||
m_log.Debug("WARNING: All threads are in use. Probable cause: Something didnt release a mutex properly, or high volume of requests inbound.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getBalance(string userID)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.getBalance(userID);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.getBalance(userID);
|
||||
}
|
||||
catch(Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return 0;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool withdrawMoney(UUID transactionID, string senderID, int amount)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.withdrawMoney(transactionID, senderID, amount);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.withdrawMoney(transactionID, senderID, amount);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool giveMoney(UUID transactionID, string receiverID, int amount)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.giveMoney(transactionID, receiverID, amount);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.giveMoney(transactionID, receiverID, amount);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool setTotalSale(TransactionData transaction)
|
||||
{
|
||||
if (transaction.Receiver==transaction.Sender) return false;
|
||||
if (transaction.Sender==UUID.Zero.ToString()) return false;
|
||||
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
int time = (int)((DateTime.UtcNow.Ticks - TicksToEpoch) / 10000000);
|
||||
try {
|
||||
return dbm.Manager.setTotalSale(transaction.Receiver, transaction.ObjectUUID, transaction.Type, 1, transaction.Amount, time);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.setTotalSale(transaction.Receiver, transaction.ObjectUUID, transaction.Type, 1, transaction.Amount, time);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool addTransaction(TransactionData transaction)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.addTransaction(transaction);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.addTransaction(transaction);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool addUser(string userID, int balance, int status, int type)
|
||||
{
|
||||
TransactionData transaction = new TransactionData();
|
||||
transaction.TransUUID = UUID.Random();
|
||||
transaction.Sender = UUID.Zero.ToString();
|
||||
transaction.Receiver = userID;
|
||||
transaction.Amount = balance;
|
||||
transaction.ObjectUUID = UUID.Zero.ToString();
|
||||
transaction.ObjectName = string.Empty;
|
||||
transaction.RegionHandle = string.Empty;
|
||||
transaction.Type = (int)TransactionType.BirthGift;
|
||||
transaction.Time = (int)((DateTime.UtcNow.Ticks - TicksToEpoch) / 10000000);;
|
||||
transaction.Status = (int)Status.PENDING_STATUS;
|
||||
transaction.SecureCode = UUID.Random().ToString();
|
||||
transaction.CommonName = string.Empty;
|
||||
transaction.Description = "addUser " + DateTime.UtcNow.ToString();
|
||||
|
||||
bool ret = addTransaction(transaction);
|
||||
if (!ret) return false;
|
||||
|
||||
//
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
ret = dbm.Manager.addUser(userID, 0, status, type); // make Balance Table
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
ret = dbm.Manager.addUser(userID, 0, status, type); // make Balance Table
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
|
||||
//
|
||||
if (ret) ret = giveMoney(transaction.TransUUID, userID, balance);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public bool updateTransactionStatus(UUID transactionID, int status, string description)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.updateTransactionStatus(transactionID, status, description);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.updateTransactionStatus(transactionID, status, description);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool SetTransExpired(int deadTime)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.SetTransExpired(deadTime);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.SetTransExpired(deadTime);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool ValidateTransfer(string secureCode, UUID transactionID)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.ValidateTransfer(secureCode, transactionID);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.ValidateTransfer(secureCode, transactionID);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TransactionData FetchTransaction(UUID transactionID)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.FetchTransaction(transactionID);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.FetchTransaction(transactionID);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TransactionData FetchTransaction(string userID, int startTime, int endTime, int lastIndex)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
TransactionData[] arrTransaction;
|
||||
|
||||
uint index = 0;
|
||||
if (lastIndex>=0) index = Convert.ToUInt32(lastIndex) + 1;
|
||||
|
||||
try {
|
||||
arrTransaction = dbm.Manager.FetchTransaction(userID, startTime, endTime, index, 1);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
arrTransaction = dbm.Manager.FetchTransaction(userID, startTime, endTime, index, 1);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
|
||||
//
|
||||
if (arrTransaction.Length > 0) {
|
||||
return arrTransaction[0];
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool DoTransfer(UUID transactionUUID)
|
||||
{
|
||||
bool do_trans = false;
|
||||
|
||||
TransactionData transaction = new TransactionData();
|
||||
transaction = FetchTransaction(transactionUUID);
|
||||
|
||||
if (transaction != null && transaction.Status == (int)Status.PENDING_STATUS) {
|
||||
int balance = getBalance(transaction.Sender);
|
||||
|
||||
//check the amount
|
||||
if (transaction.Amount >= 0 && balance >= transaction.Amount) {
|
||||
if (withdrawMoney(transactionUUID, transaction.Sender, transaction.Amount)) {
|
||||
//If receiver not found, add it to DB.
|
||||
if (getBalance(transaction.Receiver) == -1) {
|
||||
m_log.ErrorFormat("[MONEY DB]: DoTransfer: Receiver not found in balances DB. {0}", transaction.Receiver);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (giveMoney(transactionUUID, transaction.Receiver, transaction.Amount)) {
|
||||
do_trans = true;
|
||||
}
|
||||
else { // give money to receiver failed. 返金処理
|
||||
m_log.ErrorFormat("[MONEY DB]: Give money to receiver {0} failed", transaction.Receiver);
|
||||
//Return money to sender
|
||||
if (giveMoney(transactionUUID, transaction.Sender, transaction.Amount)) {
|
||||
m_log.ErrorFormat("[MONEY DB]: give money to receiver {0} failed but return it to sender {1} successfully",
|
||||
transaction.Receiver, transaction.Sender);
|
||||
updateTransactionStatus(transactionUUID, (int)Status.FAILED_STATUS, "give money to receiver failed but return it to sender successfully");
|
||||
}
|
||||
else {
|
||||
m_log.ErrorFormat("[MONEY DB]: FATAL ERROR: Money withdrawn from sender: {0}, but failed to be given to receiver {1}",
|
||||
transaction.Sender, transaction.Receiver);
|
||||
updateTransactionStatus(transactionUUID, (int)Status.ERROR_STATUS, "give money to receiver failed, and return it to sender unsuccessfully!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // withdraw money failed
|
||||
m_log.ErrorFormat("[MONEY DB]: Withdraw money from sender {0} failed", transaction.Sender);
|
||||
}
|
||||
}
|
||||
else { // not enough balance to finish the transaction
|
||||
m_log.ErrorFormat("[MONEY DB]: Not enough balance for user: {0} to apply the transaction.", transaction.Sender);
|
||||
}
|
||||
}
|
||||
else { // Can not fetch the transaction or it has expired
|
||||
m_log.ErrorFormat("[MONEY DB]: The transaction:{0} has expired", transactionUUID.ToString());
|
||||
}
|
||||
|
||||
//
|
||||
if (do_trans) {
|
||||
setTotalSale(transaction);
|
||||
}
|
||||
|
||||
return do_trans;
|
||||
}
|
||||
|
||||
|
||||
// by Fumi.Iseki
|
||||
public bool DoAddMoney(UUID transactionUUID)
|
||||
{
|
||||
TransactionData transaction = new TransactionData();
|
||||
transaction = FetchTransaction(transactionUUID);
|
||||
|
||||
if (transaction!=null && transaction.Status==(int)Status.PENDING_STATUS) {
|
||||
//If receiver not found, add it to DB.
|
||||
if (getBalance(transaction.Receiver)==-1) {
|
||||
m_log.ErrorFormat("[MONEY DB]: DoAddMoney: Receiver not found in balances DB. {0}", transaction.Receiver);
|
||||
return false;
|
||||
}
|
||||
//
|
||||
if (giveMoney(transactionUUID, transaction.Receiver, transaction.Amount)) {
|
||||
setTotalSale(transaction);
|
||||
return true;
|
||||
}
|
||||
else { // give money to receiver failed.
|
||||
m_log.ErrorFormat("[MONEY DB]: Add money to receiver {0} failed", transaction.Receiver);
|
||||
updateTransactionStatus(transactionUUID, (int)Status.FAILED_STATUS, "add money to receiver failed");
|
||||
}
|
||||
}
|
||||
else { // Can not fetch the transaction or it has expired
|
||||
m_log.ErrorFormat("[MONEY DB]: The transaction:{0} has expired", transactionUUID.ToString());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// userinfo
|
||||
//
|
||||
|
||||
public bool TryAddUserInfo(UserInfo user)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
UserInfo userInfo = null;
|
||||
|
||||
try {
|
||||
userInfo = dbm.Manager.fetchUserInfo(user.UserID);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
userInfo = dbm.Manager.fetchUserInfo(user.UserID);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
dbm.Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (userInfo!=null) {
|
||||
//m_log.InfoFormat("[MONEY DB]: Found user \"{0}\", now update information", user.Avatar);
|
||||
if (dbm.Manager.updateUserInfo(user)) return true;
|
||||
}
|
||||
else if (dbm.Manager.addUserInfo(user)) {
|
||||
//m_log.InfoFormat("[MONEY DB]: Unable to find user \"{0}\", add it to DB successfully", user.Avatar);
|
||||
return true;
|
||||
}
|
||||
m_log.InfoFormat("[MONEY DB]: WARNNING: TryAddUserInfo: Unable to TryAddUserInfo.");
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public UserInfo FetchUserInfo(string userID)
|
||||
{
|
||||
UserInfo userInfo = null;
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
userInfo = dbm.Manager.fetchUserInfo(userID);
|
||||
return userInfo;
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
userInfo = dbm.Manager.fetchUserInfo(userID);
|
||||
return userInfo;
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getTransactionNum(string userID, int startTime, int endTime)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try {
|
||||
return dbm.Manager.getTransactionNum(userID,startTime,endTime);
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
catch (MySql.Data.MySqlClient.MySqlException e) {
|
||||
#pragma warning restore CS0168 // Variable ist deklariert, wird jedoch niemals verwendet
|
||||
dbm.Manager.Reconnect();
|
||||
return dbm.Manager.getTransactionNum(userID,startTime,endTime);
|
||||
}
|
||||
catch (Exception e) {
|
||||
m_log.Error(e.ToString());
|
||||
return -1;
|
||||
}
|
||||
finally {
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,384 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/, http://www.nsl.tuis.ac.jp/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma warning disable S1128 // Unused "using" should be removed
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Data;
|
||||
using NSL.Certificate.Tools;
|
||||
|
||||
using System.Threading;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using log4net.Appender;
|
||||
using log4net.Core;
|
||||
using log4net.Repository;
|
||||
using OpenMetaverse;
|
||||
using Timer = System.Timers.Timer;
|
||||
#pragma warning restore S1128 // Unused "using" should be removed
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OpenSim Grid MoneyServer
|
||||
/// </summary>
|
||||
namespace OpenSim.Grid.MoneyServer
|
||||
{
|
||||
/// <summary>
|
||||
/// class MoneyServerBase : BaseOpenSimServer, IMoneyServiceCore
|
||||
/// Manni internal class
|
||||
/// </summary>
|
||||
internal class MoneyServerBase : BaseOpenSimServer, IMoneyServiceCore
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string connectionString = string.Empty;
|
||||
private uint m_moneyServerPort = 8008; // 8008 is default server port
|
||||
|
||||
private string m_certFilename = "";
|
||||
private string m_certPassword = "";
|
||||
private string m_cacertFilename = "";
|
||||
private string m_clcrlFilename = "";
|
||||
private bool m_checkClientCert = false;
|
||||
|
||||
private int DEAD_TIME = 120;
|
||||
private int MAX_DB_CONNECTION = 10;
|
||||
|
||||
#pragma warning disable S1450 // Private fields only used as local variables in methods should become local variables
|
||||
private MoneyXmlRpcModule m_moneyXmlRpcModule;
|
||||
#pragma warning restore S1450 // Private fields only used as local variables in methods should become local variables
|
||||
private MoneyDBService m_moneyDBService;
|
||||
|
||||
#pragma warning disable S2933 // Fields that are only assigned in the constructor should be "readonly"
|
||||
private Dictionary<string, string> m_sessionDic = new Dictionary<string, string>();
|
||||
private Dictionary<string, string> m_secureSessionDic = new Dictionary<string, string>();
|
||||
private Dictionary<string, string> m_webSessionDic = new Dictionary<string, string>();
|
||||
#pragma warning restore S2933 // Fields that are only assigned in the constructor should be "readonly"
|
||||
|
||||
IConfig m_server_config;
|
||||
IConfig m_cert_config;
|
||||
|
||||
/// <summary>
|
||||
/// Money Server Base
|
||||
/// </summary>
|
||||
public MoneyServerBase()
|
||||
{
|
||||
m_console = new LocalConsole("MoneyServer ");
|
||||
MainConsole.Instance = m_console;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Work
|
||||
/// </summary>
|
||||
public void Work()
|
||||
{
|
||||
//The timer checks the transactions table every 60 seconds
|
||||
Timer checkTimer = new Timer
|
||||
{
|
||||
Interval = 60 * 1000,
|
||||
Enabled = true
|
||||
};
|
||||
checkTimer.Elapsed += new ElapsedEventHandler(CheckTransaction);
|
||||
checkTimer.Start();
|
||||
|
||||
while (true) {
|
||||
m_console.Prompt();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check the transactions table, set expired transaction state to failed
|
||||
/// </summary>
|
||||
private void CheckTransaction(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
long ticksToEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
|
||||
int unixEpochTime =(int) ((DateTime.UtcNow.Ticks - ticksToEpoch )/10000000);
|
||||
int deadTime = unixEpochTime - DEAD_TIME;
|
||||
m_moneyDBService.SetTransExpired(deadTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Startup Specific
|
||||
/// </summary>
|
||||
protected override void StartupSpecific()
|
||||
{
|
||||
m_log.Info("[MONEY SERVER]: Setup HTTP Server process");
|
||||
|
||||
ReadIniConfig();
|
||||
|
||||
try {
|
||||
if (m_certFilename != "")
|
||||
{
|
||||
m_httpServer = new BaseHttpServer(m_moneyServerPort, true, m_certFilename, m_certPassword);
|
||||
if (m_checkClientCert) {
|
||||
Type typeBaseHttpServer = typeof(BaseHttpServer);
|
||||
PropertyInfo pinfo = typeBaseHttpServer.GetProperty("CertificateValidationCallback");
|
||||
|
||||
if (pinfo!=null) {
|
||||
m_log.Info ("[MONEY SERVER]: Set RemoteCertificateValidationCallback");
|
||||
}
|
||||
else {
|
||||
m_log.Error("[MONEY SERVER]: StartupSpecific: CheckClientCert is true. But this MoneyServer does not support CheckClientCert!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_httpServer = new BaseHttpServer(m_moneyServerPort);
|
||||
}
|
||||
|
||||
SetupMoneyServices();
|
||||
m_httpServer.Start();
|
||||
base.StartupSpecific();
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY SERVER]: StartupSpecific: Fail to start HTTPS process");
|
||||
m_log.ErrorFormat("[MONEY SERVER]: StartupSpecific: Please Check Certificate File or Password. Exit");
|
||||
m_log.ErrorFormat("[MONEY SERVER]: StartupSpecific: {0}", e);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read Ini Config
|
||||
/// </summary>
|
||||
protected void ReadIniConfig()
|
||||
{
|
||||
MoneyServerConfigSource moneyConfig = new MoneyServerConfigSource();
|
||||
Config = moneyConfig.m_config;
|
||||
|
||||
try {
|
||||
// [Startup]
|
||||
IConfig st_config = moneyConfig.m_config.Configs["Startup"];
|
||||
string PIDFile = st_config.GetString("PIDFile", "");
|
||||
if (PIDFile != "") Create_PIDFile(PIDFile);
|
||||
|
||||
// [MySql]
|
||||
IConfig db_config = moneyConfig.m_config.Configs["MySql"];
|
||||
string sqlserver = db_config.GetString("hostname", "localhost");
|
||||
string database = db_config.GetString("database", "OpenSim");
|
||||
string username = db_config.GetString("username", "root");
|
||||
string password = db_config.GetString("password", "password");
|
||||
string pooling = db_config.GetString("pooling", "false");
|
||||
string port = db_config.GetString("port", "3306");
|
||||
MAX_DB_CONNECTION = db_config.GetInt ("MaxConnection", MAX_DB_CONNECTION);
|
||||
|
||||
connectionString = "Server=" + sqlserver + ";Port=" + port + ";Database=" + database + ";User ID=" +
|
||||
username + ";Password=" + password + ";Pooling=" + pooling + ";";
|
||||
|
||||
// [MoneyServer]
|
||||
m_server_config = moneyConfig.m_config.Configs["MoneyServer"];
|
||||
DEAD_TIME = m_server_config.GetInt("ExpiredTime", DEAD_TIME);
|
||||
m_moneyServerPort = (uint)m_server_config.GetInt("ServerPort", (int)m_moneyServerPort);
|
||||
|
||||
//
|
||||
// [Certificate]
|
||||
m_cert_config = moneyConfig.m_config.Configs["Certificate"];
|
||||
if (m_cert_config==null) {
|
||||
m_log.Info("[MONEY SERVER]: [Certificate] section is not found. Using [MoneyServer] section instead");
|
||||
m_cert_config = m_server_config;
|
||||
}
|
||||
|
||||
// HTTPS Server Cert (Server Mode)
|
||||
m_certFilename = m_cert_config.GetString("ServerCertFilename", m_certFilename);
|
||||
m_certPassword = m_cert_config.GetString("ServerCertPassword", m_certPassword);
|
||||
if (m_certFilename != "")
|
||||
{
|
||||
m_log.Info("[MONEY SERVER]: ReadIniConfig: Execute HTTPS comunication. Cert file is " + m_certFilename);
|
||||
}
|
||||
|
||||
m_checkClientCert = m_cert_config.GetBoolean("CheckClientCert", m_checkClientCert);
|
||||
m_cacertFilename = m_cert_config.GetString("CACertFilename", m_cacertFilename);
|
||||
m_clcrlFilename = m_cert_config.GetString("ClientCrlFilename", m_clcrlFilename);
|
||||
//
|
||||
if (m_checkClientCert && m_cacertFilename != "")
|
||||
{
|
||||
m_log.Info("[MONEY SERVER]: ReadIniConfig: Execute Authentication of Clients. CA file is " + m_cacertFilename);
|
||||
}
|
||||
else {
|
||||
m_checkClientCert = false;
|
||||
}
|
||||
|
||||
if (m_checkClientCert)
|
||||
{
|
||||
if (m_clcrlFilename != "")
|
||||
{
|
||||
m_log.Info("[MONEY SERVER]: ReadIniConfig: Execute Authentication of Clients. CRL file is " + m_clcrlFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Error("[MONEY SERVER]: ReadIniConfig: Fail to setup configure. Please check MoneyServer.ini. Exit");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create PID File added by skidz
|
||||
/// </summary>
|
||||
protected void Create_PIDFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
|
||||
FileStream fs = File.Create(path);
|
||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
Byte[] buf = enc.GetBytes(pidstring);
|
||||
fs.Write(buf, 0, buf.Length);
|
||||
fs.Close();
|
||||
m_pidFile = path;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup Money Services
|
||||
/// </summary>
|
||||
protected virtual void SetupMoneyServices()
|
||||
{
|
||||
|
||||
m_log.Info("[MONEY SERVER]: Connecting to Money Storage Server");
|
||||
|
||||
m_moneyDBService = new MoneyDBService();
|
||||
m_moneyDBService.Initialise(connectionString, MAX_DB_CONNECTION);
|
||||
|
||||
|
||||
m_moneyXmlRpcModule = new MoneyXmlRpcModule();
|
||||
m_moneyXmlRpcModule.Initialise(m_version, m_moneyDBService, this);
|
||||
m_moneyXmlRpcModule.PostInitialise();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Is Check Client Cert
|
||||
/// </summary>
|
||||
public bool IsCheckClientCert()
|
||||
{
|
||||
return m_checkClientCert;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Server Config
|
||||
/// </summary>
|
||||
public IConfig GetServerConfig()
|
||||
{
|
||||
return m_server_config;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Cert Config
|
||||
/// </summary>
|
||||
public IConfig GetCertConfig()
|
||||
{
|
||||
return m_cert_config;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Http Server
|
||||
/// </summary>
|
||||
public BaseHttpServer GetHttpServer()
|
||||
{
|
||||
return m_httpServer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Session Dic
|
||||
/// </summary>
|
||||
public Dictionary<string, string> GetSessionDic()
|
||||
{
|
||||
return m_sessionDic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Secure Session Dic
|
||||
/// </summary>
|
||||
public Dictionary<string, string> GetSecureSessionDic()
|
||||
{
|
||||
return m_secureSessionDic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Web Session Dic
|
||||
/// </summary>
|
||||
public Dictionary<string, string> GetWebSessionDic()
|
||||
{
|
||||
return m_webSessionDic;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// class Money Server Config Source
|
||||
/// </summary>
|
||||
class MoneyServerConfigSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Ini Config Source
|
||||
/// </summary>
|
||||
public IniConfigSource m_config;
|
||||
|
||||
/// <summary>
|
||||
/// Money Server Config Source
|
||||
/// </summary>
|
||||
public MoneyServerConfigSource()
|
||||
{
|
||||
string configPath = Path.Combine(Directory.GetCurrentDirectory(), "MoneyServer.ini");
|
||||
if (File.Exists(configPath))
|
||||
{
|
||||
m_config = new IniConfigSource(configPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save config
|
||||
/// </summary>
|
||||
public void Save(string path)
|
||||
{
|
||||
m_config.Save(path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using log4net.Config;
|
||||
|
||||
namespace OpenSim.Grid.MoneyServer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
MoneyServerBase app = new MoneyServerBase();
|
||||
app.Startup();
|
||||
app.Work();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Grid.MoneyServer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("OpenSim.Grid.MoneyServer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f554c84a-d8c7-41ea-833d-2483cde29e0f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" ?>
|
||||
<Project frameworkVersion="v4_6" name="MoneyServer" path="addon-modules/OpenSim-Grid-MoneyServer" type="Exe">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../bin/</ReferencePath>
|
||||
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Data"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Runtime.Remoting"/>
|
||||
<Reference name="Mono.Security.dll" path="../../bin/lib/NET/"/>
|
||||
<Reference name="Nini" path="../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../bin/"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
<Reference name="XMLRPC" path="../../bin/"/>
|
||||
<Reference name="MySql.Data" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Data.MySQL.MySQLMoneyDataWrapper"/>
|
||||
<Reference name="OpenSim.Modules.Currency"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://www.nsl.tuis.ac.jp
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma warning disable S1128 // Unused "using" should be removed
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using log4net;
|
||||
#pragma warning restore S1128 // Unused "using" should be removed
|
||||
|
||||
|
||||
namespace NSL.Certificate.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// class NSL Certificate Verify
|
||||
/// </summary>
|
||||
public class NSLCertificateVerify
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private X509Chain m_chain = null;
|
||||
private X509Certificate2 m_cacert = null;
|
||||
|
||||
private Mono.Security.X509.X509Crl m_clientcrl = null;
|
||||
|
||||
/// <summary>
|
||||
/// NSL Certificate Verify
|
||||
/// </summary>
|
||||
public NSLCertificateVerify()
|
||||
{
|
||||
m_chain = null;
|
||||
m_cacert = null;
|
||||
m_clientcrl = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NSL Certificate Verify
|
||||
/// </summary>
|
||||
/// <param name="certfile"></param>
|
||||
public NSLCertificateVerify(string certfile)
|
||||
{
|
||||
SetPrivateCA(certfile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NSL Certificate Verify
|
||||
/// </summary>
|
||||
/// <param name="certfile"></param>
|
||||
/// <param name="crlfile"></param>
|
||||
public NSLCertificateVerify(string certfile, string crlfile)
|
||||
{
|
||||
SetPrivateCA (certfile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Private CA
|
||||
/// </summary>
|
||||
/// <param name="certfile"></param>
|
||||
public void SetPrivateCA(string certfile)
|
||||
{
|
||||
try {
|
||||
m_cacert = new X509Certificate2(certfile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_cacert = null;
|
||||
m_log.ErrorFormat("[SET PRIVATE CA]: CA File reading error [{0}]. {1}", certfile, ex);
|
||||
}
|
||||
|
||||
if (m_cacert!=null) {
|
||||
m_chain = new X509Chain();
|
||||
m_chain.ChainPolicy.ExtraStore.Add(m_cacert);
|
||||
m_chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
|
||||
m_chain.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check Private Chain
|
||||
/// </summary>
|
||||
/// <param name="cert"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckPrivateChain(X509Certificate2 cert)
|
||||
{
|
||||
if (m_chain==null || m_cacert==null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = m_chain.Build((X509Certificate2)cert);
|
||||
if (ret) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i=0; i<m_chain.ChainStatus.Length; i++)
|
||||
{
|
||||
if (m_chain.ChainStatus[i].Status==X509ChainStatusFlags.UntrustedRoot) return true;
|
||||
}
|
||||
//
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate Server Certificate
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="certificate"></param>
|
||||
/// <param name="chain"></param>
|
||||
/// <param name="sslPolicyErrors"></param>
|
||||
/// <returns></returns>
|
||||
public bool ValidateServerCertificate(object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
if (obj is HttpWebRequest)
|
||||
{
|
||||
HttpWebRequest Request = (HttpWebRequest)obj;
|
||||
string noVerify = Request.Headers.Get("NoVerifyCert");
|
||||
if (noVerify!=null && noVerify.ToLower()=="true")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
X509Certificate2 certificate2 = new X509Certificate2(certificate);
|
||||
string simplename = certificate2.GetNameInfo(X509NameType.SimpleName, false);
|
||||
|
||||
// None, ChainErrors Error except for.
|
||||
if (sslPolicyErrors!=SslPolicyErrors.None && sslPolicyErrors!=SslPolicyErrors.RemoteCertificateChainErrors) {
|
||||
m_log.InfoFormat("[NSL SERVER CERT VERIFY]: ValidateServerCertificate: Policy Error! {0}", sslPolicyErrors);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool valid = CheckPrivateChain(certificate2);
|
||||
if (valid) {
|
||||
m_log.InfoFormat("[NSL SERVER CERT VERIFY]: Valid Server Certification for \"{0}\"", simplename);
|
||||
}
|
||||
else {
|
||||
m_log.InfoFormat("[NSL SERVER CERT VERIFY]: Failed to Verify Server Certification for \"{0}\"", simplename);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Validate Client Certificate
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="certificate"></param>
|
||||
/// <param name="chain"></param>
|
||||
/// <param name="sslPolicyErrors"></param>
|
||||
/// <returns></returns>
|
||||
public bool ValidateClientCertificate(object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
X509Certificate2 certificate2 = new X509Certificate2(certificate);
|
||||
string simplename = certificate2.GetNameInfo(X509NameType.SimpleName, false);
|
||||
|
||||
// None, ChainErrors 以外は全てエラーとする.
|
||||
if (sslPolicyErrors!=SslPolicyErrors.None && sslPolicyErrors!=SslPolicyErrors.RemoteCertificateChainErrors) {
|
||||
m_log.InfoFormat("[NSL CLIENT CERT VERIFY]: ValidateClientCertificate: Policy Error! {0}", sslPolicyErrors);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check CRL
|
||||
if (m_clientcrl!=null) {
|
||||
Mono.Security.X509.X509Certificate monocert = new Mono.Security.X509.X509Certificate(certificate.GetRawCertData());
|
||||
Mono.Security.X509.X509Crl.X509CrlEntry entry = m_clientcrl.GetCrlEntry(monocert);
|
||||
if (entry!=null) {
|
||||
m_log.InfoFormat("[NSL CLIENT CERT VERIFY]: Common Name \"{0}\" was revoked at {1}", simplename, entry.RevocationDate.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool valid = CheckPrivateChain(certificate2);
|
||||
if (valid) {
|
||||
m_log.InfoFormat("[NSL CLIENT CERT VERIFY]: Valid Client Certification for \"{0}\"", simplename);
|
||||
}
|
||||
else {
|
||||
m_log.InfoFormat("[NSL CLIENT CERT VERIFY]: Failed to Verify Client Certification for \"{0}\"", simplename);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// class NSL Certificate Policy
|
||||
/// </summary>
|
||||
public class NSLCertificatePolicy : ICertificatePolicy
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Check Validation Result
|
||||
/// </summary>
|
||||
/// <param name="srvPoint"></param>
|
||||
/// <param name="certificate"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="certificateProblem"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
|
||||
{
|
||||
if (certificateProblem == 0 || //normal
|
||||
certificateProblem == -2146762487 || //Not trusted?
|
||||
certificateProblem == -2146762495 || //Expired
|
||||
certificateProblem == -2146762481) { //Incorrect name?
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://www.nsl.tuis.ac.jp
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
|
||||
|
||||
namespace NSL.Network.XmlRpc
|
||||
{
|
||||
public class NSLXmlRpcRequest : XmlRpcRequest
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Encoding _encoding = new UTF8Encoding();
|
||||
private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
|
||||
private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
|
||||
|
||||
|
||||
public NSLXmlRpcRequest()
|
||||
{
|
||||
_params = new ArrayList();
|
||||
}
|
||||
|
||||
|
||||
public NSLXmlRpcRequest(String methodName, IList parameters)
|
||||
{
|
||||
MethodName = methodName;
|
||||
_params = parameters;
|
||||
}
|
||||
|
||||
|
||||
public XmlRpcResponse certSend(String url, X509Certificate2 myClientCert, bool checkServerCert, Int32 timeout)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY NSL RPC]: XmlRpcResponse certSend: connect to {0}", url);
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
if (request==null)
|
||||
{
|
||||
throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR, XmlRpcErrorCodes.TRANSPORT_ERROR_MSG +": Could not create request with " + url);
|
||||
}
|
||||
|
||||
request.Method = "POST";
|
||||
request.ContentType = "text/xml";
|
||||
request.AllowWriteStreamBuffering = true;
|
||||
request.Timeout = timeout;
|
||||
request.UserAgent = "NSLXmlRpcRequest";
|
||||
|
||||
if (myClientCert!=null) request.ClientCertificates.Add(myClientCert); // 自身の証明書
|
||||
if (!checkServerCert) request.Headers.Add("NoVerifyCert", "true"); // 相手の証明書を検証しない
|
||||
|
||||
Stream stream = null;
|
||||
try {
|
||||
stream = request.GetRequestStream();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
m_log.ErrorFormat("[MONEY NSL RPC]: GetRequestStream Error: {0}", ex);
|
||||
}
|
||||
if (stream==null) return null;
|
||||
|
||||
//
|
||||
XmlTextWriter xml = new XmlTextWriter(stream, _encoding);
|
||||
_serializer.Serialize(xml, this);
|
||||
xml.Flush();
|
||||
xml.Close();
|
||||
|
||||
HttpWebResponse response = null;
|
||||
try {
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
m_log.ErrorFormat("[MONEY NSL RPC]: XmlRpcResponse certSend: GetResponse Error: {0}", ex.ToString());
|
||||
}
|
||||
StreamReader input = new StreamReader(response.GetResponseStream());
|
||||
|
||||
string inputXml = input.ReadToEnd();
|
||||
XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
|
||||
|
||||
input.Close();
|
||||
response.Close();
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Modules.Currency")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("DTL/NSL Group")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("2363e3c9-7be0-4b9b-84ac-82923d5021f4")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" ?>
|
||||
<Project frameworkVersion="v4_6" name="OpenSim.Modules.Currency" path="addon-modules/OpenSim-Modules-Currency" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
<AllowUnsafe>true</AllowUnsafe>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../bin/</ReferencePath>
|
||||
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Runtime.Remoting"/>
|
||||
<Reference name="Mono.Security.dll" path="../../bin/lib/NET"/>
|
||||
<Reference name="Nini" path="../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../bin/"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
<Reference name="XMLRPC" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Data.MySQL.MySQLMoneyDataWrapper"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<appSettings>
|
||||
</appSettings>
|
||||
<log4net>
|
||||
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||
<file value="MoneyServer.log" />
|
||||
<appendToFile value="true" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="LogFileAppender" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -0,0 +1,77 @@
|
|||
[Startup]
|
||||
;
|
||||
; Place to create a PID file
|
||||
; PIDFile = "/tmp/money.pid"
|
||||
|
||||
|
||||
[MySql]
|
||||
;
|
||||
;Connection parameters of MySQL
|
||||
hostname = localhost
|
||||
database = Database_name
|
||||
username = Database_user
|
||||
password = Database_password
|
||||
|
||||
pooling = false
|
||||
port = 3306
|
||||
|
||||
;
|
||||
; Max DB connections kept by money server.
|
||||
MaxConnection = 20
|
||||
|
||||
|
||||
[MoneyServer]
|
||||
; Port No. of this Server
|
||||
ServerPort = 8008
|
||||
|
||||
;
|
||||
; If the user is not found in database,he/she will be created with the default balance.
|
||||
DefaultBalance = 1000
|
||||
|
||||
;
|
||||
; Is amount==0 transaction enable? Default is false.
|
||||
EnableAmountZero = true
|
||||
|
||||
;
|
||||
; If "00000000-0000-0000-0000-000000000000" is specified, all avatars can get money from system.
|
||||
; If "" is specified, nobody can get money.
|
||||
BankerAvatar = "00000000-0000-0000-0000-000000000000"
|
||||
|
||||
;
|
||||
; If you want to use llGiveMoney() function normally even when payer doesn't login to OpenSim,
|
||||
; please set true to this valiable
|
||||
EnableForceTransfer = true
|
||||
|
||||
;
|
||||
; Send/Move money to/from avatar by Money Script
|
||||
;EnableScriptSendMoney = true
|
||||
;MoneyScriptAccessKey = "123456789" ;; Specify same secret key in include/config.php or WI(XoopenSim/Modlos)
|
||||
;MoneyScriptIPaddress = "202.26.159.139" ;; Not use 127.0.0.1. This is used to generate Script key
|
||||
|
||||
;
|
||||
; for HG/Guest Avatar. Foreign Avatar is always false
|
||||
EnableHGAvatar = true
|
||||
EnableGuestAvatar = true
|
||||
HGAvatarDefaultBalance = 1000
|
||||
GuestAvatarDefaultBalance = 1000
|
||||
|
||||
;
|
||||
; Message that displayed in blue dialog, when balance is updated.
|
||||
; If "" is specified, blue dialog is not displayed.
|
||||
; You can use {0} and {1} in message string.
|
||||
; {0} means amount and {1} means avatar name or object owner name.
|
||||
BalanceMessageSendGift = "Sent Gift L${0} to {1}." ;; for send gift to other avatar
|
||||
BalanceMessageReceiveGift = "Received Gift L${0} from {1}." ;; for receieve gift from other avatar
|
||||
BalanceMessagePayCharge = "Paid the Money L${0} for creation." ;; for upload and group creation charge
|
||||
BalanceMessageBuyObject = "Bought the Object {2} from {1} by L${0}." ;; for buy the object
|
||||
BalanceMessageSellObject = "{1} bought the Object {2} by L${0}." ;; for sell the object
|
||||
BalanceMessageLandSale = "Paid the Money L${0} for Land." ;; for buy the land
|
||||
BalanceMessageScvLandSale = "Paid the Money L${0} for Land." ;; for get the money of the sold land
|
||||
BalanceMessageGetMoney = "Got the Money L${0} from {1}." ;; for get the money from object by llGiveMoney()
|
||||
BalanceMessageBuyMoney = "Bought the Money L${0}." ;; for buy the money from system
|
||||
BalanceMessageRollBack = "RollBack the Transaction: L${0} from/to {1}." ;; when roll back ocuurred
|
||||
BalanceMessageSendMoney = "Paid the Money L${0} to {1}." ;; for sender of sending the money
|
||||
BalanceMessageReceiveMoney = "Received L${0} from {1}." ;; for receive the money
|
||||
|
||||
|
||||
[Certificate]
|
|
@ -0,0 +1,26 @@
|
|||
[Economy]
|
||||
;; Enables selling.
|
||||
SellEnabled = true
|
||||
|
||||
;CurrencyServer = "" ;; ex.) "https://opensim.net:8008/" Default is ""
|
||||
EconomyModule = DTLNSLMoneyModule
|
||||
CurrencyServer = "${Const|BaseURL}:8008/"
|
||||
UserServer = "${Const|BaseURL}:8002/"
|
||||
|
||||
;; Money Unit fee to upload textures, animations etc. Default is 0.
|
||||
PriceUpload = 0
|
||||
|
||||
;; Mesh upload factors
|
||||
MeshModelUploadCostFactor = 1.0
|
||||
MeshModelUploadTextureCostFactor = 1.0
|
||||
MeshModelMinCostFactor = 1.0
|
||||
|
||||
;; Money Unit fee to create groups. Default is 0.
|
||||
PriceGroupCreate = 0
|
||||
|
||||
;; Avatar Class for HG Avatar
|
||||
;; {ForeignAvatar, HGAvatar, GuestAvatar, LocalAvatar} HGAvatar
|
||||
;; HG Avatar is assumed as a specified avatar class. Default is HGAvatar
|
||||
;; Processing for each avatar class is dependent on Money Server settings.
|
||||
;HGAvatarAs = "HGAvatar"
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue