removed old, unused, inappropriate tools & errata

removed irc bot
removed dllsocket & netutil
removed DM Line Counter
removed Event Probabilities spreadsheet
removed /tg/ redirector
removed /tg/ runtime squasher
removed Unstandardness Tester
removed strongdmm binaries
This commit is contained in:
spookerton
2023-10-10 14:05:00 +01:00
parent dbb6dc752d
commit 7eb2291c65
78 changed files with 0 additions and 12490 deletions
-13
View File
@@ -1,13 +0,0 @@
Name = "CC_NanoTrasen" #The name he uses to connect
no_absolute_paths = True
debug_on = False
SName = ["cc","nt","trasen","nano","nanotrasen"] #Other names he will respond to, in lowercase
DISABLE_ALL_NON_MANDATORY_SOCKET_CONNECTIONS = False
directory = "bot/directory/here/" # Directory the bot is located in, make sure to keep the "/" at the end
version = "TG CC-BY-SA 6"
Network = 'YOUR.SERVER.HERE' #e.g. "irc.rizon.net"
channel = "#YOUR CHANNEL HERE" #what channel you want the bot in
channels = ["#YOUR CHANNEL HERE"] #same as above
greeting = "Welcome!" #what he says when a person he hasn't seen before joins
prefix = "!" #prefix for bot commands
Port = 7000
-32
View File
@@ -1,32 +0,0 @@
from random import choice as fsample #Yay for added speed!
global responses
responses = ['Yes','Too bad','Will you turn me off if I tell you?','Absolutely',
"Not at all", "Nope", "It does", "No", "All the time",
"I don't really know", "Could be","Possibly","You're still here?",# Chaoticag
"No idea", "Of course", "Would you turn me off if I tell you?",
"Sweet!","Nah","Certainly","Yeah","Yup","I am quite confident that the answer is Yes",
"Perhaps", "Yeeeeaah... No.", "Indubitably" ] # Richard
def eightball(data,debug,sender,prefix):
global responses
arg = data.lower().replace(prefix+"eightball ","")
arg = arg.replace(prefix+"8ball ","")
if debug:
print sender+":"+prefix+"eightball", arg
if "answer" in arg and "everything" in arg and "to" in arg:
if debug:
print "Responded with",42
return "42"
elif arg == "derp":
if debug:
print "Responded with herp"
return("herp")
elif arg == "herp":
if debug:
print "Responded with derp"
return("derp")
else:
#choice = sample(responses,1)[0]
choice = fsample(responses)
if debug:
print "Responded with", choice
return(choice)
-5
View File
@@ -1,5 +0,0 @@
#Throws a coin, simple.
from random import random
def heaortai(debug,sender): return("Heads" if random() > 0.5 else "Tails")
# Takes 1/6th the time of doing it with random.randint(0,1)
# This file used to be a lot bigger, now it's kind of useless.
-21
View File
@@ -1,21 +0,0 @@
from save_load import save
from os import listdir
import CORE_DATA
directory = CORE_DATA.directory
def mkquote(prefix,influx,sender,debug):
arg = influx[10+len(prefix):]
if debug:
print sender+":"+prefix+"makequote "+str(len(arg))+" Characters"
if len(arg) == 0:
return("Type something to a quote")
else:
files = listdir(directory+"userquotes")
numb = 0
while True:
numb += 1
if sender.lower()+str(numb) in files:
pass
else:
save(directory+"userquotes/"+sender.lower()+str(numb),[arg,sender.lower()])
return("Saved as:"+sender.lower()+str(numb))
break
-70
View File
@@ -1,70 +0,0 @@
### EXPERIMENTAL PROTOTYPE ###
# e = 2.7182818284590452353602874713526624977572
# pi = math.pi
from __future__ import division #PYTHON Y U NO TELL ME THIS BEFORE
import math
import random
import re
e = "2.7182818284590452353602874713526624977572"
pi = str(math.pi)
global pre
pre = len("maths ")
def maths(influx,prefix="!",sender="NaN",debug=True,method="n"):
global pre
influx = influx.lower()
influx = influx[len(prefix)+pre:]
influx = influx.replace("pie",pi+"*"+e)
influx = influx.replace("e*",e+"*")
influx = influx.replace("*e","*"+e)
influx = influx.replace("pi",pi)
if debug:
print sender+":"+prefix+"maths"
if influx.count("**") == 0 and influx.count('"') == 0 and influx.count("'") == 0 and influx.count(";") == 0 and influx.count(":") == 0:
influx_low = influx.lower()
influx_hi = influx.upper()
if "0b" in influx_low:
influx_low = re.sub("0b[0-1]*","",influx_low)
influx_hi = re.sub("0B[0-1]*","",influx_hi)
if "0x" in influx_low:
influx_low = re.sub("0x[a-f0-9]*","",influx_low)
influx_hi = re.sub("0X[A-F0-9]*","",influx_hi)
if "rand" in influx_low:
influx_low = re.sub("rand","",influx_low)
influx_hi = re.sub("RAND","",influx_hi)
if influx_low == influx_hi:
influx = re.sub("rand","random.random()",influx)
try:
result = eval(influx.lower())
except ZeroDivisionError:
return "Divide by zero detected."
except SyntaxError:
return "Syntax Error detected."
except TypeError:
return "Type Error detected."
except:
return "Unknown Error detected."
else:
if method == "n": #Normal
return result
elif method == "i": #Forced Int
return int(result)
elif method == "h": #Hex
try:
if "L" in hex(result)[2:]:
return hex(result)[2:-1]
else:
return hex(result)[2:].upper()
except TypeError:
return "That value (%s) cannot be interpreted properly using !hmaths" %(str(result))
elif method == "b": #Binary
try:
return bin(result)[2:].upper()
except TypeError:
return "That value (%s) cannot be interpreted properly using !bmaths" %(str(result))
else:
return result
else:
return "What are you trying to make me do again?"
else:
return "Those are likely to make me hang"
-23
View File
@@ -1,23 +0,0 @@
global parta,partb
parta = {"A":"N","B":"O","C":"P","D":"Q","E":"R","F":"S","G":"T","H":"U","I":"V","J":"W","K":"X","L":"Y","M":"Z"}
partb = {'O':'B','N':'A','Q':'D','P':'C','S':'F','R':'E','U':'H','T':'G','W':'J','V':'I','Y':'L','X':'K','Z':'M'}
def rot13(text):
global parta,partb
newtext = ""
for letter in text:
try:
if letter.isupper():
newtext += parta[letter]
else:
newtext += parta[letter.upper()].lower()
except:
try:
if letter.isupper():
newtext += partb[letter]
pass
else:
newtext += partb[letter.upper()].lower()
pass
except:
newtext += letter
return newtext
-96
View File
@@ -1,96 +0,0 @@
import random
def rtd(data,debug,sender):
backo = data
try:
arg1,arg2 = backo.split("d")
except ValueError, err:
return("Too many or too small amount of arguments")
else:
if debug:
print sender+":!rtd "+arg1+"d"+arg2 #faster than using %s's
die,die2 = [],[]
current_mark = ""
outcome = 0
realnumberfound = False
checks = []
count = 0
arg1 = arg1.replace(" ","")
arg2 = arg2.replace(" ","")
try:
i_arg1 = int(arg1)
a_arg1 = abs(i_arg1)
if "+" in arg2 or "-" in arg2:
plus_spot = arg2.find("+")
minus_spot = arg2.find("-")
if plus_spot == -1 and minus_spot == -1:
nicer_form = ""
elif plus_spot != -1 and minus_spot == -1:
nicer_form = arg2[plus_spot:]
elif plus_spot == -1 and minus_spot != -1:
nicer_form = arg2[minus_spot:]
else:
if plus_spot < minus_spot:
nicer_form = arg2[plus_spot:]
else:
nicer_form = arg2[minus_spot:]
for letter in arg2:
if letter == "+" or letter == "-":
current_mark = letter
checks = []
count += 1
continue
checks.append(letter)
try:
next_up = arg2[count+1]
except:
if realnumberfound == False:
i_arg2 = int("".join(checks))
checks = []
realnumberfound = True
elif current_mark == "+":
outcome += int("".join(checks))
else:
outcome -= int("".join(checks))
else:
if next_up == "+" or next_up == "-":
if realnumberfound == False:
i_arg2 = int("".join(checks))
checks = []
realnumberfound = True
else:
if current_mark == "+":
outcome += int("".join(checks))
else:
outcome -= int("".join(checks))
checks = []
count += 1
else:
i_arg2 = int(arg2)
if a_arg1 == 0 or abs(i_arg2) == 0:
raise RuntimeError
except ValueError:
return("You lied! That's not a number!")
except RuntimeError:
return("Too many zeroes!")
else:
if a_arg1 > 100:
return("Too many rolls, I can only do one hundred at max.")
else:
for i in xrange(0,a_arg1):
if i_arg2 < 0:
dice = random.randint(i_arg2,0)
else:
dice = random.randint(1,i_arg2)
die.append(dice)
die2.append(str(dice))
if i_arg2 < 0:
flist = "".join(die2)
else:
flist = "+".join(die2)
if len(flist) > 350:
return(str(reduce(lambda x,y: x+y, die)+outcome))
else:
if current_mark == "":
return(flist+" = "+str(reduce(lambda x,y: x+y, die)+outcome))
else:
return(flist+" ("+nicer_form+") = "+str(reduce(lambda x,y: x+y, die)+outcome))
-30
View File
@@ -1,30 +0,0 @@
from random import choice as fsample
sarcastic_responses = ["Yeah right","What do I look like to you?","Are you kidding me?",#UsF
"As much as you","You don't believe that yourself","When pigs fly",#UsF
"Like your grandma","You would like to know, wouldn't you?", #UsF
"Like your mom", #Spectre
"Totally","Not at all", #Spectre
"AHAHAHahahaha, No.", #Strumpetplaya
"Not as much as USER","As much as USER",
"Really, you expect me to tell you that?",
"Right, and you've been building NOUNs for those USERs in the LOCATION, haven't you?" ] #Richard
locations = ["woods","baystation","ditch"]
nouns = ["bomb","toilet","robot","cyborg",
"garbage can","gun","cake",
"missile"]
def sarcasticball(data,debug,sender,users,prefix):
arg = data.lower().replace(prefix+"sarcasticball ","")
arg = arg.replace(prefix+"sball ","")
if debug:
print sender+":"+prefix+"sarcasticball", arg
choice = fsample(sarcastic_responses)
if "USER" in choice:
choice = choice.replace("USER",fsample(users),1)
choice = choice.replace("USER",fsample(users),1)
if "NOUN" in choice:
choice = choice.replace("NOUN",fsample(nouns),1)
if "LOCATION" in choice:
choice = choice.replace("LOCATION",fsample(locations),1)
if debug:
print "Responded with", choice
return(choice)
-35
View File
@@ -1,35 +0,0 @@
import random
def srtd(data,debug,sender):
try:
arg1,arg2 = data.split("d")
except ValueError, err:
if str(err) == "need more than 1 value to unpack":
return("Too small amount of arguments")
else:
return("Too many arguments")
else:
if debug:
print sender+":!rtd "+arg1+"d"+arg2
die = []
arg1 = arg1.replace(" ","")
arg2 = arg2.replace(" ","")
try:
i_arg1 = int(arg1)
i_arg2 = int(arg2)
if abs(i_arg1) == 0 or abs(i_arg2) == 0:
raise RuntimeError
except ValueError:
return("You lied! That's not a number!")
except RuntimeError:
return("Too many zeroes!")
else:
if abs(i_arg1) > 500:
return("Too many rolls, I can only do five hundred at max.")
else:
for i in xrange(0,abs(i_arg1)):
if i_arg2 < 0:
dice = random.randint(i_arg2,0)
else:
dice = random.randint(1,i_arg2)
die.append(dice)
return(str(reduce(lambda x,y: x+y, die)))
-60
View File
@@ -1,60 +0,0 @@
#As new commands are added, update this.
# Last updated: 8.3.2011
# Updated 12.3.2011:
# - Added the missing help data for Version
# - Imported CORE_DATA to get the name.
# - Tidied some commands up a bit.
# - Replaced all "Bot"s with the Skibot's current name.
from CORE_DATA import Name
everything = {"8ball":"[8ball <arg>] Responds to the argument",
"allcaps":"[allcaps <arg>] Takes an uppercase string and returns a capitalized version",
"bmaths":"[bmaths <arg>] Takes a math equation (Like 5+5) and returns a binary result",
"coin":"[coin] Flips a coin",
"dance":"[dance] Makes %s do a little dance" %(Name),
"delquote":"(OP ONLY) [delquote <arg>] Removes a quote with the filename equal to the argument",
"disable":"(OP ONLY) [disable] Disables all output from %s" %(Name),
"disable dance":"(HALFOP / OP ONLY) [disable dance] or [dd] Toggles dancing",
"disable fml":"(HALFOP / OP ONLY) [disable fml] Disables FML",
"eightball":"[eightball <arg>] Responds to the argument",
"enable":"(OP ONLY) [enable] After being disabled, enable will turn output back on",
"enable fml":"{HALFOP / OP ONLY} [enable fml] After fml has been disabled, enable fml will make it available again",
"fml":"[fml] Returns a random Fuck My Life bit",
"give":"[give <arg>] Gives the Pneumatic Disposal Unit the argument",
"help":"[help [<command>]] Returns the list of commands or a detailed description of a command if specified",
"hmaths":"[hmaths <arg>] Takes a math equation (Like 5+5) and returns a hex result",
"makequote":"[makequote <arg>] Creates a quote with arg being the quote itself",
"maths":"[maths <arg>] Takes a math equation (Like 5+5) and returns a default result",
"note":"[note <arg1> [<arg2>]] Opens a note if only arg1 is specified, Creates a note with the name of arg1 and contents of arg2 if arg2 is specified, if you prefix the note name with [CP], it creates a public note only to that channel. Which can be accessed by !note _<note name>",
"notes":"[notes] Displays all your saved notes on %s" %(Name),
"otherball":"[otherball] If Floorbot is on the same channel, %s will ask him a random question when this command is passed" %(Name),
"purgemessages":"[purgemessages] Used to delete all your Tell messages (%s,Tell <User> <Message>)" %(Name),
"quote":"[quote [<author>]] Picks a random quote, if the author is specified, a random quote by that author",
"redmine":"[redmine] If you have a note called redmine, with a valid whoopshop redmine address, this displays all the bugs labeled as 'New' on that page. It also displays the todo note if it's found.",
"replace":"[replace] Fixes the Pneumatic Smasher if it's been broken",
"rot13":"[rot13 <arg>] Encrypts the arg by using the rot13 method",
"rtd":"[rtd [<arg1>d<arg2>]] Rolls a six-sided dice if no arguments are specified, otherwise arg1 is the amount of rolls and arg2 is the amount of sides the dice have",
"sarcasticball":"[sarcasticball <arg>] Responds to the argument sarcastically",
"sball":"[sball <arg>] Responds to the argument sarcastically",
"srtd":"[srtd <arg1>d<arg2>] Rolls <arg1> amount of <arg2> sided die without showing the dice values separately",
"stop":"(RESTRICTED TO OP AND CREATOR) [stop] Stops %s, plain and simple" %(Name),
"suggest":"[suggest <arg>] Saves a suggestion given to %s, to be later viewed by the creator" %(Name),
"take":"[take <arg>] Takes an item specified in the argument from the Pneumatic Smasher",
"tban":"(OP ONLY) [tban <user> <seconds>] When %s is an operator, You can ban an user for specified amount of seconds" %(Name),
"thm":"(RESTRICTED TO OP AND CREATOR) [thm] Normally in 8ball and sarcasticball, Users are not shown, instead replaced by things like demons or plasma researchers, toggling this changes that behaviour.",
"tm":"(OP AND CREATOR ONLY) [tm] Toggles marakov",
"togglequotemakers":"(OP ONLY) [togglequotemakers or tqm] Normally with the quote command, makers are not shown, this toggles that behaviour.",
"tqm":"(OP ONLY) [tqm or togglequotemakers] Normally with the quote command, makers are not shown, this toggles that behaviour.",
"toggleofflinemessages":"(OP ONLY) [toggleofflinemessages or tom] Allows an operator to toggle leaving Tell messages (%s, Tell <User> <Message)" %(Name),
"tom":"(OP ONLY) [tom or toggleofflinemessages] Allows an operator to toggle leaving Tell messages (%s, Tell <User> <Message)" %(Name),
"toggleyoutubereveal":"(OP ONLY) [toggleyoutubereveal] or [tyr] Toggles the automatic showing of youtube video titles based on URL's.",
"tyr":"(OP ONLY) [tyr] or [toggleyoutubereveal] Toggles the automatic showing of youtube video titles based on URL's.",
"translate":"(OP ONLY) [translate <user>] Whenever the user says something in allcaps, it's capitalized.",
"uptime":"[uptime] Displays how long %s has been alive on the channel."%(Name),
"use":"[use] Uses the Pneumatic Smasher.",
"youtube":"[youtube <url>] Shows the title of a video by checking the URL provided.",
"version":"[version] Shows the current version of %s." %(Name),
"weather":"[weather <location>] Displays the current weather of the provided location.",
"life":"I cannot help you with that, sorry."}
-55
View File
@@ -1,55 +0,0 @@
from htmltagremove import htr
def formatter(data):
newdata = []
data = htr(data)
bad = ["Your nick : Categories : ","\r","Advanced search - last",
"FMyLife","Get the guts to spill the beans","FML: Your random funny stories",
"Woman","Man","Choose","Health","Intimacy","Miscellaneous","Man or woman? ",
"Money","Kids","Work","Love","Email notification?",
"Moderate the FMLs","Submit your FML story",
"- If your story isn't published on the website, don't feel offended, and thank you nevertheless&#33;",
"Pick a country","See all","Your account","Team's blog",
"Meet the FMLHello readers! Did you meet someone new this...The whole blog",
"Amazon","Borders","IndieBound","Personalized book","Terms of use",
"FML t-shirts -","Love - Money - Kids - Work - Health - Intimacy - Miscellaneous - Members",
"Follow the FML Follow the FML blog Follow the FML comments ",
"_qoptions={",
"};","})();","Categories","Sign up - Password? ", " Net Avenir : gestion publicitaire",
"FMyLife, the book","Available NOW on:","Barnes &amp; Noble"]
for checkable in data:
if checkable in bad:
pass
elif "_gaq.push" in checkable:
pass
elif "ga.src" in checkable:
pass
elif "var _gaq" in checkable:
pass
elif "var s =" in checkable:
pass
elif "var ga" in checkable:
pass
elif "function()" in checkable:
pass
elif "siteanalytics" in checkable:
pass
elif "qacct:" in checkable:
pass
elif "\r" in checkable:
pass
elif "ic_" in checkable:
pass
elif "Please note that spam and nonsensical stories" in checkable:
pass
elif "Refresh this page" in checkable:
pass
elif "You...The whole blo" in checkable:
pass
elif "Net Avenir : gestion publicitair" in checkable:
pass
else:
if "Net Avenir : gestion publicitaireClose the advertisement" in checkable:
checkable = checkable.replace("Net Avenir : gestion publicitaireClose the advertisement","")
newdata.append(checkable)
return newdata
File diff suppressed because it is too large Load Diff
-203
View File
@@ -1,203 +0,0 @@
import pickle
import random
import os
import sys
import time
import CORE_DATA
def merge(d1, d2, merger=lambda x,y:x+y):
#http://stackoverflow.com/questions/38987/how-can-i-merge-two-python-dictionaries-as-a-single-expression
result = dict(d1)
for k,v in d2.iteritems():
if k in result:
result[k] = merger(result[k], v)
else:
result[k] = v
return result
full_data = {}
imported_data = {}
try:
tiedostot = os.listdir("Marakov")
except:
os.mkdir("Marakov")
tiedostot = os.listdir("Marakov")
else:
pass
listaus = []
for i in tiedostot:
if "marakov." not in i.lower():
pass
else:
listaus.append(i)
for i in listaus:
tiedosto = open("Marakov/"+i,"r")
old_size = len(full_data.keys())
if i != "Marakov.Cache":
imported_data = merge(imported_data,pickle.load(tiedosto))
print "Added contents of "+i+" (Import)"
print "Entries: "+str(len(imported_data))
else:
full_data = merge(full_data,pickle.load(tiedosto))
new_size = len(full_data.keys())
print "Added contents of "+i
print "Entries: "+str(new_size-old_size)
time.sleep(0.1)
def give_data(data):
state = False
for a,b in zip(data.split(" "),data.split(" ")[1:]):
a = a.lower().replace(",","").replace(".","").replace("?","").replace("!","").replace("(","").replace(")","").replace("[","").replace("]","").replace('"',"").replace("'","")
b = b.lower().replace(",","").replace(".","").replace("?","").replace("!","").replace("(","").replace(")","").replace("[","").replace("]","").replace('"',"").replace("'","")
if a not in [CORE_DATA.prefix+"marakov"]+CORE_DATA.SName:
state = True
if a[:7] == "http://" or a[:7] == "http:\\\\" or a[:4] == "www.":
pass
else:
try:
if b not in full_data[a]:
full_data[a].append(b)
except:
try:
if b not in imported_data[a]:
pass
except:
full_data[a] = []
full_data[a].append(b)
if state == True:
tiedosto = open("Marakov/Marakov.Cache","w")
pickle.dump(full_data,tiedosto)
tiedosto.close()
def form_sentence(argument=None):
length = 0
attempts = 0
while attempts < 20:
sentence = []
if argument != None:
a = argument
else:
try:
a = random.choice(full_data.keys())
except IndexError:
try:
b = random.choice(imported_data.keys())
except IndexError:
attempts = 999
return "No sentences formable at all"
sentence.append(a)
length = 0
attempts += 1
while length < 12 or sentence[-1].lower() in ["but","who","gets","im","most","is","it","if","then","after","over","every","of","on","or","as","the","wheather","whether","a","to","and","for"] and length < 24:
try:
b = random.choice(full_data[a])
except:
try:
b = random.choice(imported_data[a])
except IndexError:
break
except KeyError:
break
else:
sentence.append(b)
length += 1
a = b
else:
sentence.append(b)
length += 1
a = b
if len(sentence) > 5:
argument = None
return sentence
else:
pass
argument = None
return sentence
def remdata(arg):
try:
del(full_data[arg])
except:
print "There is no such data"
else:
tiedosto = open("Marakov/Marakov.Cache","w")
pickle.dump(full_data,tiedosto)
tiedosto.close()
def remobject(arg1,arg2):
try:
del(full_data[arg1][full_data[arg1].index(arg2)])
except ValueError:
print "No such object"
except KeyError:
print "No such data"
else:
tiedosto = open("Marakov/Marakov.Cache","w")
pickle.dump(full_data,tiedosto)
tiedosto.close()
def convert(filename_from,filename_to):
try:
tiedosto = open(filename_from,"r")
data = pickle.load(tiedosto)
tiedosto.close()
except:
try:
tiedosto.close()
except:
pass
print "Error!"
else:
for lista in data.keys():
try:
a = lista[-1]
except IndexError:
pass
else:
if lista[-1] in """",.?!'()[]{}""" and not lista.islower():
if lista[:-1].lower() in data.keys():
data[lista[:-1].lower()] += data[lista]
print "Added "+str(len(data[lista]))+" Objects from "+lista+" To "+lista[:-1].lower()
del(data[lista])
else:
data[lista[:-1].lower()] = data[lista]
print lista+" Is now "+lista[:-1].lower()
del(data[lista])
elif lista[-1] in """",.?!'()[]{}""" and lista.islower():
if lista[:-1] in data.keys():
data[lista[:-1]] += data[lista]
print "Added "+str(len(data[lista]))+" Objects from "+lista+" To "+lista[:-1]
del(data[lista])
else:
data[lista[:-1]] = data[lista]
print lista+" Is now "+lista[:-1]
del(data[lista])
elif not lista.islower():
if lista.lower() in data.keys():
data[lista.lower()] += data[lista]
print "Added "+str(len(data[lista]))+" Objects from "+lista+" To "+lista.lower()
del(data[lista])
else:
data[lista.lower()] = data[lista]
print lista+" Is now "+lista.lower()
del(data[lista])
for a in data.keys():
for b in data[a]:
if b.lower()[:7] == "http://" or b.lower()[:7] == "http:\\\\" or b.lower()[:4] == "www.":
data[a].pop(b)
else:
try:
if b[-1] in """",.?!'()[]{}""" and not b.islower() and not b.isdigit():
data[a].pop(data[a].index(b))
data[a].append(b[:-1].lower())
print a+" | "+b +" -> "+b[:-1].lower()
elif b[-1] in """",.?!'()[]{}""" and b.islower():
data[a].pop(data[a].index(b))
data[a].append(b[:-1].lower())
print a+" | "+b +" -> "+b[:-1]
elif not b.islower() and not b.isdigit():
data[a].pop(data[a].index(b))
data[a].append(b.lower())
print a+" | "+b +" -> "+b.lower()
except IndexError: #If it has no letters.. well.. yeah.
data[a].pop(data[a].index(b))
print "Removed a NULL object"
tiedosto = open(filename_to,"w")
pickle.dump(data,tiedosto)
-19
View File
@@ -1,19 +0,0 @@
def Namecheck(name,against,sender):
__doc__ = "False = No match, True = Match"
for i in against:
if i.lower() in name.lower() and sender.lower() not in name.lower():
return True
else:
pass
def Namecheck_dict(name,against):
__doc__ = "False = No match, True = Match"
fuse = False
for a,i in against.items():
if i.lower() in name.lower():
fuse = True
break
else:
pass
return fuse,a
-1565
View File
File diff suppressed because it is too large Load Diff
-28
View File
@@ -1,28 +0,0 @@
def shortname(name):
lowname = name.lower()
numb = 0
count = 0
spot = 0
for letter in name:
if letter.isupper():
spot = numb
count += 1
numb += 1
if "_" in name:
if name.count("_") > 1:
name = " ".join(name.split("_")[0:name.count("_")])
if name.lower()[-3:] == "the":
return name[:-4]
else:
return name
else:
return name.split("_")[0]
if count > 1:
if len(name[0:spot]) > 2:
return name[0:spot]
if len(name) < 5:
return name #Too short to be shortened
elif "ca" in lowname or "ct" in lowname or "tp" in lowname or "lp" in lowname:
return name[0:max(map(lambda x: lowname.find(x),["ca","ct","tp","lp"]))+1]
else:
return name[0:len(name)/2+len(name)%2]
-204
View File
@@ -1,204 +0,0 @@
#Sources:
# http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/convert/
# http://www.timeanddate.com/library/abbreviations/timezones/na/
# Times are GMT +- x
# For eq.
# EST = -5
# GMT = 0
# UTC = 0
#Times are in hours,
#2.5 = 2 and half hours
global times
times = {"ADT":-3,"HAA":-3, #Synonyms on the same line
"AKDT":-8,"HAY":-8,
"AKST":-9,"HNY":-9,
"AST":-4,"HNA":-4,
"CDT":-5,"HAC":-5,
"CST":-6,"HNC":-6,
"EDT":-4,"HAE":-4,
"EGST":0,
"EGT":-1,
"EST":-5,"HNE":-5,"ET":-5,
"HADT":-9,
"HAST":-10,
"MDT":-6,"HAR":-6,
"MST":-7,"HNR":-7,
"NDT":-2.5,"HAT":-2.5,
"NST":-3.5,"HNT":-3.5,
"PDT":-7,"HAP":-7,
"PMDT":-2,
"PMST":-3,
"PST":-8,"HNP":-8,"PT":-8,
"WGST":-2,
"WGT":-3,
"GMT":0,
"UTC":0}
def converter(zones,time):
#Zones should be a list containing
# ( From zone
# To zone )
global times
#from_z = for example UTC+00:00, WGT or GMT-05:30
#to_z = same style as above.
from_z,to_z = zones
from_z = from_z.upper()
to_z = to_z.upper()
if from_z.find("+") != -1:
from_zone_offset = from_z[from_z.find("+"):]
if ":" in from_zone_offset:
try:
from_zone_offset1,from_zone_offset2 = from_zone_offset.split(":")
except ValueError:
return "Too many or too small amount of values"
try:
from_zone_offset = int(from_zone_offset1) + int(from_zone_offset2)/60.0
except:
return "Error, the 'From Zone' variable has an incorrect offset number"
else:
try:
from_zone_offset = float(from_zone_offset)
except:
return "Error, the 'From Zone' variable has an incorrect offset number"
try:
from_zone_realtime = from_zone_offset + times[from_z[:from_z.find("+")]]
except KeyError:
return "Incorrect From zone"
elif "-" in from_z:
from_zone_offset = from_z[from_z.find("-"):]
if ":" in from_zone_offset:
from_zone_offset1,from_zone_offset2 = from_zone_offset.split(":")
try:
from_zone_offset = -int(from_zone_offset1) + int(from_zone_offset2)/60.0
except:
return "Error, the 'From Zone' variable has an incorrect offset number"
else:
try:
from_zone_offset = -float(from_zone_offset)
except:
return "Error, the 'From Zone' variable has an incorrect offset number"
from_zone_realtime = times[from_z[:from_z.find("-")]] - from_zone_offset
pass
else:
from_zone_offset = 0
try:
from_zone_realtime = from_zone_offset + times[from_z]
except KeyError:
return "Incorrect From zone"
if to_z.find("+") != -1:
to_zone_offset = to_z[to_z.find("+"):]
if ":" in to_zone_offset:
try:
to_zone_offset1,to_zone_offset2 = to_zone_offset.split(":")
except ValueError:
return "Too many or too small amount of values"
try:
to_zone_offset = int(to_zone_offset1) + int(to_zone_offset2)/60.0
except:
return "Error, the 'To Zone' variable has an incorrect offset number"
else:
try:
to_zone_offset = float(to_zone_offset)
except:
return "Error, the 'To Zone' variable has an incorrect offset number"
try:
to_zone_realtime = to_zone_offset + times[to_z[:to_z.find("+")]]
except KeyError:
return "The zone you want the time to be changed to is not found"
elif "-" in to_z:
to_zone_offset = to_z[to_z.find("-"):]
if ":" in to_zone_offset:
to_zone_offset1,to_zone_offset2 = to_zone_offset.split(":")
try:
to_zone_offset = -int(to_zone_offset1) + int(to_zone_offset2)/60.0
except:
return "Error, the 'To Zone' variable has an incorrect offset number"
else:
try:
to_zone_offset = -float(to_zone_offset)
except:
return "Error, the 'To Zone' variable has an incorrect offset number"
to_zone_realtime = times[to_z[:to_z.find("-")]] -to_zone_offset
pass
else:
to_zone_offset = 0
try:
to_zone_realtime = to_zone_offset + times[to_z]
except KeyError:
return "Incorrect To zone"
try:
time_hour,time_minute = time.split(":")
time_hour,time_minute = int(time_hour),int(time_minute)
string = ":"
except:
try:
time_hour,time_minute = time.split(".")
time_hour,time_minute = int(time_hour),int(time_minute)
string = "."
except ValueError:
return "The time was input in an odd way"
if to_zone_realtime % 1.0 == 0.0 and from_zone_realtime % 1.0 == 0.0:
time_hour = time_hour + (to_zone_realtime - from_zone_realtime)
return str(int(time_hour))+string+str(int(time_minute))
else:
if to_zone_realtime % 1.0 != 0.0 and from_zone_realtime % 1.0 != 0.0:
time_minute = time_minute + (((to_zone_realtime % 1.0) * 60) - ((from_zone_realtime % 1.0) * 60))
elif to_zone_realtime % 1.0 != 0.0 and from_zone_realtime % 1.0 == 0.0:
time_minute = time_minute + (((to_zone_realtime % 1.0) * 60) - 0)
elif to_zone_realtime % 1.0 == 0.0 and from_zone_realtime % 1.0 != 0.0:
time_minute = time_minute + (0 - ((from_zone_realtime % 1.0) * 60))
else:
print "Wut?"
time_hour = time_hour + (int(to_zone_realtime//1) - int(from_zone_realtime//1))
return str(int(time_hour))+string+str(int(time_minute))
def formatter(time):
if "." in time:
string = "."
elif ":" in time:
string = ":"
else:
return time
hours,minutes = time.split(string)
days = 0
if int(minutes) < 0:
buphours = int(hours)
hours,minutes = divmod(int(minutes),60)
hours += buphours
if int(minutes) > 60:
hours,minutes = divmod(int(minutes),60)
hours += int(hours)
if int(hours) < 0:
days = 0
days,hours = divmod(int(hours),24)
if int(hours) > 24:
days = 0
days,hours = divmod(int(hours),24)
if int(hours) == 24 and int(minutes) > 0:
days += 1
hours = int(hours) - 24
hours = str(hours)
minutes = str(minutes)
if len(minutes) == 1:
minutes = "0"+minutes
if len(hours) == 1:
hours = "0"+hours
if days > 0:
if days == 1:
return hours+string+minutes+" (Tomorrow)"
else:
return hours+string+minutes+" (After "+str(days)+" days)"
elif days < 0:
if days == -1:
return hours+string+minutes+" (Yesterday)"
else:
return hours+string+minutes+" ("+str(abs(days))+" days ago)"
return hours+string+minutes
-61
View File
@@ -1,61 +0,0 @@
# -*- coding: cp1252 -*-
import urllib,xml.sax.handler
# S10 COMPATIABLE
def message(data):
if data["type"] == "PRIVMSG":
try:
splitdata = data["content"].lower().split(" ")
if splitdata[0] == ":weather" and len(splitdata) > 1:
data = Weather(" ".join(splitdata[1:]))
data["conn"].privmsg(data["target"],"Weather for "+data[1]+": "+data[0])
return True
except KeyError:
print "WUT"
else:
return -1
def Weather(question):
question = question.replace("ä","a")
url = "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query="+question
opener = urllib.FancyURLopener({})
f = opener.open(url)
data = f.read()
f.close()
bufferi = []
seen = False
for i in data.split("\n"):
if "<temperature_string>" in i:
stuff = cutter(i,"<temperature_string>")
if len(stuff) > 7:
bufferi.append("Temperature: "+stuff)
elif "<observation_time>" in i:
stuff = cutter(i,"<observation_time>")
if len(stuff) > 19:
bufferi.append(stuff)
elif "<weather>" in i:
stuff = cutter(i,"<weather>")
if len(stuff) > 0:
bufferi.append("Weather: "+stuff)
elif "<relative_humidity>" in i:
stuff = cutter(i,"<relative_humidity>")
if len(stuff) > 0:
bufferi.append("Humidity: "+stuff)
elif "<wind_string>" in i:
stuff = cutter(i,"<wind_string>")
if len(stuff) > 0:
bufferi.append("Wind blows "+stuff)
elif "<pressure_string>" in i:
stuff = cutter(i,"<pressure_string>")
if len(stuff) > 9:
bufferi.append("Air pressure is "+stuff)
elif "<full>" in i and seen == False:
seen = True
where = cutter(i,"<full>")
if len(where) == 4:
where = "Location doesn't exist"
return [", ".join(bufferi),where]
def cutter(fullstring,cut):
fullstring = fullstring.replace(cut,"")
fullstring = fullstring.replace("</"+cut[1:],"")
fullstring = fullstring.replace("\t","")
return fullstring
-75
View File
@@ -1,75 +0,0 @@
from urllib2 import urlopen
from CORE_DATA import directory,no_absolute_paths
def YTCV2(youtube_url,cache=1,debug=0):
import time
__doc__ = "Cache 0 = No cache access, Cache 1 = Cache access (Default)"
if cache == 1:
import md5
import pickle
crypt = md5.md5(youtube_url)
try:
cryp = crypt.hexdigest()
if no_absolute_paths:
tiedosto = open("YTCache/"+cryp,"r")
else:
tiedosto = open(directory+"\NanoTrasen\YTCache\\"+cryp,"r")
aha = pickle.load(tiedosto)
tiedosto.close()
return aha[0]
except:
if no_absolute_paths:
tiedosto = open("YTCache/"+crypt.hexdigest(),"w")
else:
tiedosto = open(directory+"\NanoTrasen\YTCache\\"+crypt.hexdigest(),"w")
else:
pass
youtube_url = youtube_url.replace("http//","http://")
if youtube_url.lower()[0:7] != "http://" and youtube_url[0:4] == "www.":
youtube_url = "http://" + youtube_url
if youtube_url.count("/") + youtube_url.count("\\") < 3:
return "Reflex: Video cannot exist"
else:
if youtube_url[0:7].lower() != "http://":
return "Reflex: Incorrect link start"
try:
website = urlopen(youtube_url)
except:
return "Reflex: Incorrect link!"
for i in website:
if i.count('<meta name="title" content') == 1:
epoch = time.time()
if type(i[30:-3]) != str:
if cache == 1:
aha = ["No title for video",epoch]
pickle.dump(aha,tiedosto)
tiedosto.close()
tiedosto.close()
return "Video deleted"
else:
result = i[30:-3]
if "&amp;quot;" in result:
result = result.replace("&amp;quot;",'"')
else:
pass
if "&amp;amp;" in result:
result = result.replace("&amp;amp;","&")
else:
pass
if "&amp;#39;" in result:
result = result.replace("&amp;#39;","'")
else:
pass
if cache == 1:
aha = [result,epoch]
pickle.dump(aha,tiedosto)
tiedosto.close()
tiedosto.close()
return result
if cache == 1:
epoch = time.time()
aha = ["No title for video, could be removed / does not exist at all",epoch]
pickle.dump(aha,tiedosto)
tiedosto.close()
tiedosto.close()
return "No title for video, could be removed / does not exist at all"
-132
View File
@@ -1,132 +0,0 @@
from urllib2 import urlopen
import os
import pickle
from CORE_DATA import directory,no_absolute_paths
global did_tell, no_absolute_paths
no_absolute_paths = True
did_tell = False
def YTCV4(youtube_url,cache=1,debug=0):
global did_tell, no_absolute_paths
Do_not_open = True
__doc__ = "Cache does not affect anything, it's legacy for skibot."
try:
cut_down = youtube_url.split("watch?v=")[1].split("&")[0]
if len(cut_down) > 11: #Longer than normal, presume troll.
youtube_url.replace(cut_down,cut_down[:11])
elif len(cut_down) < 11: #Shorter than normal
pass
except IndexError:
return "Reflex: Where's the watch?v=?"
first_two = cut_down[0:2]
try:
if no_absolute_paths:
tiedosto = open("YTCache/"+first_two+".tcc","r")
else:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","r")
except:
prev_dict = {}
else:
try:
prev_dict = pickle.load(tiedosto)
except EOFError: # Cache is corrupt
os.remove(directory+tiedosto.name)
print "REMOVED CORRUPT CACHE: "+tiedosto.name
prev_dict = {}
tiedosto.close() # I think this should belong here.
if cut_down in prev_dict.keys():
return prev_dict[cut_down]
else:
pass
try:
if no_absolute_paths:
tiedosto = open("YTCache/"+first_two+".tcc","w")
else:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w")
except IOError,error:
if len(prev_dict.keys()) > 0:
try:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
except IOError:
if did_tell == False:
did_tell = True
return "COULD NOT ACCESS FILE "+first_two+".tcc! The next time you run this link, it checks it through the web"
Do_not_open = False
else:
did_tell = False
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
else:
pass
return "Very odd error occurred: " + str(error)
youtube_url = youtube_url.replace("http//","http://")
if youtube_url.lower()[0:7] != "http://" and youtube_url[0:4] == "www.":
youtube_url = "http://" + youtube_url
if youtube_url.count("/") + youtube_url.count("\\") < 3:
if len(prev_dict.keys()) > 0:
if Do_not_open == True:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
else:
pass
return "Reflex: Video cannot exist"
else:
if "http://" in youtube_url[0:12].lower() and youtube_url[0:7].lower() != "http://":
youtube_url = youtube_url[youtube_url.find("http://"):]
elif youtube_url[0:7].lower() != "http://":
if len(prev_dict.keys()) > 0:
if Do_not_open == True:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
return "Reflex: Incorrect link start"
if "?feature=player_embedded&" in youtube_url:
youtube_url = youtube_url.replace("?feature=player_embedded&","?")
try:
website = urlopen(youtube_url)
except:
if len(prev_dict.keys()) > 0:
if Do_not_open == True:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
else:
pass
return "Reflex: Incorrect link!"
for i in website.readlines():
if i.count('<meta name="title" content') == 1:
if type(i[30:-3]) != str:
if Do_not_open == True:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
prev_dict[cut_down] = "No title for video"
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
return "Video deleted"
else:
#result = i[30:-3]
contentvar = i.find('content="')
result = i[contentvar+5:i.find('">',contentvar)]
if "&amp;quot;" in result:
result = result.replace("&amp;quot;",'"')
else:
pass
if "&amp;amp;" in result:
result = result.replace("&amp;amp;","&")
else:
pass
if "&amp;#39;" in result:
result = result.replace("&amp;#39;","'")
else:
pass
if Do_not_open == True:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
prev_dict[cut_down] = result
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
return result
if Do_not_open == True:
tiedosto = open(directory+"YTCache/"+first_two+".tcc","w") #This is a Just In Case
prev_dict[cut_down] = "No title for video, Removed / Needs Age verification / Does not exist"
pickle.dump(prev_dict,tiedosto)
tiedosto.close()
return "No title for video, Removed / Needs age verification / Does not exist"
-74
View File
@@ -1,74 +0,0 @@
/// Adminhelp relay IRC bot setup guide
/// CC_Nanotrasen bot created by Skibiliano and distributed under the CC-BY-SA 3.0 license
/// All derivative works of this bot must properly credit Skibiliano as the original author
/// Big thanks to Skibiliano his bot and allowing distribution, and to BS12 for sharing their code for making use of it ingame
QUESTION: What does this bot do?
ANSWER: It, in conjunction with BYOND, relays adminhelps to a designated channel, along with various extra functions that can be accessed by saying !help in the same channel/in a query with the bot.
Some basic info before you set this up:
CC_Nanotrasen is coded in python 2.6 and requires a serverside installation of python 2.6 (obtainable at http://www.python.org/getit/releases/2.6/)
- Python MUST BE installed to the same directory as the .dmb you are using to host your server/server config folder
- CC_Nanotrasen supports, but does not require, Psyco (obtainable at http://psyco.sourceforge.net/download.html) which increases the speed 20-30% and slightly increases RAM usage
Now that that's out of the way, I'll teach you how to set this up.
BOT CONFIG:
Move everything in this folder (this file noninclusive) to the same folder as the hosting server (where your .dmb, config folder, and python are installed)
Open CORE_DATA.py with a text editor of your choice (recommended to be notepad++ or notepad)
You should see 14 lines of code which look like
Name = "CC_NanoTrasen" #The name he uses to connect
no_absolute_paths = True #Do not change this.
debug_on = False
SName = ["cc","nt","trasen","nano","nanotrasen"] #Other names he will respond to, must be lowercase
DISABLE_ALL_NON_MANDATORY_SOCKET_CONNECTIONS = False
directory = "BOT DIRECTORY GOES HERE/" #make sure to keep the "/" at the end
version = "TG CC-BY-SA 6"
Network = 'irc.server.goes.here' #e.g. "irc.rizon.net"
channel = "#CHANNEL GOES HERE" #what channel you want the bot in
channels = ["#CHANNEL GOES HERE","#ALSO ANOTHER CHANNEL GOES HERE IF YOU WANT"] #same as above
greeting = "Welcome!" #what he says when a person he hasn't seen before joins
prefix = "!" #prefix for bot commands
Port = 7000
There are some basic comments besides every important config option in here, but I'll summarize them in detail
NAME - The name the bot assumes when it connects to IRC, so in this example it would join the IRC under the nickname "CC_Nanotrasen"
SNAME - A list of secondary names, with commas, that the bot will respond to for commands (for example, this setup will allow the bot to respond to "nt, tell quarxink he's a terrible writer")
DIRECTORY - The directory of the bot files, dmb, python, and config folder IN FORWARD SLASHES, WITH FORWARD SLASH AT THE END(for example, I host my test server from "c:\tgstation\tgstation13\tgstation.dmb" so for me the line would say directory = "c:/tgstation/tgstation13/")
NETWORK - The IRC server it will connect to, such as "irc.rizon.net"
CHANNEL/CHANNELS - what channel the bot will join (channels allows for multiple channel connections, in the same formatting as SName separates nicknames)
GREETING - CC_Nanotrasen will store the names of people it has seen before, but when a nickname joins that it hasn't seen before it will greet that person with whatever message is put in this
PREFIX = What character/string will be placed before commands for the bot (so if you changed this to "$", you would pull up the bot's help menu by saying $help instead of !help)
PORT - What port to connect to for the IRC server (if you are unsure of what port to use, most IRC clients will show you what port you are connecting to)
Once you have that ready, you're on to step two.
Open up the config folder in your install dir, and open config.txt
Scroll to the bottom, right below #FORBID_SINGULO_POSSESSION should be
##Remove the # mark if you are going to use the SVN irc bot to relay adminhelps
#USEIRCBOT
Just remove the "#" in front of USEIRCBOT (you don't even have to recompile your DMB!
Got that all ready to go? Good, it's time for step three.
Open Dream Daemon (that thing you use when you host)
On the bottom of the window you should see port, security, and visibility.
Change security to "Trusted"
Congratulations, you've set up this bot!
A few things to note as far as features:
Use !help to list most commands for the bot.
You can leave notes for other users! Just say "[bot name], tell [other user's name] [message]"
So let's say you wonder if I'm going to jump in to your IRC ever and you want to tell me this readme was horrible, you would say "Nano, tell Quarxink Your readme was horrible"
TROUBLESHOOTING:
Attempting to run the bot gives me an error about encoding.utf-8.
You've probably installed python to a separate folder than the bot/server, move python's files over and it should run fine
It's telling me connection refused when someone adminhelps.
You've moved the bot to a separate folder from the nudge script, most likely.
BYOND asks me on any restart if I want to allow nudge.py to run.
Set security to trusted in Dream Daemon
If you have any requests, suggestions, or issues not covered by this guide, I can be contacted as Quarxink at #coderbus on irc.rizon.net (If I don't respond, leave me a query with your problem and how to reach you [preferably an email address, steam, other irc channel, or aim/msn])
-15
View File
@@ -1,15 +0,0 @@
from FMLformatter import formatter
from urllib2 import urlopen
try:
from hashlib import md5
except:
from md5 import md5
from save_load import save,load
import CORE_DATA
directory = CORE_DATA.directory
FML = urlopen("http://www.fmylife.com/random")
formatted = formatter(FML.read().split("\n"))
for Quote in formatted:
exact = Quote[:Quote.find("#")]
# print exact
save(directory+"fmlquotes/"+md5(exact).hexdigest()+".txt",exact)
-28
View File
@@ -1,28 +0,0 @@
def htr(data):
ignore = False
if type(data) == list:
b = []
for olio in data:
tempolio = ""
for letter in olio:
if letter == "<":
ignore = True
else:
pass
if ignore != True:
tempolio += letter
else:
pass
if letter == ">":
ignore = False
else:
pass
tempolio = tempolio.replace("\t","")
if len(tempolio) == 0:
pass
elif len(tempolio.replace(" ","")) == 0:
pass
else:
b.append(tempolio)
#Finetuning
return b
-94
View File
@@ -1,94 +0,0 @@
import socket
import time
class IRC:
queue = []
partial = ''
def __init__ ( self, network, port, name, hostName, serverName, realName ):
self.network = network
self.port = port
self.hostName = hostName
self.serverName = serverName
self.realName = realName
self.socket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
self.socket.connect ( ( self.network, self.port ) )
self.address = self.socket.getpeername()
self.nick ( name )
self.send ( 'USER ' + self.name + ' ' + self.serverName + ' ' + self.hostName + ' :' + self.realName )
def quit ( self ):
self.send ( 'QUIT' )
self.socket.close()
def send ( self, text ):
count = 0
try:
count += 1
self.socket.send ( text + '\r\n' )
except:
if count > 10:
time.sleep(1)
self.socket.send(text+'\r\n')
else:
count = 0
def nick ( self, name ):
self.name = name
self.send ( 'NICK ' + self.name )
def addressquery(self):
print self.address
aha = socket.gethostbyaddr(str(self.address[0]))
return aha
def recv ( self, size = 2048 ):
commands = self.socket.recv ( size ).split ( '\r\n' )
if len ( self.partial ):
commands [ 0 ] = self.partial + commands [ 0 ]
self.partial = ''
if len ( commands [ -1 ] ):
self.partial = commands [ -1 ]
self.queue.extend ( commands [ :-1 ] )
else:
self.queue.extend ( commands )
def retrieve ( self ):
if len ( self.queue ):
command = self.queue [ 0 ]
self.queue.pop ( 0 )
return command
else:
return False
def dismantle ( self, command ):
if command:
source = command.split ( ':' ) [ 1 ].split ( ' ' ) [ 0 ]
parameters = command.split ( ':' ) [ 1 ].split ( ' ' ) [ 1: ]
if len(parameters) > 0:
if not len ( parameters [ -1 ] ):
parameters.pop()
if command.count ( ':' ) > 1:
parameters.append(command[command.find(":",command.find(":")+1)+1:])
return source, parameters
def privmsg ( self, destination, message ):
self.send ( 'PRIVMSG ' + destination + ' :' + message )
def handshake(self,hexstring):
self.send("PONG :"+hexstring)
def notice ( self, destination, message ):
self.send ( 'NOTICE ' + destination + ' :' + message )
def join ( self, channel ):
self.send ( 'JOIN ' + channel )
def part ( self, channel ):
self.send ( 'PART ' + channel )
def topic ( self, channel, topic = '' ):
self.send ( 'TOPIC ' + channel + ' ' + topic )
def names ( self, channel ):
self.send ( 'NAMES ' + channel )
def invite ( self, nick, channel ):
self.send ( 'INVITE ' + nick + ' ' + channel )
def mode ( self, channel, mode, nick = '' ):
self.send ( 'MODE ' + channel + ' ' + mode + ' ' + nick )
def banon(self,channel,name):
self.mode(channel,"+b",name)
def banoff(self,channel,name):
self.mode(channel,"-b",name)
def kick ( self, channel, nick, reason = '' ):
self.send ( 'KICK ' + channel + ' ' + nick + ' ' + reason )
def who ( self, pattern ):
self.send ( 'WHO ' + pattern )
def whois ( self, nick ):
self.send ( 'WHOIS ' + nick )
def whowas ( self, nick ):
self.send ( 'WHOWAS ' + nick )
-43
View File
@@ -1,43 +0,0 @@
import os
directory = ""
raw = os.listdir(directory)
extract = []
for i in raw:
if i[-3:] == ".py":
extract.append(i)
toc = 0
toc3 = 0
toc2 = 0
print len(extract),"Files"
lista = []
for ob in extract:
count3 = 0
if directory == "":
tiedosto = open(ob,"r")
tiedosto2 = open(ob,"r")
count3 += os.path.getsize(ob)
toc3 += count3
else:
tiedosto = open(directory+"/"+ob,"r")
tiedosto2 = open(directory+"/"+ob,"r")
count3 += os.path.getsize(directory+"/"+ob)
toc3 += count3
count = 0
count2 = 0
line = tiedosto.readline()
while line != "":
count += 1
toc += 1
line = tiedosto.readline()
count2 += len(tiedosto2.read())
toc2 += count2
lista.append([count,count2,ob,count3])
tiedosto.close()
tiedosto2.close()
print toc,"Lines in total"
print toc2,"Letters in total"
print toc3,"Bytes in total"
for linecount, lettercount, filename, bytecount in lista:
print str(linecount)+" Lines (%s%%) || "%(str(round((float(linecount)/toc)*100,1))),str(lettercount)+" Letters (%s%%) in file " %(str(round((float(lettercount)/toc2)*100,1)))+filename
print str(bytecount) + " Bytes (%s%%) "%(str(round((float(bytecount)/toc3)*100,1)))
-39
View File
@@ -1,39 +0,0 @@
import sys,pickle,socket, CORE_DATA
#def pack():
# path = "/home/ski/Nanotrasen/message.txt"
# ip = sys.argv[1]
# dictionary = {"ip":ip,"data":1}
# try:
# targetfile = open(path,"r")
# except IOError:
# targetfile = open(path,"w")
# pickle.dump(dictionary,targetfile)
# targetfile.close()
# nudge()
# else:
# targetfile.close() #Professionals, have standards.
# pass
def pack():
ip = sys.argv[1]
try:
data = sys.argv[2:] #The rest of the arguments is data
except:
data = "NO DATA SPECIFIED"
dictionary = {"ip":ip,"data":data}
pickled = pickle.dumps(dictionary)
nudge(pickled)
def nudge(data):
if CORE_DATA.DISABLE_ALL_NON_MANDATORY_SOCKET_CONNECTIONS:
pass
else:
HOST = "localhost"
PORT = 45678
size = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST,PORT))
s.send(data)
s.close()
if __name__ == "__main__" and len(sys.argv) > 1: # If not imported and more than one argument
pack()
-24
View File
@@ -1,24 +0,0 @@
import pickle
def save(filename,data,dnrw=0):
if dnrw == 1:
try:
tiedosto = open(filename,"r")
except:
tiedosto = open(filename,"w")
else:
return False
else:
tiedosto = open(filename,"w")
if "http//" in data:
data = data.replace("http//","http://")
pickle.dump(data,tiedosto)
tiedosto.close()
def load(filename):
try:
tiedosto = open(filename,"r")
except IOError:
return "ERROR ERROR ERROR ERR"
a = pickle.load(tiedosto)
tiedosto.close()
return a
-20
View File
@@ -1,20 +0,0 @@
def sbna2(only_one,one_of_these,data):
if type(only_one) != list:
only_one = list(only_one)
if type(data) != list:
data = data.split(" ")
count = 0
for datoid in only_one:
if datoid in data and count >= 1:
return False
elif datoid in data:
count += 1
pass
else:
pass
if count == 0:
return False
for datoid in one_of_these:
if datoid in data:
return True
return False
-40
View File
@@ -1,40 +0,0 @@
from urllib2 import urlopen
from json import loads
from pickle import dump,load
from CORE_DATA import no_absolute_paths
def xkcd(link):
try:
filename = link[link.find("xkcd.com")+9:].replace("/","").replace("\\","")
if no_absolute_paths:
tiedosto = open("xkcdcache/"+filename,"r")
else:
tiedosto = open(directory+"xkcdcache/"+filename,"r")
except:
try:
if no_absolute_paths:
tiedosto = open("xkcdcache/"+filename,"w")
else:
tiedosto = open(directory+"xkcdcache/"+filename,"w")
except IOError:
return "NOTHING"
else:
try:
return load(tiedosto)
except EOFError:
tiedosto = open("xkcdcache/"+filename,"w")
pass #Corrupt cache, moving on.
if link[-1] == "/" or link[-1] == "\\": #Ending is fine.
link += "info.0.json"
else:
link += "/info.0.json"
try:
data = urlopen(link).read()
except:
return "NOTHING"
try:
newdata = loads(data)["title"]
dump(newdata,tiedosto)
return newdata
except:
return "NOTHING"
-50
View File
@@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="DLLSocket" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin\Debug\DLLSocket" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Debug\" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-DBUILD_DLL" />
<Add option="-g" />
</Compiler>
<Linker>
<Add library="user32" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin\Release\DLLSocket" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Release\" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-DBUILD_DLL" />
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="user32" />
</Linker>
</Target>
</Build>
<Unit filename="main.cpp" />
<Unit filename="main.h" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
-1
View File
@@ -1 +0,0 @@
g++ -static -shared -O3 -fPIC main.cpp -o DLLSocket.so
-133
View File
@@ -1,133 +0,0 @@
// OS-specific networking includes
// -------------------------------
#ifdef __WIN32
#include <winsock2.h>
typedef int socklen_t;
#else
extern "C" {
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
}
typedef int SOCKET;
typedef sockaddr_in SOCKADDR_IN;
typedef sockaddr SOCKADDR;
#define SOCKET_ERROR -1
#endif
// Socket used for all communications
SOCKET sock;
// Address of the remote server
SOCKADDR_IN addr;
// Buffer used to return dynamic strings to the caller
#define BUFFER_SIZE 1024
char return_buffer[BUFFER_SIZE];
// exposed functions
// ------------------------------
const char* SUCCESS = "1\0"; // string representing success
#ifdef __WIN32
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __attribute__ ((visibility ("default")))
#endif
// arg1: ip(in the xx.xx.xx.xx format)
// arg2: port(a short)
// return: NULL on failure, SUCCESS otherwise
extern "C" DLL_EXPORT const char* establish_connection(int n, char *v[])
{
// extract args
// ------------
if(n < 2) return 0;
const char* ip = v[0];
const char* port_s = v[1];
unsigned short port = atoi(port_s);
// set up network stuff
// --------------------
#ifdef __WIN32
WSADATA wsa;
WSAStartup(MAKEWORD(2,0),&wsa);
#endif
sock = socket(AF_INET,SOCK_DGRAM,0);
// make the socket non-blocking
// ----------------------------
#ifdef __WIN32
unsigned long iMode=1;
ioctlsocket(sock,FIONBIO,&iMode);
#else
fcntl(sock, F_SETFL, O_NONBLOCK);
#endif
// establish a connection to the server
// ------------------------------------
memset(&addr,0,sizeof(SOCKADDR_IN));
addr.sin_family=AF_INET;
addr.sin_port=htons(port);
// convert the string representation of the ip to a byte representation
addr.sin_addr.s_addr=inet_addr(ip);
return SUCCESS;
}
// arg1: string message to send
// return: NULL on failure, SUCCESS otherwise
extern "C" DLL_EXPORT const char* send_message(int n, char *v[])
{
// extract the args
if(n < 1) return 0;
const char* msg = v[0];
// send the message
int rc = sendto(sock,msg,strlen(msg),0,(SOCKADDR*)&addr,sizeof(SOCKADDR));
// check for errors
if (rc != -1) {
return SUCCESS;
}
else {
return 0;
}
}
// no args
// return: message if any received, NULL otherwise
extern "C" DLL_EXPORT const char* recv_message(int n, char *v[])
{
SOCKADDR_IN sender; // we will store the sender address here
socklen_t sender_byte_length = sizeof(sender);
// Try receiving messages until we receive one that's valid, or there are no more messages
while(1) {
int rc = recvfrom(sock, return_buffer, BUFFER_SIZE,0,(SOCKADDR*) &sender,&sender_byte_length);
if(rc > 0) {
// we could read something
if(sender.sin_addr.s_addr != addr.sin_addr.s_addr) {
continue; // not our connection, ignore and try again
} else {
return_buffer[rc] = 0; // 0-terminate the string
return return_buffer;
}
}
else {
break; // no more messages, stop trying to receive
}
}
return 0;
}
-51
View File
@@ -1,51 +0,0 @@
import subprocess
import socket
import urlparse
UDP_IP="127.0.0.1"
UDP_PORT=8019
sock = socket.socket( socket.AF_INET, # Internet
socket.SOCK_DGRAM ) # UDP
sock.bind( (UDP_IP,UDP_PORT) )
last_ticker_state = None
def handle_message(data, addr):
global last_ticker_state
params = urlparse.parse_qs(data)
print(data)
try:
if params["type"][0] == "log" and str(params["log"][0]) and str(params["message"][0]):
open(params["log"][0],"a+").write(params["message"][0]+"\n")
except IOError:
pass
except KeyError:
pass
try:
if params["type"][0] == "ticker_state" and str(params["message"][0]):
last_ticker_state = str(params["message"][0])
except KeyError:
pass
try:
if params["type"][0] == "startup" and last_ticker_state:
open("crashlog.txt","a+").write("Server exited, last ticker state was: "+last_ticker_state+"\n")
except KeyError:
pass
sock.settimeout(60*6) # 10 minute timeout
while True:
try:
data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
handle_message(data,addr)
except socket.timeout:
# try to start the server again
print("Server timed out.. attempting restart.")
if last_ticker_state:
open("crashmsg.txt","a+").write("Server crashed, trying to reboot. last ticker state: "+last_ticker_state+"\n")
subprocess.call("killall -9 DreamDaemon")
subprocess.call("./start")
-109
View File
@@ -1,109 +0,0 @@
#include "netutil.h"
#include "string.h"
int net_ready = 0;
void net_init()
{
#ifdef _WIN32
WSADATA wsa;
WSAStartup(MAKEWORD(2,0),&wsa);
#endif
net_ready = 1;
}
socket_t connect_sock(char * host, char * port)
{
if(!net_ready)
{
net_init();
}
socket_t out_sock = -1;
struct addrinfo addr_in;
struct addrinfo * addr_proc;
int gai_status;
memset(&addr_in, 0, sizeof(addr_in));
addr_in.ai_family = AF_UNSPEC;
addr_in.ai_socktype = SOCK_STREAM;
addr_in.ai_flags = AI_PASSIVE;
gai_status = getaddrinfo(host, port, &addr_in, &addr_proc);
if(gai_status)
{
return -1;
}
struct addrinfo * ai_p;
for(ai_p = addr_proc; ai_p != 0; ai_p = ai_p->ai_next)
{
out_sock = socket(ai_p->ai_family, ai_p->ai_socktype,
ai_p->ai_protocol);
if((int)out_sock == -1)
{
continue;
}
else if(connect(out_sock, ai_p->ai_addr, ai_p->ai_addrlen) == -1)
{
close_socket(out_sock);
continue;
}
else
{
break;
}
}
if(!out_sock)
{
freeaddrinfo(addr_proc);
return -1;
}
freeaddrinfo(addr_proc);
return out_sock;
}
void send_n(socket_t sock, const char * buf, size_t n)
{
size_t to_send = n;
const char * buf_i = buf;
while(to_send)
{
int sent = send(sock, buf_i, to_send, 0);
if(sent != -1)
{
to_send -= sent;
buf_i += sent;
}
else
{
return;
}
}
return;
}
void recv_n(socket_t sock, char * buf, size_t n)
{
size_t total = 0;
char * buf_i = buf;
while(total < n)
{
int recved = recv(sock, buf_i, n - total, 0);
if(recved > 0)
{
total += recved;
buf_i += recved;
}
else
{
return;
}
}
return;
}
-33
View File
@@ -1,33 +0,0 @@
#ifndef NETUTIL_H
#define NETUTIL_H
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
typedef SOCKET socket_t;
#define close_socket(sock) closesocket(sock)
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
typedef int socket_t;
#define close_socket(sock) close(sock)
#endif
extern int net_ready;
void init_net();
socket_t connect_sock(char * host, char * port);
void send_n(socket_t sock, const char * buf, size_t n);
void recv_n(socket_t sock, char * buf, size_t n);
#endif
-74
View File
@@ -1,74 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include "netutil.h"
#ifdef _WIN32
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __attribute__ ((visibility ("default")))
#endif
size_t san_c(const char * input)
{
unsigned int count = strlen(input);
const char * i;
for(i = input; *i; i++)
{
if(*i == '\\' || *i == '\'')
{
count++;
}
}
return count;
}
char * san_cpy(char * out_buf, const char * in_buf)
{
const char * i_in = in_buf;
char * i_out = out_buf;
while(*i_in)
{
if(*i_in == '\\' || *i_in == '\'')
{
*(i_out++) = '\\';
}
*(i_out++) = *(i_in++);
}
return i_out;
}
DLL_EXPORT const char * nudge(int n, char *v[])
{
if(n != 4)
{
return "";
}
size_t out_c = san_c(v[0]) + san_c(v[2]) + san_c(v[3]);
char * san_out = malloc(out_c + 57);
char * san_i = san_out;
strcpy(san_i, "(dp1\nS'ip'\np2\nS'");
san_i += 16;
san_i = san_cpy(san_i, v[2]);
strcpy(san_i, "'\np3\nsS'data'\np4\n(lp5\nS'");
san_i += 24;
san_i = san_cpy(san_i, v[0]);
strcpy(san_i, "'\np6\naS'");
san_i += 8;
san_i = san_cpy(san_i, v[3]);
strcpy(san_i, "'\np7\nas.");
socket_t nudge_sock = connect_sock(v[1], "45678");
send_n(nudge_sock, san_out, out_c + 56);
close_socket(nudge_sock);
free(san_out);
return "1";
}
Binary file not shown.
Binary file not shown.
-53
View File
@@ -1,53 +0,0 @@
/*
Written by contributor Doohl for the /tg/station Open Source project, hosted on Google Code.
(2012)
*/
var/global/list/config_stream = list()
var/global/list/servers = list()
var/global/list/servernames = list()
var/global/list/adminfiles = list()
var/global/list/adminkeys = list()
proc/gen_configs()
config_stream = dd_file2list("config.txt")
var/server_gen = 0 // if the stream is looking for servers
var/admin_gen = 0 // if the stream is looking for admins
for(var/line in config_stream)
if(line == "\[SERVERS\]")
server_gen = 1
if(admin_gen)
admin_gen = 0
else if(line == "\[ADMINS\]")
admin_gen = 1
if(server_gen)
server_gen = 0
else
if(findtext(line, ".") && !findtext(line, "##"))
if(server_gen)
var/filterline = replacetext(line, " ", "")
var/serverlink = copytext(filterline, findtext( filterline, ")") + 1)
servers.Add(serverlink)
servernames.Add( copytext(line, findtext(line, "("), findtext(line, ")") + 1))
else if(admin_gen)
adminfiles.Add(line)
to_world(line)
// Generate the list of admins now
for(var/file in adminfiles)
var/admin_config_stream = dd_file2list(file)
for(var/line in admin_config_stream)
var/akey = copytext(line, 1, findtext(line, " "))
adminkeys.Add(akey)
Binary file not shown.
-21
View File
@@ -1,21 +0,0 @@
// DM Environment file for Redirect_Tgstation.dme.
// All manual changes should be made outside the BEGIN_ and END_ blocks.
// New source code should be placed in .dm files: choose File/New --> Code File.
// BEGIN_INTERNALS
// END_INTERNALS
// BEGIN_FILE_DIR
#define FILE_DIR .
// END_FILE_DIR
// BEGIN_PREFERENCES
// END_PREFERENCES
// BEGIN_INCLUDE
#include "Configurations.dm"
#include "Redirector.dm"
#include "textprocs.dm"
#include "skin.dmf"
// END_INCLUDE
-87
View File
@@ -1,87 +0,0 @@
/*
Written by contributor Doohl for the /tg/station Open Source project, hosted on Google Code.
(2012)
*/
/* TODO: work on server selection for detected admins */
#define ADMINS 1
#define PLAYERS 0
var/global/player_weight = 1 // players are more likely to join a server with less players
var/global/admin_weight = 5 // admins are more likely to join a server with less admins
var/global/player_substr = "players=" // search for this substring to locate # of players
var/global/admin_substr = "admins=" // search for this to locate # of admins
/world
name = "TGstation Redirector"
/world/New()
..()
gen_configs()
/datum/server
var/players = 0
var/admins = 0
var/weight = 0 // lower weight is good; highet weight is bad
var/link = ""
mob/Login()
..()
var/list/weights = list()
var/list/servers = list()
for(var/x in global.servers)
to_world("[x] [servernames[ global.servers.Find(x) ]]")
var/info = world.Export("[x]?status")
var/datum/server/S = new()
S.players = extract(info, PLAYERS)
S.admins = extract(info, ADMINS)
S.weight += player_weight * S.players
S.link = x
to_world(S.players)
to_world(S.admins)
weights.Add(S.weight)
servers.Add(S)
var/lowest = min(weights)
var/serverlink
for(var/datum/server/S in servers)
if(S.weight == lowest)
serverlink = S.link
src << link(serverlink)
proc/extract(var/data, var/type = PLAYERS)
var/nextpos = 0
if(type == PLAYERS)
nextpos = findtextEx(data, player_substr)
nextpos += length(player_substr)
else
nextpos = findtextEx(data, admin_substr)
nextpos += length(admin_substr)
var/returnval = ""
for(var/i = 1, i <= 10, i++)
var/interval = copytext(data, nextpos + (i-1), nextpos + i)
if(interval == "&")
break
else
returnval += interval
return returnval
-12
View File
@@ -1,12 +0,0 @@
[SERVERS]
## Simply enter a list of servers to poll. Be sure to specify a server name in parentheses.
(Sibyl #1) byond://game.nanotrasen.com:1337
(Sibyl #2) byond://game.nanotrasen.com:2337
[ADMINS]
## Specify some standard Windows filepaths (you may use relative paths) for admin txt lists to poll.
C:\SS13\config\admins.txt
-149
View File
@@ -1,149 +0,0 @@
macro "macro"
elem
name = "North+REP"
command = ".north"
is-disabled = false
elem
name = "South+REP"
command = ".south"
is-disabled = false
elem
name = "East+REP"
command = ".east"
is-disabled = false
elem
name = "West+REP"
command = ".west"
is-disabled = false
elem
name = "Northeast+REP"
command = ".northeast"
is-disabled = false
elem
name = "Northwest+REP"
command = ".northwest"
is-disabled = false
elem
name = "Southeast+REP"
command = ".southeast"
is-disabled = false
elem
name = "Southwest+REP"
command = ".southwest"
is-disabled = false
elem
name = "Center+REP"
command = ".center"
is-disabled = false
menu "menu"
elem
name = "&Quit"
command = ".quit"
category = "&File"
is-checked = false
can-check = false
group = ""
is-disabled = false
saved-params = "is-checked"
window "window"
elem "window"
type = MAIN
pos = 281,0
size = 594x231
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = #000000
is-visible = false
is-disabled = false
is-transparent = false
is-default = true
border = none
drop-zone = false
right-click = false
saved-params = "pos;size;is-minimized;is-maximized"
on-size = ""
title = ""
titlebar = true
statusbar = false
can-close = true
can-minimize = true
can-resize = true
is-pane = false
is-minimized = false
is-maximized = false
can-scroll = none
icon = ""
image = ""
image-mode = stretch
keep-aspect = false
transparent-color = none
alpha = 255
macro = "macro"
menu = ""
on-close = ""
elem "servers"
type = GRID
pos = 8,8
size = 576x152
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #ffffff
background-color = #000000
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = true
right-click = false
saved-params = ""
on-size = ""
cells = 1x1
current-cell = 1,1
show-lines = none
small-icons = true
show-names = true
enable-http-images = false
link-color = #0000ff
visited-color = #ff00ff
line-color = #c0c0c0
style = ""
is-list = false
elem "output1"
type = OUTPUT
pos = 8,168
size = 576x56
anchor1 = none
anchor2 = none
font-family = ""
font-size = 0
font-style = ""
text-color = #ffffff
background-color = #000000
is-visible = true
is-disabled = false
is-transparent = false
is-default = true
border = none
drop-zone = false
right-click = false
saved-params = "max-lines"
on-size = ""
link-color = #0000ff
visited-color = #ff00ff
style = ""
enable-http-images = false
max-lines = 1000
image = ""
-150
View File
@@ -1,150 +0,0 @@
/*
Written by contributor Doohl for the /tg/station Open Source project, hosted on Google Code.
(2012)
NOTE: The below functions are part of BYOND user Deadron's "TextHandling" library.
[ http://www.byond.com/developer/Deadron/TextHandling ]
*/
proc
///////////////////
// Reading files //
///////////////////
dd_file2list(file_path, separator = "\n")
var/file
if (isfile(file_path))
file = file_path
else
file = file(file_path)
return dd_text2list(file2text(file), separator)
////////////////////
// Replacing text //
////////////////////
dd_replacetext(text, search_string, replacement_string)
// A nice way to do this is to split the text into an array based on the search_string,
// then put it back together into text using replacement_string as the new separator.
var/list/textList = dd_text2list(text, search_string)
return dd_list2text(textList, replacement_string)
dd_replaceText(text, search_string, replacement_string)
var/list/textList = dd_text2List(text, search_string)
return dd_list2text(textList, replacement_string)
/////////////////////
// Prefix checking //
/////////////////////
dd_hasprefix(text, prefix)
var/start = 1
var/end = length(prefix) + 1
return findtext(text, prefix, start, end)
dd_hasPrefix(text, prefix)
var/start = 1
var/end = length(prefix) + 1
return findtextEx(text, prefix, start, end)
/////////////////////
// Suffix checking //
/////////////////////
dd_hassuffix(text, suffix)
var/start = length(text) - length(suffix)
if (start) return findtext(text, suffix, start)
dd_hasSuffix(text, suffix)
var/start = length(text) - length(suffix)
if (start) return findtextEx(text, suffix, start)
/////////////////////////////
// Turning text into lists //
/////////////////////////////
dd_text2list(text, separator)
var/textlength = length(text)
var/separatorlength = length(separator)
var/list/textList = new /list()
var/searchPosition = 1
var/findPosition = 1
var/buggyText
while (1) // Loop forever.
findPosition = findtext(text, separator, searchPosition, 0)
buggyText = copytext(text, searchPosition, findPosition) // Everything from searchPosition to findPosition goes into a list element.
textList += "[buggyText]" // Working around weird problem where "text" != "text" after this copytext().
searchPosition = findPosition + separatorlength // Skip over separator.
if (findPosition == 0) // Didn't find anything at end of string so stop here.
return textList
else
if (searchPosition > textlength) // Found separator at very end of string.
textList += "" // So add empty element.
return textList
dd_text2List(text, separator)
var/textlength = length(text)
var/separatorlength = length(separator)
var/list/textList = new /list()
var/searchPosition = 1
var/findPosition = 1
var/buggyText
while (1) // Loop forever.
findPosition = findtextEx(text, separator, searchPosition, 0)
buggyText = copytext(text, searchPosition, findPosition) // Everything from searchPosition to findPosition goes into a list element.
textList += "[buggyText]" // Working around weird problem where "text" != "text" after this copytext().
searchPosition = findPosition + separatorlength // Skip over separator.
if (findPosition == 0) // Didn't find anything at end of string so stop here.
return textList
else
if (searchPosition > textlength) // Found separator at very end of string.
textList += "" // So add empty element.
return textList
dd_list2text(list/the_list, separator)
var/total = the_list.len
if (total == 0) // Nothing to work with.
return
var/newText = "[the_list[1]]" // Treats any object/number as text also.
var/count
for (count = 2, count <= total, count++)
if (separator) newText += separator
newText += "[the_list[count]]"
return newText
dd_centertext(message, length)
var/new_message = message
var/size = length(message)
if (size == length)
return new_message
if (size > length)
return copytext(new_message, 1, length + 1)
// Need to pad text to center it.
var/delta = length - size
if (delta == 1)
// Add one space after it.
return new_message + " "
// Is this an odd number? If so, add extra space to front.
if (delta % 2)
new_message = " " + new_message
delta--
// Divide delta in 2, add those spaces to both ends.
delta = delta / 2
var/spaces = ""
for (var/count = 1, count <= delta, count++)
spaces += " "
return spaces + new_message + spaces
dd_limittext(message, length)
// Truncates text to limit if necessary.
var/size = length(message)
if (size <= length)
return message
else
return copytext(message, 1, length + 1)
File diff suppressed because it is too large Load Diff
-314
View File
@@ -1,314 +0,0 @@
/* Runtime Condenser by Nodrak
* This will sum up identical runtimes into one, giving a total of how many times it occured. The first occurance
* of the runtime will log the proc, source, usr and src, the rest will just add to the total. Infinite loops will
* also be caught and displayed (if any) above the list of runtimes.
*
* How to use:
* 1) Copy and paste your list of runtimes from Dream Daemon into input.exe
* 2) Run RuntimeCondenser.exe
* 3) Open output.txt for a condensed report of the runtimes
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//Make all of these global. It's bad yes, but it's a small program so it really doesn't affect anything.
//Because hardcoded numbers are bad :(
const unsigned short maxStorage = 99; //100 - 1
//What we use to read input
string currentLine = "Blank";
string nextLine = "Blank";
//Stores lines we want to keep to print out
string storedRuntime[maxStorage+1];
string storedProc[maxStorage+1];
string storedSource[maxStorage+1];
string storedUsr[maxStorage+1];
string storedSrc[maxStorage+1];
//Stat tracking stuff for output
unsigned int totalRuntimes = 0;
unsigned int totalUniqueRuntimes = 0;
unsigned int totalInfiniteLoops = 0;
unsigned int totalUniqueInfiniteLoops = 0;
//Misc
unsigned int numRuntime[maxStorage+1]; //Number of times a specific runtime has occured
bool checkNextLines = false; //Used in case byond has condensed a large number of similar runtimes
int storedIterator = 0; //Used to remember where we stored the runtime
bool readFromFile()
{
//Open file to read
ifstream inputFile("input.txt");
if(inputFile.is_open())
{
while(!inputFile.eof()) //Until end of file
{
//If we've run out of storage
if(storedRuntime[maxStorage] != "Blank") break;
//Update our lines
currentLine = nextLine;
getline(inputFile, nextLine);
//After finding a new runtime, check to see if there are extra values to store
if(checkNextLines)
{
//Skip ahead
currentLine = nextLine;
getline(inputFile, nextLine);
//If we find this, we have new stuff to store
if(nextLine.find("usr:") != std::string::npos)
{
//Store more info
storedSource[storedIterator] = currentLine;
storedUsr[storedIterator] = nextLine;
//Skip ahead again
currentLine = nextLine;
getline(inputFile, nextLine);
//Store the last of the info
storedSrc[storedIterator] = nextLine;
}
checkNextLines = false;
}
//Found an infinite loop!
if(currentLine.find("Infinite loop suspected") != std::string::npos || currentLine.find("Maximum recursion level reached") != std::string::npos)
{
totalInfiniteLoops++;
for(int i=0; i <= maxStorage; i++)
{
//We've already encountered this
if(currentLine == storedRuntime[i])
{
numRuntime[i]++;
break;
}
//We've never encoutnered this
if(storedRuntime[i] == "Blank")
{
storedRuntime[i] = currentLine;
currentLine = nextLine;
getline(inputFile, nextLine); //Skip the "if this is not an infinite loop" line
storedProc[i] = nextLine;
numRuntime[i] = 1;
checkNextLines = true;
storedIterator = i;
totalUniqueInfiniteLoops++;
break;
}
}
}
//Found a runtime!
else if(currentLine.find("runtime error:") != std::string::npos)
{
totalRuntimes++;
for(int i=0; i <= maxStorage; i++)
{
//We've already encountered this
if(currentLine == storedRuntime[i])
{
numRuntime[i]++;
break;
}
//We've never encoutnered this
if(storedRuntime[i] == "Blank")
{
storedRuntime[i] = currentLine;
storedProc[i] = nextLine;
numRuntime[i] = 1;
checkNextLines = true;
storedIterator = i;
totalUniqueRuntimes++;
break;
}
}
}
}
}
else
{
return false;
}
return true;
}
bool writeToFile()
{
//Open and clear the file
ofstream outputFile("Output.txt", ios::trunc);
if(outputFile.is_open())
{
outputFile << "Note: The proc name, source file, src and usr are all from the FIRST of the identical runtimes. Everything else is cropped.\n\n";
if(totalUniqueInfiniteLoops > 0)
{
outputFile << "Total unique infinite loops: " << totalUniqueInfiniteLoops << endl;
}
if(totalInfiniteLoops > 0)
{
outputFile << "Total infinite loops: " << totalInfiniteLoops << endl;
}
outputFile << "Total unique runtimes: " << totalUniqueRuntimes << endl;
outputFile << "Total runtimes: " << totalRuntimes << endl << endl;
//Display a warning if we've hit the maximum space we've allocated for storage
if(totalUniqueRuntimes + totalUniqueInfiniteLoops >= maxStorage)
{
outputFile << "Warning: The maximum number of unique runtimes has been hit. If there were more, they have been cropped out.\n\n";
}
//If we have infinite loops, display them first.
if(totalInfiniteLoops > 0)
{
outputFile << "** Infinite loops **";
for(int i=0; i <= maxStorage; i++)
{
if(storedRuntime[i].find("Infinite loop suspected") != std::string::npos || storedRuntime[i].find("Maximum recursion level reached") != std::string::npos)
{
if(numRuntime[i] != 0) outputFile << endl << endl << "The following infinite loop has occured " << numRuntime[i] << " time(s).\n";
if(storedRuntime[i] != "Blank") outputFile << storedRuntime[i] << endl;
if(storedProc[i] != "Blank") outputFile << storedProc[i] << endl;
if(storedSource[i] != "Blank") outputFile << storedSource[i] << endl;
if(storedUsr[i] != "Blank") outputFile << storedUsr[i] << endl;
if(storedSrc[i] != "Blank") outputFile << storedSrc[i] << endl;
}
}
outputFile << endl << endl; //For spacing
}
//Do runtimes next
outputFile << "** Runtimes **";
for(int i=0; i <= maxStorage; i++)
{
if(storedRuntime[i].find("Infinite loop suspected") != std::string::npos || storedRuntime[i].find("Maximum recursion level reached") != std::string::npos) continue;
if(numRuntime[i] != 0) outputFile << endl << endl << "The following runtime has occured " << numRuntime[i] << " time(s).\n";
if(storedRuntime[i] != "Blank") outputFile << storedRuntime[i] << endl;
if(storedProc[i] != "Blank") outputFile << storedProc[i] << endl;
if(storedSource[i] != "Blank") outputFile << storedSource[i] << endl;
if(storedUsr[i] != "Blank") outputFile << storedUsr[i] << endl;
if(storedSrc[i] != "Blank") outputFile << storedSrc[i] << endl;
}
outputFile.close();
}
else
{
return false;
}
return true;
}
void sortRuntimes()
{
string tempRuntime[maxStorage+1];
string tempProc[maxStorage+1];
string tempSource[maxStorage+1];
string tempUsr[maxStorage+1];
string tempSrc[maxStorage+1];
unsigned int tempNumRuntime[maxStorage+1];
unsigned int highestCount = 0; //Used for descending order
// int keepLooping = 0;
//Move all of our data into temporary arrays. Also clear the stored data (not necessary but.. just incase)
for(int i=0; i <= maxStorage; i++)
{
//Get the largest occurance of a single runtime
if(highestCount < numRuntime[i])
{
highestCount = numRuntime[i];
}
tempRuntime[i] = storedRuntime[i]; storedRuntime[i] = "Blank";
tempProc[i] = storedProc[i]; storedProc[i] = "Blank";
tempSource[i] = storedSource[i]; storedSource[i] = "Blank";
tempUsr[i] = storedUsr[i]; storedUsr[i] = "Blank";
tempSrc[i] = storedSrc[i]; storedSrc[i] = "Blank";
tempNumRuntime[i] = numRuntime[i]; numRuntime[i] = 0;
}
while(highestCount > 0)
{
for(int i=0; i <= maxStorage; i++) //For every runtime
{
if(tempNumRuntime[i] == highestCount) //If the number of occurances of that runtime is equal to our current highest
{
for(int j=0; j <= maxStorage; j++) //Find the next available slot and store the info
{
if(storedRuntime[j] == "Blank") //Found an empty spot
{
storedRuntime[j] = tempRuntime[i];
storedProc[j] = tempProc[i];
storedSource[j] = tempSource[i];
storedUsr[j] = tempUsr[i];
storedSrc[j] = tempSrc[i];
numRuntime[j] = tempNumRuntime[i];
break;
}
}
}
}
highestCount--; //Lower our 'highest' by one and continue
}
}
int main() {
char exit; //Used to stop the program from immediatly exiting
//Start everything fresh. "Blank" should never occur in the runtime logs on its own.
for(int i=0; i <= maxStorage; i++)
{
storedRuntime[i] = "Blank";
storedProc[i] = "Blank";
storedSource[i] = "Blank";
storedUsr[i] = "Blank";
storedSrc[i] = "Blank";
numRuntime[i] = 0;
}
if(readFromFile())
{
cout << "Input read successfully!\n";
}
else
{
cout << "Input failed to open, shutting down.\n";
cout << "\nEnter any letter to quit.\n";
cin >> exit;
return 1;
}
sortRuntimes();
if(writeToFile())
{
cout << "Output was successful!\n";
cout << "\nEnter any letter to quit.\n";
cin >> exit;
return 0;
}
else
{
cout << "The output file could not be opened, shutting down.\n";
cout << "\nEnter any letter to quit.\n";
cin >> exit;
return 0;
}
return 0;
}
-21
View File
@@ -1,21 +0,0 @@
Note: The proc name, source file, src and usr are all from the FIRST of the identical runtimes. Everything else is cropped.
Total unique runtimes: 2
Total runtimes: 2
** Runtimes **
The following runtime has occured 1 time(s).
runtime error: type mismatch: the plating (107,70,1) (/turf/simulated/floor/plating) += the plating (108,70,1) (/turf/simulated/floor/plating)
proc name: IsolateContents (/zone/proc/IsolateContents)
source file: ZAS_Zones.dm,747
usr: null
src: /zone (/zone)
The following runtime has occured 1 time(s).
runtime error: Cannot read null.len
proc name: Rebuild (/zone/proc/Rebuild)
source file: ZAS_Zones.dm,669
usr: null
src: /zone (/zone)
Binary file not shown.
-45
View File
@@ -1,45 +0,0 @@
# StrongDMM
### LICENSE
The contents of this folder are licensed under the GNU General Public License version 3, which can be found in full in ~/LICENSE-GPL3.txt.
The source code can be found at https://github.com/SpaiR/StrongDMM
### Overview
[SpaiR/StrongDMM](https://github.com/SpaiR/StrongDMM) is a 3rd-party program licensed under GPL-v3 that loads in the object tree from a .dme file, and provides an interface very similar to DreamMaker's own mapping interface with which to make and edit .dmm map files. Generally speaking, it loads faster than DM, has several useful features and a cleaner interface, but requires compilation from a separate program (With some care required to ensure that changes are properly copied over). Executables for both Windows and Linux are provided, differentiated by the windows executable being suffixed with `.exe`. There are also instructions on StrongDMM's github page (Linked above) on how to build it from the source code (Not provided)
### Setup
Navigate to `/tools/StrongDMM` and run the launcher appropriate for your operating system. If you're on windows, it ends in `.exe`. If you're on linux, it has no suffix. Because going into those folders is considered tedious by ~~lazy coders~~ basically everyone, it's recommended to set up a shortcut in the root directory. The launcher will automatically update to the latest build and then open the editor. You should see something like this:
![.png](https://puu.sh/H75QH/28c4a5917c.png)
It's important to note the format of the map files you intend to be working with. Byond's native format is very compact, both by organization and actual storage, where single tile definitions and rows of map tiles are each one line, and tile definitions are re-used where possible. This tends to make map diffs much larger and merge conflicts more tedious to deal with. /tg/ has designed their own format, `TGM`, which spreads out tile and map-row definitions across multiple lines, making the file much more human-readable. It also uses a unique definition for each map tile, which increases the size of the map files by a fair margin. DreamMaker doesn't really care what format it loads in, but it only knows how to save to the native format. StrongDMM has a preference to save maps according to either format, and this can be set by going to `File`->`Preferences`, and selecting the appropriate format, as shown:
![.png](https://puu.sh/H75Uj/8b666b11b0.png)
You can also change the other settings as you see fit, but the map save format and nudge mode are most important. Unless you know what you're doing, you probably don't want to change nudge mode, as `step_x/step_y` breaks the commonly-used glide movement animations. Ticking the `Alternate Scrolling Behaviour` will allow you to zoom while holding Space, and scrolling otherwise pans like DreamMaker. With the option unticked, scrolling will only affect zoom. The middle mouse button can always be used to pan, in either case.
### Loading a map
If this is the first time you're using StrongDMM, the panel on the left will be blank except for the `Open Environment...` button at the top. You'll want to click that (Or go `File`->`Open Environment`, or open one directly from `Recent Environments`) and then navigate to the `.dme` file for the project you're working on. StrongDMM needs this to load in the object tree so it can understand the map files that you try to load. It's generally a good idea to make sure that the map files you want to load successfully compile, which generally means making sure the right files for their map-specific objects and areas are ticked when you compile. Once you've loaded an environment, the panel on the left should show the object tree, which looks very similar to DreamMaker's UI, but is notably not a blinding white.
![.png](https://puu.sh/H75YM/dc455a1b42.png)
Next is to load a map. Go to `File`->`Open Available Map...` (Ctrl+Shift+o) and it'll show all map files that exist within the environment you've loaded. Note that some, or even many, of them may not load correctly because you didn't compile all their necessary objects. You can also use `File`->`Open Map` (Ctrl+o) to navigate to the desired map files yourself. Once you click `Open`, it'll take (up to) a couple of seconds to load the map file into the program, and your screen should show whatever's in the bottom-left corner of the map:
![.png](https://puu.sh/H762D/90894c7e49.png)
If the map cannot load correctly because objects aren't defined in the environment tree, you'll see a UI that looks pretty similar to DreamMaker's "Hey this doesn't exist" UI, but again, isn't bright white, and also lets you set variables on the replacements.
![.png](https://puu.sh/H763d/c609eaff27.png)
### Mapping
Once a map is loaded, you're pretty much free to start mapping, just as you would in DreamMaker. You can use Ctrl+[1, 2, 3, 4] to toggle the various layers or do so manually from the `Options` menu, which notably _doesn't_ require ticking any extra boxes. By default, in the bottom right of the screen will be one or two small UI elements. The bottommost one will show the map coordinates of the cursor, and the top one, if present, will allow you to move between Z-levels on maps with multiple Z levels (But not when multiple map _files_ are stitched together into multi-Z).
![.png](https://puu.sh/H7685/da1121bfef.png)
Shift+Right Click will open up the Edit-Variables interface for whatever you clicked on, which can be tricky to do for small things or things on very cluttered tiles, but you can also right click on the tile, and navigate to the appropriate object and click `Edit`. Note that while the Edit-Variables interface is open, you cannot pan or edit the map, the interface consumes all input. This interface also has a filter, so you can quickly and easily find the variable that you're trying to set!
![.png](https://puu.sh/H76aI/0726f5ebc4.png)
The only other really important thing to note is that all these panels can be moved about the whole window, so if you find something is in the way, you're totally free to move it. And again, remember to save (Ctrl+S) and compile your changes before you start your test server and wonder where in the hells all your changes went.
-5
View File
@@ -1,5 +0,0 @@
[diagnostics]
macro_redefined = "off"
macro_undefined_no_definition = "off"
as_local_var = "off"
tmp_no_effect = "off"
Binary file not shown.
Binary file not shown.
@@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnstandardnessTestForDM", "UnstandardnessTestForDM\UnstandardnessTestForDM.csproj", "{A0EEBFC9-41D4-474D-853D-126AFDFB82DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A0EEBFC9-41D4-474D-853D-126AFDFB82DE}.Debug|x86.ActiveCfg = Debug|x86
{A0EEBFC9-41D4-474D-853D-126AFDFB82DE}.Debug|x86.Build.0 = Debug|x86
{A0EEBFC9-41D4-474D-853D-126AFDFB82DE}.Release|x86.ActiveCfg = Release|x86
{A0EEBFC9-41D4-474D-853D-126AFDFB82DE}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -1,160 +0,0 @@
namespace UnstandardnessTestForDM
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.panel1 = new System.Windows.Forms.Panel();
this.listBox2 = new System.Windows.Forms.ListBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(222, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Locate all #defines";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(12, 82);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(696, 160);
this.listBox1.TabIndex = 1;
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.listBox2);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Location = new System.Drawing.Point(12, 297);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(696, 244);
this.panel1.TabIndex = 2;
//
// listBox2
//
this.listBox2.FormattingEnabled = true;
this.listBox2.Location = new System.Drawing.Point(8, 71);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(683, 160);
this.listBox2.TabIndex = 4;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(5, 55);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(69, 13);
this.label4.TabIndex = 3;
this.label4.Text = "Referenced: ";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(5, 42);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Value: ";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(5, 29);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Defined in: ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 29);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(9, 38);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(81, 13);
this.label5.TabIndex = 3;
this.label5.Text = "Files searched: ";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(720, 553);
this.Controls.Add(this.label5);
this.Controls.Add(this.panel1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Unstandardness Test For DM";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
public System.Windows.Forms.ListBox listBox2;
public System.Windows.Forms.Label label5;
public System.Windows.Forms.ListBox listBox1;
}
}
@@ -1,484 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
namespace UnstandardnessTestForDM
{
public partial class Form1 : Form
{
DMSource source;
public Form1()
{
InitializeComponent();
source = new DMSource();
source.mainform = this;
}
private void button1_Click(object sender, EventArgs e)
{
source.find_all_defines();
generate_define_report();
}
public void generate_define_report()
{
TextWriter tw = new StreamWriter("DEFINES REPORT.txt");
tw.WriteLine("Unstandardness Test For DM report for DEFINES");
tw.WriteLine("Generated on " + DateTime.Now);
tw.WriteLine("Total number of defines " + source.defines.Count());
tw.WriteLine("Total number of Files " + source.filessearched);
tw.WriteLine("Total number of references " + source.totalreferences);
tw.WriteLine("Total number of errorous defines " + source.errordefines);
tw.WriteLine("------------------------------------------------");
foreach (Define d in source.defines)
{
tw.WriteLine(d.name);
tw.WriteLine("\tValue: " + d.value);
tw.WriteLine("\tComment: " + d.comment);
tw.WriteLine("\tDefined in: " + d.location + " : " + d.line);
tw.WriteLine("\tNumber of references: " + d.references.Count());
foreach (String s in d.references)
{
tw.WriteLine("\t\t" + s);
}
}
tw.WriteLine("------------------------------------------------");
tw.WriteLine("SUCCESS");
tw.Close();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
Define d = (Define)listBox1.Items[listBox1.SelectedIndex];
label1.Text = d.name;
label2.Text = "Defined in: " + d.location + " : " + d.line;
label3.Text = "Value: " + d.value;
label4.Text = "References: " + d.references.Count();
listBox2.Items.Clear();
foreach (String s in d.references)
{
listBox2.Items.Add(s);
}
}
catch (Exception ex) { Console.WriteLine("ERROR HERE: " + ex.Message); }
}
}
public class DMSource
{
public List<Define> defines;
public const int FLAG_DEFINE = 1;
public Form1 mainform;
public int filessearched = 0;
public int totalreferences = 0;
public int errordefines = 0;
public List<String> filenames;
public DMSource()
{
defines = new List<Define>();
filenames = new List<String>();
}
public void find_all_defines()
{
find_all_files();
foreach(String filename in filenames){
searchFileForDefines(filename);
}
}
public void find_all_files()
{
filenames = new List<String>();
String dmefilename = "";
foreach (string f in Directory.GetFiles("."))
{
if (f.ToLower().EndsWith(".dme"))
{
dmefilename = f;
break;
}
}
if (dmefilename.Equals(""))
{
MessageBox.Show("dme file not found");
return;
}
using (var reader = File.OpenText(dmefilename))
{
String s;
while (true)
{
s = reader.ReadLine();
if (!(s is String))
break;
if (s.StartsWith("#include"))
{
int start = s.IndexOf("\"")+1;
s = s.Substring(start, s.Length - 11);
if (s.EndsWith(".dm"))
{
filenames.Add(s);
}
}
s = s.Trim(' ');
if (s == "") { continue; }
}
reader.Close();
}
}
public void DirSearch(string sDir, int flag)
{
try
{
foreach (string d in Directory.GetDirectories(sDir))
{
foreach (string f in Directory.GetFiles(d))
{
if (f.ToLower().EndsWith(".dm"))
{
if ((flag & FLAG_DEFINE) > 0)
{
searchFileForDefines(f);
}
}
}
DirSearch(d, flag);
}
}
catch (System.Exception excpt)
{
Console.WriteLine("ERROR IN DIRSEARCH");
Console.WriteLine(excpt.Message);
Console.WriteLine(excpt.Data);
Console.WriteLine(excpt.ToString());
Console.WriteLine(excpt.StackTrace);
Console.WriteLine("END OF ERROR IN DIRSEARCH");
}
}
//DEFINES
public void searchFileForDefines(String fileName)
{
filessearched++;
FileInfo f = new FileInfo(fileName);
List<String> lines = new List<String>();
List<String> lines_without_comments = new List<String>();
mainform.label5.Text = "Files searched: " + filessearched + "; Defines found: " + defines.Count() + "; References found: " + totalreferences + "; Errorous defines: " + errordefines;
mainform.label5.Refresh();
//This code segment reads the file and stores it into the lines variable.
using (var reader = File.OpenText(fileName))
{
try
{
String s;
while (true)
{
s = reader.ReadLine();
lines.Add(s);
s = s.Trim(' ');
if (s == "") { continue; }
}
}
catch { }
reader.Close();
}
mainform.listBox1.Items.Add("ATTEMPTING: " + fileName);
lines_without_comments = remove_comments(lines);
/*TextWriter tw = new StreamWriter(fileName);
foreach (String s in lines_without_comments)
{
tw.WriteLine(s);
}
tw.Close();
mainform.listBox1.Items.Add("REWRITE: "+fileName);*/
try
{
for (int i = 0; i < lines_without_comments.Count; i++)
{
String line = lines_without_comments[i];
if (!(line is string))
continue;
//Console.WriteLine("LINE: " + line);
foreach (Define define in defines)
{
if (line.IndexOf(define.name) >= 0)
{
define.references.Add(fileName + " : " + i);
totalreferences++;
}
}
if( line.ToLower().IndexOf("#define") >= 0 )
{
line = line.Trim();
line = line.Replace('\t', ' ');
//Console.WriteLine("LINE = "+line);
String[] slist = line.Split(' ');
if(slist.Length >= 3){
//slist[0] has the value of "#define"
String name = slist[1];
String value = slist[2];
for (int j = 3; j < slist.Length; j++)
{
value += " " + slist[j];
//Console.WriteLine("LISTITEM["+j+"] = "+slist[j]);
}
value = value.Trim();
String comment = "";
if (value.IndexOf("//") >= 0)
{
comment = value.Substring(value.IndexOf("//"));
value = value.Substring(0, value.IndexOf("//"));
}
comment = comment.Trim();
value = value.Trim();
Define d = new Define(fileName,i,name,value,comment);
defines.Add(d);
mainform.listBox1.Items.Add(d);
mainform.listBox1.Refresh();
}else{
Define d = new Define(fileName, i, "ERROR ERROR", "Something went wrong here", line);
errordefines++;
defines.Add(d);
mainform.listBox1.Items.Add(d);
mainform.listBox1.Refresh();
}
}
}
}
catch (Exception e) {
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
MessageBox.Show("Exception: " + e.Message + " | " + e.ToString());
}
}
bool iscomment = false;
int ismultilinecomment = 0;
bool isstring = false;
bool ismultilinestring = false;
int escapesequence = 0;
int stringvar = 0;
public List<String> remove_comments(List<String> lines)
{
List<String> r = new List<String>();
iscomment = false;
ismultilinecomment = 0;
isstring = false;
ismultilinestring = false;
bool skiponechar = false; //Used so the / in */ doesn't get written;
for (int i = 0; i < lines.Count(); i++)
{
String line = lines[i];
if (!(line is String))
continue;
iscomment = false;
isstring = false;
char ca = ' ';
escapesequence = 0;
String newline = "";
int k = line.Length;
for (int j = 0; j < k; j++)
{
char c = line.ToCharArray()[j];
if (escapesequence == 0)
if (normalstatus())
{
if (ca == '/' && c == '/')
{
c = ' ';
iscomment = true;
newline = newline.Remove(newline.Length - 1);
k = line.Length;
}
if (ca == '/' && c == '*')
{
c = ' ';
ismultilinecomment = 1;
newline = newline.Remove(newline.Length - 1);
k = line.Length;
}
if (c == '"')
{
isstring = true;
}
if (ca == '{' && c == '"')
{
ismultilinestring = true;
}
}
else if (isstring)
{
if (c == '\\')
{
escapesequence = 2;
}
else if (stringvar > 0)
{
if (c == ']')
{
stringvar--;
}
else if (c == '[')
{
stringvar++;
}
}
else if (c == '"')
{
isstring = false;
}
else if (c == '[')
{
stringvar++;
}
}
else if (ismultilinestring)
{
if (ca == '"' && c == '}')
{
ismultilinestring = false;
}
}
else if (ismultilinecomment > 0)
{
if (ca == '/' && c == '*')
{
c = ' '; //These things are here to prevent /*/ from bieng interpreted as the start and end of a comment.
skiponechar = true;
ismultilinecomment++;
}
if (ca == '*' && c == '/')
{
c = ' '; //These things are here to prevent /*/ from bieng interpreted as the start and end of a comment.
skiponechar = true;
ismultilinecomment--;
}
}
if (!iscomment && (ismultilinecomment==0) && !skiponechar)
{
newline += c;
}
if (skiponechar)
{
skiponechar = false;
}
if (escapesequence > 0)
{
escapesequence--;
}
else
{
ca = c;
}
}
r.Add(newline.TrimEnd());
}
return r;
}
private bool normalstatus()
{
return !isstring && !ismultilinestring && (ismultilinecomment==0) && !iscomment && (escapesequence == 0);
}
}
public class Define
{
public String location;
public int line;
public String name;
public String value;
public String comment;
public List<String> references;
public Define(String location, int line, String name, String value, String comment)
{
this.location = location;
this.line = line;
this.name = name;
this.value = value;
this.comment = comment;
this.references = new List<String>();
}
public override String ToString()
{
return "DEFINE: \""+name+"\" is defined as \""+value+"\" AT "+location+" : "+line;
}
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace UnstandardnessTestForDM
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
@@ -1,36 +0,0 @@
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("UnstandardnessTestForDM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("UnstandardnessTestForDM")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("c0e09000-1840-4416-8bb2-d86a8227adf1")]
// 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")]
@@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace UnstandardnessTestForDM.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UnstandardnessTestForDM.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace UnstandardnessTestForDM.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,87 +0,0 @@
<?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>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A0EEBFC9-41D4-474D-853D-126AFDFB82DE}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnstandardnessTestForDM</RootNamespace>
<AssemblyName>UnstandardnessTestForDM</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<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|x86' ">
<PlatformTarget>x86</PlatformTarget>
<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.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</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>
-->
</Project>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
@@ -1,18 +0,0 @@
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\bin\Debug\UnstandardnessTestForDM.exe
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\bin\Debug\UnstandardnessTestForDM.pdb
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\ResolveAssemblyReference.cache
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.Form1.resources
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.Properties.Resources.resources
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\GenerateResource.read.1.tlog
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\GenerateResource.write.1.tlog
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.exe
c:\users\baloh\documents\visual studio 2010\Projects\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.pdb
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\bin\Debug\UnstandardnessTestForDM.exe
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\bin\Debug\UnstandardnessTestForDM.pdb
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\ResolveAssemblyReference.cache
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.Form1.resources
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.Properties.Resources.resources
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\GenerateResource.read.1.tlog
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\GenerateResource.write.1.tlog
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.exe
C:\Users\Baloh\Desktop\tgs13\tools\UnstandardnessTestForDM\UnstandardnessTestForDM\obj\x86\Debug\UnstandardnessTestForDM.pdb
-6
View File
@@ -1,6 +0,0 @@
the compiled exe file for the Unstandardness text for DM program is in:
UnstandardnessTestForDM\bin\Debug\UnstandardnessTestForDM.exe
of
UnstandardnessTestForDM\bin\Release\UnstandardnessTestForDM.exe
You have to move it to the root folder (where the dme file is) and run it from there for it to work.