Reintegrated 2.3 branch into trunk

This commit is contained in:
Birunthan Mohanathas
2012-01-08 17:35:29 +00:00
parent c3335adec5
commit c3ed2e5fa3
87 changed files with 5379 additions and 2732 deletions

View File

@ -0,0 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("© 2011 - Birunthan Mohanathas")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion(Rainmeter.Version.Informational)]
[assembly: AssemblyProduct("Rainmeter")]

View File

@ -0,0 +1,154 @@
/*
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Define/undefine to control exports. Undefine to infrom that this plugin does not support
// a particular function.
#define ExportUpdate
#undef ExportGetString
#undef ExportExecuteBang
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Rainmeter;
namespace ExampleCS
{
/// <summary>
/// Represents a measure. Members are specific to a measure. Methods are called by Rainmeter
/// when needed.
/// </summary>
internal class Measure
{
/// <summary>
/// Called when a measure is created.
/// </summary>
internal Measure()
{
}
/// <summary>
/// Called when a measure is destroyed. Use this rather than a destructor to perform
/// cleanup.
/// </summary>
internal void Cleanup()
{
}
/// <summary>
/// Called when the measure settings must be (re)read.
/// </summary>
internal void Reload(Rainmeter.API rm)
{
// Examples:
// string value = rm.ReadString("TestOption", "DefaultValue");
// double value = rm.ReadFormula("TestOption", 20);
}
/// <summary>
/// Called when the measure settings must be (re)read.
/// </summary>
#if ExportUpdate
internal double Update()
{
return 42.0;
}
#endif
/// <summary>
/// Called when the string representation of the measure value is required.
/// </summary>
/// <remarks>
/// Can be called multiple times per update cycle. Do not call heavy functions here.
/// Instead create a string member, set it in Update, and simply return it here.
/// </remarks>
#if ExportGetString
internal string GetString()
{
return "Hello, world!";
}
#endif
/// <summary>
/// Called when as a result of a !CommandMeasure bang aimed at the measure.
/// </summary>
#if ExportExecuteBang
internal void ExecuteBang(string args)
{
}
#endif
}
/// <summary>
/// Handles communication between Rainmeter and the plugin.
/// </summary>
public static class Plugin
{
[DllExport]
public unsafe static void Initialize(void** data)
{
IntPtr dataPtr = (IntPtr)((void*)*data);
Measures.Add(dataPtr, new Measure());
}
[DllExport]
public unsafe static void Finalize(void* data)
{
IntPtr dataPtr = (IntPtr)data;
Measures[dataPtr].Cleanup();
Measures.Remove(dataPtr);
}
[DllExport]
public unsafe static void Reload(void* data, void* rm, double* maxValue)
{
IntPtr dataPtr = (IntPtr)data;
Measures[dataPtr].Reload(new Rainmeter.API((IntPtr)rm));
}
#if ExportUpdate
[DllExport]
public unsafe static double Update(void* data)
{
IntPtr dataPtr = (IntPtr)data;
return Measures[dataPtr].Update();
}
#endif
#if ExportGetString
[DllExport]
public unsafe static char* GetString(void* data)
{
IntPtr dataPtr = (IntPtr)data;
return Rainmeter.API.ToUnsafe(Measures[dataPtr].GetString());
}
#endif
#if ExportExecuteBang
[DllExport]
public unsafe static void ExecuteBang(void* data, char* args)
{
IntPtr dataPtr = (IntPtr)data;
Measures[dataPtr].ExecuteBang(new string(args));
Measures.Remove(dataPtr);
}
#endif
internal static Dictionary<IntPtr, Measure> Measures = new Dictionary<IntPtr, Measure>();
}
}

View File

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D31F73ED-3978-44FA-B599-49584BA30D3A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExampleCS</RootNamespace>
<AssemblyName>ExampleCS</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>$(SolutionDir)TestBench\x32\Debug\Plugins\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1607</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>$(SolutionDir)TestBench\x32\Release\Plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1607</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>$(SolutionDir)TestBench\x64\Debug\Plugins\</OutputPath>
<DefineConstants>TRACE;DEBUG;X64</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>$(SolutionDir)TestBench\x64\Release\Plugins\</OutputPath>
<DefineConstants>TRACE;X64</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="..\API\Rainmeter.cs" />
<Compile Include="$(SolutionDir)Version.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>"$(SolutionDir)Plugins\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" "$(TargetedFrameworkDir)\ilasm.exe" "$(FrameworkSDKDir)bin\ildasm.exe"</PostBuildEvent>
</PropertyGroup>
</Project>