Skip to content

Commit

Permalink
Hello World
Browse files Browse the repository at this point in the history
Hello World 1.0 Release
  • Loading branch information
SixthTitan committed Jan 17, 2020
1 parent 4402e3f commit 6282ffc
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 0 deletions.
25 changes: 25 additions & 0 deletions SDVWM_Example_Addon.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDVWM_Example_Addon", "SDVWM_Example_Addon\SDVWM_Example_Addon.csproj", "{CF87A4D0-C6C0-4AB0-8C97-60F657E7973D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF87A4D0-C6C0-4AB0-8C97-60F657E7973D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF87A4D0-C6C0-4AB0-8C97-60F657E7973D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF87A4D0-C6C0-4AB0-8C97-60F657E7973D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF87A4D0-C6C0-4AB0-8C97-60F657E7973D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AFD811B0-AF06-4A2F-B894-4BFD7E7D59BD}
EndGlobalSection
EndGlobal
17 changes: 17 additions & 0 deletions SDVWM_Example_Addon/Extension/Configuration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

namespace SDVWM_Example_Addon.Extension
{
class Configuration
{
/// <summary>
// Get Weather Data from Weather Machine
/// </summary>

private string summary;
public string Weather_Summary
{
get { return summary; }
set { summary = value; }
}
}
}
70 changes: 70 additions & 0 deletions SDVWM_Example_Addon/Extension/Extension_Loader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System.IO;
using System.Linq;

namespace SDVWM_Example_Addon.Extension
{
class Extension_Loader
{
Configuration config = new Configuration();

public bool Load_Configuration()
{
string APP_BASE = System.AppDomain.CurrentDomain.BaseDirectory;

string APP = "StarDewValleyWeatherMachine"; // Name of the Master Application to get data from
string config_file = "SDVWM.ini";

string extension_folder = APP_BASE + "Mods" + "\\" + APP;
string config_directory = APP_BASE + "Mods" + "\\" + APP + "\\" + config_file;


//File.ReadAllText(filepath);
if (Directory.Exists(extension_folder))
{
if (File.Exists(config_directory))
{
return true;
}


}

return false;

}


public string Load_Weather_Summary()
{
string APP_BASE = System.AppDomain.CurrentDomain.BaseDirectory;

string APP = "StarDewValleyWeatherMachine"; // Name of the Master Application to get data from
string config_file = "SDVWM.ini";

string extension_folder = APP_BASE + "Mods" + "\\" + APP;
string config_directory = APP_BASE + "Mods" + "\\" + APP + "\\" + config_file;

string[] result;

//File.ReadAllText(filepath);
if (Directory.Exists(extension_folder))
{
if (File.Exists(config_directory))
{
result = File.ReadLines(config_directory).ToArray();

config.Weather_Summary = result[0];

return config.Weather_Summary;
}


}

return "No weather reported";

}


}
}
69 changes: 69 additions & 0 deletions SDVWM_Example_Addon/ModEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using StardewModdingAPI;
using StardewModdingAPI.Events;
using SDVWM_Example_Addon.Extension;

namespace SDVWM_Example_Addon
{

/// <summary>The mod entry point.</summary>
public class ModEntry : Mod
{
public static bool gamelaunched = false;

// Base Configuration
Extension_Loader _Loader = new Extension_Loader(); // Load config from Master


/*********
** Public methods
*********/
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
{

/* Event Helpers */
helper.Events.GameLoop.DayStarted += this.OnDayStarted;
helper.Events.GameLoop.GameLaunched += this.GameLaunched;

}


/*********
** Private methods
*********/
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>

private void GameLaunched(object sender, GameLaunchedEventArgs e)
{
/// ########################################### ///
/// Check if SDVWM is installed ///
/// ########################################## ///

if (_Loader.Load_Configuration() == true)
{
this.Monitor.Log("Hello SDVWM!", LogLevel.Info);
}

if (_Loader.Load_Configuration() == false)
{
this.Monitor.Log("Hello World, where is SDVWM?", LogLevel.Info);
}

}

private void OnDayStarted(object sender, DayStartedEventArgs e)
{

// Display the weather summary from SDVWM.ini file whenever a new day starts.
this.Monitor.Log("It's currently: " + _Loader.Load_Weather_Summary(), LogLevel.Info);

}

}


}

36 changes: 36 additions & 0 deletions SDVWM_Example_Addon/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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("SDVWM_Example_Addon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDVWM_Example_Addon")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("cf87a4d0-c6c0-4ab0-8c97-60f657e7973d")]

// 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")]
63 changes: 63 additions & 0 deletions SDVWM_Example_Addon/SDVWM_Example_Addon.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CF87A4D0-C6C0-4AB0-8C97-60F657E7973D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SDVWM_Example_Addon</RootNamespace>
<AssemblyName>SDVWM_Example_Addon</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Extension\Configuration.cs" />
<Compile Include="Extension\Extension_Loader.cs" />
<Compile Include="ModEntry.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="manifest.json" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.3.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.3.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.3.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.3.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>
10 changes: 10 additions & 0 deletions SDVWM_Example_Addon/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Name": "SDVWM_Example_Addon",
"Author": "SixthTitan",
"Version": "1.0",
"Description": "Example Add-on Project for SDVWM",
"UniqueID": "SixthTitan.SDVWM_Example_Addon",
"EntryDll": "SDVWM_Example_Addon.dll",
"MinimumApiVersion": "2.9",
"UpdateKeys": [ "" ]
}
4 changes: 4 additions & 0 deletions SDVWM_Example_Addon/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="3.0.0" targetFramework="net472" />
</packages>

0 comments on commit 6282ffc

Please sign in to comment.