Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
.vs/

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
packages

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
4 changes: 2 additions & 2 deletions AutoBroadcast.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoBroadcast", "AutoBroadcast\AutoBroadcast.csproj", "{85F20ADC-C2D1-416D-B7FF-9433C75A8F01}"
EndProject
Global
Expand Down
53 changes: 23 additions & 30 deletions AutoBroadcast/ABConfig.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using Newtonsoft.Json;
using TShockAPI;

namespace AutoBroadcast
{
Expand All @@ -20,37 +17,33 @@ public static ABConfig Read(string file)
{
if (!File.Exists(file))
{
ABConfig.WriteExample(file);
WriteExample(file);
}
return JsonConvert.DeserializeObject<ABConfig>(File.ReadAllText(file));
}

public static void WriteExample(string file)
{
File.WriteAllText(file, @"{
""Broadcasts"": [
{
""Name"": ""Example Broadcast"",
""Enabled"": false,
""Messages"": [
""This is an example broadcast"",
""It will broadcast every 5 minutes"",
""Broadcasts can also execute commands"",
""/time noon""
],
""ColorRGB"": [
255.0,
0.0,
0.0
],
""Interval"": 300,
""StartDelay"": 60,
""Groups"": [],
""TriggerWords"": [],
""TriggerToWholeGroup"": false
}
]
}");
var Ex = new Broadcast();
Ex.Name = "Example Broadcast";
Ex.Enabled = false;
Ex.Messages = new string[]
{
"This is an example broadcast",
"It will broadcast every 5 minutes",
"Broadcasts can also execute commands",
"/time noon"
};
Ex.ColorRGB = new int[] { 255, 0, 0 };
Ex.Interval = 300;
Ex.StartDelay = 60;

var Conf = new ABConfig
{
Broadcasts = new Broadcast[] { Ex }
};

Conf.Write(file);
}
}

Expand All @@ -59,7 +52,7 @@ public class Broadcast
public string Name = string.Empty;
public bool Enabled = false;
public string[] Messages = new string[0];
public float[] ColorRGB = new float[3];
public int[] ColorRGB = new int[3];
public int Interval = 0;
public int StartDelay = 0;
public string[] Groups = new string[0];
Expand Down
Loading