Fixed line endings and applied gitignore

This commit is contained in:
2014-07-26 09:43:40 +03:00
parent 0c57cabe56
commit 7cba5cc109
542 changed files with 112014 additions and 119759 deletions

View File

@ -1,140 +1,140 @@
/*
Copyright (C) 2011 Birunthan Mohanathas
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Runtime.InteropServices;
namespace Rainmeter
{
/// <summary>
/// Wrapper around the Rainmeter C API.
/// </summary>
public class API
{
private IntPtr m_Rm;
public API(IntPtr rm)
{
m_Rm = rm;
}
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static IntPtr RmReadString(IntPtr rm, string option, string defValue, bool replaceMeasures);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static double RmReadFormula(IntPtr rm, string option, double defValue);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static IntPtr RmReplaceVariables(IntPtr rm, string str);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static IntPtr RmPathToAbsolute(IntPtr rm, string relativePath);
[DllImport("Rainmeter.dll", EntryPoint = "RmExecute", CharSet = CharSet.Unicode)]
public extern static void Execute(IntPtr skin, string command);
[DllImport("Rainmeter.dll")]
private extern static IntPtr RmGet(IntPtr rm, RmGetType type);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private extern static int LSLog(LogType type, string unused, string message);
private enum RmGetType
{
MeasureName = 0,
Skin = 1,
SettingsFile = 2,
SkinName = 3,
SkinWindowHandle = 4
}
public enum LogType
{
Error = 1,
Warning = 2,
Notice = 3,
Debug = 4
}
public string ReadString(string option, string defValue, bool replaceMeasures = true)
{
return Marshal.PtrToStringUni(RmReadString(m_Rm, option, defValue, replaceMeasures));
}
public string ReadPath(string option, string defValue)
{
return Marshal.PtrToStringUni(RmPathToAbsolute(m_Rm, ReadString(option, defValue)));
}
public double ReadDouble(string option, double defValue)
{
return RmReadFormula(m_Rm, option, defValue);
}
public int ReadInt(string option, int defValue)
{
return (int)RmReadFormula(m_Rm, option, defValue);
}
public string ReplaceVariables(string str)
{
return Marshal.PtrToStringUni(RmReplaceVariables(m_Rm, str));
}
public string GetMeasureName()
{
return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.MeasureName));
}
public IntPtr GetSkin()
{
return RmGet(m_Rm, RmGetType.Skin);
}
public string GetSettingsFile()
{
return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.SettingsFile));
}
public string GetSkinName()
{
return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.SkinName));
}
public IntPtr GetSkinWindow()
{
return RmGet(m_Rm, RmGetType.SkinWindowHandle);
}
public static void Log(LogType type, string message)
{
LSLog(type, null, message);
}
}
/// <summary>
/// Dummy attribute to mark method as exported for DllExporter.exe.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class DllExport : Attribute
{
public DllExport()
{
}
}
}
/*
Copyright (C) 2011 Birunthan Mohanathas
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Runtime.InteropServices;
namespace Rainmeter
{
/// <summary>
/// Wrapper around the Rainmeter C API.
/// </summary>
public class API
{
private IntPtr m_Rm;
public API(IntPtr rm)
{
m_Rm = rm;
}
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static IntPtr RmReadString(IntPtr rm, string option, string defValue, bool replaceMeasures);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static double RmReadFormula(IntPtr rm, string option, double defValue);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static IntPtr RmReplaceVariables(IntPtr rm, string str);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)]
private extern static IntPtr RmPathToAbsolute(IntPtr rm, string relativePath);
[DllImport("Rainmeter.dll", EntryPoint = "RmExecute", CharSet = CharSet.Unicode)]
public extern static void Execute(IntPtr skin, string command);
[DllImport("Rainmeter.dll")]
private extern static IntPtr RmGet(IntPtr rm, RmGetType type);
[DllImport("Rainmeter.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private extern static int LSLog(LogType type, string unused, string message);
private enum RmGetType
{
MeasureName = 0,
Skin = 1,
SettingsFile = 2,
SkinName = 3,
SkinWindowHandle = 4
}
public enum LogType
{
Error = 1,
Warning = 2,
Notice = 3,
Debug = 4
}
public string ReadString(string option, string defValue, bool replaceMeasures = true)
{
return Marshal.PtrToStringUni(RmReadString(m_Rm, option, defValue, replaceMeasures));
}
public string ReadPath(string option, string defValue)
{
return Marshal.PtrToStringUni(RmPathToAbsolute(m_Rm, ReadString(option, defValue)));
}
public double ReadDouble(string option, double defValue)
{
return RmReadFormula(m_Rm, option, defValue);
}
public int ReadInt(string option, int defValue)
{
return (int)RmReadFormula(m_Rm, option, defValue);
}
public string ReplaceVariables(string str)
{
return Marshal.PtrToStringUni(RmReplaceVariables(m_Rm, str));
}
public string GetMeasureName()
{
return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.MeasureName));
}
public IntPtr GetSkin()
{
return RmGet(m_Rm, RmGetType.Skin);
}
public string GetSettingsFile()
{
return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.SettingsFile));
}
public string GetSkinName()
{
return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.SkinName));
}
public IntPtr GetSkinWindow()
{
return RmGet(m_Rm, RmGetType.SkinWindowHandle);
}
public static void Log(LogType type, string message)
{
LSLog(type, null, message);
}
}
/// <summary>
/// Dummy attribute to mark method as exported for DllExporter.exe.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class DllExport : Attribute
{
public DllExport()
{
}
}
}

View File

@ -1,125 +1,125 @@
/*
Copyright (C) 2011 Kimmo Pekkola, Birunthan Mohanathas
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __RAINMETERAPI_H__
#define __RAINMETERAPI_H__
#ifdef LIBRARY_EXPORTS
#define LIBRARY_EXPORT EXTERN_C
#else
#define LIBRARY_EXPORT EXTERN_C __declspec(dllimport)
#endif // LIBRARY_EXPORTS
#define PLUGIN_EXPORT EXTERN_C __declspec(dllexport)
//
// Exported functions
//
#ifdef __cplusplus
LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE);
#else
LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures);
#endif // __cplusplus
LIBRARY_EXPORT double __stdcall RmReadFormula(void* rm, LPCWSTR option, double defValue);
LIBRARY_EXPORT LPCWSTR __stdcall RmReplaceVariables(void* rm, LPCWSTR str);
LIBRARY_EXPORT LPCWSTR __stdcall RmPathToAbsolute(void* rm, LPCWSTR relativePath);
LIBRARY_EXPORT void __stdcall RmExecute(void* skin, LPCWSTR command);
LIBRARY_EXPORT void* __stdcall RmGet(void* rm, int type);
enum RmGetType
{
RMG_MEASURENAME = 0,
RMG_SKIN = 1,
RMG_SETTINGSFILE = 2,
RMG_SKINNAME = 3,
RMG_SKINWINDOWHANDLE = 4
};
LIBRARY_EXPORT void __stdcall RmLog(void* rm, int level, LPCWSTR message);
LIBRARY_EXPORT void __cdecl RmLogF(void* rm, int level, LPCWSTR format, ...);
LIBRARY_EXPORT BOOL __cdecl LSLog(int level, LPCWSTR unused, LPCWSTR message);
//
// Wrapper functions
//
#ifndef LIBRARY_EXPORTS
__inline LPCWSTR RmReadPath(void* rm, LPCWSTR option, LPCWSTR defValue)
{
LPCWSTR relativePath = RmReadString(rm, option, defValue, TRUE);
return RmPathToAbsolute(rm, relativePath);
}
__inline int RmReadInt(void* rm, LPCWSTR option, int defValue)
{
return (int)RmReadFormula(rm, option, defValue);
}
__inline double RmReadDouble(void* rm, LPCWSTR option, double defValue)
{
return RmReadFormula(rm, option, defValue);
}
__inline LPCWSTR RmGetMeasureName(void* rm)
{
return (LPCWSTR)RmGet(rm, RMG_MEASURENAME);
}
__inline LPCWSTR RmGetSettingsFile()
{
return (LPCWSTR)RmGet(NULL, RMG_SETTINGSFILE);
}
__inline void* RmGetSkin(void* rm)
{
return (void*)RmGet(rm, RMG_SKIN);
}
__inline LPCWSTR RmGetSkinName(void* rm)
{
return (LPCWSTR)RmGet(rm, RMG_SKINNAME);
}
__inline HWND RmGetSkinWindow(void* rm)
{
return (HWND)RmGet(rm, RMG_SKINWINDOWHANDLE);
}
__inline void RmLog(int level, LPCWSTR message)
{
LSLog(level, NULL, message);
}
enum LOGLEVEL
{
LOG_ERROR = 1,
LOG_WARNING = 2,
LOG_NOTICE = 3,
LOG_DEBUG = 4
};
#endif // LIBRARY_EXPORTS
#endif
/*
Copyright (C) 2011 Kimmo Pekkola, Birunthan Mohanathas
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __RAINMETERAPI_H__
#define __RAINMETERAPI_H__
#ifdef LIBRARY_EXPORTS
#define LIBRARY_EXPORT EXTERN_C
#else
#define LIBRARY_EXPORT EXTERN_C __declspec(dllimport)
#endif // LIBRARY_EXPORTS
#define PLUGIN_EXPORT EXTERN_C __declspec(dllexport)
//
// Exported functions
//
#ifdef __cplusplus
LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE);
#else
LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures);
#endif // __cplusplus
LIBRARY_EXPORT double __stdcall RmReadFormula(void* rm, LPCWSTR option, double defValue);
LIBRARY_EXPORT LPCWSTR __stdcall RmReplaceVariables(void* rm, LPCWSTR str);
LIBRARY_EXPORT LPCWSTR __stdcall RmPathToAbsolute(void* rm, LPCWSTR relativePath);
LIBRARY_EXPORT void __stdcall RmExecute(void* skin, LPCWSTR command);
LIBRARY_EXPORT void* __stdcall RmGet(void* rm, int type);
enum RmGetType
{
RMG_MEASURENAME = 0,
RMG_SKIN = 1,
RMG_SETTINGSFILE = 2,
RMG_SKINNAME = 3,
RMG_SKINWINDOWHANDLE = 4
};
LIBRARY_EXPORT void __stdcall RmLog(void* rm, int level, LPCWSTR message);
LIBRARY_EXPORT void __cdecl RmLogF(void* rm, int level, LPCWSTR format, ...);
LIBRARY_EXPORT BOOL __cdecl LSLog(int level, LPCWSTR unused, LPCWSTR message);
//
// Wrapper functions
//
#ifndef LIBRARY_EXPORTS
__inline LPCWSTR RmReadPath(void* rm, LPCWSTR option, LPCWSTR defValue)
{
LPCWSTR relativePath = RmReadString(rm, option, defValue, TRUE);
return RmPathToAbsolute(rm, relativePath);
}
__inline int RmReadInt(void* rm, LPCWSTR option, int defValue)
{
return (int)RmReadFormula(rm, option, defValue);
}
__inline double RmReadDouble(void* rm, LPCWSTR option, double defValue)
{
return RmReadFormula(rm, option, defValue);
}
__inline LPCWSTR RmGetMeasureName(void* rm)
{
return (LPCWSTR)RmGet(rm, RMG_MEASURENAME);
}
__inline LPCWSTR RmGetSettingsFile()
{
return (LPCWSTR)RmGet(NULL, RMG_SETTINGSFILE);
}
__inline void* RmGetSkin(void* rm)
{
return (void*)RmGet(rm, RMG_SKIN);
}
__inline LPCWSTR RmGetSkinName(void* rm)
{
return (LPCWSTR)RmGet(rm, RMG_SKINNAME);
}
__inline HWND RmGetSkinWindow(void* rm)
{
return (HWND)RmGet(rm, RMG_SKINWINDOWHANDLE);
}
__inline void RmLog(int level, LPCWSTR message)
{
LSLog(level, NULL, message);
}
enum LOGLEVEL
{
LOG_ERROR = 1,
LOG_WARNING = 2,
LOG_NOTICE = 3,
LOG_DEBUG = 4
};
#endif // LIBRARY_EXPORTS
#endif

Binary file not shown.

Binary file not shown.