text stringlengths 13 6.01M |
|---|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SetName : MonoBehaviour
{
public InputField nameInputField;
public void SetNameGameManager()
{
GameManager.instance.CharacterName = nameInputField.text;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CS691final.App_Code;
namespace CS691final
{
public partial class Registration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
//submit the user information to customer table
CustomerInfo customer = new CustomerInfo();
customer.UserName = tbxUsername.Text;
customer.Name = tbxName.Text;
customer.Email = tbxEmail.Text;
customer.Password = tbxPassword.Text;
if (!customer.CheckUserExit())
{
customer.InsertCustomerData();
Response.Write("<script> alert('Welcome to FloverTown')</script>");
Response.Redirect("Login.aspx");
// Response.AddHeader("refresh", "3;url=Login.aspx");
}
else
{
lblWarming.Text = "The username already exit!";
lblWarming.ForeColor = System.Drawing.Color.Red;
//Response.AddHeader("refresh", "3;url=Login.aspx");
}
}
}
} |
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using Bow.Enter.Views;
using Xamarin.Forms;
namespace Bow.Enter.ViewModels
{
/// <summary>
/// ViewModel to demonstrate binding to a Command from a GestureRecognizer
/// </summary>
/// <remarks>
/// View models can be used regardless of whether the UI is build in code or with Xaml.
/// In this example the view model is referenced by a Xaml page, but the same bindings
/// can be done in C#.
/// </remarks>
public class FuncViewModel : INotifyPropertyChanged
{
public FuncViewModel()
{
// configure the FuncCommand with a method
FuncCommand = new Command(OnTapped);
}
/// <summary>
/// Expose the FuncCommand via a property so that Xaml can bind to it
/// </summary>
public ICommand FuncCommand { get; }
/// <summary>
/// Called whenever TapCommand is executed (because it was wired up in the constructor)
/// </summary>
void OnTapped(object s)
{
// Debug.WriteLine("parameter: " + s);
switch (s.ToString())
{
case "0.0":
Application.Current.MainPage.Navigation.PushAsync(new NavigationPage(new MainPage()));
break;
case "0.1":
break;
case "0.2":
break;
case "1.0":
break;
case "1.1":
break;
case "1.2":
break;
case "2.0":
break;
case "2.1":
break;
case "2.2":
break;
}
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using V50_IDOMBackOffice.AspxArea.PriceList.Models;
using V50_IDOMBackOffice.AspxArea.MasterData.Controllers;
using IdomOffice.Interface.BackOffice.PriceLists;
using V50_IDOMBackOffice.AspxArea.PriceList.Controllers;
using V50_IDOMBackOffice.AspxArea.PriceList.Controls;
namespace V50_IDOMBackOffice.AspxArea.MasterData.Forms
{
public partial class UnitPopUp : System.Web.UI.Page
{
UnitPopUpController controller = new UnitPopUpController();
IPricelistController pricecontroller = new PurchasePriceFormController();
PriceListModel model;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}
private void Bind()
{
comboboxSiteCode.DataSource = controller.GetSiteCodes();
comboboxSiteCode.DataBind();
}
protected void btnAdd_Click(object sender, EventArgs e)
{
Uri u = HttpContext.Current.Request.Url;
string to = HttpUtility.ParseQueryString(u.Query).Get("to");
string sc = HttpUtility.ParseQueryString(u.Query).Get("sc");
string uc = HttpUtility.ParseQueryString(u.Query).Get("uc");
string oc = HttpUtility.ParseQueryString(u.Query).Get("oc");
string plt = HttpUtility.ParseQueryString(u.Query).Get("plt");
PriceListType targetpricetype = (PriceListType)Enum.Parse(typeof(PriceListType), plt, true);
string sitecode = comboboxSiteCode.SelectedItem==null ? string.Empty: comboboxSiteCode.SelectedItem.Text;
// string unitcode = comboboxUnitCode.SelectedItem==null ? string.Empty: comboboxUnitCode.SelectedItem.Text;
string offercode = comboboxOfferCode.SelectedIndex < 0 ? null : comboboxOfferCode.SelectedItem.Text;
string pricelisttype = comboboxPriceListType.SelectedItem == null ? string.Empty : comboboxPriceListType.SelectedItem.Text;
PriceListType pricetype = (PriceListType)Enum.Parse(typeof(PriceListType), pricelisttype, true);
string faktor = txtFaktor.Text;
decimal faktorvalue = Decimal.Parse(txtFaktor.Text);
pricecontroller.CopyPriceList(to, sitecode, offercode, pricetype, sc, uc, oc, targetpricetype, faktorvalue);
//model = pricecontroller.GetModel(sitecode, unitcode, offercode, pricetype);
//string id = model.id;
//List<SeasonAndPrice> SeasonPrice = new List<SeasonAndPrice>();
//List<SeasonUnitAvailability> Availability = new List<SeasonUnitAvailability>();
//List<SeasonUnitAction> Actions= new List<SeasonUnitAction>();
//List<SeasonUnitCondition> Conditions = new List<SeasonUnitCondition>();
//List<SeasonUnitService> Services = new List<SeasonUnitService>();
//List<PaymentMode> PaymentMode = new List<PaymentMode>();
//List<SpecialPrices> SpecialPrices = new List<SpecialPrices>();
//var price = model.SeasonPriceList;
//SeasonPrice = model.SeasonPriceList;
//Availability = model.AvailabilityList;
//Actions = model.ActionsList;
//Conditions = model.ConditionsList;
//Services = model.ServicesList;
//PaymentMode = model.PaymentModeList;
//SpecialPrices = model.SpecialPricesList;
//if(model.SeasonPriceList.Count>0)
//{
// var prices = GetPrices(price, faktorvalue);
// SeasonPrice.AddRange(prices);
//}
//if(model.AvailabilityList.Count>0)
//{
// Availability.AddRange(model.AvailabilityList);
//}
//if(model.ActionsList.Count>0)
//{
// Actions.AddRange(model.ActionsList);
//}
//if(model.ConditionsList.Count>0)
//{
// Conditions.AddRange(model.ConditionsList);
//}
//if(model.ServicesList.Count>0)
//{
// Services.AddRange(model.ServicesList);
//}
//if(model.PaymentModeList.Count>0)
//{
// PaymentMode.AddRange(model.PaymentModeList);
//}
//if(model.SpecialPricesList.Count>0)
//{
// SpecialPrices.AddRange(model.SpecialPricesList);
//}
//pricecontroller.SavePartialModelSeasonAndPrice(id, SeasonPrice);
//pricecontroller.SavePartialModelSeasonUnitAction(id, Actions);
//pricecontroller.SavePartialModelSeasonUnitAvailability(id, Availability);
//pricecontroller.SavePartialModelSeasonUnitCondition(id, Conditions);
//pricecontroller.SavePartialModelSeasonUnitService(id, Services);
//pricecontroller.SavePartialModelSpecialPrices(id, SpecialPrices);
//pricecontroller.SavePartialModelPaymentMode(id, PaymentMode);
}
protected void comboboxSiteCode_SelectedIndexChanged(object sender, EventArgs e)
{
string sitecode = comboboxSiteCode.SelectedItem.Text;
// string unitcode = comboboxUnitCode.SelectedItem.Text;
comboboxOfferCode.DataSource = controller.GetOfferCodes(sitecode);
comboboxOfferCode.DataBind();
}
protected void comboboxUnitCode_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void comboboxOfferCode_SelectedIndexChanged(object sender, EventArgs e)
{
string sitecode = comboboxSiteCode.SelectedItem.Text;
// string unitcode = comboboxUnitCode.SelectedItem.Text;
string offercode = comboboxOfferCode.SelectedItem.Text;
comboboxPriceListType.DataSource = controller.GetPriceListTypes(sitecode, offercode);
comboboxPriceListType.DataBind();
}
private List<SeasonAndPrice> GetPrices(List<SeasonAndPrice> prices,decimal faktor)
{
List<SeasonAndPrice> newprices = new List<SeasonAndPrice>();
foreach(var price in prices)
{
SeasonAndPrice seasonandprice = new SeasonAndPrice();
seasonandprice = price;
seasonandprice.Eur *= faktor;
newprices.Add(seasonandprice);
}
return newprices;
}
}
} |
using System;
namespace NumberSum
{
/// <summary>
/// Напишете програма, която въвежда цяло число num и отпечатва сумата от цифрите му.
/// </summary>
class Program
{
static void Main()
{
// Ask the user for input
Console.Write("Type a number: ");
string input = Console.ReadLine();
int sum = 0;
// Do the calculations
for (int i = 0; i < input.Length; i++)
{
int number = int.Parse(input[i].ToString());
if (i == input.Length - 1)
{
Console.Write($"{ number }");
}
else
{
Console.Write($"{ number } + ");
}
sum += number;
}
// Print the sum to the console
Console.Write($" = { sum }");
// Wait for input so the program does not close
Console.WriteLine("\nPress Any Key To Exit . . .");
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
namespace ClusterFig.RandomGenerators
{
public interface IRandomGenerator<out T>
{
T Generate();
}
}
|
using Godot;
using System;
public class CntPanels : Control
{
public override void _Ready()
{
// GetNode<Button>("VBoxBtns/BtnControls").Disabled = true;
foreach (Panel p in GetChildren())
{
p.Visible = false;
}
// GetNode<Panel>("CntPanels/PnlControls").Visible = true;
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FXB.DataManager;
using FXB.Data;
using FXB.Common;
namespace FXB.Dialog
{
public partial class ChangePasswordDlg : Form
{
public ChangePasswordDlg()
{
InitializeComponent();
}
private void ChangePasswordDlg_Load(object sender, EventArgs e)
{
this.FormBorderStyle = FormBorderStyle.FixedSingle;
}
private void okBtn_Click(object sender, EventArgs e)
{
EmployeeData curLoginEmployee = AuthMgr.Instance().CurLoginEmployee;
AuthData authData = curLoginEmployee.AuthData;
string oldPwd = oldPwdEdi.Text;
if (oldPwd != authData.Password)
{
MessageBox.Show("旧密码错误");
return;
}
if (newPwdEdi.Text == "")
{
MessageBox.Show("新密码不能为空");
return;
}
if (newPwdEdi.Text != newPwdEdi1.Text)
{
MessageBox.Show("两次密码不一致");
return;
}
try
{
AuthMgr.Instance().ChangePassword(authData.JobNumber, newPwdEdi.Text);
authData.Password = newPwdEdi.Text;
MessageBox.Show("修改成功");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
System.Environment.Exit(0);
}
Close();
}
private void closeBtn_Click(object sender, EventArgs e)
{
Close();
}
}
}
|
using UnityEngine;
using Facebook.Unity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class SAMobileSocialHelper : MonoBehaviour
{
public static SAMobileSocialHelper instance;
public Texture2D lazyAngusIcon;
const string TwitterAddress = "http://twitter.com/intent/tweet";
const string TwitterAppLaunch = "twitter://post";
const string FBAddress = "http://www.facebook.com/dialog/feed";
const string FBAppLaunch = "fb://publish/profile/me";
const string FBAppID = "853535184714876";
int scoreToShare;
// Use this for initialization
void Start ()
{
instance = this;
SPTwitter.instance.Init ();
FB.Init (OnFBInitComplete);
}
// Update is called once per frame
void Update ()
{
}
public void ShareScoreOnTwitter (int score)
{
// FIXME(dbanks)
// Maybe don't need the rest of the functions if this works.
string message = Utilities.GetShareMessageForScore (score);
message += " #LazyAngus";
SPShareUtility.TwitterShare (message, lazyAngusIcon);
}
private void OnFBInitComplete ()
{
if (Debug.isDebugBuild) {
Debug.Log ("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
}
}
public void ShareScoreOnFB (int score, bool isHighScore)
{
ShareScoreOnFBThroughLibraries (score);
}
public void ShareScoreOnFBThroughLibraries (int score)
{
if (Debug.isDebugBuild) {
Debug.Log ("FacebookSharing.ShareScoreThroughLibraries");
}
if (!FB.IsLoggedIn) {
scoreToShare = score;
if (Debug.isDebugBuild) {
Debug.Log ("Calling FB.Login");
}
FB.LogInWithPublishPermissions (new List<string> () { "publish_actions" },
LoginCallback);
} else {
ShareScoreOnFBInternal (score);
}
}
private void LoginCallback (IResult result)
{
if (Debug.isDebugBuild) {
Debug.Log ("FacebookSharing.LoginCallback");
}
if (FB.IsLoggedIn) {
ShareScoreOnFBInternal (scoreToShare);
}
}
private void ShareScoreOnFBInternal (int score)
{
if (Debug.isDebugBuild) {
Debug.Log ("FacebookSharing.ShareScoreInternal");
}
string title = Utilities.GetShareTitleForScore (score);
string message = Utilities.GetShareMessageForScore (score);
if (Debug.isDebugBuild) {
Debug.Log ("title = " + title);
Debug.Log ("message = " + message);
Debug.Log ("Calling FB.Feed");
}
FB.ShareLink (new Uri(Utilities.appURL, true),
title,
message,
new Uri(Utilities.appImageURL, true),
null);
}
/*
private void OnFBFeedFinished (FB_Result result)
{
if (Debug.isDebugBuild) {
Debug.Log ("FacebookSharing.OnFeedFinished");
Debug.Log ("Posted...");
}
}
*/
public void DEPRECATED_ShareScoreOnTwitter (int score)
{
if (Debug.isDebugBuild) {
Debug.Log ("TwitterSharing.ShareScoreThroughURLs");
}
/*
// If twitter authorized, use libraries, else use urls.
if (SPTwitter.instance.IsAuthed) {
DEPRECATED_ShareScoreOnTwitterInternal (score);
} else {
DEPRECATED_ShareScoreOnTwitterThroughURLs (score);
}
*/
}
void DEPRECATED_ShareScoreOnTwitterThroughURLs (int score)
{
if (Debug.isDebugBuild) {
Debug.Log ("TwitterSharing.ShareScoreThroughURLs");
}
string message = Utilities.GetShareMessageForScore (score);
string webURL = TwitterAddress + "?text=" + WWW.EscapeURL (message) +
"&url=" + WWW.EscapeURL (Utilities.appURL) +
"&hashtags=LazyAngus";
message = message + " " + Utilities.appURL + " #LazyAngus";
string appURL = TwitterAppLaunch + "?text=" + WWW.EscapeURL (message);
// OK the appURL For twitter doesn't seem to handle '+', maybe it wants
// %20?
appURL = appURL.Replace ("+", "%20");
StartCoroutine (Utilities.LaunchAppOrWeb (appURL, webURL));
}
void DEPRECATED_ShareScoreOnTwitterInternal (int score)
{
if (Debug.isDebugBuild) {
Debug.Log ("TwitterSharing.ShareScoreInternal");
}
string message = Utilities.GetShareMessageForScore (score);
// SPTwitter.instance.Post (message, lazyAngusIcon);
}
public void DEPRECATED_ShareScoreOnFBThroughURLs (int score)
{
string args = "?app_id=" + FBAppID +
"&link=" + WWW.EscapeURL (Utilities.appURL) +
"&name=" + WWW.EscapeURL ("Lazy Angus") +
"&caption=" + WWW.EscapeURL (Utilities.GetShareTitleForScore (score)) +
"&description=" + WWW.EscapeURL (Utilities.GetShareMessageForScore (score)) +
"&picture=" + WWW.EscapeURL (Utilities.appImageURL) +
"&redirect_uri=" + WWW.EscapeURL ("http://facebook.com");
string webURL = FBAddress + args;
args = "?text=" + WWW.EscapeURL (Utilities.GetShareMessageForScore (score)) +
"&picture=" + WWW.EscapeURL (Utilities.appImageURL);
string appURL = FBAppLaunch + args;
if (Debug.isDebugBuild) {
Debug.Log ("facebook web url = \n" + webURL);
Debug.Log ("facebook app url = \n" + appURL);
}
StartCoroutine (Utilities.LaunchAppOrWeb (appURL, webURL));
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyFirstAppConsoleUI
{
class Program
{
static void Main(string[] args)
{
/** cw doble tap para escribir Console.Write**/
Console.WriteLine("Hello SPVDI 2020 - 2021");//Escribir en consola
Console.ReadKey();
}
}
}
|
using Cupcake.iOS.Network;
using CupcakePCL.BL;
namespace Cupcake.iOS
{
public class IOSConnectivity : IConnectivity
{
private bool _isConnected { get; set; }
public IOSConnectivity()
{
_isConnected = !Reachability.IsHostReachable("http://google.com");;
}
public bool IsConnected()
{
return _isConnected;
}
}
} |
using System.Collections.Generic;
namespace AudioText.Models.ViewModels
{
public class ShoppingCartItemModel
{
public int InventoryItemId { get; set; }
public string ItemName { get; private set; }
public string ItemImage { get; private set; }
public int ItemQuantity { get; private set; }
public decimal ItemTotal { get; private set; }
public decimal ItemPrice { get; private set; }
public ShoppingCartItemModel(int itemId, string itemName, string itemImage, int itemQuantity, decimal itemPrice, decimal itemTotal)
{
this.InventoryItemId = itemId;
this.ItemName = itemName;
this.ItemImage = itemImage;
this.ItemQuantity = itemQuantity;
this.ItemPrice = itemPrice;
this.ItemTotal = itemTotal;
}
}
public class ShoppingCartModels
{
public List<ShoppingCartItemModel> cartItems { get; private set; }
public decimal orderSubtotal { get; private set; }
public decimal orderTax { get; private set; }
public decimal orderCompleteTotal { get; private set; }
public ShoppingCartModels(List<ShoppingCartItemModel> cartItems)
{
this.cartItems = cartItems;
foreach (var nextItem in cartItems)
{
orderSubtotal += nextItem.ItemTotal;
}
orderTax = orderSubtotal * .08M;
orderCompleteTotal = orderSubtotal + orderTax;
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Wpf.ViewModel;
namespace Wpf
{
/// <summary>
/// coverInfoPage.xaml 的交互逻辑
/// </summary>
public partial class CoverInfoPage : Page
{
public CoverInfoPage()
{
CoverViewModel coverViewModel = new CoverViewModel();
InitializeComponent();
this.DataContext = coverViewModel;
}
}
}
|
using Confluent.Kafka;
using System;
using System.Collections.Generic;
using System.Text;
namespace KafkaPubSub
{
public class KafkaConfig
{
public ProducerConfig producerConfig { get; set; }
public ConsumerConfig consumerConfig { get; set; }
public int status { get; set; }
public static KafkaConfig Instance { get; } = new KafkaConfig();
}
}
|
using LibModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace TrungTamTienDat.Models
{
public class ViewModels
{
public List<Album> l_Album { get; set; }
public List<Anh> l_Anh { get; set; }
public List<BaiViet> l_BaiViet { get; set; }
public List<ChuDe> l_ChuDe { get; set; }
public List<DangKy> l_DangKy { get; set; }
public List<GiaoVien> l_GiaoVien { get; set; }
public List<LopHoc> l_LopHoc { get; set; }
public List<PhanHoi> l_PhanHoi { get; set; }
public List<MonHoc> l_MonHoc { get; set; }
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Planet_Explosion_Slow_Beam : MonoBehaviour
{
public GameObject planetSeparateFX;
public GameObject planetExplodeFX;
public GameObject planetExplodeAnim;
public GameObject glowSphere;
public GameObject planetAtmos;
public GameObject orbitalBeamLaser;
public GameObject laserEffects;
public ParticleSystem laserSparks;
public GameObject laserChargeBeam;
public GameObject smokeAndSparks;
public AudioSource laserChargeAudio;
public AudioSource laserAudio;
public AudioSource laserStopAudio;
public GameObject cameraShake;
// Use this for initialization
void Start()
{
planetExplodeFX.SetActive(false);
planetSeparateFX.SetActive(false);
orbitalBeamLaser.SetActive(false);
laserEffects.SetActive(false);
laserChargeBeam.SetActive(false);
smokeAndSparks.SetActive(false);
laserChargeAudio.Stop();
laserAudio.Stop();
laserStopAudio.Stop();
planetAtmos.SetActive(true);
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
StartCoroutine("ExplodePlanet");
}
}
IEnumerator ExplodePlanet()
{
orbitalBeamLaser.SetActive(true);
laserChargeAudio.Play();
laserChargeBeam.SetActive(true);
yield return new WaitForSeconds(1.4f);
laserEffects.SetActive(true);
smokeAndSparks.SetActive(true);
laserSparks.Play();
laserAudio.Play();
planetSeparateFX.SetActive(true);
planetExplodeAnim.GetComponent<Animation>().Play();
yield return new WaitForSeconds(4.5f);
cameraShake.GetComponent<Animation>().Play();
planetAtmos.SetActive(false);
glowSphere.SetActive(false);
planetExplodeFX.SetActive(true);
orbitalBeamLaser.SetActive(false);
yield return new WaitForSeconds(6.0f);
planetExplodeFX.SetActive(false);
planetSeparateFX.SetActive(false);
orbitalBeamLaser.SetActive(false);
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
public class AudioManager : Generic {
public Sound[] sounds;
public static AudioManager instance;
public AudioMixer vaudioMixer;
// Use this for initialization
void Awake () {
if(instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
return;
}
//DontDestroyOnLoad(gameObject);
foreach(Sound s in sounds)
{
s.source = gameObject.AddComponent<AudioSource>();
s.source.clip = s.clip;
s.source.volume = s.volume;
s.source.pitch = s.pitch;
s.source.loop = s.loop;
#if UNITY_WEBGL
Debug.Log("AudioMixer Not Supported");
#else
if (s.output != null || s.output != "")
{
//Debug.Log(vaudioMixer.FindMatchingGroups(s.output)[0]);
s.source.outputAudioMixerGroup = vaudioMixer.FindMatchingGroups(s.output)[0];
}
#endif
}
}
// Update is called once per frame
void Start () {
}
public void Play(string name)
{
if (sounds.Length <= 0)
{
Debug.Log("No sound currently set in this game !");
return;
}
Sound s = Array.Find(sounds, sound => sound.name == name);
if (s == null)
{
Debug.LogWarning("Sound: " + name + " not found!");
return;
}
//Debug.Log(s.name + " VS " + name);
s.source.Play();
}
public void Stop(string name)
{
if (sounds.Length <= 0)
{
Debug.Log("No sound currently set in this game !");
return;
}
Sound s = Array.Find(sounds, sound => sound.name == name);
if (s == null)
{
Debug.LogWarning("Sound: " + name + " not found!");
return;
}
s.source.Stop();
}
public void StopAll()
{
if(sounds.Length <= 0)
{
Debug.Log("No sound currently set in this game !");
return;
}
foreach(Sound s in sounds)
{
s.source.Stop();
}
}
}
|
using Dapper;
using System;
using System.Collections.Generic;
using System.Text;
namespace BulkBook.DataAccess.Repository.IRepository
{
public interface ISP_Call:IDisposable
{
T Sing<T>(string prodcedureName, DynamicParameters param = null);
void Execute(string prodcedureName, DynamicParameters param = null);
T OneRecord<T>(string prodcedureName, DynamicParameters param = null);
IEnumerable<T> List<T>(string prodcedureName, DynamicParameters param = null);
Tuple<IEnumerable<T1>,IEnumerable<T2>> List<T1,T2>(string prodcedureName, DynamicParameters param = null);
}
}
|
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.Diagnostics;
namespace processnote
{
public partial class Processes : Form
{
private Dictionary<int, string> commentList = new Dictionary<int, string>();
private int actualPID = -1;
public Processes()
{
InitializeComponent();
}
private void Processes_Load(object sender, EventArgs e)
{
SetupHeader();
PopulateData();
}
private void SetupHeader()
{
processList.ColumnCount = 5;
processList.EnableHeadersVisualStyles = false;
processList.ColumnHeadersDefaultCellStyle.BackColor = Color.Lavender;
processList.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
processList.Columns[0].Name = "Process";
processList.Columns[1].Name = "PID";
processList.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
processList.Columns[2].Name = "Memory usage";
processList.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
processList.Columns[3].Name = "CPU time";
processList.Columns[4].Name = "Start time";
}
private void PopulateData()
{
Process[] runningProcesses = Process.GetProcesses();
string cpuTime;
string startTime;
foreach (Process process in runningProcesses)
{
try
{
cpuTime = process.TotalProcessorTime.ToString();
startTime = process.StartTime.ToString();
}
catch (Exception)
{
cpuTime = "N/A";
startTime = "N/A";
}
string[] newData =
{
process.ProcessName,
process.Id.ToString(),
(process.WorkingSet64 / 1024).ToString() + " kB",
cpuTime,
startTime
};
processList.Rows.Add(newData);
}
}
private void RefreshButton_Click(object sender, EventArgs e)
{
processList.Rows.Clear();
PopulateData();
}
private void CloseButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void ProcessList_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
processDetails.Clear();
int rowIndex = e.RowIndex;
DataGridViewRow selectedRow = processList.Rows[rowIndex];
foreach (DataGridViewCell cell in selectedRow.Cells)
{
processDetails.AppendText($"{processList.Columns[cell.ColumnIndex].Name}: {cell.Value.ToString()} \n");
}
int.TryParse(selectedRow.Cells[1].Value.ToString(), out actualPID);
commentBox.Text = commentList.Keys.Contains(actualPID) ? commentList[actualPID] : "";
commentBox.Focus();
commentBox.SelectionStart = commentBox.Text.Length;
saveComment.BackColor = Control.DefaultBackColor;
}
private void ProcessList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Right:
int rowIndex = e.RowIndex;
if (rowIndex >= 0)
{
DataGridViewCell pidCell = processList.Rows[rowIndex].Cells[1];
int.TryParse(pidCell.Value.ToString(), out int processId);
}
ContextMenuStrip cms = new ContextMenuStrip();
cms.Items.Add("Kill Process");
cms.Items.Add("Cancel");
try
{
processList.Rows[rowIndex].Cells[e.ColumnIndex].ContextMenuStrip = cms;
}
catch (Exception)
{
}
break;
default:
break;
}
}
private void CommentBox_TextChanged(object sender, EventArgs e)
{
if (actualPID > -1)
{
saveComment.BackColor = Color.IndianRed;
saveComment.Text = "Save comment";
}
}
private void SaveComment_Click(object sender, EventArgs e)
{
SaveComment();
}
private void CommentBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.S)
{
SaveComment();
}
}
private void SaveComment()
{
if (actualPID > -1)
{
commentList[actualPID] = commentBox.Text;
saveComment.BackColor = Color.LawnGreen;
saveComment.Text = "Comment saved";
}
}
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
this.TopMost = !this.TopMost;
}
}
}
|
using UnityEngine;
public class ParticleSystemMonitor : MonoBehaviour
{
// base components
[HideInInspector] public GameObject myGameObject;
[HideInInspector] public ParticleSystem myParticleSystem;
// settings
[Header("settings")]
public bool autoClear;
public int clearDur;
int clearCounter;
void Awake ()
{
myGameObject = gameObject;
myParticleSystem = GetComponent<ParticleSystem>();
clearCounter = 0;
Store();
}
void Update()
{
if ( autoClear )
{
if ( SetupManager.instance != null && !SetupManager.instance.inFreeze )
{
if ( clearCounter < clearDur )
{
clearCounter++;
}
else
{
Clear();
}
}
}
}
public void Store ()
{
if ( SetupManager.instance != null && SetupManager.instance.allParticleSystems != null )
{
if (!SetupManager.instance.allParticleSystems.Contains(myParticleSystem))
{
SetupManager.instance.allParticleSystems.Add(myParticleSystem);
}
}
}
public void Remove ()
{
if (SetupManager.instance != null && SetupManager.instance.allParticleSystems != null)
{
if (SetupManager.instance.allParticleSystems.Contains(myParticleSystem))
{
SetupManager.instance.allParticleSystems.Remove(myParticleSystem);
}
}
if ( myParticleSystem != null )
{
Destroy(myParticleSystem);
}
}
public void Clear ()
{
Remove();
Destroy(myGameObject);
}
public void OnParticleSystemStopped()
{
Clear();
}
}
|
using Dapper;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Framework.Data
{
partial class ModelWrapper
{
/*
* 以IDbConnection + CommandType + commandText + paramType為一個cache
* 一個cache會有一個ParamWrapper用來處理傳入物件轉成DbCommand的參數
* 一個cache會有多個Deserializer,分別為不同回傳類型所對應的deserializer
*/
internal sealed class Cache
{
#region static
private sealed class SerializerIdentity : IEquatable<SerializerIdentity>
{
private readonly string connectionString;
private readonly CommandType commandType;
private readonly string sql;
private readonly Type paramType;
private readonly int hashCode; //we *know* we are using this in a dictionary, so pre-compute this
public SerializerIdentity(IDbConnection conn, CommandType commandType, string sql, Type paramType)
{
connectionString = conn.ConnectionString;
this.commandType = commandType;
this.sql = sql;
this.paramType = paramType;
hashCode = InternalDbHelper.CombineHashCodes(new[] {
connectionString == null ? 0 : StringComparer.Ordinal.GetHashCode(connectionString),
commandType.GetHashCode(),
sql?.GetHashCode() ?? 0,
paramType?.GetHashCode() ?? 0
});
}
public override int GetHashCode() => hashCode;
public bool Equals(SerializerIdentity other) =>
other != null &&
connectionString == other.connectionString &&
commandType == other.commandType &&
sql == other.sql &&
paramType == other.paramType;
}
private static ConcurrentDictionary<SerializerIdentity, Cache> storage = new ConcurrentDictionary<SerializerIdentity, Cache>();
public static Cache GetCache(IDbConnection conn, CommandType commandType, string sql, Type paramType, Func<Func<object, object>> paramWrapperGetter) =>
storage.GetOrAdd(new SerializerIdentity(conn, commandType, sql, paramType), x => new Cache { ParamWrapper = paramWrapperGetter() });
#endregion
private sealed class DeserializerComparer : EqualityComparer<Type[]>
{
public override bool Equals(Type[] x, Type[] y) => x.SequenceEqual(y);
public override int GetHashCode(Type[] obj)
{
var hashCodes = new int[obj.Length];
for (var i = 0; i < obj.Length; i++)
{
hashCodes[i] = obj == null ? 0 : obj.GetHashCode();
}
return InternalDbHelper.CombineHashCodes(hashCodes);
}
}
/// <summary>包裝器,用以將外部傳入的參數包裝成內部丟給Dapper用的參數。</summary>
public Func<object, object> ParamWrapper { get; private set; }
private readonly ConcurrentDictionary<Type[], Func<IDataReader, object>[]> deserializers =
new ConcurrentDictionary<Type[], Func<IDataReader, object>[]>(new DeserializerComparer());
public Func<IDataReader, object>[] GetDeserializer(Type[] resultTypes, Func<Type[], Func<IDataReader, object>[]> valueFactory) =>
deserializers.GetOrAdd(resultTypes, x => valueFactory(resultTypes));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.ServiceModel.Syndication;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using FluentAssertions;
using NUnit.Framework;
namespace Condor.Tests.Learn.SystemServiceModelSyndication
{
[TestFixture]
[Explicit]
internal class ReadFeed
{
private const string FeedUrl = "http://eventstore.local:2113/streams/log";
//private const string FeedUrl = "http://feeds.dzone.com/dzone/frontpage";
[Test]
public async void Do()
{
// expected feed requires Accept header to application/atom+xml.
// Can't do this via XmlReader.Create(url, settings), so use HttpClient
var client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/atom+xml"));
var uri = new UriBuilder(FeedUrl).Uri;
var response = await client.GetAsync(uri);
response.StatusCode.Should().Be(HttpStatusCode.OK);
var contentStream = await response.Content.ReadAsStreamAsync();
var reader = XmlReader.Create(contentStream);
SyndicationFeed feed = SyndicationFeed.Load(reader);
}
[Test]
public async void FindMostRecentItem()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/atom+xml"));
var uri = new UriBuilder(FeedUrl).Uri;
var response = await client.GetAsync(uri);
response.StatusCode.Should().Be(HttpStatusCode.OK);
var contentStream = await response.Content.ReadAsStreamAsync();
var reader = XmlReader.Create(contentStream);
SyndicationFeed feed = SyndicationFeed.Load(reader);
// PublishDate is empty
DateTimeOffset maxDate = feed.Items.Max(x => x.LastUpdatedTime);
var mostRecent = feed.Items.First(x => maxDate == x.LastUpdatedTime);
object stop = null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using NHibernate.Envers;
using NHibernate.Envers.Query;
using NHibernate.Transform;
using Profiling2.Domain;
using Profiling2.Domain.Contracts.Queries.Audit;
using Profiling2.Domain.DTO;
using Profiling2.Domain.Prf.Events;
namespace Profiling2.Infrastructure.Queries.Audit
{
public class EventRevisionsQuery : NHibernateAuditQuery, IEventRevisionsQuery
{
public IList<AuditTrailDTO> GetEventRevisions(Event e)
{
IList<object[]> objects = AuditReaderFactory.Get(Session).CreateQuery()
.ForRevisionsOfEntity(typeof(Event), false, true)
.Add(AuditEntity.Id().Eq(e.Id))
.GetResultList<object[]>();
return this.AddDifferences<Event>(this.TransformToDto(objects));
}
public IList<AuditTrailDTO> GetEventCollectionRevisions<T>(Event e)
{
IList<object[]> objects = AuditReaderFactory.Get(Session).CreateQuery()
.ForRevisionsOfEntity(typeof(T), false, true)
.Add(AuditEntity.Property("Event").Eq(e))
.GetResultList<object[]>();
return this.AddDifferences<T>(this.TransformToDto(objects));
}
public IList<AuditTrailDTO> GetEventRelationshipRevisions(Event e)
{
IList<object[]> subjects = AuditReaderFactory.Get(Session).CreateQuery()
.ForRevisionsOfEntity(typeof(EventRelationship), false, true)
.Add(AuditEntity.Property("SubjectEvent").Eq(e))
.GetResultList<object[]>();
IList<object[]> objects = AuditReaderFactory.Get(Session).CreateQuery()
.ForRevisionsOfEntity(typeof(EventRelationship), false, true)
.Add(AuditEntity.Property("ObjectEvent").Eq(e))
.GetResultList<object[]>();
return this.AddDifferences<EventRelationship>(this.TransformToDto(subjects.Concat(objects).ToList()));
}
public IList<ChangeActivityDTO> GetOldEventAuditTrail(int eventId)
{
string sql = @"
SELECT
A.AdminAuditID AS [LogNo],
ISNULL(U.UserName,U.UserID) AS [Who],
AT.[AdminAuditTypeName]
+ CASE WHEN RIGHT(AT.AdminAuditTypeName, 1) = 'E' THEN 'D ' ELSE 'ED ' END
+ A.ChangedTableName
+ ' ID = ' + CAST(A.ChangedRecordID AS NVARCHAR(12)) AS [What],
A.ChangedDateTime AS [When],
CASE WHEN A.ChangedColumns IS NULL THEN '' ELSE A.ChangedColumns END AS [PreviousValues],
CASE WHEN A.IsProfilingChange = 0 THEN 'Yes' ELSE '' END AS [NonProfilingChange]
FROM PRF_AdminAudit AS A
INNER JOIN
(
SELECT A.AdminAuditID
FROM PRF_Event AS E INNER JOIN PRF_AdminAudit AS A
ON E.EventID = A.ChangedRecordID
AND A.ChangedTableName = 'Event'
WHERE E.EventID = :EventID
UNION ALL
SELECT A.AdminAuditID
FROM PRF_PersonResponsibility AS PR INNER JOIN PRF_AdminAudit AS A
ON PR.PersonResponsibilityID = A.ChangedRecordID
AND A.ChangedTableName = 'PersonResponsibility'
WHERE PR.EventID = :EventID
UNION ALL
SELECT A.AdminAuditID
FROM PRF_OrganizationResponsibility AS OResp INNER JOIN PRF_AdminAudit AS A
ON OResp.OrganizationResponsibilityID = A.ChangedRecordID
AND A.ChangedTableName = 'OrganizationResponsibility'
WHERE OResp.EventID = :EventID
UNION ALL
SELECT A.AdminAuditID
FROM PRF_EventSource AS ES INNER JOIN PRF_AdminAudit AS A
ON ES.EventSourceID = A.ChangedRecordID
AND A.ChangedTableName = 'EventSource'
WHERE ES.EventID = :EventID
UNION ALL
SELECT A.AdminAuditID
FROM PRF_ActionTaken AS AT INNER JOIN PRF_AdminAudit AS A
ON AT.ActionTakenID = A.ChangedRecordID
AND A.ChangedTableName = 'ActionTaken'
WHERE AT.EventID = :EventID
UNION ALL
SELECT A.AdminAuditID
FROM PRF_EventRelationship AS ER INNER JOIN PRF_AdminAudit AS A
ON ER.EventRelationshipID = A.ChangedRecordID
AND A.ChangedTableName = 'EventRelationship'
WHERE ER.SubjectEventID = :EventID OR ER.ObjectEventID = :EventID
) AS AuditTrail
ON AuditTrail.AdminAuditID = A.AdminAuditID
INNER JOIN PRF_AdminUser AS U ON A.AdminUserID = U.AdminUserID
INNER JOIN PRF_AdminAuditType AS AT ON A.AdminAuditTypeID = AT.AdminAuditTypeID
ORDER BY A.ChangedDateTime DESC
";
return Session.CreateSQLQuery(sql)
.SetInt32("EventID", eventId)
.SetResultTransformer(Transformers.AliasToBean(typeof(ChangeActivityDTO)))
.List<ChangeActivityDTO>();
}
public int GetEventCount(DateTime date)
{
int revision = this.GetRevisionNumberForDate(date);
return AuditReaderFactory.Get(Session).CreateQuery()
.ForEntitiesAtRevision(typeof(Event), Convert.ToInt64(revision))
.Add(AuditEntity.Property("Archive").Eq(false))
.GetResultList().Count;
}
}
}
|
using System;
using ChipsDemo.ViewModels;
using ChipsDemo.Views;
using Prism;
using Prism.Ioc;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ChipsDemo
{
[AutoRegisterForNavigation]
public partial class App
{
public App() : this(null) { }
public App(IPlatformInitializer initializer) : base(initializer) { }
protected override async void OnInitialized()
{
InitializeComponent();
XF.Material.Forms.Material.Init(this);
await NavigationService.NavigateAsync($"{nameof(NavigationPage)}/{nameof(HomePage)}");
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<NavigationPage>();
containerRegistry.RegisterForNavigation<HomePage, HomePageViewModel>();
}
}
}
|
using System.Text.RegularExpressions;
namespace Common
{
/// <summary>
/// 操作正则表达式的公共类
/// </summary>
public class RegexHelper
{
#region 验证输入字符串是否与模式字符串匹配
/// <summary>
/// 验证输入字符串是否与模式字符串匹配,匹配返回true
/// </summary>
/// <param name="input">输入字符串</param>
/// <param name="pattern">模式字符串</param>
public static bool IsMatch(string input, string pattern)
{
return IsMatch(input, pattern, RegexOptions.IgnoreCase);
}
/// <summary>
/// 验证输入字符串是否与模式字符串匹配,匹配返回true
/// </summary>
/// <param name="input">输入的字符串</param>
/// <param name="pattern">模式字符串</param>
/// <param name="options">筛选条件</param>
public static bool IsMatch(string input, string pattern, RegexOptions options)
{
return Regex.IsMatch(input, pattern, options);
}
#endregion
public static string GetProductUrl(string productname,int pid)
{
string newurl="";
string pattern = "\\s+";
string replacement = " ";
string oldurl = Regex.Replace(productname.Trim(), @"[^A-Za-z0-9]", replacement);
oldurl = Regex.Replace(oldurl, pattern, replacement);
oldurl = oldurl.Trim();
string[] urls = oldurl.Split(' ');
if (urls.Length > 6)
{
for (int i = 0; i < 6; i++)
{
newurl = newurl + urls[i] + "-";
}
}
else
{
foreach (var item in urls)
{
newurl = newurl + item + "-";
}
}
newurl = ConfigurationHelper.AppSetting("ReleaseProductUrl") + newurl.Substring(0, newurl.LastIndexOf('-')) + "_" + pid + ".html";
return newurl;
}
public static string GetSupplierUrl(string name, int id)
{
string newurl = "";
string pattern = "\\s+";
string replacement = " ";
string oldurl = Regex.Replace(name.Trim(), @"[^A-Za-z0-9]", replacement);
oldurl = Regex.Replace(oldurl, pattern, replacement);
oldurl = oldurl.Trim();
string[] urls = oldurl.Split(' ');
if (urls.Length > 6)
{
for (int i = 0; i < 6; i++)
{
newurl = newurl + urls[i] + "-";
}
}
else
{
foreach (var item in urls)
{
newurl = newurl + item + "-";
}
}
newurl = ConfigurationHelper.AppSetting("ReleaseSupplierUrl") + newurl.Substring(0, newurl.LastIndexOf('-')) + "_" + id + "/index.html";
return newurl;
}
public static string GetNewsUrl(string newsname, int newsid)
{
string newurl = "";
string pattern = "\\s+";
string replacement = " ";
string oldurl = Regex.Replace(newsname.Trim(), @"[^A-Za-z0-9]", replacement);
oldurl = Regex.Replace(oldurl, pattern, replacement);
oldurl = oldurl.Trim();
string[] urls = oldurl.Split(' ');
if (urls.Length > 6)
{
for (int i = 0; i < 6; i++)
{
newurl = newurl + urls[i] + "-";
}
}
else
{
foreach (var item in urls)
{
newurl = newurl + item + "-";
}
}
newurl = ConfigurationHelper.AppSetting("ReleaseNewsUrl") + newurl.Substring(0, newurl.LastIndexOf('-')) + "_" + newsid + ".html";
return newurl;
}
}
}
|
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace marlinX
{
class Program
{
static async Task Main(string[] args)
{
if (!HttpListener.IsSupported)
{
Console.WriteLine("Windows XP SP2 or Server 2003 is required to use the HttpListener class.");
return;
}
// Create a listener.
HttpListener listener = new HttpListener();
// Add the prefixes.
listener.Prefixes.Add("http://127.0.0.1:8081/");
JsonSerializer serializer = new JsonSerializer();
listener.Start();
Console.WriteLine("Listening...");
while (true)
{
// Note: The GetContext method blocks while waiting for a request.
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
// Obtain a response object.
HttpListenerResponse response = context.Response;
response.Headers.Add("Access-Control-Allow-Origin", "http://localhost:4200");
byte[] buffer;
if (request.QueryString.AllKeys.Contains("dateFrom") &&
request.QueryString.AllKeys.Contains("dateTo") &&
request.QueryString.AllKeys.Contains("source"))
{
DateTime fromDate = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(request.QueryString["dateFrom"])).LocalDateTime;
DateTime toDate = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(request.QueryString["dateTo"])).LocalDateTime;
// Construct a response.
var result = await Load.LoadArticlesAsync(fromDate, toDate, request.QueryString["source"]);
response.ContentType = "application/json";
string responseString = JsonConvert.SerializeObject(result);
buffer = Encoding.UTF8.GetBytes(responseString);
// Get a response stream and write the response to it.
response.ContentLength64 = buffer.Length;
}
else
{
buffer = Encoding.UTF8.GetBytes("missing parameter");
// Get a response stream and write the response to it.
response.ContentLength64 = buffer.Length;
response.StatusCode = 400;
}
System.IO.Stream output = response.OutputStream;
output.Write(buffer, 0, buffer.Length);
// You must close the output stream.
output.Close();
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScoreController : MonoBehaviour
{
public GameObject popUp;
public GameObject ball;
public Text winLoseCondition;
public Text playerScoreText;
private string playerScore;
public Text enemyScoreText;
private string enemyScore;
public float maxScore;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
playerScore = PlayerAttribute.score.ToString();
enemyScore = EnemyAttribute.score.ToString();
playerScoreText.text = playerScore;
enemyScoreText.text = enemyScore;
if(PlayerAttribute.score >= maxScore)
{
Time.timeScale = 0;
winLoseCondition.text = "You Win!";
popUp.SetActive(true);
ball.SetActive(false);
}
if(EnemyAttribute.score >= maxScore)
{
Time.timeScale = 0;
winLoseCondition.text = "You Lose!";
popUp.SetActive(true);
ball.SetActive(false);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using TraceWizard.Entities;
using TraceWizard.Logging;
using TraceWizard.Logging.Adapters;
using TraceWizard.Logging.Adapters.MeterMasterCsv;
using TraceWizard.Logging.Adapters.MeterMasterJet;
using TraceWizard.Entities.Adapters;
using TraceWizard.Entities.Adapters.Arff;
using TraceWizard.Entities.Adapters.Tw4Jet;
using TraceWizard.Environment;
using TraceWizard.Classification;
using TraceWizard.Classification.Classifiers.Null;
using TraceWizard.Disaggregation;
namespace TraceWizard.Services {
public static class TwServices {
public static Log CreateLog(string dataSource) {
return CreateLogAdapter(dataSource).Load(dataSource);
}
public static Analysis CreateAnalysis(string dataSource) {
var analysisAdapter = CreateAnalysisAdapter(dataSource);
return analysisAdapter.Load(dataSource);
}
public static bool IsLog(string dataSource) {
var factory = new LogAdapterFactory();
return (factory.GetAdapter(dataSource) != null);
}
public static bool IsAnalysis(string dataSource) {
var factory = new AnalysisAdapterFactory();
return (factory.GetAdapter(dataSource) != null);
}
public static LogAdapter CreateLogAdapter(string dataSource) {
var factory = new LogAdapterFactory();
return factory.GetAdapter(dataSource) as LogAdapter;
}
public static AnalysisAdapter CreateAnalysisAdapter(string dataSource) {
var factory = new AnalysisAdapterFactory();
return factory.GetAdapter(dataSource) as AnalysisAdapter;
}
public static int ExportMdbToCsv(List<string> files) {
var csvAdapter = CreateLogAdapter("dummy.csv") as MeterMasterCsvLogAdapter;
var factory = new LogAdapterFactory();
int countFilesSaved = 0;
foreach (var file in files) {
var logAdapter = factory.GetAdapter(file) as MeterMasterJetLogAdapter;
if (logAdapter != null) {
var log = logAdapter.Load(file) as LogMeter;
csvAdapter.Save(System.IO.Path.ChangeExtension(file, TwEnvironment.CsvLogExtension),log);
countFilesSaved++;
}
}
return countFilesSaved;
}
public static int ExportTdbToTwdb(List<string> files) {
var twdbAdapter = CreateAnalysisAdapter("dummy.twdb") as ArffAnalysisAdapter;
var factory = new AnalysisAdapterFactory();
int countFilesSaved = 0;
foreach (var file in files) {
var analysisAdapter = factory.GetAdapter(file) as Tw4JetAnalysisAdapter;
if (analysisAdapter != null) {
var analysis = analysisAdapter.Load(file);
twdbAdapter.Save(System.IO.Path.ChangeExtension(file, TwEnvironment.ArffAnalysisExtension), analysis, true);
countFilesSaved++;
}
}
return countFilesSaved;
}
public static int ExportLogToTwdb(List<string> files, Disaggregator disaggregator) {
var twdbAdapter = CreateAnalysisAdapter("dummy.twdb") as ArffAnalysisAdapter;
var factory = new LogAdapterFactory();
int countFilesSaved = 0;
foreach (var file in files) {
var logAdapter = factory.GetAdapter(file) as LogAdapter;
if (logAdapter != null) {
var log = logAdapter.Load(file);
var classifier = new NullClassifier();
disaggregator.Log = log;
Events events = disaggregator.Disaggregate();
var analysis = new AnalysisDatabase(file, events, log);
classifier.Classify(analysis);
analysis.UpdateFixtureSummaries();
twdbAdapter.Save(System.IO.Path.ChangeExtension(file, TwEnvironment.ArffAnalysisExtension), analysis, true);
countFilesSaved++;
}
}
return countFilesSaved;
}
public static bool DispatchUtilities(string[] files, Disaggregator disaggregator) {
string currentDirectory = System.Environment.CurrentDirectory;
if (files.Length < 2 || files[1].Length < 2)
return false;
string dispatchArg = files[1];
if (dispatchArg[0] != '-' && dispatchArg[0] != '/')
return false;
var listNormalized = new List<string>();
for (int i = 2; i < files.Length; i++) {
string fileSpec = System.IO.Path.GetFileName(files[i]);
string directory = System.IO.Path.GetDirectoryName(files[i]);
string[] filesDirectory = System.IO.Directory.GetFiles(directory, fileSpec);
foreach (string file in filesDirectory) {
listNormalized.Add(file);
if (!System.IO.File.Exists(file))
throw new Exception("File not found: " + file);
}
}
try {
switch (dispatchArg.Substring(1)) {
case TwEnvironment.MeterMasterJetLogExtension + "to" + TwEnvironment.CsvLogExtension:
TwServices.ExportMdbToCsv(listNormalized);
break;
case TwEnvironment.Tw4JetAnalysisExtension + "to" + TwEnvironment.ArffAnalysisExtension:
TwServices.ExportTdbToTwdb(listNormalized);
break;
//case TwEnvironment.MeterMasterJetLogExtension + "to" + TwEnvironment.ArffAnalysisExtension:
//case TwEnvironment.MeterMasterCsvLogExtension + "to" + TwEnvironment.ArffAnalysisExtension:
//case TwEnvironment.TelematicsLogExtension + "to" + TwEnvironment.ArffAnalysisExtension:
//case TwEnvironment.LogExtension + "to" + TwEnvironment.ArffAnalysisExtension:
case "log" + "to" + TwEnvironment.ArffAnalysisExtension:
case "logs" + "to" + TwEnvironment.ArffAnalysisExtension:
TwServices.ExportLogToTwdb(listNormalized, disaggregator);
break;
default:
throw new Exception("Invalid command line argument: " + dispatchArg.Substring(1));
}
} catch (Exception ex) {
throw new Exception("Trace Wizard Utility error: " + ex.Message);
}
return true;
}
}
}
|
using System.Collections.Generic;
using LocusNew.Core.Models;
namespace LocusNew.Core.Repositories
{
public interface IPropertyBuyersRepository
{
void AddPropertyBuyer(PropertyBuyer propertyBuyer);
int GetBuyersNumber();
PropertyBuyer GetPropertyBuyer(int buyerId);
IEnumerable<PropertyBuyer> GetPropertyBuyers();
void RemovePropertyBuyer(int id);
}
} |
using System;
using Common.Logging;
using NUnit.Framework;
namespace Spring.Messaging.Amqp.Rabbit.Test
{
/// <summary>
/// Determines if the environment is available.
/// </summary>
/// <remarks></remarks>
public class EnvironmentAvailable
{
/// <summary>
/// The logger.
/// </summary>
private static ILog logger = LogManager.GetLogger(typeof(EnvironmentAvailable));
/// <summary>
/// The default environment key.
/// </summary>
private static readonly string DEFAULT_ENVIRONMENT_KEY = "ENVIRONMENT";
/// <summary>
/// The key.
/// </summary>
private readonly string key;
/// <summary>
/// Initializes a new instance of the <see cref="EnvironmentAvailable"/> class.
/// </summary>
/// <param name="key">The key.</param>
/// <remarks></remarks>
public EnvironmentAvailable(string key)
{
this.key = key;
}
/// <summary>
/// Initializes a new instance of the <see cref="EnvironmentAvailable"/> class.
/// </summary>
/// <remarks>
/// </remarks>
public EnvironmentAvailable() : this(DEFAULT_ENVIRONMENT_KEY)
{
}
/// <summary>
/// Applies this instance.
/// </summary>
/// <remarks></remarks>
public void Apply()
{
logger.Info("Evironment: " + this.key + " active=" + this.IsActive());
Assume.That(this.IsActive());
}
/// <summary>
/// Determines whether this instance is active.
/// </summary>
/// <returns><c>true</c> if this instance is active; otherwise, <c>false</c>.</returns>
/// <remarks></remarks>
public bool IsActive()
{
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(this.key));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.ServiceBus.Messaging;
using Newtonsoft.Json;
namespace ControlData
{
public class ReadingProcessor : IEventProcessor
{
public ReadingProcessor(Action<IReading> item)
{
this.ItemCB = item;
}
public const int MessagesBetweenCheckpoints = 100;
private int untilCheckpoint = MessagesBetweenCheckpoints;
private Action<IReading> ItemCB;
public Task CloseAsync(PartitionContext context, CloseReason reason)
{
System.Diagnostics.Trace.TraceInformation("Closing RouteItemProcessor: {0}", reason);
return Task.FromResult(false);
}
public Task OpenAsync(PartitionContext context)
{
System.Diagnostics.Trace.TraceInformation("Opening RouteItemProcessor");
return Task.FromResult(false);
}
public async Task ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> messages)
{
foreach (var message in messages)
{
try
{
var dataStr = Encoding.UTF8.GetString(message.GetBytes());
var readingItem = Utility.DeserializeMessage<ReadingEH>(dataStr);
try
{
this.ItemCB(readingItem);
}
catch (Exception e)
{
System.Diagnostics.Trace.TraceError("Failed to process {0}: {1}", readingItem, e);
throw;
}
this.untilCheckpoint--;
if (this.untilCheckpoint == 0)
{
await context.CheckpointAsync();
this.untilCheckpoint = MessagesBetweenCheckpoints;
}
}
catch (Exception ex)
{
System.Diagnostics.Trace.TraceError(ex.Message);
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using HearthDb.Enums;
using Hearthstone_Deck_Tracker;
namespace PackTracker.View {
class PackNameConverter : IValueConverter {
static Config _config = Config.Instance;
public static Dictionary<int, Dictionary<Locale, string>> PackNamesWS = new Dictionary<int, Dictionary<Locale, string>>() {
{
1, new Dictionary<Locale, string>() {
{ Locale.enUS, "Classic" },
{ Locale.enGB, "Classic" },
{ Locale.frFR, "Classique" },
{ Locale.deDE, "Klassik" },
{ Locale.koKR, "오리지널" },
{ Locale.esES, "Clásico" },
{ Locale.esMX, "Clásico" },
{ Locale.ruRU, "Классический набор" },
{ Locale.zhTW, "經典" },
{ Locale.zhCN, "经典" },
{ Locale.itIT, "Classiche" },
{ Locale.ptBR, "Clássico" },
{ Locale.plPL, "Klasyczne" },
{ Locale.ptPT, "Clássico" },
{ Locale.jaJP, "クラシック" },
{ Locale.thTH, "คลาสสิค" },
}
},
{
9, new Dictionary<Locale, string>() {
{ Locale.enUS, "Goblins vs Gnomes" },
{ Locale.enGB, "Goblins vs Gnomes" },
{ Locale.frFR, "Gobelins et Gnomes" },
{ Locale.deDE, "Goblins gegen Gnome" },
{ Locale.koKR, "고블린 대 노움" },
{ Locale.esES, "Goblins vs. Gnomos" },
{ Locale.esMX, "Goblins versus Gnomos" },
{ Locale.ruRU, "Гоблины и гномы" },
{ Locale.zhTW, "哥哥打地地" },
{ Locale.zhCN, "地精大战侏儒" },
{ Locale.itIT, "Goblin vs Gnomi" },
{ Locale.ptBR, "Goblins vs Gnomos" },
{ Locale.plPL, "Gobliny vs Gnomy" },
{ Locale.ptPT, "Goblins vs Gnomos" },
{ Locale.jaJP, "ゴブリンvsノーム" },
{ Locale.thTH, "Goblins vs Gnomes" },
}
},
{
10, new Dictionary<Locale, string>() {
{ Locale.enUS, "The Grand Tournament" },
{ Locale.enGB, "The Grand Tournament" },
{ Locale.frFR, "Le Grand Tournoi" },
{ Locale.deDE, "Das Große Turnier" },
{ Locale.koKR, "대 마상시합" },
{ Locale.esES, "El Gran Torneo" },
{ Locale.esMX, "El Gran Torneo" },
{ Locale.ruRU, "Большой турнир" },
{ Locale.zhTW, "《銀白聯賽》" },
{ Locale.zhCN, "冠军的试炼" },
{ Locale.itIT, "Gran Torneo" },
{ Locale.ptBR, "O Grande Torneio" },
{ Locale.plPL, "Wielki Turniej" },
{ Locale.ptPT, "O Grande Torneio" },
{ Locale.jaJP, "グランド・トーナメント" },
{ Locale.thTH, "The Grand Tournament" },
}
},
{
11, new Dictionary<Locale, string>() {
{ Locale.enUS, "Whispers of the Old Gods" },
{ Locale.enGB, "Whispers of the Old Gods" },
{ Locale.frFR, "Les murmures des Dieux très anciens" },
{ Locale.deDE, "Das Flüstern der Alten Götter" },
{ Locale.koKR, "고대 신의 속삭임" },
{ Locale.esES, "Susurros de los Dioses Antiguos" },
{ Locale.esMX, "Susurros de los Dioses Antiguos" },
{ Locale.ruRU, "Пробуждение древних богов" },
{ Locale.zhTW, "《古神碎碎念》" },
{ Locale.zhCN, "上古之神的低语" },
{ Locale.itIT, "Sussurri degli Dei Antichi" },
{ Locale.ptBR, "Sussurros dos Deuses Antigos" },
{ Locale.plPL, "Przedwieczni Bogowie" },
{ Locale.ptPT, "Sussurros dos Deuses Antigos" },
{ Locale.jaJP, "旧神のささやき" },
{ Locale.thTH, "Whispers of the Old Gods" },
}
},
{
19, new Dictionary<Locale, string>() {
{ Locale.enUS, "Mean Streets of Gadgetzan" },
{ Locale.enGB, "Mean Streets of Gadgetzan" },
{ Locale.frFR, "Main basse sur Gadgetzan" },
{ Locale.deDE, "Die Straßen von Gadgetzan" },
{ Locale.koKR, "비열한 거리의 가젯잔" },
{ Locale.esES, "Mafias de Gadgetzan" },
{ Locale.esMX, "Mafias de Gadgetzan" },
{ Locale.ruRU, "Злачный город Прибамбасск" },
{ Locale.zhTW, "《黑街英雄之加基森風雲》" },
{ Locale.zhCN, "龙争虎斗加基森" },
{ Locale.itIT, "I bassifondi di Meccania" },
{ Locale.ptBR, "As Gangues de Geringontzan" },
{ Locale.plPL, "Ciemne zaułki Gadżetonu" },
{ Locale.ptPT, "As Gangues de Geringontzan" },
{ Locale.jaJP, "仁義なきガジェッツァン" },
{ Locale.thTH, "Mean Streets of Gadgetzan" },
}
},
{
20, new Dictionary<Locale, string>() {
{ Locale.enUS, "Journey to Un'Goro" },
{ Locale.enGB, "Journey to Un'Goro" },
{ Locale.frFR, "Voyage au centre d’Un’Goro" },
{ Locale.deDE, "Reise nach Un'Goro" },
{ Locale.koKR, "운고로를 향한 여정" },
{ Locale.esES, "Viaje a Un'Goro" },
{ Locale.esMX, "Viaje a Un'Goro" },
{ Locale.ruRU, "Экспедиция в Ун'Горо" },
{ Locale.zhTW, "《安戈洛歷險記》" },
{ Locale.zhCN, "勇闯安戈洛" },
{ Locale.itIT, "Viaggio a Un'Goro" },
{ Locale.ptBR, "Jornada a Un'Goro" },
{ Locale.plPL, "Podróż do wnętrza Un'Goro" },
{ Locale.ptPT, "Jornada a Un'Goro" },
{ Locale.jaJP, "大魔境ウンゴロ" },
{ Locale.thTH, "Journey to Un'Goro" },
}
},
{
21, new Dictionary<Locale, string>() {
{ Locale.enUS, "Knights of the Frozen Throne" },
{ Locale.enGB, "Knights of the Frozen Throne" },
{ Locale.frFR, "Chevaliers du Trône de glace" },
{ Locale.deDE, "Ritter des Frostthrons" },
{ Locale.koKR, "얼어붙은 왕좌의 기사들" },
{ Locale.esES, "Caballeros del Trono Helado" },
{ Locale.esMX, "Caballeros del Trono Helado" },
{ Locale.ruRU, "Рыцари Ледяного Трона" },
{ Locale.zhTW, "《冰封王座》" },
{ Locale.zhCN, "冰封王座的骑士" },
{ Locale.itIT, "Cavalieri del Trono di Ghiaccio" },
{ Locale.ptBR, "Cavaleiros do Trono Gélido" },
{ Locale.plPL, "Rycerze Mroźnego Tronu" },
{ Locale.ptPT, "Cavaleiros do Trono Gélido" },
{ Locale.jaJP, "凍てつく玉座の騎士団" },
{ Locale.thTH, "Knights of the Frozen Throne" },
}
},
{
30, new Dictionary<Locale, string>() {
{ Locale.enUS, "Kobolds and Catacombs" },
{ Locale.enGB, "Kobolds and Catacombs" },
{ Locale.frFR, "Kobolds et Catacombes" },
{ Locale.deDE, "Kobolde & Katakomben" },
{ Locale.koKR, "코볼트와 지하 미궁" },
{ Locale.esES, "Kóbolds & Catacumbas" },
{ Locale.esMX, "Kóbolds & Catacumbas" },
{ Locale.ruRU, "Кобольды и катакомбы" },
{ Locale.zhTW, "《狗頭人與地下城》" },
{ Locale.zhCN, "狗头人与地下世界" },
{ Locale.itIT, "Coboldi & Catacombe" },
{ Locale.ptBR, "Kobolds & Catacumbas" },
{ Locale.plPL, "Koboldy i katakumby" },
{ Locale.ptPT, "Kobolds & Catacumbas" },
{ Locale.jaJP, "コボルトと秘宝の迷宮" },
{ Locale.thTH, "Kobolds and Catacombs" }
}
},
{
31, new Dictionary<Locale, string>() {
{ Locale.enUS, "The Witchwood" },
{ Locale.enGB, "The Witchwood" },
{ Locale.frFR, "Le Bois Maudit" },
{ Locale.deDE, "Der Hexenwald" },
{ Locale.koKR, "마녀숲" },
{ Locale.esES, "El Bosque Embrujado" },
{ Locale.esMX, "El Bosque Embrujado" },
{ Locale.ruRU, "Ведьмин лес" },
{ Locale.zhTW, "《黑巫森林》" },
{ Locale.zhCN, "女巫森林" },
{ Locale.itIT, "Boscotetro" },
{ Locale.ptBR, "O Bosque das Bruxas" },
{ Locale.plPL, "Wiedźmi Las" },
{ Locale.ptPT, "O Bosque das Bruxas" },
{ Locale.jaJP, "妖の森ウィッチウッド" },
{ Locale.thTH, "The Witchwood" }
}
},
{
38, new Dictionary<Locale, string>() {
{ Locale.enUS, "The Boomsday Project" },
{ Locale.enGB, "The Boomsday Project" },
{ Locale.frFR, "Projet Armageboum" },
{ Locale.deDE, "Dr. Bumms Geheimlabor" },
{ Locale.koKR, "박사 붐의 폭심만만 프로젝트" },
{ Locale.esES, "El Proyecto Armagebum" },
{ Locale.esMX, "El Proyecto K-Bum" },
{ Locale.ruRU, "Проект Бумного дня" },
{ Locale.zhTW, "《爆爆計畫》" },
{ Locale.zhCN, "砰砰计划" },
{ Locale.itIT, "Operazione Apocalisse" },
{ Locale.ptBR, "O Projeto Cabum" },
{ Locale.plPL, "Projekt Hukatomba" },
{ Locale.ptPT, "O Projeto Cabum" },
{ Locale.jaJP, "博士のメカメカ大作戦" },
{ Locale.thTH, "The Boomsday Project" },
}
},
{
40, new Dictionary<Locale, string>() {
{ Locale.enUS, "Rastakhan's Rumble" },
{ Locale.enGB, "Rastakhan's Rumble" },
{ Locale.frFR, "Les Jeux de Rastakhan" },
{ Locale.deDE, "Rastakhans Rambazamba" },
{ Locale.koKR, "라스타칸의 대난투" },
{ Locale.esES, "La Arena de Rastakhan" },
{ Locale.esMX, "El Reto de Rastakhan" },
{ Locale.ruRU, "Растахановы игрища" },
{ Locale.zhTW, "《拉斯塔哈大混戰》" },
{ Locale.zhCN, "拉斯塔哈的大乱斗" },
{ Locale.itIT, "La sfida di Rastakhan" },
{ Locale.ptBR, "Ringue do Rastakhan" },
{ Locale.plPL, "Rozróba Rastakana" },
{ Locale.ptPT, "Ringue do Rastakhan" },
{ Locale.jaJP, "天下一ヴドゥ祭" },
{ Locale.thTH, "Rastakhan's Rumble" },
}
},
{
49, new Dictionary<Locale, string>() {
{ Locale.enUS, "Rise of Shadows" },
{ Locale.enGB, "Rise of Shadows" },
{ Locale.frFR, "Éveil des ombres" },
{ Locale.deDE, "Verschwörung der Schatten" },
{ Locale.koKR, "어둠의 반격" },
{ Locale.esES, "El Auge de las Sombras" },
{ Locale.esMX, "Ascenso de las Sombras" },
{ Locale.ruRU, "Возмездие теней" },
{ Locale.zhTW, "《反派大進擊》" },
{ Locale.zhCN, "暗影崛起" },
{ Locale.itIT, "L'ascesa delle ombre" },
{ Locale.ptBR, "Ascensão das Sombras" },
{ Locale. plPL, "Wyjście z cienia" },
{ Locale.ptPT, "Ascensão das Sombras" },
{ Locale.jaJP, "爆誕!悪党同盟" },
{ Locale.thTH, "Rise of Shadows" },
}
},
{
128, new Dictionary<Locale, string>() {
{ Locale.enUS, "Saviors of Uldum" },
{ Locale.enGB, "Saviors of Uldum" },
{ Locale.frFR, "Les Aventuriers d’Uldum" },
{ Locale.deDE, "Retter von Uldum" },
{ Locale.koKR, "울둠의 구원자" },
{ Locale.esES, "Salvadores de Uldum" },
{ Locale.esMX, "Defensores de Uldum" },
{ Locale.ruRU, "Спасители Ульдума" },
{ Locale.zhTW, "《奧丹姆守護者》" },
{ Locale.zhCN, "奧丹姆奇兵" },
{ Locale.itIT, "Salvatori di Uldum" },
{ Locale.ptBR, "Salvadores de Uldum" },
{ Locale. plPL, "Wybawcy Uldum" },
{ Locale.ptPT, "Salvadores de Uldum" },
{ Locale.jaJP, "突撃!探検同盟" },
{ Locale.thTH, "Saviors of Uldum" },
}
},
{
347, new Dictionary<Locale, string>() {
{ Locale.enUS, "Descent of Dragons" },
{ Locale.enGB, "Descent of Dragons" },
{ Locale.frFR, "L’Envol des Dragons" },
{ Locale.deDE, "Erbe der Drachen" },
{ Locale.koKR, "용의 강림" },
{ Locale.esES, "El Descenso de los Dragones" },
{ Locale.esMX, "Descenso de los Dragones" },
{ Locale.ruRU, "Натиск драконов" },
{ Locale.zhTW, "《降臨!遠古巨龍》" },
{ Locale.zhCN, "巨龙降临" },
{ Locale.itIT, "La Discesa dei Draghi" },
{ Locale.ptBR, "Despontar dos Dragões" },
{ Locale.plPL, "Wejście smoków" },
{ Locale.ptPT, "Despontar dos Dragões" },
{ Locale.jaJP, "激闘!ドラゴン大決戦" },
{ Locale.thTH, "Descent of Dragons" },
}
},
{
423, new Dictionary<Locale, string>() {
{ Locale.enUS, "Ashes of Outland" },
{ Locale.enGB, "Ashes of Outland" },
{ Locale.frFR, "Les Cendres de l’Outreterre" },
{ Locale.deDE, "Ruinen der Scherbenwelt" },
{ Locale.koKR, "황폐한 아웃랜드" },
{ Locale.esES, "Cenizas de Terrallende" },
{ Locale.esMX, "Cenizas de Terrallende" },
{ Locale.ruRU, "Руины Запределья" },
{ Locale.zhTW, "外域的灰烬" },
{ Locale.zhCN, "外域之燼" },
{ Locale.itIT, "Ceneri delle Terre Esterne" },
{ Locale.ptBR, "Cinzas de Terralém" },
{ Locale.plPL, "Popioły Rubieży" },
{ Locale.ptPT, "Cinzas de Terralém" },
{ Locale.jaJP, "灰に舞う降魔の狩人" },
{ Locale.thTH, "Ashes of Outland" },
}
},
{
468, new Dictionary<Locale, string>() {
{ Locale.enUS, "Scholomance Academy" },
{ Locale.enGB, "Scholomance Academy" },
{ Locale.frFR, "L’Académie Scholomance" },
{ Locale.deDE, "Akademie Scholomance" },
{ Locale.koKR, "스칼로맨스 아카데미" },
{ Locale.esES, "Academia Scholomance" },
{ Locale.esMX, "Academia Scholomance" },
{ Locale.ruRU, "Некроситет" },
{ Locale.zhTW, "《通靈學院》" },
{ Locale.zhCN, "通灵学园" },
{ Locale.itIT, "L'Accademia di Scholomance" },
{ Locale.ptBR, "Universidade de Scolomântia" },
{ Locale.plPL, "Scholomancjum" },
{ Locale.ptPT, "Universidade de Scolomântia" },
{ Locale.jaJP, "魔法学院スクロマンス" },
{ Locale.thTH, "Scholomance Academy" },
}
},
{
498, new Dictionary<Locale, string>() {
{ Locale.enUS, "Year of Dragon" },
{ Locale.enGB, "Year of Dragon" },
{ Locale.frFR, "Année du Dragon" },
{ Locale.deDE, "Jahr des Drachen" },
{ Locale.koKR, "용의 해" },
{ Locale.esES, "Año del Dragón" },
{ Locale.esMX, "Año del dragón" },
{ Locale.ruRU, "Год дракона" },
{ Locale.zhTW, "巨龍年" },
{ Locale.zhCN, "巨龙年" },
{ Locale.itIT, "Anno del Drago" },
{ Locale.ptBR, "Ano do Dragão" },
{ Locale.plPL, "Rok Smoka" },
{ Locale.ptPT, "Ano do Dragão" },
{ Locale.jaJP, "ドラゴン年" },
{ Locale.thTH, "ปีแห่งมังกร" },
}
},
{
553, new Dictionary<Locale, string>() {
{ Locale.enUS, "The Barrens" },
{ Locale.enGB, "The Barrens" },
{ Locale.frFR, "Les Tarides" },
{ Locale.deDE, "Das Brachland" },
{ Locale.koKR, "불모의 땅 " },
{ Locale.esES, "Los Baldíos" },
{ Locale.esMX, "Los Baldíos" },
{ Locale.ruRU, "Степи" },
{ Locale.zhTW, "貧瘠之地" },
{ Locale.zhCN, "贫瘠之地" },
{ Locale.itIT, "Savane" },
{ Locale.ptBR, "Os Sertões" },
{ Locale.plPL, "Pustkowia" },
{ Locale.ptPT, "Os Sertões" },
{ Locale.jaJP, "大荒野" },
{ Locale.thTH, "The Barrens" },
}
},
{
602, new Dictionary<Locale, string>() {
{ Locale.enUS, "United in Stormwind" },
{ Locale.enGB, "United in Stormwind" },
{ Locale.frFR, "Unis à Hurlevent" },
{ Locale.deDE, "Vereint in Sturmwind" },
{ Locale.koKR, "스톰윈드" },
{ Locale.esES, "Unidos en Ventormenta" },
{ Locale.esMX, "Unidos en Ventormenta" },
{ Locale.ruRU, "Сплоченные Штормградом" },
{ Locale.zhTW, "暴風城" },
{ Locale.zhCN, "暴风城下的集结" },
{ Locale.itIT, "Uniti a Roccavento" },
{ Locale.ptBR, "Juntos em Ventobravo" },
{ Locale.plPL, "Zjednoczeni w Wichrogrodzie" },
{ Locale.ptPT, "Juntos em Ventobravo" },
{ Locale.jaJP, "風集うストームウィンド" },
{ Locale.thTH, "United in Stormwind" },
}
},
{
616, new Dictionary<Locale, string>() {
{ Locale.enUS, "Madness at the Darkmoon Faire" },
{ Locale.enGB, "Madness at the Darkmoon Faire" },
{ Locale.frFR, "Folle journée à Sombrelune" },
{ Locale.deDE, "Der Dunkelmond-Wahnsinn" },
{ Locale.koKR, "광기의 다크문 축제" },
{ Locale.esES, "Locura en la Feria de la Luna Negra" },
{ Locale.esMX, "Locura en la Feria de la Luna Negra" },
{ Locale.ruRU, "Ярмарка безумия" },
{ Locale.zhTW, "暗月馬戲團:古神也瘋狂" },
{ Locale.zhCN, "疯狂的暗月马戏团" },
{ Locale.itIT, "Follia alla Fiera di Lunacupa" },
{ Locale.ptBR, "Delírios em Negraluna" },
{ Locale.plPL, "Obłędny Festyn Lunomroku" },
{ Locale.ptPT, "Delírios em Negraluna" },
{ Locale.jaJP, "ダークムーン・フェアへの招待状" },
{ Locale.thTH, "Madness at the Darkmoon Faire" },
}
},
{
665, new Dictionary<Locale, string>() {
{ Locale.enUS, "Fractured in Alterac Valley" },
{ Locale.enGB, "Fractured in Alterac Valley" },
{ Locale.frFR, "Divisés en Alterac" },
{ Locale.deDE, "Gespalten im Alteractal" },
{ Locale.koKR, "알터랙 계곡" },
{ Locale.esES, "Divididos en el Valle de Alterac" },
{ Locale.esMX, "Divididos en el Valle de Alterac" },
{ Locale.ruRU, "Разделенные Альтераком" },
{ Locale.zhTW, "決戰奧山" },
{ Locale.zhCN, "奥特兰克的决裂" },
{ Locale.itIT, "Divisi nella Valle d'Alterac" },
{ Locale.ptBR, "Divididos no Vale Alterac" },
{ Locale.plPL, "Rozbici w Dolinie Alterak" },
{ Locale.ptPT, "Divididos no Vale Alterac" },
{ Locale.jaJP, "烈戦のアルタラック" },
{ Locale.thTH, "Fractured in Alterac Valley" },
}
},
{
694, new Dictionary<Locale, string>() {
{ Locale.enUS, "Voyage to the Sunken City" },
{ Locale.enGB, "Voyage to the Sunken City" },
{ Locale.frFR, "Au cœur de la cité engloutie" },
{ Locale.deDE, "Reise in die Versunkene Stadt" },
{ Locale.koKR, "가라앉은 도시로의 항해" },
{ Locale.esES, "Viaje a la Ciudad Sumergida" },
{ Locale.esMX, "Viaje a la Ciudad Sumergida" },
{ Locale.ruRU, "Путешествие в Затонувший город" },
{ Locale.zhTW, "海底歷險記" },
{ Locale.zhCN, "探寻沉没之城" },
{ Locale.itIT, "Rotta per la Città Sommersa" },
{ Locale.ptBR, "Viagem à Cidade Submersa" },
{ Locale.plPL, "Podróż do Zatopionego Miasta" },
{ Locale.ptPT, "Viagem à Cidade Submersa" },
{ Locale.jaJP, "深淵に眠る海底都市" },
{ Locale.thTH, "Voyage to the Sunken City" },
}
},
{
729, new Dictionary<Locale, string>() {
{ Locale.enUS, "Murder at Castle Nathria" },
{ Locale.enGB, "Murder at Castle Nathria" },
{ Locale.frFR, "Meurtre au château Nathria" },
{ Locale.deDE, "Mord auf Schloss Nathria" },
{ Locale.koKR, "나스리아 성채 살인 사건" },
{ Locale.esES, "Asesinato en el Castillo de Nathria" },
{ Locale.esMX, "Asesinato en el Castillo Nathria" },
{ Locale.ruRU, "Убийство в замке Нафрия" },
{ Locale.zhTW, "納撒亞古堡懸案" },
{ Locale.zhCN, "纳斯利亚堡的悬案" },
{ Locale.itIT, "Assassinio al Castello di Nathria" },
{ Locale.ptBR, "Assassinato no Castelo de Nathria" },
{ Locale.plPL, "Morderstwo w twierdzy Nathria" },
{ Locale.ptPT, "Assassinato no Castelo de Nathria" },
{ Locale.jaJP, "ナスリア城殺人事件" },
{ Locale.thTH, "Murder at Castle Nathria" },
}
},
{
821, new Dictionary<Locale, string>() {
{ Locale.enUS, "March of the Lich King" },
{ Locale.enGB, "March of the Lich King" },
{ Locale.frFR, "La marche du roi-liche" },
{ Locale.deDE, "Marsch des Lichkönigs" },
{ Locale.koKR, "리치 왕의 진군" },
{ Locale.esES, "Marcha del Rey Exánime" },
{ Locale.esMX, "El Ascenso del Rey Exánime" },
{ Locale.ruRU, "Марш Короля-лича" },
{ Locale.zhTW, "進擊吧!巫妖王" },
{ Locale.zhCN, "巫妖王的进军" },
{ Locale.itIT, "L'Avanzata del Re dei Lich" },
{ Locale.ptBR, "Ascensão do Lich Rei" },
{ Locale.plPL, "Pochód Króla Lisza" },
{ Locale.ptPT, "Ascensão do Lich Rei" },
{ Locale.jaJP, "リッチキングの凱旋" },
{ Locale.thTH, "March of the Lich King" },
}
},
{
854, new Dictionary<Locale, string>() {
{ Locale.enUS, "Festival of Legends" },
{ Locale.enGB, "Festival of Legends" },
{ Locale.frFR, "La fête des légendes" },
{ Locale.deDE, "Festival der Legenden" },
{ Locale.koKR, "전설노래자랑" },
{ Locale.esES, "El Festival Legendario" },
{ Locale.esMX, "Festival de Leyendas" },
{ Locale.ruRU, "Фестиваль легенд" },
{ Locale.zhTW, "傳說音樂祭" },
{ Locale.zhCN, "传奇音乐节" },
{ Locale.itIT, "Festival delle Leggende" },
{ Locale.ptBR, "Festival das Lendas" },
{ Locale.plPL, "Festiwal Legend" },
{ Locale.ptPT, "Festival das Lendas" },
{ Locale.jaJP, "集え!レジェンド・フェス" },
{ Locale.thTH, "Festival of Legends" },
}
},
};
public static Dictionary<int, Dictionary<Locale, string>> PackNames = new Dictionary<int, Dictionary<Locale, string>>() {
{
23, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden Classic" },
{ Locale.enGB, "Golden Classic" },
{ Locale.frFR, "Classique dorée" },
{ Locale.deDE, "Klassik (Golden)" },
{ Locale.koKR, "황금 오리지널" },
{ Locale.esES, "Clásica dorada" },
{ Locale.esMX, "Dorado clásico" },
{ Locale.ruRU, "Классический набор (Золотой)" },
{ Locale.zhTW, "經典金卡" },
{ Locale.zhCN, "金色经典" },
{ Locale.itIT, "Classiche Dorate" },
{ Locale.ptBR, "Clássico Dourado" },
{ Locale.plPL, "Złote klasyczne" },
{ Locale.ptPT, "Clássico Dourado" },
{ Locale.jaJP, "ゴールデンクラシック" },
{ Locale.thTH, "คลาสสิคสีทอง" },
}
},
{
470, new Dictionary<Locale, string>() {
{ Locale.enUS, "Hunter Pack" },
{ Locale.enGB, "Hunter Pack" },
{ Locale.frFR, "Paquet de classe Chasseur" },
{ Locale.deDE, "Jägerpackung" },
{ Locale.koKR, "사냥꾼 팩" },
{ Locale.esES, "Sobre de Cazador" },
{ Locale.esMX, "Paquete de Cazador" },
{ Locale.ruRU, "Комплект карт Охотника" },
{ Locale.zhTW, "包獵人" },
{ Locale.zhCN, "包猎人" },
{ Locale.itIT, "Busta del Cacciatore" },
{ Locale.ptBR, "Pacote de Caçador" },
{ Locale.plPL, "Pakiet Łowcy" },
{ Locale.ptPT, "Pacote de Caçador" },
{ Locale.jaJP, "ハンターパック" },
{ Locale.thTH, "ซองการ์ดฮันเตอร์" },
}
},
{
545, new Dictionary<Locale, string>() {
{ Locale.enUS, "Mage Pack" },
{ Locale.enGB, "Mage Pack" },
{ Locale.frFR, "Paquet de classe Mage" },
{ Locale.deDE, "Magierpackung" },
{ Locale.koKR, "마법사 팩" },
{ Locale.esES, "Sobre de Mago" },
{ Locale.esMX, "Paquete de Mago" },
{ Locale.ruRU, "Комплект карт Мага" },
{ Locale.zhTW, "包法師" },
{ Locale.zhCN, "包法师" },
{ Locale.itIT, "Busta del Mago" },
{ Locale.ptBR, "Pacote de Mago" },
{ Locale.plPL, "Pakiet Maga" },
{ Locale.ptPT, "Pacote de Mago" },
{ Locale.jaJP, "メイジパック" },
{ Locale.thTH, "ซองการ์ดเมจ" },
}
},
{
603, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden Scholomance Academy" },
{ Locale.enGB, "Golden Scholomance Academy" },
{ Locale.frFR, "L’Académie Scholomance doré" },
{ Locale.deDE, "Goldene Akademie Scholomance" },
{ Locale.koKR, "황금 스칼로맨스 아카데미" },
{ Locale.esES, "Doradas de Academia Scholomance" },
{ Locale.esMX, "Dorado de Academia Scholomance" },
{ Locale.ruRU, "Некроситет (Золотой)" },
{ Locale.zhTW, "通靈學院金卡" },
{ Locale.zhCN, "金色通灵学园" },
{ Locale.itIT, "Accademia di Scholomance Dorata" },
{ Locale.ptBR, "Universidade de Scolomântia Dourado" },
{ Locale.plPL, "Złote Scholomancjum" },
{ Locale.ptPT, "Universidade de Scolomântia Dourado" },
{ Locale.jaJP, "ゴールデン魔法学院スクロマンス" },
{ Locale.thTH, "Scholomance Academy สีทอง" },
}
},
{
631, new Dictionary<Locale, string>() {
{ Locale.enUS, "Druid Pack" },
{ Locale.enGB, "Druid Pack" },
{ Locale.frFR, "Paquet de classe Druide" },
{ Locale.deDE, "Druidepackung" },
{ Locale.koKR, "드루이드 팩" },
{ Locale.esES, "Sobre de Druida" },
{ Locale.esMX, "Paquete de Druida" },
{ Locale.ruRU, "Комплект карт Друида" },
{ Locale.zhTW, "包德魯伊" },
{ Locale.zhCN, "包德鲁伊" },
{ Locale.itIT, "Busta del Druido" },
{ Locale.ptBR, "Pacote de Druida" },
{ Locale.plPL, "Pakiet Druida" },
{ Locale.ptPT, "Pacote de Druida" },
{ Locale.jaJP, "ドルイドパック" },
{ Locale.thTH, "ซองการ์ดดรูอิด" },
}
},
{
632, new Dictionary<Locale, string>() {
{ Locale.enUS, "Paladin Pack" },
{ Locale.enGB, "Paladin Pack" },
{ Locale.frFR, "Paquet de classe paladin" },
{ Locale.deDE, "Paladinpackung" },
{ Locale.koKR, "성기사 팩" },
{ Locale.esES, "Sobre de paladín" },
{ Locale.esMX, "Paquete de Paladín" },
{ Locale.ruRU, "Набор карт Паладина" },
{ Locale.zhTW, "包聖騎士" },
{ Locale.zhCN, "包圣骑士" },
{ Locale.itIT, "Busta del Paladino" },
{ Locale.ptBR, "Pacote de Paladino" },
{ Locale.plPL, "Pakiet paladyna" },
{ Locale.ptPT, "Pacote de Paladino" },
{ Locale.jaJP, "パラディンパック" },
{ Locale.thTH, "ซองการ์ดพาลาดิน" },
}
},
{
633, new Dictionary<Locale, string>() {
{ Locale.enUS, "Warrior Pack" },
{ Locale.enGB, "Warrior Pack" },
{ Locale.frFR, "Paquet de classe guerrier" },
{ Locale.deDE, "Kriegerpackung" },
{ Locale.koKR, "전사 팩" },
{ Locale.esES, "Sobre de guerrero" },
{ Locale.esMX, "Paquete de Guerrero" },
{ Locale.ruRU, "Набор карт Воина" },
{ Locale.zhTW, "包戰士" },
{ Locale.zhCN, "包战士" },
{ Locale.itIT, "Busta del Guerriero" },
{ Locale.ptBR, "Pacote de Guerreiro" },
{ Locale.plPL, "Pakiet wojownika" },
{ Locale.ptPT, "Pacote de Guerreiro" },
{ Locale.jaJP, "ウォリアーパック" },
{ Locale.thTH, "ซองการ์ดวอริเออร์" },
}
},
{
634, new Dictionary<Locale, string>() {
{ Locale.enUS, "Priest Pack" },
{ Locale.enGB, "Priest Pack" },
{ Locale.frFR, "Paquet de classe Prêtre" },
{ Locale.deDE, "Priesterpackung" },
{ Locale.koKR, "사제 팩" },
{ Locale.esES, "Sobre de Sacerdote" },
{ Locale.esMX, "Paquete de Sacerdote" },
{ Locale.ruRU, "Набор карт Жреца" },
{ Locale.zhTW, "包牧師" },
{ Locale.zhCN, "包牧师" },
{ Locale.itIT, "Busta del Sacerdote" },
{ Locale.ptBR, "Pacote de Sacerdote" },
{ Locale.plPL, "Pakiet Kapłana" },
{ Locale.ptPT, "Pacote de Sacerdote" },
{ Locale.jaJP, "プリーストパック" },
{ Locale.thTH, "ซองการ์ดโร้ก" },
}
},
{
635, new Dictionary<Locale, string>() {
{ Locale.enUS, "Rogue Pack" },
{ Locale.enGB, "Rogue Pack" },
{ Locale.frFR, "Paquet de classe Voleur" },
{ Locale.deDE, "Schurkepackung" },
{ Locale.koKR, "도적 팩" },
{ Locale.esES, "Sobre de Picaro" },
{ Locale.esMX, "Paquete de Picaro" },
{ Locale.ruRU, "Набор карт Разбойника" },
{ Locale.zhTW, "包盜賊" },
{ Locale.zhCN, "包潜行者" },
{ Locale.itIT, "Busta del Ladro" },
{ Locale.ptBR, "Pacote de Ladino" },
{ Locale.plPL, "Pakiet Łotra" },
{ Locale.ptPT, "Pacote de Ladino" },
{ Locale.jaJP, "ローグパック" },
{ Locale.thTH, "ซองการ์ดชาแมน" },
}
},
{
636, new Dictionary<Locale, string>() {
{ Locale.enUS, "Shaman Pack" },
{ Locale.enGB, "Shaman Pack" },
{ Locale.frFR, "Paquet de classe Chaman" },
{ Locale.deDE, "Schamanepackung" },
{ Locale.koKR, "주술사 팩" },
{ Locale.esES, "Sobre de Chamán" },
{ Locale.esMX, "Paquete de Chamán" },
{ Locale.ruRU, "Набор карт Шамана" },
{ Locale.zhTW, "包薩滿" },
{ Locale.zhCN, "包萨满祭司" },
{ Locale.itIT, "Busta del Sciamano" },
{ Locale.ptBR, "Pacote de Xamã" },
{ Locale.plPL, "Pakiet Szamana" },
{ Locale.ptPT, "Pacote de Xamã" },
{ Locale.jaJP, "シャーマンパック" },
{ Locale.thTH, "ซองการ์ดวอร์ล็อค" },
}
},
{
637, new Dictionary<Locale, string>() {
{ Locale.enUS, "Warlock Pack" },
{ Locale.enGB, "Warlock Pack" },
{ Locale.frFR, "Paquet de classe Démoniste" },
{ Locale.deDE, "Hexenmeisterpackung" },
{ Locale.koKR, "흑마법사 팩" },
{ Locale.esES, "Sobre de Brujo" },
{ Locale.esMX, "Paquete de Brujo" },
{ Locale.ruRU, "Набор карт Чернокнижника" },
{ Locale.zhTW, "包術士" },
{ Locale.zhCN, "包术士" },
{ Locale.itIT, "Busta del Stregone" },
{ Locale.ptBR, "Pacote de Bruxo" },
{ Locale.plPL, "Pakiet Czarnoksiężnika" },
{ Locale.ptPT, "Pacote de Bruxo" },
{ Locale.jaJP, "ウォーロックパック" },
{ Locale.thTH, "ซองการ์ดวอริเออร์" },
}
},
{
638, new Dictionary<Locale, string>() {
{ Locale.enUS, "Demon Hunter Pack" },
{ Locale.enGB, "Demon Hunter Pack" },
{ Locale.frFR, "Paquet de classe Chasseur de démons" },
{ Locale.deDE, "Dämonenjägerpackung" },
{ Locale.koKR, "악마사냥꾼 팩" },
{ Locale.esES, "Sobre de Cazador de demonios" },
{ Locale.esMX, "Paquete de Cazador de demonios" },
{ Locale.ruRU, "Набор карт Охотника на демонов" },
{ Locale.zhTW, "包惡魔獵人" },
{ Locale.zhCN, "包恶魔猎手" },
{ Locale.itIT, "Busta del Cacciatore di Demoni" },
{ Locale.ptBR, "Pacote de Caçador de Demônios" },
{ Locale.plPL, "Pakiet Łowcy demonów" },
{ Locale.ptPT, "Pacote de Caçador de Demônios" },
{ Locale.jaJP, "デーモンハンターパック" },
{ Locale.thTH, "ซองการ์ดดีมอนฮันเตอร์" },
}
},
{
643, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden Madness at the Darkmoon Faire" },
{ Locale.enGB, "Golden Madness at the Darkmoon Faire" },
{ Locale.frFR, "Folle journée dorée à Sombrelune" },
{ Locale.deDE, "Der Dunkelmond-Wahnsinn (Golden)" },
{ Locale.koKR, "황금 광기의 다크문 축제" },
{ Locale.esES, "Locura dorada en la Feria de la Luna Negra" },
{ Locale.esMX, "Dorado de Locura en la Feria de la Luna Negra" },
{ Locale.ruRU, "Ярмарка безумия (Золотой)" },
{ Locale.zhTW, "暗月馬戲團:古神也瘋狂金卡" },
{ Locale.zhCN, "金色疯狂的暗月马戏团" },
{ Locale.itIT, "Follia alla Fiera di Lunacupa Dorata" },
{ Locale.ptBR, "Delírios em Negraluna Dourado" },
{ Locale.plPL, "Złote Obłędny Festyn Lunomroku" },
{ Locale.ptPT, "Delírios em Negraluna Dourado" },
{ Locale.jaJP, "ゴールデン・ダークムーン・フェアへの招待状" },
{ Locale.thTH, "Madness at the Darkmoon Faire สีทอง" },
}
},
{
686, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden Forged in the Barrens" },
{ Locale.enGB, "Golden Forged in the Barrens" },
{ Locale.frFR, "Forgés dans les Tarides doré" },
{ Locale.deDE, "Geschmiedet im Brachland (Golden)" },
{ Locale.koKR, "황금 불모의 땅" },
{ Locale.esES, "Doradas de Forjados en los Baldíos" },
{ Locale.esMX, "Dorado de Forjados en los Baldíos" },
{ Locale.ruRU, "Закаленные Степями (Золотой)" },
{ Locale.zhTW, "貧瘠之地金卡" },
{ Locale.zhCN, "贫瘠之地的锤炼金卡" },
{ Locale.itIT, "Forgiati nelle Savane Dorata" },
{ Locale.ptBR, "Forjado nos Sertões Dourado" },
{ Locale.plPL, "Złote Zahartowani przez Pustkowia" },
{ Locale.ptPT, "Forjado nos Sertões Dourado" },
{ Locale.jaJP, "ゴールデン荒ぶる大地の強者たち" },
{ Locale.thTH, "Forged in the Barrens สีทอง" },
}
},
{
688, new Dictionary<Locale, string>() {
{ Locale.enUS, "Year of Phoenix" },
{ Locale.enGB, "Year of Phoenix" },
{ Locale.frFR, "Année du Phénix" },
{ Locale.deDE, "Jahr des Phönix" },
{ Locale.koKR, "불사조의 해" },
{ Locale.esES, "Año del Fénix" },
{ Locale.esMX, "Año del fénix" },
{ Locale.ruRU, "Год Феникса" },
{ Locale.zhTW, "鳳凰年" },
{ Locale.zhCN, "凤凰年" },
{ Locale.itIT, "Anno della Fenice" },
{ Locale.ptBR, "Ano da Fênix" },
{ Locale.plPL, "Rok Feniksa" },
{ Locale.ptPT, "Ano da Fênix" },
{ Locale.jaJP, "フェニックス年" },
{ Locale.thTH, "ปีแห่งฟีนิกซ์" },
}
},
{
713, new Dictionary<Locale, string>() {
{ Locale.enUS, "Standard" },
{ Locale.enGB, "Standard" },
{ Locale.frFR, "Standard" },
{ Locale.deDE, "Standard" },
{ Locale.koKR, "정규" },
{ Locale.esES, "Estándar" },
{ Locale.esMX, "Estándar" },
{ Locale.ruRU, "Стандартный" },
{ Locale.zhTW, "標準" },
{ Locale.zhCN, "标准模式" },
{ Locale.itIT, "Standard" },
{ Locale.ptBR, "Padrão" },
{ Locale.plPL, "Standard" },
{ Locale.ptPT, "Padrão" },
{ Locale.jaJP, "スタンダード" },
{ Locale.thTH, "มาตรฐาน" },
}
},
{
714, new Dictionary<Locale, string>() {
{ Locale.enUS, "Wild" },
{ Locale.enGB, "Wild" },
{ Locale.frFR, "Libre" },
{ Locale.deDE, "Wild" },
{ Locale.koKR, "야생" },
{ Locale.esES, "Salvaje" },
{ Locale.esMX, "Salvaje" },
{ Locale.ruRU, "Вольный" },
{ Locale.zhTW, "開放" },
{ Locale.zhCN, "狂野" },
{ Locale.itIT, "Selvaggio" },
{ Locale.ptBR, "Livre" },
{ Locale.plPL, "Dzicz" },
{ Locale.ptPT, "Livre" },
{ Locale.jaJP, "ワイルド" },
{ Locale.thTH, "อิสระ" },
}
},
{
716, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden Standard" },
{ Locale.enGB, "Golden Standard" },
{ Locale.frFR, "Standard dorée" },
{ Locale.deDE, "Goldene Standard" },
{ Locale.koKR, "황금 정규" },
{ Locale.esES, "Doradas Estándar" },
{ Locale.esMX, "Dorado Estándar" },
{ Locale.ruRU, "Стандартный (Золотой)" },
{ Locale.zhTW, "標準金卡" },
{ Locale.zhCN, "金色标准模式" },
{ Locale.itIT, "Standard Dorata" },
{ Locale.ptBR, "Padrão Dourado" },
{ Locale.plPL, "Złote Standard" },
{ Locale.ptPT, "Padrão Dourado" },
{ Locale.jaJP, "ゴールデンスタンダード" },
{ Locale.thTH, "มาตรฐาน ีทอง" },
}
},
{
737, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden United in Stormwind" },
{ Locale.enGB, "Golden United in Stormwind" },
{ Locale.frFR, "Unis à Hurlevent dorée" },
{ Locale.deDE, "Goldene Vereint in Sturmwind" },
{ Locale.koKR, "황금 스톰윈드" },
{ Locale.esES, "Doradas Unidos en Ventormenta" },
{ Locale.esMX, "Dorado Unidos en Ventormenta" },
{ Locale.ruRU, "Сплоченные Штормградом (Золотой)" },
{ Locale.zhTW, "暴風城金卡" },
{ Locale.zhCN, "金色暴风城下的集结" },
{ Locale.itIT, "Uniti a Roccavento Dorata" },
{ Locale.ptBR, "Juntos em Ventobravo Dourado" },
{ Locale.plPL, "Złote Zjednoczeni w Wichrogrodzie" },
{ Locale.ptPT, "Juntos em Ventobravo Dourado" },
{ Locale.jaJP, "ゴールデン風集うストームウィンド" },
{ Locale.thTH, "United in Stormwind (ีทอง)" },
}
},
{
841, new Dictionary<Locale, string>() {
{ Locale.enUS, "Golden Fractured in Alterac Valley" },
{ Locale.enGB, "Golden Fractured in Alterac Valley" },
{ Locale.frFR, "Divisés en Alterac dorée" },
{ Locale.deDE, "Goldene Gespalten im Alteractal" },
{ Locale.koKR, "황금 알터랙 계곡" },
{ Locale.esES, "Daradas Divididos en el Valle de Alterac" },
{ Locale.esMX, "Dorado Divididos en el Valle de Alterac" },
{ Locale.ruRU, "Разделенные Альтераком (Золотой)" },
{ Locale.zhTW, "決戰奧山金卡" },
{ Locale.zhCN, "金色奥特兰克的决裂" },
{ Locale.itIT, "Divisi nella Valle d'Alterac Dorata" },
{ Locale.ptBR, "Divididos no Vale Alterac Dourado" },
{ Locale.plPL, "Złote Rozbici w Dolinie Alterak" },
{ Locale.ptPT, "Divididos no Vale Alterac Dourado" },
{ Locale.jaJP, "ゴールデン烈戦のアルタラック" },
{ Locale.thTH, "Fractured in Alterac Valley (ีทอง)" },
}
},
};
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) {
if(value == null) {
return "";
}
if(int.TryParse(value.ToString(), out int id)) {
if(Enum.TryParse(_config.SelectedLanguage, out Locale lang)) {
string converted = Convert(id, lang);
if(!string.IsNullOrEmpty(converted)) {
return converted;
}
}
if(PackNamesWS.ContainsKey(id)) {
if(PackNamesWS[id].ContainsKey(Locale.enUS)) {
return PackNamesWS[id][Locale.enUS];
}
}
if(PackNames.ContainsKey(id)) {
if(PackNames[id].ContainsKey(Locale.enUS)) {
return PackNames[id][Locale.enUS];
}
}
}
return value;
}
public static string Convert(int packId, Locale lang) {
if(PackNamesWS.ContainsKey(packId)) {
if(PackNamesWS[packId].ContainsKey(lang)) {
return PackNamesWS[packId][lang];
}
}
if(PackNames.ContainsKey(packId)) {
if(PackNames[packId].ContainsKey(lang)) {
return PackNames[packId][lang];
}
}
return null;
}
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
using Grasshopper.Kernel;
using PterodactylEngine;
namespace Pterodactyl
{
public class DynamicMathBlockGH : GH_Component
{
public DynamicMathBlockGH()
: base("Dynamic Math Block", "Dynamic Math Block",
"Creates dynamic math block, that can change variables values automatically. This Report Part might not appear properly in PDF exports.",
"Pterodactyl", "Parts")
{
}
public override bool IsBakeCapable => false;
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddTextParameter("Text", "Text", "Math text written in TeX-style. Put dynamic variables in <> brackets. " +
"For example: x - this is static variable, <x> - this is dynamic variable, that will change to given value.",
GH_ParamAccess.item, @"2 \cdot sin(x) + cos(y) = 2 \cdot sin(<x>) + cos(<y>) = ...");
pManager.AddTextParameter("Variables Symbols", "Variables Symbols",
"List of symbols that represent dynamic values.",
GH_ParamAccess.list, new List<string>
{"x", "y"});
pManager.AddNumberParameter("Variables Values", "Variables Values", "Variables' values as list.",
GH_ParamAccess.list, new List<double> {1.0, 2.0});
}
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddTextParameter("Report Part", "Report Part", "Created part of the report (Markdown text)", GH_ParamAccess.item);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
string text = string.Empty;
List<string> variablesSymbols = new List<string>();
List<double> variablesValues = new List<double>();
DA.GetData(0, ref text);
DA.GetDataList(1, variablesSymbols);
DA.GetDataList(2, variablesValues);
string reportPart;
DynamicMathBlock reportObject = new DynamicMathBlock(text, variablesSymbols, variablesValues);
reportPart = reportObject.Format();
DA.SetData(0, reportPart);
}
protected override System.Drawing.Bitmap Icon
{
get
{
return Properties.Resources.PterodactylDynamicMathBlock;
}
}
public override GH_Exposure Exposure
{
get { return GH_Exposure.tertiary; }
}
public override Guid ComponentGuid
{
get { return new Guid("29f4111e-1253-461b-9a66-d12e684fc17b"); }
}
}
} |
/**
* \file ParttimeEmployee.cs
* \author Ab-Code: Sekou Diaby, Tuan Ly, Becky Linyan Li, Bowen Zhuang
* \date 21-11-2014
* \brief contains all the methods and attributes to handle a part time Employee.
* \brief The part time Employee is the child class of the parent Employee clas.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
using System.Text.RegularExpressions;
namespace AllEmployees
{
///
/// \class ParttimeEmployee
/// \brief to model the attributes and behaviour of an ParttimeEmployee,
/// \brief accessor and mutators for the attributes, validates all the fields of the employee and
/// \biref shows the details of the part time Employee.
///
public class ParttimeEmployee : Employee
{
/* ====================================== */
/* PRIVATE */
/* ====================================== */
/* -------------- ATTRIBUTES ------------ */
private string dateOfHire; ///< \brief the date the employee was hired
private string dateOfTermination; ///< \brief the date the employee will be terminated
private float hourlyRate; ///< \brief the hourly pay rate for the employee
/* ====================================== */
/* PUBLIC */
/* ====================================== */
///
/// \brief This function is the constructor of the ParttimeEmployee and it set the initial value for data members to blank
/// \details <b>Details</b>
/// \param no param
/// \return no returns
///
public ParttimeEmployee()
{
bool empTypeRes = SetemployeeType(PART_TIME);
if (empTypeRes)
{
dateOfHire = "";
dateOfTermination = "";
hourlyRate = 0;
}
}
///
/// \brief This function is the constructor of the ParttimeEmployee and it set the initial value for data members to parameters
/// \details <b>Details</b>
/// \param DOH - <b>string </b> -the date the employee was hired
/// \param DOT - <b>string </b> -the date the employee will be terminated
/// \param newHrate - <b>float </b> -the hourly pay rate for the employee
/// /// \return no returns
///
public ParttimeEmployee(string DOH, string DOT, float newHrate)
{
bool empTypeRes = SetemployeeType(PART_TIME);
if (empTypeRes)
{
dateOfHire = DOH;
dateOfTermination = DOT;
hourlyRate = newHrate;
}
}
///
/// \brief This function is the constructor of the ParttimeEmployee and it set the initial value for data members to parameters
/// \details <b>Details</b>
/// \param fName - <b>string </b> -the first name for the employee
/// \param lName - <b>string </b> -the last name for the employee
/// /// \return no returns
///
public ParttimeEmployee(string fName, string lName)
{
bool empTypeRes = SetemployeeType(PART_TIME);
if (empTypeRes)
{
firstName = fName;
lastName = lName;
}
}
///
/// \brief This function sets the employee's date of hire to the parameter passed in
/// \details <b>Details</b>
///
/// \param newDOH - <b>string</b> - The date the employee was hired
/// \return ret - <b>bool</b> -The result to see if the attribute was set.
///
public bool SetdateOfHire(string newDOH)
{
bool ret = false;
if (newDOH != "")
{
//Date of Hire can be NA
if (newDOH == "N/A")
{
dateOfHire = newDOH;
ret = true;
}
else
{
// check if Date of hire is a real date
if (validateDate(newDOH))
{
dateOfHire = newDOH;
ret = true;
}
}
}
else
{
// date of Hire can be empty
dateOfHire = newDOH;
ret = true;
}
return ret;
}
///
/// \brief This function sets the employee's date of termination to the parameter passed in
/// \details <b>Details</b>
///
/// \param newDOT - <b>string</b> - The date the employee is going to be terminated
/// \return ret - <b>bool</b> -The result to see if the attribute was set.
///
public bool SetdateOfTermination(string newDOT)
{
bool ret = false;
if (newDOT != "")
{
//Date of termination can be NA
if (newDOT == "N/A")
{
dateOfTermination = newDOT;
ret = true;
}
else
{
// check if Date of hire is a real date
if (validateDate(newDOT))
{
dateOfTermination = newDOT;
ret = true;
}
}
}
else
{
//Date of termination can be empty
dateOfTermination = newDOT;
ret = true;
}
return ret;
}
///
/// \brief This function sets the employee's hourly rate to the parameter passed in
/// \details <b>Details</b>
///
/// \param float - <b>float</b> - The pay rate for the employee
/// \return ret - <b>bool</b> -The result to see if the attribute was set.
///
public bool SethourlyRate(float newHourlyRate)
{
bool ret = false;
//hourlyRate must Not be negative
if (newHourlyRate >= 0)
{
hourlyRate = newHourlyRate;
ret = true;
}
return ret;
}
///
/// \brief This function gets the parttime employee's dateOfHire and returns it.
/// \details <b>Details</b>
///
/// \param no params
/// \return dateOfHire - <b>string</b> -The dateOfHire of the created parttime employee object.
///
public string GetdateOfHire()
{
return dateOfHire;
}
///
/// \brief This function gets the parttime employee's dateOfTermination and returns it.
/// \details <b>Details</b>
///
/// \param no params
/// \return dateOfTermination - <b>string</b> -The dateOfTermination of the created parttime employee object.
///
public string GetdateOfTermination()
{
return dateOfTermination;
}
///
/// \brief This function gets the parttime employee's hourlyRate and returns it.
/// \details <b>Details</b>
///
/// \param no params
/// \return hourlyRate - <b>float</b> -The hourlyRate of the created parttime employee object.
///
public float GethourlyRate()
{
return hourlyRate;
}
///
/// \brief This function validates all the fields of a Part time employee
/// \details <b>Details</b> -It will validate all the parents attributes,
/// than it validates all the attributes specific
/// to the class. If all field are valid, it return
/// a bool and set the employee to be valid.
///
/// \param no parameters
/// \return ret - <b>bool</b> -The result to see if the part time employee is valid.
///
public override bool Validate()
{
string exceptions = "" ;
bool ret = true;
if (employeeType != 'P')
{
ret = false;
exceptions += "\nThe employee must be a part time employee\n";
}
//horly rate must be positive and not zero
if (hourlyRate <= 0)
{
exceptions += "Hourly Rate cannot be negative or zero\n";
ret = false;
}
// First name cannot be blank to be a valid part time employee
if (firstName != "")
{
// part time employee's First name must only contain aplhabets, hyphen and dashes
if (Regex.IsMatch(firstName, "[^a-zA-Z-']"))
{
exceptions += "First Name must only contain alphabets, hyphen and dashes\n";
ret = false;
}
}
else
{
exceptions += "First Name must not be empty and must only contain alphabets, hyphen and dashes";
ret = false;
}
// Last name cannot be blank to be a valid part time employee
if (lastName != "")
{
// part time employee's Last name must only contain aplhabets, hyphen and dashes
if (Regex.IsMatch(lastName, "[^a-zA-Z-']"))
{
exceptions += "Last Name must only contain alphabets, hyphen and dashes\n";
ret = false;
}
}
else
{
exceptions += "Last Name must not be empty and must only contain alphabets, hyphen and dashes\n";
ret = false;
}
//Date of birth must not be empty to be a valid part time employee
if (dateOfBirth != "")
{
bool isDateValid = validateDate(dateOfBirth);
if (!isDateValid)
{
exceptions += "The date of birth is not a valid date\n";
ret = false;
}
}
else
{
exceptions += "The date of birth is not a valid date\n";
ret = false;
}
// part time employee's SIN must be valid
bool isFTSINValid = validateSIN();
if (!isFTSINValid)
{
exceptions += "The SIN is not valid\n";
ret = false;
}
bool isFTDateValid;
// part time employee's date of Hire must not be empty
if (dateOfHire != "")
{
isFTDateValid = validateDate(dateOfHire);
if (!isFTDateValid)
{
exceptions += "The date of Hire is not a valid date\n";
ret = false;
}
}
else
{
exceptions += "The date of hire is not a valid date\n";
ret = false;
}
// date of termination may be blank or a valid date
if (dateOfTermination != "")
{
isFTDateValid = validateDate(dateOfTermination);
if (!isFTDateValid)
{
exceptions += "The date of termination is not a valid date\n";
ret = false;
}
}
if (dateOfBirth != "" && dateOfHire != "" )
{
int fire = 0;
//check if the employee is not too old or too young
int birth = Convert.ToInt32(dateOfBirth.Substring(0, 4));
int hire = Convert.ToInt32(dateOfHire.Substring(0, 4));
if (dateOfTermination != "")
{
fire = Convert.ToInt32(dateOfTermination.Substring(0, 4));
}
if ((hire - birth) > 100)
{
ret = false;
exceptions += "Employee's age must not be larger than 100\n";
}
if (fire != 0)
{
if ((fire - hire) > 100)
{
ret = false;
exceptions += "Employee's Work period must not be larger than 100\n";
}
}
if ((hire - birth) < 14)
{
ret = false;
exceptions += "Employee must be 14 years or older to start work\n";
}
if ((hire < birth))
{
ret = false;
exceptions += "Employee Cannot start work before their birth date\n";
}
if (fire != 0)
{
if (fire < hire)
{
ret = false;
exceptions += "Employee Cannot be fired when they have not started working\n";
}
}
if (birth > 2014)
{
ret = false;
exceptions += "Employee cannot be born on a date that has not occured\n";
}
if (hire > 2014)
{
ret = false;
exceptions += "Employee cannot be hired on a date that has not occured\n";
}
if (fire != 0)
{
if (fire > 2014)
{
ret = false;
exceptions += "Employee cannot be fired on a date that has not occured\n";
}
}
}
if (ret)
isValidEmp = true;
else
{
isValidEmp = false;
throw new Exception(exceptions);
}
return ret;
}
///
/// \brief This function displays all attributes of an employee.
/// \details <b>Details</b> -The child function is displays all
/// the attributes and displays if the
/// part time employee is valid.
/// \param no params
/// \return no returns
///
public override void Details()
{
// display employee details
string type = "";
if (employeeType == PART_TIME)
{
type = "Part Time";
}
else
{
type += employeeType;
}
Console.WriteLine("\n************************************************************");
Console.WriteLine(" EMPLOYEE DETAILS ");
Console.WriteLine(" Is Employee Valid ? {0}", isValidEmp);
Console.WriteLine("*************************************************************");
Console.WriteLine(" |");
Console.WriteLine(" Employee Type | {0}", type);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" First Name | {0}", firstName);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" Last Name | {0}", lastName);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" Date Of Birth | {0}", dateOfBirth);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" Social Insurance Number | {0}", socialInsuranceNumber);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" Date Of Hire | {0}", dateOfHire);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" Date Of Termination | {0}", dateOfTermination);
Console.WriteLine(" |");
Console.WriteLine("-------------------------|----------------------------------");
Console.WriteLine(" |");
Console.WriteLine(" Hourly Rate | {0}", hourlyRate);
Console.WriteLine(" |");
Console.WriteLine("************************************************************\n");
/*Log in file after details*/
/* cant log it from here*/
}
///
/// \brief This function puts all attributes of an employee into a string to be logged in the logfile.
/// \details <b>Details</b> - concatenates if the employee is valid, all
/// the attributes and sends them to the log file
///
/// \param no params
/// \return no returns
///
public override string ToString()
{
string empStr = "";
string type = "";
if (employeeType == PART_TIME)
{
type = "Part Time";
}
else
{
type += employeeType;
}
empStr +="\r\n************************************************************\r\n";
empStr +=" EMPLOYEE DETAILS \r\n";
empStr +=" Is Employee Valid ?"+ isValidEmp+"\r\n";
empStr +="*************************************************************\r\n";
empStr +=" |\r\n";
empStr +=" Employee Type | "+type+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" First Name | "+firstName+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" Last Name | "+lastName+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" Date Of Birth | "+dateOfBirth+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" Social Insurance Number | "+socialInsuranceNumber+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" Date Of Hire | "+dateOfHire+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" Date Of Termination | "+dateOfTermination+"\r\n";
empStr +=" |\r\n";
empStr +="-------------------------|----------------------------------\r\n";
empStr +=" |\r\n";
empStr +=" Hourly Rate | "+hourlyRate+"\r\n";
empStr +=" |\r\n";
empStr +="************************************************************\r\n";
return empStr;
}
}
}
|
using System;
using ApiTemplate.Common.Enums.DateTimes;
namespace ApiTemplate.Common.Helpers
{
public class CommonHelper
{
#region Get TimeSpan By Period
public static TimeSpan GetTimeSpanByPeriod(Period period, int val)
{
switch (period)
{
case Period.Millisecond:
{
return TimeSpan.FromMilliseconds(val);
}
case Period.Second:
{
return TimeSpan.FromSeconds(val);
}
case Period.Minute:
{
return TimeSpan.FromMinutes(val);
}
case Period.Hour:
{
return TimeSpan.FromHours(val);
}
case Period.Day:
{
return TimeSpan.FromDays(val);
}
case Period.Month:
{
return TimeSpan.FromDays(30 * val);
}
case Period.Year:
{
return TimeSpan.FromDays(365 * val);
}
case Period.Week:
{
return TimeSpan.FromDays(7 * val);
}
default:
{
return TimeSpan.FromHours(1);
}
}
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SnowAPI.Models
{
public class CreateResourceModel
{
public string Link { get; set; }
}
}
|
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Cooldowns : MonoBehaviour
{
private GameObject uiAbilities;
private Dictionary<AttackType, Cooldown> cooldowns = new Dictionary<AttackType, Cooldown> ();
public void Initialize (GameObject uiAbilitiesGameObject)
{
this.uiAbilities = uiAbilitiesGameObject;
}
public void Activate (AttackType type, int duration)
{
if (InProgress(type)) {
throw new Exception ("type: " + type + " is already in progress. cannot activate");
}
var coroutine = GetOrCreateCooldown(type).Activate(duration);
StartCoroutine(coroutine);
}
private Cooldown GetOrCreateCooldown (AttackType type)
{
if (!this.cooldowns.ContainsKey(type)) {
this.cooldowns [type] = Cooldown.create(GetCooldownGameObject(type));
}
return this.cooldowns[type];
}
public bool InProgress(AttackType type) {
return !this.cooldowns.ContainsKey(type) ? false : this.cooldowns [type].InProgress();
}
private GameObject GetCooldownGameObject (AttackType type)
{
switch (type) {
case AttackType.BLUE:
return this.uiAbilities.transform.Find("Ability Blue/Cooldown Cover").gameObject;
case AttackType.GREEN:
return this.uiAbilities.transform.Find("Ability Green/Cooldown Cover").gameObject;
case AttackType.PURPLE:
return this.uiAbilities.transform.Find("Ability Purple/Cooldown Cover").gameObject;
case AttackType.RED:
return this.uiAbilities.transform.Find("Ability Red/Cooldown Cover").gameObject;
default:
throw new ArgumentException ("unknown type: " + type);
}
}
}
|
using IndusValley.Banking;
using IndusValley.Broker;
using SE.Miscellaneous;
using SE.Money;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IndusValley.Tests {
public class TestOrder : IOrder {
public Guid Id { get; internal set; }
public bool IsExecuted { get; internal set; }
public Money Limit { get; internal set; }
public decimal Shares { get; internal set; }
public Money Slippage { get; internal set; }
public Stock Stock { get; internal set; }
}
public class TestBrokerage : IBroker {
private Dictionary<Guid, IOrder> buyOrders = new Dictionary<Guid, IOrder>();
private Dictionary<Guid, IOrder> sellOrders = new Dictionary<Guid, IOrder>();
public async Task<Maybe<IOrder>> SubmitBuyOrder(string symbol, Account account, Money amount) {
await Task.Yield();
var id = Guid.NewGuid();
var slippage = MoneyUtil.TenPercentOf(amount);
var order = new TestOrder() {
Id = id,
Slippage = slippage,
IsExecuted = false
};
buyOrders.Add(id, order);
return Maybe<IOrder>.Some(order);
}
public async Task<Maybe<IOrder>> CheckBuyOrder(Guid buyId) {
await Task.Yield();
var order = ((TestOrder)buyOrders[buyId]);
order.IsExecuted = true;
return Maybe<IOrder>.Some(buyOrders[buyId]);
}
public IObservable<Money> Stock(string symbol) {
throw new NotImplementedException();
}
public async Task<Maybe<IOrder>> SubmitSellOrder(string symbol, Account account, double shares) {
await Task.Yield();
var id = Guid.NewGuid();
var slippage = MoneyUtil.NinetyPercentOf(new Money(shares * 10, Currency.FromCurrencyCode(CurrencyCode.USD)));
var order = new TestOrder() {
Id = id,
Slippage = slippage,
IsExecuted = false
};
sellOrders.Add(id, order);
return Maybe<IOrder>.Some(order);
}
public async Task<Maybe<IOrder>> CheckSellOrder(Guid sellId) {
await Task.Yield();
var order = ((TestOrder)sellOrders[sellId]);
order.IsExecuted = true;
return Maybe<IOrder>.Some(order);
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using KartLib;
using KartLib.Views;
using KartObjects;
using System.IO;
using System.Threading;
using FastReport;
namespace KartSystem
{
public partial class ConsTradeReportView : KartUserControl
{
public ConsTradeReportView()
{
InitializeComponent();
ViewObjectType = ObjectType.ConsTradeReport;
deFrom.DateTime = DateTime.Now;
deTo.DateTime = DateTime.Now;
}
public override void InitView()
{
ucSelectedWarehouses1.Init();
base.InitView();
}
public override void SaveSettings()
{
ConsTradeReportViewSettings s = new ConsTradeReportViewSettings();
s.SelectedWarehous = ucSelectedWarehouses1.SelectedWarehouses;
s.DateBegin = deFrom.DateTime;
s.DateEnd = deTo.DateTime;
SaveSettings<ConsTradeReportViewSettings>(s);
gvConsTradeReport.SaveLayoutToXml(gvSettingsFileName(gvConsTradeReport.Name));
}
public override void LoadSettings()
{
ConsTradeReportViewSettings s = (ConsTradeReportViewSettings)LoadSettings<ConsTradeReportViewSettings>();
if (s != null)
{
ucSelectedWarehouses1.SelectedWarehouses = s.SelectedWarehous;
deFrom.DateTime = s.DateBegin;
deTo.DateTime = s.DateEnd;
}
if (File.Exists(gvSettingsFileName(gvConsTradeReport.Name)))
gvConsTradeReport.SaveLayoutToXml(gvSettingsFileName(gvConsTradeReport.Name));
}
private void openButton_Click(object sender, EventArgs e)
{
CalcReport();
}
List<TradeReportExt> _TradeReportExt = new List<TradeReportExt>();
FormWait frmWait = null;
private void CalcReport()
{
if (ucSelectedWarehouses1.SelectedWarehouses == null)
{
MessageBox.Show(@"Выберите склад.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
KartDataDictionary.ReportRunningFlag = true;
Loader.DataContext.BeginTransaction();
KartDataDictionary.CheckReportSession(null, deFrom.DateTime, deTo.DateTime);
if (ucSelectedWarehouses1.SelectedWarehouses.Count > 0)
{
foreach (Warehouse wh in ucSelectedWarehouses1.SelectedWarehouses)
{
ReportExtParam rep = new ReportExtParam() { IdParam = wh.Id, IdReportSession = KartDataDictionary.currentReportSession.IdSession, typeParam = TypeExtParam.Warehouse };
Saver.SaveToDb<ReportExtParam>(rep);
}
}
try
{
frmWait = new FormWait("Формирование данных ...");
Exception s = null;
// Процесс формирования запускаем отдельным потоком
Thread thread = new Thread(new ThreadStart(
delegate
{
try
{
_TradeReportExt = Loader.DbLoad<TradeReportExt>("1 = 1 order by SECTIONORDER, SECTIONNAME, SUBSECTIONNAME, DOCDATE, DOCINDEX, NAMESUPPLIER", 0, deFrom.DateTime, deTo.DateTime, KartDataDictionary.currentReportSession.IdSession) ?? new List<TradeReportExt>();
Thread.Sleep(10);
}
catch (Exception e1)
{
s = e1;
}
frmWait.CloseWaitForm();
})) { IsBackground = true };
thread.Start();
frmWait.ShowDialog();
frmWait.Dispose();
frmWait = null;
if (s != null)
throw s;
}
catch (Exception exc)
{
ExtMessageBox.ShowError(string.Format("При формировании данных произошли ошибки.\r\n{0}", exc.Message));
if (frmWait != null)
frmWait.CloseWaitForm();
}
KartDataDictionary.ReportRunningFlag = false;
Loader.DataContext.CommitTransaction();
tradeReportExtBindingSource.DataSource = _TradeReportExt;
}
private void printButton_Click(object sender, EventArgs e)
{
if (ucSelectedWarehouses1.SelectedWarehouses == null)
{
MessageBox.Show(@"Выберите склад.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
using (Report report = new Report())
{
string _ReportPath = Settings.GetExecPath() + @"\Reports";
if (!File.Exists(_ReportPath + @"\TradeReportWarehouse.frx"))
{
MessageBox.Show("Не найден файл:\n" + _ReportPath + @"\TradeReportWarehouse.frx");
return;
}
report.Load(_ReportPath + @"\TradeReportWarehouse.frx");
if (report == null) return;
if (_TradeReportExt.Count == 0)
{
CalcReport();
}
List<TradeReportExtSixWarehouse> _TradeReportExtSixWarehouse = new List<TradeReportExtSixWarehouse>();
List<string> _listWhSectionName = new List<string>();
foreach (TradeReportExt value in _TradeReportExt)
{
if (!_listWhSectionName.Exists(s => s == value.WarehouseName))
_listWhSectionName.Add(value.WarehouseName);
}
_listWhSectionName.Sort();
foreach (TradeReportExt item in _TradeReportExt)
{
if (!_TradeReportExtSixWarehouse.Exists(q => q.SectionName == item.SectionName
&& q.SubSectionName == item.SubSectionName
&& q.SectionOrder == item.SectionOrder
&& q.NameSupplier == item.NameSupplier
&& q.DocDate == item.DocDate
&& q.DocIndex == item.DocIndex))
{
_TradeReportExtSixWarehouse.Add(new TradeReportExtSixWarehouse()
{
SectionName = item.SectionName,
SubSectionName = item.SubSectionName,
SectionOrder = item.SectionOrder,
NameSupplier = item.NameSupplier,
DocDate = item.DocDate,
DocIndex = item.DocIndex
});
}
TradeReportExtSixWarehouse FindSection = _TradeReportExtSixWarehouse.Find(q => q.SectionName == item.SectionName
&& q.SubSectionName == item.SubSectionName
&& q.SectionOrder == item.SectionOrder
&& q.NameSupplier == item.NameSupplier
&& q.DocDate == item.DocDate
&& q.DocIndex == item.DocIndex);
if (FindSection != null)
{
int index = _listWhSectionName.IndexOf(item.WarehouseName);
switch (index)
{
case 0:
FindSection.CostSum1 = item.CostSum;
FindSection.PriceSum1 = item.PriceSum;
FindSection.WarehouseName1 = _listWhSectionName[index];
FindSection.TareSum1 = item.TareSum;
break;
case 1:
FindSection.CostSum2 = item.CostSum;
FindSection.PriceSum2 = item.PriceSum;
FindSection.WarehouseName2 = _listWhSectionName[index];
FindSection.TareSum2 = item.TareSum;
break;
case 2:
FindSection.CostSum3 = item.CostSum;
FindSection.PriceSum3 = item.PriceSum;
FindSection.WarehouseName3 = _listWhSectionName[index];
FindSection.TareSum3 = item.TareSum;
break;
case 3:
FindSection.CostSum4 = item.CostSum;
FindSection.PriceSum4 = item.PriceSum;
FindSection.WarehouseName4 = _listWhSectionName[index];
FindSection.TareSum4 = item.TareSum;
break;
case 4:
FindSection.CostSum5 = item.CostSum;
FindSection.PriceSum5 = item.PriceSum;
FindSection.WarehouseName5 = _listWhSectionName[index];
FindSection.TareSum5 = item.TareSum;
break;
case 5:
FindSection.CostSum6 = item.CostSum;
FindSection.PriceSum6 = item.PriceSum;
FindSection.WarehouseName6 = _listWhSectionName[index];
FindSection.TareSum6 = item.TareSum;
break;
case 6:
FindSection.CostSum7 = item.CostSum;
FindSection.PriceSum7 = item.PriceSum;
FindSection.WarehouseName7 = _listWhSectionName[index];
FindSection.TareSum7 = item.TareSum;
break;
case 7:
FindSection.CostSum8 = item.CostSum;
FindSection.PriceSum8 = item.PriceSum;
FindSection.WarehouseName8 = _listWhSectionName[index];
FindSection.TareSum8 = item.TareSum;
break;
default:
break;
}
}
}
report.RegisterData(_TradeReportExtSixWarehouse, "tradeReportExtSixWarehouseBindingSource");
report.GetDataSource("tradeReportExtSixWarehouseBindingSource").Enabled = true;
TextObject Date = (TextObject)report.FindObject("Date");
if (Date != null)
Date.Text = "Период c " + deFrom.DateTime.ToShortDateString() + " по " + deTo.DateTime.ToShortDateString();
string WarehouseName = "";
if (_listWhSectionName.Count > 0)
{
WarehouseName = "";
int i = 1;
foreach (string wh in _listWhSectionName)
{
if (i == 1)
WarehouseName += wh;
else
WarehouseName += ", " + wh;
i++;
}
}
FastReport.Table.TableCell Cell73 = (FastReport.Table.TableCell)report.FindObject("Cell73");
FastReport.Table.TableCell Cell74 = (FastReport.Table.TableCell)report.FindObject("Cell74");
FastReport.Table.TableCell Cell75 = (FastReport.Table.TableCell)report.FindObject("Cell75");
FastReport.Table.TableCell Cell76 = (FastReport.Table.TableCell)report.FindObject("Cell76");
FastReport.Table.TableCell Cell77 = (FastReport.Table.TableCell)report.FindObject("Cell77");
FastReport.Table.TableCell Cell78 = (FastReport.Table.TableCell)report.FindObject("Cell78");
FastReport.Table.TableCell Cell79 = (FastReport.Table.TableCell)report.FindObject("Cell79");
FastReport.Table.TableCell Cell80 = (FastReport.Table.TableCell)report.FindObject("Cell80");
if (_listWhSectionName.Count > 0)
if (Cell73 != null)
Cell73.Text = _listWhSectionName[0];
if (_listWhSectionName.Count > 1)
if (Cell74 != null)
Cell74.Text = _listWhSectionName[1];
if (_listWhSectionName.Count > 2)
if (Cell75 != null)
Cell75.Text = _listWhSectionName[2];
if (_listWhSectionName.Count > 3)
if (Cell76 != null)
Cell76.Text = _listWhSectionName[3];
if (_listWhSectionName.Count > 4)
if (Cell77 != null)
Cell77.Text = _listWhSectionName[4];
if (_listWhSectionName.Count > 5)
if (Cell78 != null)
Cell78.Text = _listWhSectionName[5];
//
// if (_listWhSectionName.Count > 6)
// if (Cell79 != null)
// Cell79.Text = _listWhSectionName[6];
//
// if (_listWhSectionName.Count > 7)
// if (Cell80 != null)
// Cell80.Text = _listWhSectionName[7];
TextObject Warehouse = (TextObject)report.FindObject("Warehouse");
if (Warehouse != null)
Warehouse.Text = WarehouseName;
if (report.Prepare())
report.ShowPrepared(true);
}
}
private void tradeReportExtSixWarehouseBindingSource_CurrentChanged(object sender, EventArgs e)
{
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class EnviarMensaje : System.Web.UI.Page
{
webservicio.Webservice2Client conec = new webservicio.Webservice2Client();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button12_Click(object sender, EventArgs e)
{
string men = mensaje.Text;
string des = destinatario.Text;
string rem = remitente.Text;
conec.EnviarMensaje(men, des, rem);
mensaje.Text = "";
destinatario.Text = "";
remitente.Text = "";
}
} |
using UnityEngine;
public class xInputManager
{
static public Quaternion GetWorldRotation(float h_, float v_)
{
//float h = GetHorizontalValue();
//float v = GetVerticalValue();
float upRotation = Vector2.Angle(Vector2.up, new Vector2(h_, v_));
if (h_ < 0f) upRotation = 360f - upRotation;
return Quaternion.Euler(0f, upRotation, 0f);
}
static public void SetHorizontalValue(float val, bool use)
{
s_horizontalValue = val;
s_useJoystick = use;
}
static public float GetHorizontalValue()
{
if (s_useJoystick)
{
return s_horizontalValue;
}
else
{
return Input.GetAxis("Horizontal");
}
}
static public float GetHorizontalValueRaw()
{
if (s_useJoystick)
{
return (s_horizontalValue >= 0) ? Mathf.Ceil(s_horizontalValue) : Mathf.Floor(s_horizontalValue);
}
else
{
float h = Input.GetAxis("Horizontal");
return (h >= 0) ? Mathf.Ceil(h) : Mathf.Floor(h);
}
}
static public void SetVerticalValue(float val, bool use)
{
s_verticalValue = val;
s_useJoystick = use;
}
static public float GetVerticalValue()
{
if (s_useJoystick)
{
return s_verticalValue;
}
else
{
return Input.GetAxis("Vertical");
}
}
static public float GetVerticalValueRaw()
{
if (s_useJoystick)
{
return (s_verticalValue >= 0) ? Mathf.Ceil(s_verticalValue) : Mathf.Floor(s_verticalValue);
}
else
{
float v = Input.GetAxis("Vertical");
return (v >= 0) ? Mathf.Ceil(v) : Mathf.Floor(v);
}
}
static private bool s_useJoystick = false;
static private float s_horizontalValue = 0.0f;
static private float s_verticalValue = 0.0f;
}
|
using System.Collections.Generic;
namespace Embraer_Backend.Models
{
public class LimpezaIndex
{
public List<string> TipoControle { get; set; }
public IEnumerable<LocalMedicao> Local { get; set; }
public LimpezaIndex()
{
this.TipoControle = new List<string>();
this.Local = new List<LocalMedicao>();
}
}
} |
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
namespace LeetCodeTests
{
public abstract class Problem_0077
{
/*
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
*/
public static void Test()
{
Solution sol = new Solution();
/*
var input = new int[] { 2, 7, 11, 15 };
Console.WriteLine($"Input array: {string.Join(", ", input)}");
*/
int n = 4;
int k = 2;
Console.WriteLine($"All combinations for n={n} and k={k}: {Utils.PrintArray(sol.Combine(n, k))}");
}
public class Solution
{
public IList<IList<int>> Combine(int n, int k)
{
List<IList<int>> resList = new List<IList<int>>();
FillListWithCombinations(resList, new List<int>(), n, k, 1);
return resList;
}
private void FillListWithCombinations(IList<IList<int>> resList, List<int> accum, int n, int k, int startFrom)
{
if (k == 0)
{
resList.Add(new List<int>(accum));
}
else
{
for (int i = startFrom; i <= n - k + 1; i++)
{
accum.Add(i);
FillListWithCombinations(resList, accum, n, k - 1, i + 1);
accum.Remove(i);
}
}
}
}
}//public abstract class Problem_
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Otiport.API.Contract.Request.Medicines
{
public class DeleteMedicineRequest : RequestBase
{
public int MedicineId { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataModel.Models
{
[Table("tblProduct")]
public class tblProduct
{
BaseDataContext db = new BaseDataContext();
[Key]
public int Product_ID { get; set; }
//[Required(ErrorMessage = "Please enter name.")]
public Nullable<int> CategoryId { get; set; }
public string ProductName { get; set; }
public Decimal? Cost { get; set; }
public string QRN { get; set; }
public byte[] ProductImage { get; set; }
public int? ParentId { get; set; }
public bool? IsParent { get; set; }
public int? HolderTypeId { get; set; }
public bool? IsParentInsert { get; set; }
public string PartNumber { get; set; }
public string Diameter { get; set; }
public string Length { get; set; }
public string Code { get; set; }
private string pName;
[NotMapped]
public string Parent
{
get
{
if (CategoryId != null)
{
return db.tCategories.Find(CategoryId).Name;
}
else
{
return "";
}
}
set
{
if (CategoryId != null)
{
if (value == db.tCategories.Find(CategoryId).Name)
pName = value;
}
else
{
pName = "";
}
}
}
}
}
|
using FluentValidation;
using INOTE.Core.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace INOTE.Core.EntityValidator
{
public class NoteValidator : AbstractValidator<Note>
{
public NoteValidator()
{
RuleFor(n => n.Title)
.NotEmpty().WithMessage("Please specify title")
.MinimumLength(8).MaximumLength(32);
RuleFor(n => n.Content)
.NotEmpty().WithMessage("Please specify content")
.MinimumLength(1).MaximumLength(10000);
}
}
}
|
using iSukces.Code.Interfaces;
namespace iSukces.Code.Irony
{
public abstract class TokenInfo : ICsExpression, ITokenNameSource
{
protected TokenInfo(TokenName name) => Name = name;
public NonTerminalInfo CreateOptional()
{
var info1 = new NonTerminalInfo(new TokenName(Name.Name + "_optional"))
.AsOptional(this);
return info1;
}
public abstract string GetCode(ITypeNameResolver resolver);
public TokenName GetTokenName() => Name;
public abstract TokenNameTarget GetTokenNameIsNonterminal();
public TokenName Name { get; }
public TokenCreationInfo CreationInfo { get; } = new TokenCreationInfo();
}
public class TokenCreationInfo
{
public ConstructorBuilder DataConstructor { get; set; }
public CsClass AstClass { get; set; }
public CsClass DataClass { get; set; }
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data
{
[Serializable()]
public class ConcreteProductCategory : ProductCategory
{
public string Name { get; private set; }
public string ID { get; private set; }
public ProductCategory Parent { get; set; }
public IList<ProductCategory> SubCategories { get; private set; }
private IList<Product> products;
public IList<object> Children
{
get
{
List<object> children = new List<object>();
children.AddRange(SubCategories);
children.AddRange(products);
return children;
}
}
public ConcreteProductCategory(string id, string name, ProductCategory parent)
{
this.ID = id;
this.Name = name;
this.Parent = parent;
this.SubCategories = new List<ProductCategory>();
products = new List<Product>();
if (parent != null)
{
parent.SubCategories.Add(this);
}
}
public void AddProduct(Product p)
{
products.Add(p);
p.Categories.Add(this);
}
public IEnumerable<ShoppingItem> GetItems()
{
List<ShoppingItem> ps = products.Select(p => new ShoppingItem(p, 1)).ToList();
foreach (ProductCategory subCat in SubCategories)
{
ps.AddRange(subCat.GetItems());
}
return ps.Distinct();
}
public ProductCategory GetCategoryByID(string id)
{
if (id == ID) { return this; }
foreach (ProductCategory category in SubCategories)
{
ProductCategory c = category.GetCategoryByID(id);
if (c != null)
{
return c;
}
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using Meshop.Framework.Module;
using Meshop.Framework.Security;
namespace Meshop.Reviews.Controllers
{
[Admin]
[Menu(Name="Reviews")]
public class AdminReviewsController : PluginController
{
//
// GET: /AdminReviews/
public ActionResult Index()
{
return View(new object());
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using CODE.Framework.Wpf.Layout;
using CODE.Framework.Wpf.Utilities;
namespace CODE.Framework.Wpf.Mvvm
{
/// <summary>
/// Items control that auto-populates from an Actions collection of model object that implements IHaveActions
/// </summary>
public class ViewActionItemsControl : ItemsControl
{
/// <summary>
/// Model used as the data context
/// </summary>
public object Model
{
get { return GetValue(ModelProperty); }
set { SetValue(ModelProperty, value); }
}
/// <summary>
/// Model dependency property
/// </summary>
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register("Model", typeof(object), typeof(ViewActionItemsControl), new UIPropertyMetadata(null, ModelChanged));
/// <summary>
/// Change handler for model property
/// </summary>
/// <param name="d">The dependency object that triggered this change.</param>
/// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
private static void ModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var itemsControl = d as ViewActionItemsControl;
if (itemsControl == null) return;
itemsControl.RepopulateItems(e.NewValue);
}
/// <summary>
/// Policy that can be applied to view-actions displayed in the ribbon.
/// </summary>
/// <remarks>
/// This kind of policy can be used to change which view-actions are to be displayed, or which order they are displayed in.
/// </remarks>
/// <value>The view action policy.</value>
public IViewActionPolicy ViewActionPolicy
{
get { return (IViewActionPolicy)GetValue(ViewActionPolicyProperty); }
set { SetValue(ViewActionPolicyProperty, value); }
}
/// <summary>
/// Policy that can be applied to view-actions displayed in the ribbon.
/// </summary>
/// <remarks>
/// This kind of policy can be used to change which view-actions are to be displayed, or which order they are displayed in.
/// </remarks>
/// <value>The view action policy.</value>
public static readonly DependencyProperty ViewActionPolicyProperty = DependencyProperty.Register("ViewActionPolicy", typeof(IViewActionPolicy), typeof(ViewActionItemsControl), new PropertyMetadata(null));
/// <summary>
/// If set to true, actions are sorted by group title, before they are sorted by order
/// </summary>
/// <value><c>true</c> if [order by group title]; otherwise, <c>false</c>.</value>
public bool OrderByGroupTitle
{
get { return (bool)GetValue(OrderByGroupTitleProperty); }
set { SetValue(OrderByGroupTitleProperty, value); }
}
/// <summary>
/// If set to true, actions are sorted by group title, before they are sorted by order
/// </summary>
public static readonly DependencyProperty OrderByGroupTitleProperty = DependencyProperty.Register("OrderByGroupTitle", typeof (bool), typeof (ViewActionItemsControl), new PropertyMetadata(false));
/// <summary>
/// Title for empty global category titles (default: File)
/// </summary>
public string EmptyGlobalCategoryTitle
{
get { return (string)GetValue(EmptyGlobalCategoryTitleProperty); }
set { SetValue(EmptyGlobalCategoryTitleProperty, value); }
}
/// <summary>
/// Title for empty global category titles (default: File)
/// </summary>
public static readonly DependencyProperty EmptyGlobalCategoryTitleProperty = DependencyProperty.Register("EmptyGlobalCategoryTitle", typeof(string), typeof(ViewActionItemsControl), new PropertyMetadata("File"));
private void RepopulateItems(object model)
{
var actionsContainer = model as IHaveActions;
if (actionsContainer != null && actionsContainer.Actions != null)
{
actionsContainer.Actions.CollectionChanged += (s, e2) => PopulateItems(actionsContainer);
Visibility = Visibility.Visible;
PopulateItems(actionsContainer);
}
else
Visibility = Visibility.Collapsed;
}
/// <summary>
/// Populates the current items control with items based on the actions collection
/// </summary>
/// <param name="actions">List of actions</param>
protected virtual void PopulateItems(IHaveActions actions)
{
RemoveAllMenuKeyBindings();
Items.Clear();
if (actions == null || actions.Actions == null) return;
var actionList = actions.Actions.ToList();
var rootCategories = ViewActionPolicy != null ? ViewActionPolicy.GetTopLevelActionCategories(actionList, EmptyGlobalCategoryTitle) : ViewActionHelper.GetTopLevelActionCategories(actionList, EmptyGlobalCategoryTitle);
var viewActionCategories = rootCategories as ViewActionCategory[] ?? rootCategories.ToArray();
foreach (var category in viewActionCategories)
{
var matchingActions = ViewActionPolicy != null ? ViewActionPolicy.GetAllActionsForCategory(actionList, category, orderByGroupTitle: OrderByGroupTitle) : ViewActionHelper.GetAllActionsForCategory(actionList, category, orderByGroupTitle: OrderByGroupTitle);
foreach (var action in matchingActions)
{
var wrapper = new DependencyViewActionWrapper(action);
if (action.Categories.Count > 0)
{
MetroTiles.SetGroupName(wrapper, action.Categories[0].Id);
MetroTiles.SetGroupTitle(wrapper, action.Categories[0].Caption);
}
else
{
MetroTiles.SetGroupName(wrapper, string.Empty);
MetroTiles.SetGroupTitle(wrapper, string.Empty);
}
if (action.Availability != ViewActionAvailabilities.Unavailable)
MetroTiles.SetTileVisibility(wrapper, action.Visibility);
else
MetroTiles.SetTileVisibility(wrapper, Visibility.Collapsed);
Items.Add(wrapper);
if (action.ShortcutKey == Key.None) continue;
MenuKeyBindings.Add(new ViewActionMenuKeyBinding(action));
}
}
CreateAllMenuKeyBindings();
}
/// <summary>
/// For internal use only
/// </summary>
protected readonly List<ViewActionMenuKeyBinding> MenuKeyBindings = new List<ViewActionMenuKeyBinding>();
/// <summary>
/// Removes all key bindings from the current window that were associated with a view category menu
/// </summary>
protected virtual void CreateAllMenuKeyBindings()
{
var window = ElementHelper.FindVisualTreeParent<Window>(this);
if (window == null) return;
foreach (var binding in MenuKeyBindings)
window.InputBindings.Add(binding);
}
/// <summary>
/// Removes all key bindings from the current window that were associated with a view category menu
/// </summary>
protected virtual void RemoveAllMenuKeyBindings()
{
MenuKeyBindings.Clear();
var window = ElementHelper.FindVisualTreeParent<Window>(this);
if (window == null) return;
var bindingIndex = 0;
while (true)
{
if (bindingIndex >= window.InputBindings.Count) break;
var binding = window.InputBindings[bindingIndex];
if (binding is ViewActionMenuKeyBinding)
window.InputBindings.RemoveAt(bindingIndex); // We remove the item from the collection and start over with the remove operation since now all indexes changed
else
bindingIndex++;
}
}
}
}
|
using Contracts;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace ExploitEngine.Vulnerabilities
{
public class ExploitBase : IExploit
{
protected Threat Threat { get; set; }
protected string ExploitFilePath { get; set; }
protected string Command { get; set; }
public ExploitBase(string exploitFilePath, string command= "\"{0}\" {1}")
{
this.ExploitFilePath = exploitFilePath;
this.Command = command;
}
protected void RunCommandOnChildShell(Threat threat, string command)
{
var processInfo = new ProcessStartInfo
{
UseShellExecute = false, // change value to false
FileName = "cmd.exe",
Arguments = $"/c {command}"
};
Console.WriteLine($"Starting exploit: {threat.Type.ToString()} for the vulnerability: {threat.FilePath}");
using (var process = Process.Start(processInfo))
{
process.WaitForExit();
}
}
public virtual void Initialize(Threat threat)
{
this.Threat = threat;
}
public virtual void Exploit()
{
string workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
string exploitPath = Path.Combine(workingDirectory, ExploitFilePath);
string command = string.Format(Command, Threat.FilePath, exploitPath);
RunCommandOnChildShell(Threat, command);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace HolaWEB.App.Frontend.Pages{
public class ListModel:PageModel{
private string[] saludos = {"Hola", "Buenos días", "Hasta luego"};
public List<string> ListaSaludos {get; set;}
public void OnGet(){
ListaSaludos = new List<string>();
ListaSaludos.AddRange(saludos);
}
}
}
|
using FluentNHibernate.Automapping.Alterations;
using Profiling2.Domain.Scr;
using FluentNHibernate.Automapping;
using Profiling2.Domain.Scr.Proposed;
using Profiling2.Domain.Scr.Person;
using Profiling2.Domain.Scr.PersonEntity;
namespace Profiling2.Infrastructure.NHibernateMaps.Overrides
{
public class RequestMappingOverride : IAutoMappingOverride<Request>
{
public void Override(AutoMapping<Request> mapping)
{
mapping.HasMany<RequestHistory>(x => x.RequestHistories)
.KeyColumn("RequestID")
.Cascade.AllDeleteOrphan()
.Inverse();
mapping.HasMany<RequestProposedPerson>(x => x.ProposedPersons)
.KeyColumn("RequestID")
.Cascade.AllDeleteOrphan()
.Inverse();
mapping.HasMany<RequestPerson>(x => x.Persons)
.KeyColumn("RequestID")
.Cascade.AllDeleteOrphan()
.Inverse();
mapping.HasMany<ScreeningRequestEntityResponse>(x => x.ScreeningRequestEntityResponses)
.KeyColumn("RequestID")
.Cascade.AllDeleteOrphan()
.Inverse();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Eevee.Models;
namespace Eevee.Data
{
public class EeveeContext : DbContext
{
public EeveeContext (DbContextOptions<EeveeContext> options)
: base(options)
{
}
public DbSet<Eevee.Models.AccountType> AccountType{ get; set; }
public DbSet<Eevee.Models.Artist> Artist { get; set; }
public DbSet<Eevee.Models.AdvertiserType> AdvertiserType { get; set; }
public DbSet<Eevee.Models.Album> Album{ get; set; }
public DbSet<Eevee.Models.Genre> Genre{ get; set; }
public DbSet<Eevee.Models.History> History{ get; set; }
public DbSet<Eevee.Models.Instrument> Instrument { get; set; }
public DbSet<Eevee.Models.InstrumentManufacturer> InstrumentManufacturer { get; set; }
public DbSet<Eevee.Models.InstrumentType> InstrumentType { get; set; }
public DbSet<Eevee.Models.Note> Note{ get; set; }
public DbSet<Eevee.Models.Playlist> Playlist{ get; set; }
public DbSet<Eevee.Models.PlaylistSongAssignment> PlaylistSongAssignment{ get; set; }
public DbSet<Eevee.Models.Song> Song { get; set; }
public DbSet<Eevee.Models.SongInstrumentAssignment> SongInstrumentAssignment{ get; set; }
public DbSet<Eevee.Models.User> User { get; set; }
public DbSet<Eevee.Models.UserAccountTypeAssignment> UserAccountTypeAssignment { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using XH.Infrastructure.Query;
namespace XH.APIs.WebAPI.Models
{
/// <summary>
/// List request base
/// </summary>
[DataContract]
public class ListRequestBase
{
/// <summary>
/// TO DO, In setting
/// </summary>
public ListRequestBase()
{
Page = 1;
PageSize = 15;
}
/// <summary>
/// Sorts
/// </summary>
[DataMember]
public List<SortItem> Sorts { get; set; }
/// <summary>
/// Page
/// </summary>
[DataMember]
public int Page { get; set; }
/// <summary>
/// Page size
/// </summary>
[DataMember]
public int PageSize { get; set; }
}
} |
using System;
using System.Linq;
using Upgrader.Infrastructure;
namespace Upgrader.MySql
{
public class MySqlDatabase : Database
{
private static readonly Lazy<ConnectionFactory> ConnectionFactory = new Lazy<ConnectionFactory>(() => new ConnectionFactory("MySql.Data.dll", "MySql.Data.MySqlClient.MySqlConnection"));
private readonly string connectionString;
/// <summary>
/// Initializes a new instance of the <see cref="MySqlDatabase"/> class.
/// </summary>
/// <param name="connectionString">Connection string.</param>
public MySqlDatabase(string connectionString) : base(ConnectionFactory.Value.CreateConnection(connectionString), GetMasterConnectionString(connectionString, "Database", "mysql"))
{
this.connectionString = connectionString;
TypeMappings.Add<bool>("bit");
TypeMappings.Add<byte>("tinyint unsigned");
TypeMappings.Add<char>("char(1)");
TypeMappings.Add<DateTime>("datetime");
TypeMappings.Add<decimal>("decimal(19,5)");
TypeMappings.Add<double>("double");
TypeMappings.Add<float>("double");
TypeMappings.Add<Guid>("char(36)");
TypeMappings.Add<int>("int");
TypeMappings.Add<long>("bigint");
TypeMappings.Add<short>("smallint");
TypeMappings.Add<string>("varchar(50)");
TypeMappings.Add<TimeSpan>("time(3)");
}
public override bool Exists
{
get
{
UseMainDatabase();
var exists = Dapper.ExecuteScalar<bool>("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = @databaseName", new { databaseName = DatabaseName });
UseConnectedDatabase();
return exists;
}
}
internal override string[] GeneratedTypes => new string[] { };
internal override int MaxIdentifierLength => 64;
internal override string AutoIncrementStatement => "AUTO_INCREMENT";
internal override void SupportsTransactionalDataDescriptionLanguage()
{
throw new NotSupportedException("Transactional data definition language statements are not supported by MySql.");
}
internal override string GetColumnDataType(string tableName, string columnName)
{
var schemaName = GetSchema(tableName);
var columnInformation = Dapper.Query<InformationSchema.Column>(
@"
SELECT
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
NUMERIC_PRECISION,
NUMERIC_SCALE,
COLUMN_TYPE,
DATETIME_PRECISION
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
COLUMN_NAME = @columnName AND
TABLE_NAME = @tableName AND
TABLE_SCHEMA = @schemaName
",
new { tableName, schemaName, columnName }).SingleOrDefault();
if (columnInformation == null)
{
return null;
}
var unsigned = columnInformation.column_type.EndsWith("unsigned") ? " unsigned" : "";
var includePrecisionOnTypes = new[] { "varchar", "char", "integer", "time", "decimal" };
if (includePrecisionOnTypes.Contains(columnInformation.data_type) == false)
{
return columnInformation.data_type + unsigned;
}
var parameters = new[] { columnInformation.datetime_precision, columnInformation.character_maximum_length, columnInformation.numeric_precision, columnInformation.numeric_scale };
var usedParameters = parameters.Where(parameter => parameter.HasValue).Select(parameter => parameter.Value.ToString()).ToArray();
return columnInformation.data_type + (usedParameters.Any() ? "(" + string.Join(",", usedParameters) + ")" : "") + unsigned;
}
internal override string GetCreateComputedStatement(string dataType, bool nullable, string expression, bool persisted)
{
var persistedExpression = persisted ? " STORED" : "";
return $"{dataType} GENERATED ALWAYS AS ({expression}){persistedExpression}";
}
internal override void ChangeColumn(string tableName, string columnName, string dataType, bool nullable)
{
var escapedTableName = EscapeIdentifier(tableName);
var escapedColumnName = EscapeIdentifier(columnName);
var nullableStatement = nullable ? "NULL" : "NOT NULL";
Dapper.Execute($"ALTER TABLE {escapedTableName} CHANGE COLUMN {escapedColumnName} {escapedColumnName} {dataType} {nullableStatement}");
}
internal override void AddPrimaryKey(string tableName, string[] columnNames, string constraintName)
{
var isSupportedConstraintName = constraintName == "PRIMARY" || constraintName == NamingConvention.GetPrimaryKeyNamingConvention(tableName, columnNames);
Validate.IsTrue(isSupportedConstraintName, nameof(constraintName), "MySql only supports primary key constraints named \"PRIMARY\".");
base.AddPrimaryKey(tableName, columnNames, constraintName);
}
internal override void RemovePrimaryKey(string tableName, string primaryKeyName)
{
var escapedTableName = EscapeIdentifier(tableName);
Dapper.Execute($"ALTER TABLE {escapedTableName} DROP PRIMARY KEY");
}
internal override string GetForeignKeyForeignTableName(string tableName, string constraintName)
{
var schemaName = GetSchema(tableName);
return Dapper.ExecuteScalar<string>(
@"
SELECT
KCU2.TABLE_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1 ON
KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME AND
KCU1.TABLE_NAME = RC.TABLE_NAME AND
KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND
KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON
KCU2.CONSTRAINT_NAME = UNIQUE_CONSTRAINT_NAME AND
KCU2.TABLE_NAME = RC.REFERENCED_TABLE_NAME AND
KCU2.CONSTRAINT_CATALOG = UNIQUE_CONSTRAINT_CATALOG AND
KCU2.CONSTRAINT_SCHEMA = UNIQUE_CONSTRAINT_SCHEMA
WHERE
RC.CONSTRAINT_NAME = @constraintName AND
RC.CONSTRAINT_SCHEMA = @schemaName AND
KCU1.TABLE_NAME = @tableName
ORDER BY
KCU2.ORDINAL_POSITION
",
new { constraintName, tableName, schemaName });
}
internal override string[] GetForeignKeyForeignColumnNames(string tableName, string constraintName)
{
var schemaName = GetSchema(tableName);
return Dapper.Query<string>(
@"
SELECT
KCU2.COLUMN_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1 ON
KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME AND
KCU1.TABLE_NAME = RC.TABLE_NAME AND
KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND
KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON
KCU2.CONSTRAINT_NAME = UNIQUE_CONSTRAINT_NAME AND
KCU2.TABLE_NAME = RC.REFERENCED_TABLE_NAME AND
KCU2.CONSTRAINT_CATALOG = UNIQUE_CONSTRAINT_CATALOG AND
KCU2.CONSTRAINT_SCHEMA = UNIQUE_CONSTRAINT_SCHEMA
WHERE
RC.CONSTRAINT_NAME = @constraintName AND
RC.CONSTRAINT_SCHEMA = @schemaName AND
KCU1.TABLE_NAME = @tableName
ORDER BY
KCU2.ORDINAL_POSITION
",
new { constraintName, tableName, schemaName }).ToArray();
}
internal override void RemoveForeignKey(string tableName, string foreignKeyName)
{
var escapedTableName = EscapeIdentifier(tableName);
var escapedForeignKeyName = EscapeIdentifier(foreignKeyName);
Dapper.Execute($"ALTER TABLE {escapedTableName} DROP FOREIGN KEY {escapedForeignKeyName}");
}
internal override string[] GetIndexNames(string tableName)
{
var schemaName = GetSchema(tableName);
return Dapper.Query<string>(
@"
SELECT DISTINCT
INDEX_NAME
FROM INFORMATION_SCHEMA.STATISTICS
WHERE
TABLE_NAME = @tableName AND
TABLE_SCHEMA = @schemaName AND
INDEX_NAME <> 'PRIMARY'
",
new { tableName, schemaName })
.Except(GetForeignKeyNames(tableName))
.ToArray();
}
internal override void AddIndex(string tableName, string[] columnNames, bool unique, string indexName, string[] includeColumnNames)
{
if (includeColumnNames != null)
{
throw new NotSupportedException("Including columns in an index is not supported by MySql.");
}
this.DataDefinitionLanguage.AddIndex(tableName, columnNames, unique, indexName, null);
}
internal override bool GetIndexType(string tableName, string indexName)
{
var schemaName = GetSchema(tableName);
return Dapper.ExecuteScalar<bool>(
@"
SELECT DISTINCT
1 - NON_UNIQUE AS IS_UNIQUE
FROM INFORMATION_SCHEMA.STATISTICS WHERE
INDEX_NAME = @indexName AND
TABLE_NAME = @tableName AND
TABLE_SCHEMA = @schemaName
",
new { indexName, tableName, schemaName });
}
internal override string[] GetIndexColumnNames(string tableName, string indexName)
{
var schemaName = GetSchema(tableName);
return Dapper.Query<string>(
@"
SELECT
COLUMN_NAME
FROM INFORMATION_SCHEMA.STATISTICS WHERE
INDEX_NAME = @indexName AND
TABLE_NAME = @tableName AND
TABLE_SCHEMA = @schemaName
",
new { indexName, tableName, schemaName }).ToArray();
}
internal override void RemoveIndex(string tableName, string indexName)
{
var escapedTableName = EscapeIdentifier(tableName);
var escapedIndexName = EscapeIdentifier(indexName);
Dapper.Execute($"ALTER TABLE {escapedTableName} DROP INDEX {escapedIndexName}");
}
internal override string GetSchema(string tableName)
{
return Connection.Database;
}
internal override string GetCatalog()
{
return "def";
}
internal override void RenameColumn(string tableName, string columnName, string newColumnName)
{
var escapedTableName = EscapeIdentifier(tableName);
var escapedColumnName = EscapeIdentifier(columnName);
var escapedNewColumnName = EscapeIdentifier(newColumnName);
Dapper.Execute($"ALTER TABLE {escapedTableName} RENAME COLUMN {escapedColumnName} TO {escapedNewColumnName}");
}
internal override void RenameTable(string tableName, string newTableName)
{
var escapedTableName = EscapeIdentifier(tableName);
var escapedNewTableName = EscapeIdentifier(newTableName);
Dapper.Execute($"RENAME TABLE {escapedTableName} TO {escapedNewTableName}");
}
internal override bool GetColumnAutoIncrement(string tableName, string columnName)
{
return Dapper.ExecuteScalar<bool>(
@"
SELECT
EXTRA LIKE '%auto_increment%'
FROM INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_NAME = @tableName AND
COLUMN_NAME = @columnName
",
new { tableName, columnName });
}
internal override string EscapeIdentifier(string identifier)
{
return "`" + identifier.Replace("`", "``") + "`";
}
internal override string GetLastInsertedAutoIncrementedPrimaryKeyIdentity(string columnName)
{
return ";SELECT LAST_INSERT_ID()";
}
internal override Database Clone()
{
return new MySqlDatabase(connectionString);
}
}
}
|
using System;
using Grasshopper.Kernel;
using Pterodactyl;
using Xunit;
namespace UnitTestsGH
{
public class TestEmphasisGhHelper
{
public static EmphasisGH TestObject
{
get
{
EmphasisGH testObject = new EmphasisGH();
return testObject;
}
}
}
public class TestEmphasisGh
{
[Theory]
[InlineData("Emphasis", "Emphasis",
"Format text -> emphasis",
"Pterodactyl", "Format")]
public void TestName(string name, string nickname, string description, string category, string subCategory)
{
Assert.Equal(name, TestEmphasisGhHelper.TestObject.Name);
Assert.Equal(nickname, TestEmphasisGhHelper.TestObject.NickName);
Assert.Equal(description, TestEmphasisGhHelper.TestObject.Description);
Assert.Equal(category, TestEmphasisGhHelper.TestObject.Category);
Assert.Equal(subCategory, TestEmphasisGhHelper.TestObject.SubCategory);
}
[Theory]
[InlineData(0, "Text", "Text", "Text to format", GH_ParamAccess.item)]
public void TestRegisterInputParams(int id, string name, string nickname,
string description, GH_ParamAccess access)
{
Assert.Equal(name, TestEmphasisGhHelper.TestObject.Params.Input[id].Name);
Assert.Equal(nickname, TestEmphasisGhHelper.TestObject.Params.Input[id].NickName);
Assert.Equal(description, TestEmphasisGhHelper.TestObject.Params.Input[id].Description);
Assert.Equal(access, TestEmphasisGhHelper.TestObject.Params.Input[id].Access);
}
[Theory]
[InlineData(0, "Report Part", "Report Part", "Created part of the report", GH_ParamAccess.item)]
public void TestRegisterOutputParams(int id, string name, string nickname,
string description, GH_ParamAccess access)
{
Assert.Equal(name, TestEmphasisGhHelper.TestObject.Params.Output[id].Name);
Assert.Equal(nickname, TestEmphasisGhHelper.TestObject.Params.Output[id].NickName);
Assert.Equal(description, TestEmphasisGhHelper.TestObject.Params.Output[id].Description);
Assert.Equal(access, TestEmphasisGhHelper.TestObject.Params.Output[id].Access);
}
[Fact]
public void TestGuid()
{
Guid expected = new Guid("92a5c76a-6b8f-40bc-846c-95b6868c924f");
Guid actual = TestEmphasisGhHelper.TestObject.ComponentGuid;
Assert.Equal(expected, actual);
}
}
}
|
using UnityEngine;
using System.Collections;
public class pickupPoints : MonoBehaviour {
public int scoreToGive;
private ScoreManager theScoreManager;
public AudioSource coinSound;
// Called at the start of each game
void Start () {
// Find and sets Score Manager object
theScoreManager = FindObjectOfType<ScoreManager> ();
}
// If a player collides with a coin, then the score is increased by a set value
void OnTriggerEnter2D (Collider2D other)
{
if(other.gameObject.name == "Player")
{
theScoreManager.AddScore(scoreToGive);
gameObject.SetActive(false);
coinSound.Play ();
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class GameController : MonoBehaviour {
[Header("GameObject and Script References")]
public Fader fader;
public UIController uiController;
public RespawnManager respawnManager;
public MapRespawner mapRespawner;
public GameObject resultCanvas;
public GameObject waveObject;
public Vector3 waveStartingPoint;
public Vector3 waveEndPoint;
public Text nextWaveText;
public Text timerText;
public Text roundTimer;
public Text winnerText;
public Image winnerPanel;
public RigidBodyMovement player1;
[HideInInspector]
public bool player1Active = false;
int player1Score = 0;
public RigidBodyMovement player2;
[HideInInspector]
public bool player2Active = false;
int player2Score = 0;
public RigidBodyMovement player3;
[HideInInspector]
public bool player3Active = false;
int player3Score = 0;
public RigidBodyMovement player4;
[HideInInspector]
public bool player4Active = false;
int player4Score = 0;
[Header("Adjustable Values")]
public int initialCountdown = 3;
public int numberOfRounds = 5;
public Color colorPlayer1;
public Color colorPlayer2;
public Color colorPlayer3;
public Color colorPlayer4;
int currentTime = 20;
int[] roundTimers;
bool gameRunning = false;
int roundNumber = 0;
int[] scores = new int[4];
public GameObject bubbles;
Action nextRoundCallback;
bool exitMenuOpened = false;
public GameObject BackToMenu;
public SoundManager soundManager;
bool speedUp = false;
bool finishedGame = false;
int currentNumberOfShells = 99;
// Start is called before the first frame update
void Start() {
GenerateRoundTimes();
nextRoundCallback = () =>
{
++roundNumber;
roundTimer.text = "Round: " + (roundNumber + 1);
timerText.color = Color.black;
if (roundNumber >= numberOfRounds)
{
System.Random rnd = new System.Random();
currentTime = rnd.Next(5, 15);
}
else currentTime = this.roundTimers[roundNumber];
};
nextWaveText.text = "";
timerText.text = "READY?";
roundTimer.text = "";
int[] roundTimers = new int[numberOfRounds];
currentNumberOfShells = mapRespawner.currentMap.GetComponent<ShellCount>().numberOfShells;
Unfade();
// StartTimer();
}
void DoWave()
{
StartCoroutine(DoWaveCoroutine());
}
IEnumerator DoWaveCoroutine()
{
float duration = 4.0f;
float currentTime = 0.0f;
bool spawnTriggered = false;
while (currentTime < duration)
{
waveObject.transform.position = new Vector3(Mathf.Lerp(waveStartingPoint.x, waveEndPoint.x, currentTime / duration),
Mathf.Lerp(waveStartingPoint.y, waveEndPoint.y, currentTime / duration), Mathf.Lerp(waveStartingPoint.z, waveEndPoint.z, currentTime / duration));
if (!spawnTriggered && (currentTime / duration) >= 0.5f)
{
spawnTriggered = true;
mapRespawner.ReMap();
currentNumberOfShells = mapRespawner.currentMap.GetComponent<ShellCount>().numberOfShells;
respawnManager.Respawn();
Instantiate(bubbles);
}
currentTime += Time.deltaTime;
yield return null;
}
}
// Update is called once per frame
void Update()
{
bool threeShellsCollected = false;
int starPlayer = 0;
// Check player score
if (player1Active && player1.score > player1Score)
{
--currentNumberOfShells;
if (player1.score == 8 && !speedUp)
{
speedUp = true;
soundManager.PlaySpeedUpMusic();
}
player1Score = player1.score;
if (player1.score % 3 == 0)
{
threeShellsCollected = true;
starPlayer = 1;
}
uiController.SetScoreForPlayer(player1.score, 1);
if (player1.score == 9)
{
finishedGame = true;
FinishGame(false, 1);
}
}
if (player2Active && player2.score > player2Score)
{
--currentNumberOfShells;
if (player2.score == 8 && !speedUp)
{
speedUp = true;
soundManager.PlaySpeedUpMusic();
}
player2Score = player2.score;
if (player2.score % 3 == 0)
{
threeShellsCollected = true;
starPlayer = 2;
}
uiController.SetScoreForPlayer(player2.score, 2);
if (player2.score == 9)
{
finishedGame = true;
FinishGame(false, 2);
}
}
if (player3Active && player3.score > player3Score)
{
--currentNumberOfShells;
if (player3.score == 8 && !speedUp)
{
speedUp = true;
soundManager.PlaySpeedUpMusic();
}
player3Score = player3.score;
if (player3.score % 3 == 0)
{
threeShellsCollected = true;
starPlayer = 3;
}
uiController.SetScoreForPlayer(player3.score, 3);
if (player3.score == 9)
{
finishedGame = true;
FinishGame(false, 3);
}
}
if (player4Active && player4.score > player4Score)
{
--currentNumberOfShells;
if (player4.score == 8 && !speedUp)
{
speedUp = true;
soundManager.PlaySpeedUpMusic();
}
player4Score = player4.score;
if (player4.score % 3 == 0)
{
threeShellsCollected = true;
starPlayer = 4;
}
uiController.SetScoreForPlayer(player4.score, 4);
if (player4.score == 9)
{
finishedGame = true;
FinishGame(false, 4);
}
}
if (threeShellsCollected)
{
player1.pause = true;
player2.pause = true;
player3.pause = true;
player4.pause = true;
StartCoroutine(DoWinStar(starPlayer));
}
else if (currentNumberOfShells <= 0)
{
currentNumberOfShells = 99;
roundNumber = 0;
currentTime = 1;
soundManager.PlayWaveSound();
}
if (!gameRunning && resultCanvas.activeInHierarchy)
{
if (Input.GetButtonDown("Fire1_1") || Input.GetButtonDown("Fire1_2") || Input.GetButtonDown("Fire1_3") || Input.GetButtonDown("Fire1_4"))
{
SceneManager.LoadScene("Menu");
}
}
if (Input.GetButtonDown("Start"))
{
if (!exitMenuOpened && gameRunning)
{
soundManager.PlayButtonSound();
BackToMenu.SetActive(true);
exitMenuOpened = true;
gameRunning = false;
player1.pause = true;
player2.pause = true;
player3.pause = true;
player4.pause = true;
}
}
if (exitMenuOpened)
{
if (Input.GetButtonDown("Fire1_1") || Input.GetButtonDown("Fire1_2") || Input.GetButtonDown("Fire1_3") || Input.GetButtonDown("Fire1_4"))
{
SceneManager.LoadScene("Menu");
}
if (Input.GetButtonDown("Fire2_1") || Input.GetButtonDown("Fire2_2") || Input.GetButtonDown("Fire2_3") || Input.GetButtonDown("Fire2_4"))
{
soundManager.PlayButtonSound();
BackToMenu.SetActive(false);
exitMenuOpened = false;
gameRunning = true;
player1.pause = false;
player2.pause = false;
player3.pause = false;
player4.pause = false;
}
}
}
IEnumerator DoWinStar(int playerId)
{
if (!finishedGame) soundManager.PlayStarSound();
roundTimer.text = "";
timerText.text = "";
roundNumber = -1;
currentTime = 1;
soundManager.PlayWaveSound();
// Play Fanfare Sound
yield return new WaitForSeconds(3.0f);
if (player1.gameObject.activeInHierarchy)
{
player1.CallCleanShells();
player1Score = player1Score - (player1Score%3);
}
if (player2.gameObject.activeInHierarchy)
{
player2.CallCleanShells();
player2Score = player2Score - (player2Score % 3);
}
if (player3.gameObject.activeInHierarchy)
{
player3.CallCleanShells();
player3Score = player3Score - (player3Score % 3);
}
if (player4.gameObject.activeInHierarchy)
{
player4.CallCleanShells();
player4Score = player4Score - (player4Score % 3);
}
// Play ding sound
player1.pause = false;
player2.pause = false;
player3.pause = false;
player4.pause = false;
}
void Unfade()
{
if (!fader.gameObject.activeInHierarchy) fader.gameObject.SetActive(true);
fader.DoFade(0.0f, 0.2f, (finish) => { });
}
void GenerateRoundTimes()
{
roundTimers = new int[numberOfRounds];
// TODO - Proper generation
System.Random rnd = new System.Random();
for (int i = 0; i < numberOfRounds; ++i)
{
if (i <= 0) roundTimers[i] = 20;
else if (i == 1) roundTimers[i] = rnd.Next(10, 20);
else if (i == 2) roundTimers[i] = rnd.Next(10, 15);
else if (i >= 3) roundTimers[i] = rnd.Next(5, 15);
}
currentTime = roundTimers[0];
}
void FinishGame(bool timeOut, int playerId )
{
gameRunning = false;
nextWaveText.gameObject.SetActive(true);
timerText.text = "FINISH!";
soundManager.StopMusic();
soundManager.PlayWinSound();
// TODO
player1.pause = true;
player2.pause = true;
player3.pause = true;
player4.pause = true;
resultCanvas.SetActive(true);
switch (playerId)
{
case 1:
winnerText.text = "Red crab got a new home";
winnerPanel.color = colorPlayer1;
break;
case 2:
winnerText.text = "Blue crab got a new home";
winnerPanel.color = colorPlayer2;
break;
case 3:
winnerText.text = "Green crab got a new home";
winnerPanel.color = colorPlayer3;
break;
case 4:
winnerText.text = "Purple crab got a new home";
winnerPanel.color = colorPlayer4;
break;
}
}
public void StartTimer()
{
StartCoroutine(StartTimerCoroutine(() => {
gameRunning = true;
player1.pause = false;
player2.pause = false;
player3.pause = false;
player4.pause = false;
}));
}
IEnumerator StartTimerCoroutine(Action callback)
{
int countdown = initialCountdown;
yield return new WaitForSeconds(2.5f);
timerText.text = "GO!";
soundManager.PlayStartRoundSound();
yield return new WaitForSeconds(1.5f);
soundManager.PlayIngameMusic();
roundTimer.text = "Round: " + (roundNumber + 1);
/*
nextWaveText.text = "Game begins in";
timerText.text = ""+countdown;
while (countdown > 0)
{
yield return new WaitForSeconds(1.0f);
--countdown;
if (countdown <= 0)
{
timerText.text = "GO!";
roundTimer.text = "Round: " + (roundNumber + 1);
}
else timerText.text = "" + countdown;
// TODO - Play beep sound for timer
}
*/
callback();
nextWaveText.text = "Next Wave";
timerText.text = "" + currentTime;
StartCoroutine(RoundTimerCoroutine());
}
IEnumerator RoundTimerCoroutine()
{
while (true)
{
while (gameRunning)
{
yield return new WaitForSeconds(1.0f);
--currentTime;
if (currentTime <= 3)
{
timerText.color = Color.red;
}
if (currentTime == 2)
{
soundManager.PlayWaveSound();
}
timerText.text = currentTime + "";
if (currentTime <= 0)
{
timerText.color = Color.red;
timerText.text = "WAVE!";
this.DoWave();
nextRoundCallback();
yield return new WaitForSeconds(3.0f);
}
}
yield return null;
}
}
}
|
using MHT.CourseManagment.Commom;
namespace MHT.CourseManagment.Model
{
public class LoginModel: NotifyBase
{
private string _userName;
/// <summary>
/// 用户名
/// </summary>
public string UserName
{
get { return _userName; }
set
{
_userName = value;
this.NotifyPropertyChanged();
}
}
private string _password;
/// <summary>
/// 密码
/// </summary>
public string Password
{
get { return _password; }
set
{
_password = value;
this.NotifyPropertyChanged();
}
}
private string _validationCode;
/// <summary>
/// 验证码
/// </summary>
public string ValidationCode
{
get { return _validationCode; }
set
{
_validationCode = value;
this.NotifyPropertyChanged();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace MasterLIO.Forms
{
public partial class StatisticForm : Form
{
private static int CURRENT_USER_ID = 1;
private Statistic statistic = DBUtils.GetUserStatistic(CURRENT_USER_ID);
private List<ExerciseResultInfo> resultsInfo;
public StatisticForm()
{
InitializeComponent();
statisticChart1.Series["Series1"].Enabled = false;
dateTimePicker1.Text = "";
}
private void statisticSearchButton1_Click(object sender, EventArgs e)
{
resultsInfo = statistic.getResultsByDate(dateTimePicker1.Value);
foreach (ExerciseResultInfo result in resultsInfo)
{
String level = result.level.ToString();
String exerciseNum = result.exerciseId.ToString().Substring(1);// MAGIC!
exerciseNumbercomboBox1.Items.Add("№"+exerciseNum+", ур-нь "+level);
}
}
private void exerciseNumbercomboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int exerciseNum = Convert.ToInt32(convertToExersiceId(exerciseNumbercomboBox1.SelectedItem.ToString()));
ExerciseResultInfo currentResultInfo = getResultInfoByNum(exerciseNum);
errorCounttextBox3.Text = currentResultInfo.errorsCount.ToString();
exerciseSpeedtextBox4.Text = currentResultInfo.speed.ToString();
assessmentTextBox5.Text = currentResultInfo.assesment.ToString();
}
private ExerciseResultInfo getResultInfoByNum(int exerciseNum)
{
ExerciseResultInfo exercise = null;
foreach (ExerciseResultInfo result in resultsInfo)
{
if (result.exerciseId == exerciseNum)
exercise = result;
}
return exercise;
}
private int convertToExersiceId(string stringName)
{
string exerciseId = "";
string pattern = @"\b(\d)\b";
Regex regex = new Regex(pattern);
Match match = regex.Match(stringName);
while (match.Success)
{
exerciseId += match.Groups[1].Value;
match = match.NextMatch();
}
exerciseId = exerciseId.Substring(exerciseId.Length - 1) + exerciseId.Substring(0,exerciseId.Length-1);
return Convert.ToInt32(exerciseId);
}
}
}
|
#define SHOW_NET_INFO
using UnityEngine;
public class RequestMasterServer : MonoBehaviour
{
public enum GameScene : int
{
Movie = 0,
Scene01 = 1,
Scene01_Net = 2,
SetPanel = 3
}
bool IsClickConnect;
public static string MasterServerMovieComment = "Movie Scence";
public static string MasterServerGameNetComment = "GameNet Scence";
string ServerIp = "";
float TimeConnect;
static RequestMasterServer _Instance;
public static RequestMasterServer GetInstance()
{
if (_Instance == null)
{
GameObject obj = new GameObject("_RequestMasterServer");
_Instance = obj.AddComponent<RequestMasterServer>();
DontDestroyOnLoad(obj);
}
return _Instance;
}
void Start()
{
InitLoopRequestHostList();
CancelInvoke("CheckMasterServerList");
InvokeRepeating("CheckMasterServerList", 3f, 0.1f);
}
void InitLoopRequestHostList()
{
CancelInvoke("RequestHostListLoop");
InvokeRepeating("RequestHostListLoop", 0f, 3f);
}
void RequestHostListLoop()
{
MasterServer.RequestHostList(NetworkServerNet.GetInstance().mGameTypeName);
}
float RandConnectTime = Random.Range(3f, 10f);
public static float TimeConnectServer = 0f;
void OnGUI()
{
GameScene levelVal = (GameScene)Application.loadedLevel;
HostData[] data = MasterServer.PollHostList();
// Go through all the hosts in the host list
foreach (var element in data)
{
#if SHOW_NET_INFO
var name = element.gameName + " " + element.connectedPlayers + " / " + element.playerLimit;
GUILayout.BeginHorizontal();
GUILayout.Box(name);
GUILayout.Space(5);
var hostInfo = "[";
foreach (var host in element.ip)
{
hostInfo = hostInfo + host + ":" + element.port + " ";
}
hostInfo = hostInfo + "]";
GUILayout.Box(hostInfo);
GUILayout.Space(5);
GUILayout.Box(element.comment);
GUILayout.Space(5);
GUILayout.FlexibleSpace();
#endif
if (element.comment == MasterServerGameNetComment
&& ServerIp == element.ip[0]
&& Toubi.GetInstance() != null
&& !Toubi.GetInstance().IsIntoPlayGame)
{
Toubi.GetInstance().IsIntoPlayGame = true;
}
if (Network.peerType == NetworkPeerType.Disconnected)
{
if (!IsClickConnect)
{
bool isConnectServer = false;
if (levelVal == GameScene.Scene01_Net
&& element.comment == MasterServerGameNetComment
&& element.ip[0] != Network.player.ipAddress
&& ServerIp == element.ip[0])
{
if (Time.realtimeSinceStartup - TimeConnectServer > RandConnectTime)
{
isConnectServer = true;
TimeConnectServer = Time.realtimeSinceStartup;
RandConnectTime = Random.Range(3f, 10f);
}
}
else if (levelVal == GameScene.Movie
&& element.comment == MasterServerMovieComment
&& element.ip[0] != Network.player.ipAddress
&& element.connectedPlayers < element.playerLimit
&& Toubi.GetInstance() != null
&& Toubi.GetInstance().CheckIsLoopWait())
{
if (Time.realtimeSinceStartup - TimeConnectServer > RandConnectTime)
{
isConnectServer = true;
TimeConnectServer = Time.realtimeSinceStartup;
RandConnectTime = Random.Range(3f, 10f);
}
}
if (isConnectServer)
{
// Connect to HostData struct, internally the correct method is used (GUID when using NAT).
Network.RemoveRPCs(Network.player);
Network.DestroyPlayerObjects(Network.player);
MasterServer.dedicatedServer = false;
Network.Connect(element);
IsClickConnect = true;
if (levelVal == GameScene.Movie)
{
ServerIp = element.ip[0];
TimeConnect = 0f;
}
Debug.Log("Connect element.ip -> " + element.ip[0]
+ ", element.comment " + element.comment
+ ", gameLeve " + levelVal
+ ", time " + Time.realtimeSinceStartup.ToString("f2"));
}
}
else
{
if (levelVal == GameScene.Scene01_Net)
{
if (element.comment == MasterServerGameNetComment && ServerIp == element.ip[0])
{
TimeConnect += Time.deltaTime;
if (TimeConnect >= 2f)
{
TimeConnect = 0f;
IsClickConnect = false;
}
}
}
else if (levelVal == GameScene.Movie)
{
TimeConnect += Time.deltaTime;
if (TimeConnect >= 2f)
{
TimeConnect = 0f;
IsClickConnect = false;
Debug.Log("reconnect masterServer...");
}
}
}
}
#if SHOW_NET_INFO
GUILayout.EndHorizontal();
#endif
}
}
public void ResetIsClickConnect()
{
IsClickConnect = false;
}
public void SetMasterServerIp(string ip)
{
ServerIp = ip;
}
public int GetMovieMasterServerNum()
{
int masterServerNum = 0;
HostData[] data = MasterServer.PollHostList();
// Go through all the hosts in the host list
foreach (var element in data)
{
if (element.comment == MasterServerMovieComment)
{
masterServerNum++;
}
}
return masterServerNum;
}
//float TestDVal;
void CheckMasterServerList()
{
int masterServerNum = 0;
//int masterServerGameNetNum = 0;
bool isCreatMasterServer = true;
HostData[] data = MasterServer.PollHostList();
// Go through all the hosts in the host list
foreach (var element in data)
{
if (element.comment == MasterServerMovieComment)
{
masterServerNum++;
if (Network.peerType == NetworkPeerType.Disconnected)
{
if (masterServerNum > 0)
{
isCreatMasterServer = false;
}
}
else if (Network.peerType == NetworkPeerType.Server)
{
if (masterServerNum > 1 && Random.Range(0, 100) % 2 == 1)
{
//随机删除1个循环动画场景的masterServer.
isCreatMasterServer = false;
Debug.Log("random remove masterServer...");
}
}
}
else if (element.comment == MasterServerGameNetComment && element.ip[0] == ServerIp)
{
//masterServerGameNetNum++;
}
}
GameScene levelVal = (GameScene)Application.loadedLevel;
if (levelVal == GameScene.Scene01 || levelVal == GameScene.SetPanel)
{
isCreatMasterServer = false;
}
switch (Network.peerType)
{
case NetworkPeerType.Disconnected:
if (isCreatMasterServer)
{
if (levelVal == GameScene.Movie)
{
if ((Toubi.GetInstance() != null && !Toubi.GetInstance().CheckIsLoopWait())
|| Toubi.GetInstance() == null)
{
return;
}
ServerIp = "";
}
NetworkServerNet.GetInstance().InitCreateServer();
//MasterServerTime = Time.realtimeSinceStartup;
}
break;
case NetworkPeerType.Server:
if (!isCreatMasterServer)
{
NetworkServerNet.GetInstance().RemoveMasterServerHost();
}
else
{
if (levelVal == GameScene.Movie)
{
//MasterServerTime = Time.realtimeSinceStartup;
if (Toubi.GetInstance() != null && !Toubi.GetInstance().CheckIsLoopWait())
{
NetworkServerNet.GetInstance().ResetMasterServerHost();
}
}
/*else if (levelVal == GameLeve.WaterwheelNet) {
if (masterServerGameNetNum == 0) {
TestDVal = Time.realtimeSinceStartup - MasterServerTime;
if (Time.realtimeSinceStartup - MasterServerTime > 10f) {
Debug.Log("no masterServer...");
NetworkServerNet.GetInstance().RemoveMasterServerHost();
MasterServerTime = Time.realtimeSinceStartup;
}
}
}*/
}
break;
}
}
void OnFailedToConnectToMasterServer(NetworkConnectionError info)
{
Debug.Log("Could not connect to master server: " + info);
//if (Application.loadedLevel == (int)GameLeve.Movie) {
// ServerLinkInfo.GetInstance().SetServerLinkInfo("Cannot Link MasterServer");
//}
}
void OnMasterServerEvent(MasterServerEvent msEvent)
{
//Debug.Log("OnMasterServerEvent: " + msEvent + ", time " + Time.time);
if (msEvent == MasterServerEvent.RegistrationSucceeded)
{
Debug.Log("MasterServer registered, GameLevel " + (GameScene)Application.loadedLevel);
if ((GameScene)Application.loadedLevel == GameScene.Movie)
{
//只在循环动画场景执行!
//ServerLinkInfo.GetInstance().HiddenServerLinkInfo();
NetworkRootMovie.GetInstance().mNetworkRpcMsgSpawn.CreateNetworkRpc();
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using fi.upm.es.dwgDecoder.dwgElementos;
namespace fi.upm.es.dwgDecoder.tools
{
/**
* @brief Clase que implementa los metodos para el manipulado y conversión de curvas a segmentos de linea.
*
**/
public static class herramientasCurvas
{
/**
* @brief Metodo que descompone una curva en un conjunto de segmentos de línea que aproximan o recubren la curva original.
*
* @param cur Entidad curva que debe ser linealizada.
* @param numSeg Número de líneas en las que tiene que ser partida la curva.
* @param acBlkTbl Tabla de bloques de AutoCAD para buscar nuevos objetos y añadir nuevos objetos generados.
* @param acBlkTblRec Tabla de registros de los bloques de AutoCAD para buscar nuevos objetos y añadir nuevos objetos generados.
* @param t Transaccion abierta para manipular la tabla de bloques de AutoCAD.
* @param LayerId Parámetro del tipo ObjectId que identifica la capa a la que tendrán que asociarse las nuevas líneas generadas por el proceso
* de descomposición de la curva.
* @param dwfg Parámetro del tipo dwgFile donde se almacenaran las nuevas líneas creadas a partir del proceso de descomposición de la curva.
*
* @return Devuelve una colección de entidades tipo linea bajo la clase DBObjectCollection.
**/
public static DBObjectCollection curvaAlineas(Curve cur, int numSeg, BlockTable acBlkTbl, BlockTableRecord acBlkTblRec,Transaction t, ObjectId LayerId, dwgFile dwfg)
{
DBObjectCollection ret = new DBObjectCollection();
// Collect points along our curve
Point3dCollection pts = new Point3dCollection();
// Split the curve's parameter space into
// equal parts
double startParam = cur.StartParam;
double segLen = (cur.EndParam - startParam) / numSeg;
// Loop along it, getting points each time
for (int i = 0; i < numSeg + 1; i++)
{
Point3d pt = cur.GetPointAtParameter(startParam + segLen * i);
pts.Add(pt);
}
if (pts != null && pts.Count > 0)
{
if (pts.Count == 1)
{
// Retornamos un punto.
}
else if (pts.Count >= 2)
{
// Retornamos una secuencia de lineas
for (int i = 0; i < pts.Count - 1; i++)
{
Line ln = new Line();
ln.StartPoint = pts[i];
ln.EndPoint = pts[i + 1];
ln.LayerId = LayerId;
acBlkTblRec.AppendEntity(ln);
t.AddNewlyCreatedDBObject(ln, true);
dwfg.objetosArtificiales.Add(ln.ObjectId);
ret.Add(ln);
}
}
}
return ret;
}
}
}
|
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RSS.Business.Interfaces;
using RSS.Business.Models;
using RSS.WebApi.Controllers;
using RSS.WebApi.DTOs;
using RSS.WebApi.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace RSS.WebApi.v2.Controllers
{
[Authorize]
[ApiVersion("2.0")]
[Route("api/v{version:apiVersion}/[controller]")]
public class SuppliersController : MainController
{
private readonly ISupplierRepository _supplierRepository;
private readonly IAddressRepository _addressRepository;
private readonly ISupplierService _supplierService;
private readonly IMapper _mapper;
public SuppliersController(ISupplierRepository supplierRepository,
IMapper mapper,
IAddressRepository addressRepository,
INotifiable notifiable,
IUser appUser) : base(notifiable, appUser)
{
_supplierRepository = supplierRepository;
_mapper = mapper;
_addressRepository = addressRepository;
}
[HttpGet]
[AllowAnonymous]
[ProducesResponseType(typeof(IEnumerable<SupplierDTO>), StatusCodes.Status200OK)]
public async Task<ActionResult<IEnumerable<SupplierDTO>>> GetAllSuppliers()
{
var suppliers = _mapper.Map<IEnumerable<SupplierDTO>>(await _supplierRepository.GetAll());
return Ok(suppliers);
}
[HttpGet("{id:guid}")]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(SupplierDTO), StatusCodes.Status200OK)]
public async Task<ActionResult<SupplierDTO>> GetSupplierById(Guid id)
{
var supplier = await GetSupplierAddressProducts(id);
if (supplier == null) return NotFound();
return Ok(supplier);
}
[HttpPost]
[ClaimsAuthorize("Supplier", "Add")]
[ProducesResponseType(typeof(Supplier), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult> AddSupplier(SupplierDTO supplierDTO)
{
if (!ModelState.IsValid) return CustomResponse(ModelState);
await _supplierService.AddSupplier(_mapper.Map<Supplier>(supplierDTO));
return CustomResponse(supplierDTO);
}
[HttpPut("{id:guid}")]
[ClaimsAuthorize("Supplier", "Update")]
[ProducesResponseType(typeof(Supplier), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult> UpdateSupplier(Guid id, SupplierDTO supplierDTO)
{
if (id != supplierDTO.Id)
{
NotifyError("O id informado é diferente do id do fornecedor");
return CustomResponse(supplierDTO);
}
if (!ModelState.IsValid) return CustomResponse(ModelState);
await _supplierService.UpdateSupplier(_mapper.Map<Supplier>(supplierDTO));
return CustomResponse(supplierDTO);
}
[HttpDelete("id:guid")]
[ClaimsAuthorize("Supplier", "Delete")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult> DeleteSupplier(Guid id)
{
var supplierDTO = await GetSupplierAddress(id);
if (supplierDTO == null) return NotFound();
await _supplierService.RemoveSupplier(id);
return CustomResponse(supplierDTO);
}
[HttpGet("get-address/{id:guid}")]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult<AddressDTO>> GetAddressById(Guid id)
{
return Ok(_mapper.Map<AddressDTO>(await _addressRepository.FindById(id)));
}
[HttpPut("update-address/{id:guid}")]
[ClaimsAuthorize("Supplier", "Update")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult<AddressDTO>> UpdateAddress(Guid id, AddressDTO addressDTO)
{
if(id != addressDTO.Id)
{
NotifyError("O id informado é diferente do endereço");
CustomResponse(addressDTO);
}
if (!ModelState.IsValid) return CustomResponse(ModelState);
await _supplierService.UpdateSupplierAddress(_mapper.Map<Address>(addressDTO));
return CustomResponse(addressDTO);
}
private async Task<SupplierDTO> GetSupplierAddress(Guid id)
{
return _mapper.Map<SupplierDTO>(await _supplierRepository.GetSupplierAddress(id));
}
private async Task<SupplierDTO> GetSupplierAddressProducts(Guid id)
{
return _mapper.Map<SupplierDTO>(await _supplierRepository.GetSupplierProductsAddress(id));
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CommonQ;
using SharpPcap;
namespace popkart_capture
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public class PopKartCaptcha
{
public string account;
public System.Net.IPAddress remoteip;
public uint acknumber;
public byte[] httpBuf;
public string httpGet;
public byte[] imgBuf;
}
public class PopKartRecord
{
private string _time;
private string _record;
private BitmapImage _img;
public string Time
{
get { return _time; }
set { _time = value; }
}
public string Record
{
get { return _record; }
set { _record = value; }
}
public BitmapImage Img
{
get { return _img; }
set { _img = value; }
}
}
static MainWindow _mainWinow = null;
static Dictionary<string, PopKartCaptcha> m_dPopKartCaptcha = new Dictionary<string, PopKartCaptcha>(); //<account, popkart_captcha>
static CLogger logger;
static Computer _Compputer;
static string _rKey;
public MainWindow()
{
InitializeComponent();
_rKey = RandomString.Next(8, "a-zA-Z0-9");
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
logger = CLogger.FromFolder(@"log/log");
/* Retrieve the device list */
var devices = CaptureDeviceList.Instance;
/*If no device exists, print error */
if (devices.Count < 1)
{
MessageBox.Show("网络适配器异常!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
int i = 0;
foreach (var dev in devices)
{
/* Description */
logger.Debug("{0}) {1} {2}", i, dev.Name, dev.Description);
i++;
}
_Compputer = Computer.Instance();
_mainWinow = this;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void StopAllDevice()
{
btnStop.IsEnabled = false;
bool hasStartDevice = false;
var devices = CaptureDeviceList.Instance;
for (int i = 0; i < devices.Count; ++i)
{
var device = devices[i];
if (device.Started)
{
hasStartDevice = true;
device.StopCaptureTimeout = new System.TimeSpan(0, 0, 0, 5);
device.Close();
}
}
if (!hasStartDevice)
{
btnStop.IsEnabled = true;
}
}
private void Button_Click_Stop(object sender, RoutedEventArgs e)
{
StopAllDevice();
}
private void Button_Click_Start(object sender, RoutedEventArgs e)
{
var devices = CaptureDeviceList.Instance;
for (int i = 0; i < devices.Count; ++i)
{
var device = devices[i];
device.OnPacketArrival +=
new PacketArrivalEventHandler(device_OnPacketArrival);
device.OnCaptureStopped += new CaptureStoppedEventHandler(delegate
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
bool allstop = true;
for (int ii = 0; ii < devices.Count; ++ii)
{
if (devices[ii].Started)
{
allstop = false;
}
}
if (allstop)
{
btnStart.IsEnabled = true;
btnStop.IsEnabled = true;
}
}));
});
// Open the device for capturing
int readTimeoutMilliseconds = 1000;
device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds);
//tcpdump filter to capture only TCP/IP packets
string filter = "ip and tcp";
device.Filter = filter;
device.StartCapture();
}
btnStart.IsEnabled = false;
}
private static void device_OnPacketArrival(object sender, CaptureEventArgs e)
{
var time = e.Packet.Timeval.Date;
var len = e.Packet.Data.Length;
var packet = PacketDotNet.Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);
var tcpPacket = (PacketDotNet.TcpPacket)packet.Extract(typeof(PacketDotNet.TcpPacket));
if (tcpPacket != null)
{
var ipPacket = (PacketDotNet.IpPacket)tcpPacket.ParentPacket;
System.Net.IPAddress srcIp = ipPacket.SourceAddress;
System.Net.IPAddress dstIp = ipPacket.DestinationAddress;
int srcPort = tcpPacket.SourcePort;
int dstPort = tcpPacket.DestinationPort;
if (dstPort == 80)
{
if (ipPacket.TotalLength - 40 >= 3)
{
if (tcpPacket.Bytes[20] == 'G'
&& tcpPacket.Bytes[20 + 1] == 'E'
&& tcpPacket.Bytes[20 + 2] == 'T')
{
string s = System.Text.Encoding.Default.GetString(tcpPacket.Bytes, 20, tcpPacket.Bytes.Length - 20);
string pattern = "GET /client.ashx\\?code=0&fid=SVG013&uid=(\\w+) HTTP/1.1";
Match mt = Regex.Match(s, pattern);
if (mt.Groups.Count == 2)
{
PopKartCaptcha t = new PopKartCaptcha();
t.account = mt.Groups[1].ToString();
t.acknumber = tcpPacket.SequenceNumber + (uint)ipPacket.TotalLength - 40;
t.httpGet = s;
t.remoteip = dstIp;
t.httpBuf = null;
t.imgBuf = null;
m_dPopKartCaptcha[t.account] = t;
}
}
}
}
if (srcPort == 80)
{
if (tcpPacket.Bytes.Length > 20)
{
foreach (var t in m_dPopKartCaptcha.Values)
{
//var t = g;
if (t.acknumber == tcpPacket.AcknowledgmentNumber
&& t.remoteip.Equals(srcIp))
{
if (t.httpBuf == null)
{
t.httpBuf = new byte[tcpPacket.Bytes.Length - 20];
Array.Copy(tcpPacket.Bytes, 20, t.httpBuf, 0, tcpPacket.Bytes.Length - 20);
}
else
{
byte[] oldBuf = t.httpBuf;
t.httpBuf = new byte[oldBuf.Length + tcpPacket.Bytes.Length - 20];
Array.Copy(oldBuf, 0, t.httpBuf, 0, oldBuf.Length);
Array.Copy(tcpPacket.Bytes, 20, t.httpBuf, oldBuf.Length, tcpPacket.Bytes.Length - 20);
}
try
{
if (t.imgBuf == null)
{
TryGetImage(t.httpBuf, t.account);
}
}
catch
{
}
}
}
}
}
}
}
static void TryGetImage(byte[] mt, string account)
{
for (int ii = 0; ii < mt.Length; ++ii)
{
if (mt.Length - ii >= 4)
{
if (mt[ii] == '\r'
&& mt[ii + 1] == '\n'
&& mt[ii + 2] == '\r'
&& mt[ii + 3] == '\n')
{
byte[] tmp = new byte[ii + 3];
Array.Copy(mt, 0, tmp, 0, tmp.Length);
string s = System.Text.Encoding.Default.GetString(tmp);
string[] sp = s.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
bool L = false;
bool R = false;
bool C = false;
bool image = false;
for (int x = 0; x < sp.Length; x++)
{
if (sp[x].IndexOf("image/Jpeg") >= 0)
{
image = true;
}
if (sp[x].IndexOf("L:") >= 0)
{
L = true;
}
if (sp[x].IndexOf("R:") >= 0)
{
R = true;
}
if (sp[x].IndexOf("C:") >= 0)
{
C = true;
}
}
if (image && L && R && C)
{
byte[] ck = new byte[mt.Length - ii - 4];
Array.Copy(mt, ii + 4, ck, 0, ck.Length);
byte[] img_data = TryGetChuckData(ck);
m_dPopKartCaptcha[account].imgBuf = img_data;
try
{
string cpu = "" + _Compputer.CpuID + "----" + _Compputer.MacAddress + "----" + _Compputer.DiskID;
string encode = MyDes.Encode(cpu, _rKey);
//string url = "http://localhost/popkart_captcha.php";
string url = "http://121.42.148.243/popkart_captcha.php";
HttpWebRequest request = System.Net.WebRequest.Create(url) as HttpWebRequest;
request.ServicePoint.Expect100Continue = false;
request.Timeout = 2000;
request.ContentType = "application/octet-stream ";
request.ContentLength = img_data.Length;
request.Method = "POST";
request.Headers["C"] = encode;
request.Headers["K"] = _rKey;
request.Headers["U"] = _Compputer.LoginUserName;
request.Headers["S"] = _Compputer.SystemType;
Stream stm = request.GetRequestStream();
stm.Write(img_data, 0, img_data.Length);
stm.Flush();
WebResponse respone = request.GetResponse();
StreamReader reader = new StreamReader(respone.GetResponseStream(), Encoding.GetEncoding("GB2312"));
string ss = reader.ReadToEnd();
string[] split = ss.Split(new string[] { "----" },StringSplitOptions.RemoveEmptyEntries);
if (split.Length == 3)
{
logger.Debug(ss);
File.WriteAllText("code.txt", split[2]);
_mainWinow.AddNewCode(split[2], img_data);
}
}
catch(Exception ex)
{
logger.Debug(ex.ToString());
}
}
break;
}
}
}
}
private void AddNewCode(string r, byte[] img)
{
Dispatcher.BeginInvoke(new Action(() =>
{
PopKartRecord q = new PopKartRecord();
q.Time = DateTime.Now.ToLocalTime().ToShortTimeString();
q.Record = r;
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.StreamSource = new MemoryStream(img);
bmp.EndInit();
q.Img = bmp;
if (_mainWinow.lvRecord.Items.Count > 4)
{
_mainWinow.lvRecord.Items.Clear();
}
_mainWinow.lvRecord.Items.Add(q);
}));
}
static public string cs_md5(string src)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] strbytes = Encoding.Default.GetBytes(src);
byte[] md5_bytes = md5.ComputeHash(strbytes, 0, strbytes.Length);
string md5_str = BitConverter.ToString(md5_bytes).Replace("-", "");
return md5_str;
}
static public string cs_md5(byte[] src)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] strbytes = src;
byte[] md5_bytes = md5.ComputeHash(strbytes, 0, strbytes.Length);
string md5_str = BitConverter.ToString(md5_bytes).Replace("-", "");
return md5_str;
}
static byte[] TryGetChuckData(byte[] chuck)
{
byte[] ret = new byte[0];
int chuck_size = 0;
for (int i = 0; i < chuck.Length; i++)
{
if (chuck.Length - i >= 2)
{
if (chuck[i] == '\r'
&& chuck[i + 1] == '\n')
{
byte[] tmp = new byte[i];
Array.Copy(chuck, 0, tmp, 0, tmp.Length);
chuck_size = Convert.ToInt32(System.Text.Encoding.Default.GetString(tmp), 16);
if (chuck_size > 0)
{
if (chuck_size <= chuck.Length - i - 2 - 2)
{
byte[] newchuck = new byte[chuck.Length - i - 2 - chuck_size - 2];
Array.Copy(chuck, i + 2 + chuck_size + 2, newchuck, 0, newchuck.Length);
byte[] r = TryGetChuckData(newchuck);
ret = new byte[r.Length + chuck_size];
Array.Copy(chuck, i + 2, ret, 0, chuck_size);
Array.Copy(r, 0, ret, chuck_size, r.Length);
}
else
{
throw new Exception("This is a segment!");
}
break;
}
else if (chuck_size == 0)
{
break;
}
}
}
}
return ret;
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
StopAllDevice();
CLogger.StopAllLoggers();
}
}
}
|
using System;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
public class Level18 : MonoBehaviour
{
public ClickBehaviour[] buttons;
public Text decimalVal;
public GameObject submit;
private string decimalValue = "0";
// Start is called before the first frame update
private void Start()
{
//buttons = UnityEngine.Object.FindObjectsOfType<ClickBehaviour>();
ClickListener.ObjClicked += CheckMove;
}
private void OnDestroy()
{
ClickListener.ObjClicked -= CheckMove;
}
private void CheckMove(GameObject go)
{
if (ReferenceEquals(go, submit))
{
CheckWin(decimalValue);
}
else
{
var script = go.GetComponent<ClickBehaviour>();
script.hold = !script.hold;
StringBuilder binaryString = new StringBuilder();
foreach (var item in buttons)
{
switch (!item.hold)
{
case true:
binaryString.Append("1");
break;
case false:
binaryString.Append("0");
break;
}
}
//Debug.Log(binaryString.ToString());
decimalValue = Convert.ToInt32(binaryString.ToString(), 2).ToString();
decimalVal.text = decimalValue;
}
}
public static void CheckWin(string value)
{
if (value == "18")
{
Debug.Log("Win");
GameManager.instance.NextLevel();
}
}
} |
using BDTest.Helpers.JsonConverters;
using Newtonsoft.Json;
namespace BDTest.Test;
[JsonConverter(typeof(ScenarioTextConverter))]
public record ScenarioText
{
[JsonProperty] public string Scenario { get; private set; }
public ScenarioText(string scenario)
{
Scenario = scenario;
}
[JsonConstructor]
private ScenarioText()
{
}
} |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Xml.Linq;
using ExpressionSerialization;
namespace RemoteQueryService
{
/// <summary>
/// A client-side proxy for a DataContext. Queries written against a RemoteTable will be
/// transformed into queries against the corresponding Table on the server-side.
/// </summary>
public class RemoteTable<T> : IQueryable<T>, IQueryProvider, IOrderedQueryable, IOrderedQueryable<T>
{
Expression expression;
public Expression Expression { get { return expression; } }
public IQueryProvider Provider { get { return this; } }
public Type ElementType { get { return typeof(T); } }
public RemoteTable()
{
expression = Expression.Constant(this);
}
private RemoteTable(Expression expression)
{
this.expression = expression;
}
public IEnumerator<T> GetEnumerator()
{
Object o = this.Execute(this.expression);
IEnumerable enumerable = (IEnumerable)o;
return enumerable.Cast<T>().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public IQueryable<TElement> CreateQuery<TElement>(Expression expression)
{
return new RemoteTable<TElement>(expression);
}
public IQueryable CreateQuery(Expression expression)
{
Type elementType = TypeSystem.GetElementType(expression.Type);
//Type queryType = typeof(IQueryable<>).MakeGenericType(new Type[] { elementType });
return (IQueryable)Activator.CreateInstance(
typeof(RemoteTable<>).MakeGenericType(new Type[] { elementType }),
new object[] { expression });
}
public TResult Execute<TResult>(Expression expression)
{
return (TResult)this.Execute(expression);
}
public object Execute(Expression expression)
{
XElement queryXml = this.SerializeQuery();
RemoteQueryService.ServiceReference.NorthwindServiceClient client = new RemoteQueryService.ServiceReference.NorthwindServiceClient();
Type ienumerableExpressionType = TypeSystem.FindIEnumerable(expression.Type);
if (ienumerableExpressionType == null)
{
if (typeof(ServiceReference.Customer).IsAssignableFrom(expression.Type))
return client.ExecuteQueryForCustomer(queryXml);
else if (typeof(ServiceReference.Order).IsAssignableFrom(expression.Type))
return client.ExecuteQueryForOrder(queryXml);
else
return client.ExecuteQueryForObject(queryXml);
}
Type elementType = TypeSystem.GetElementType(expression.Type);
if (typeof(ServiceReference.Customer).IsAssignableFrom(elementType))
return client.ExecuteQueryForCustomers(queryXml);
else if (typeof(ServiceReference.Order).IsAssignableFrom(elementType))
return client.ExecuteQueryForOrders(queryXml);
else
return client.ExecuteQueryForObjects(queryXml);
}
}
internal static class TypeSystem
{
internal static Type GetElementType(Type seqType)
{
Type type = FindIEnumerable(seqType);
if (type == null)
{
return seqType;
}
return type.GetGenericArguments()[0];
}
internal static Type FindIEnumerable(Type seqType)
{
if ((seqType != null) && (seqType != typeof(string)))
{
if (seqType.IsArray)
{
return typeof(IEnumerable<>).MakeGenericType(new Type[] { seqType.GetElementType() });
}
if (seqType.IsGenericType)
{
foreach (Type type in seqType.GetGenericArguments())
{
Type type2 = typeof(IEnumerable<>).MakeGenericType(new Type[] { type });
if (type2.IsAssignableFrom(seqType))
{
return type2;
}
}
}
Type[] interfaces = seqType.GetInterfaces();
if ((interfaces != null) && (interfaces.Length > 0))
{
foreach (Type type3 in interfaces)
{
Type type4 = FindIEnumerable(type3);
if (type4 != null)
{
return type4;
}
}
}
if ((seqType.BaseType != null) && (seqType.BaseType != typeof(object)))
{
return FindIEnumerable(seqType.BaseType);
}
}
return null;
}
}
}
|
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Festival.Models
{
public class AppDbContext : DbContext
{
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
public DbSet<MusicFestival> MusicFestival { get; set; }
public DbSet<Band> Band { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlServer("server=(localdb)\\MSSQLLocalDB;database=FestivalDB;Trusted_Connection=true");
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity<MusicFestival>(entity =>
{
entity.ToTable("MusicFestival");
entity.HasKey(e => e.festivalId);
entity.Property(e => e.name);
});
modelBuilder.Entity<Band>(entity =>
{
entity.ToTable("Band");
entity.Property(e => e.bandId);
entity.Property(e => e.name);
entity.Property(e => e.recordLabel);
entity.HasOne(d => d.MusicFestival)
.WithMany(p => p.Bands)
.HasForeignKey(d => d.festivalId)
.HasConstraintName("FK_Band_MusicFestival");
});
modelBuilder.Entity<MusicFestival>().HasData(
new MusicFestival
{
festivalId = 1,
name = "Twisted Tour"
},
new MusicFestival
{
festivalId = 2,
name = "Trainerella"
},
new MusicFestival
{
festivalId = 3,
name = "LOL-palooza"
}
);
modelBuilder.Entity<Band>().HasData(
new Band
{
bandId = 11,
festivalId = 1,
name = "Squint-281"
},
new Band
{
bandId = 12,
festivalId = 1,
name = "Summon",
recordLabel = "Outerscope"
},
new Band
{
bandId = 13,
festivalId = 1,
name = "Auditones",
recordLabel = "Marner Sis. Recording"
},
new Band
{
bandId = 14,
festivalId = 2,
name = "Adrian Venti",
recordLabel = "Monocracy Records"
},
new Band
{
bandId = 15,
festivalId = 2,
name = "YOUKRANE",
recordLabel = "Anti Records"
},
new Band
{
bandId = 16,
festivalId = 2,
name = "Manish Ditch",
recordLabel = "ACR"
},
new Band
{
bandId = 17,
name = "Wild Antelope",
recordLabel = "Still Bottom Records"
},
new Band
{
bandId = 18,
festivalId = 2,
name = "Propeller",
recordLabel = "Pacific Records"
},
new Band
{
bandId = 19,
name = "Critter Girls",
recordLabel = "ACR"
},
new Band
{
bandId = 20,
festivalId = 3,
name = "Frank Jupiter",
recordLabel = "Pacific Records"
},
new Band
{
bandId = 21,
festivalId = 3,
name = "Winter Primates",
},
new Band
{
bandId = 22,
festivalId = 3,
name = "Jill Black",
recordLabel = "Fourth Woman Records"
},
new Band
{
bandId = 23,
festivalId = 3,
name = "Werewolf Weekday",
recordLabel = "XS Recordings"
}
);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.Data;
namespace AdoExam
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ButEnt_Click(object sender, RoutedEventArgs e)
{
using (SqlConnection conn = new SqlConnection(App.conStr))
{
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT Password FROM Employee WHERE Name = @EmpName", conn);
if(tbName.Text!=null)
cmd.Parameters.AddWithValue("EmpName", tbName.Text);
else
cmd.Parameters.AddWithValue("EmpName", "false");
object pass = cmd.ExecuteScalar();
if (pass == null)
MessageBox.Show("The user is not regitered!");
else
{
if (pbPassw.Password == pass.ToString())
{
cmd = new SqlCommand("SELECT PositionID FROM Employee WHERE Name = @EmpName;", conn);
cmd.Parameters.AddWithValue("EmpName", tbName.Text);
int pss = (int)cmd.ExecuteScalar();
App.userName = tbName.Text;
if (pss == 1)
{
App.admin = true;
MnWindow mw = new MnWindow();
mw.Show();
this.Close();
}
else
{
SlWindow sl = new SlWindow();
sl.Show();
this.Close();
}
}
else
{
MessageBox.Show("Wrong Password!");
}
}
}
}
private void ButReg_Click(object sender, RoutedEventArgs e)
{
RegistrationWindow rw = new RegistrationWindow();
rw.Show();
this.Close();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp5
{
public class Singleton
{
// Because the _instance member is made private, the only way to get the single
// instance is via the static Instance property below. This can also be similarly
// achieved with a GetInstance() method instead of the property.
private static Singleton _instance = null;
// Making the constructor private prevents other instances from being
// created via something like Singleton s = new Singleton(), protecting
// against unintentional misuse.
private Singleton()
{
}
public static Singleton Instance
{
get
{
// The first call will create the one and only instance.
if (_instance == null)
{
_instance = new Singleton();
}
// Every call afterwards will return the single instance created above.
return _instance;
}
}
public void showMessage()
{
Console.WriteLine("Hello World");
}
}
}
|
using Microsoft.Xna.Framework;
namespace SuperMario.Entities.Blocks
{
public class BlueBrickBlock : BrickBlock
{
public BlueBrickBlock(Vector2 screenLocation, BlockItemType item) : base(screenLocation, item)
{
int numberOfBlocksInSprite = 4;
var brickBlockTexture = WinterTextureStorage.BrickBlockSpriteSheetWinter;
int width = brickBlockTexture.Width / numberOfBlocksInSprite;
int height = width;
CurrentSprite = new Sprite(brickBlockTexture, new Rectangle(width, 0, width, height));
}
}
}
|
using System;
using FluentNHibernate.Mapping;
using Sind.Model;
namespace Sind.DAL.Mappings
{
public class IndicadorMap :ClassMap<Indicador>
{
public IndicadorMap()
{
Table("Indicador");
Id(c => c.Id, "Id_Indicador").GeneratedBy.Identity();
Map(c => c.Nome, "Descricao");
Map(c => c.CodigoBRS, "BRS");
Map(c => c.UnidadeMedida, "UND");
Map(c => c.TipoCalculo, "Id_TipoCalculo").CustomType(typeof(Int32));
Map(i => i.Formula, "Formula");
Map(i => i.NomeTabela, "Tabela");
Map(i => i.NomeColuna1, "Coluna");
Map(i => i.Visivel, "Visivel");
}
}
}
|
using fNbt;
using static CellDataRail;
public class CellBehaviorRailCurve : CellBehavior, IHasData, ILeverReciever {
private bool isFlipped;
public void onLeverFlip(CellBehavior lever) {
Rotation r = this.rotation;
for(int i = 0; i < 3; i++) {
r = r.clockwise();
// Make sure both sides of the curve point towards a rail
if(this.isValidRail(r) && this.isValidRail(r.clockwise())) {
this.state.rotation = r;
this.dirty();
break;
}
}
}
public void readFromNbt(NbtCompound tag) {
this.isFlipped = tag.getBool("isSwitchCurved");
}
public void writeToNbt(NbtCompound tag) {
tag.setTag("isSwitchCurved", this.isFlipped);
}
private bool isValidRail(Rotation r) {
CellState state = this.world.getCellState(this.pos + r);
if(state.data is CellDataRail) {
return true;
/*
Rotation facingRot = state.rotation;
EnumRailMoveType railType = ((CellDataRail)state.data).moveType;
if(railType == EnumRailMoveType.STRAIGHT) {
return r.axis == facingRot.axis;
}
else if(railType == EnumRailMoveType.CROSSING) {
return true;
}
else if(railType == EnumRailMoveType.CURVE) {
return r.axis ==
}
else if(railType == EnumRailMoveType.STOPPER) {
return r == facingRot.opposite();
}
*/
}
return false;
}
}
|
using UnityEngine;
using System.Collections;
public class LevelIndexLoader : MonoBehaviour {
public int nextLevelIndex;
bool runOnce = false;
AsyncOperation async;
bool startLoad = false;
bool loading = false;
bool loadDone = false;
ScreenFade sFade;
// Use this for initialization
void Start () {
sFade = GameObject.Find("Screen Fade").GetComponent<ScreenFade>();
sFade.FadeIn();
Invoke("StartLoad", 2);}
void StartLoad(){
Time.timeScale = 1;
startLoad = true;
}
public void SetNextLevel(int i){
nextLevelIndex = i;
//Invoke("OpenLoadingScreen", 1f);
}
// Update is called once per frame
void Update () {
if(startLoad){
if(!runOnce){
Application.LoadLevel(nextLevelIndex);
runOnce = true;
}
}
}
void OpenLoadingScreen(){
//Application.LoadLevel(nextLevelIndex);
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using SimpleJSON;
using UnityEngine;
public class MapList : MonoBehaviour {
public GameObject NoEnergyGUI ;
public bool pressed;
private Game GameScript;
public int currentEnergy, MaxEnergy,energyused;
lifeless lf;
// Use this for initialization
public string lokasi = "";
void Start () {
GameScript = GetComponent<Game>();
lokasi = PlayerPrefs.GetString (Link.LOKASI);
}
// Update is called once per frame
void Update () {
}
// private IEnumerator kurangEnergy ()
// {
// string url = Link.url + "energy";
// WWWForm form = new WWWForm ();
// form.AddField (Link.ID, PlayerPrefs.GetString(Link.ID));
// form.AddField("DID", PlayerPrefs.GetString(Link.DEVICE_ID));
// form.AddField ("EUsed",PlayerPrefs.GetInt("EUsed").ToString());
// WWW www = new WWW(url,form);
// yield return www;
// if (www.error == null) {
// var jsonString = JSON.Parse (www.text);
// Debug.Log (www.text);
// PlayerPrefs.SetString (Link.FOR_CONVERTING, jsonString["code"]);
// if (int.Parse(PlayerPrefs.GetString(Link.FOR_CONVERTING)) == 1)
// {
// lf.lostLife (PlayerPrefs.GetInt("EUsed"),int.Parse(jsonString["data"]["energy"]));
// PlayerPrefs.SetString(Link.ENERGY, jsonString["data"]["energy"]);
// //yield return new WaitForSeconds (1);
// Application.LoadLevel("Game 1");
// }
// else if (PlayerPrefs.GetString(Link.FOR_CONVERTING) == "33")
// {
// ValidationError.SetActive(true);
// }
// } else {
// pressed = false;
// //trouble.SetActive (true);
// Debug.Log ("GAGAL");
// }
// }
public void NextStage ()
{
var currentStage = int.Parse(PlayerPrefs.GetString(Link.StageChoose));
switch(currentStage)
{
case 0:
OnOld_Building2();
break;
case 1:
OnOld_Building3();
break;
case 2:
OnOld_Building4();
break;
case 3:
OnOld_Building5();
break;
case 4:
OnOld_Building6();
break;
case 5:
Dialogue("SchoolStart");
OnSchool1();
break;
case 6:
OnSchool2();
break;
case 7:
OnSchool3();
break;
case 8:
OnSchool4();
break;
case 9:
OnSchool5();
break;
case 10:
OnSchool6();
break;
case 11:
Dialogue("HospitalStart");
Onhospital1();
break;
case 12:
Onhospital2();
break;
case 13:
Onhospital3();
break;
case 14:
Onhospital4();
break;
case 15:
Onhospital5();
break;
case 16:
Onhospital6();
break;
case 17:
Dialogue("BridgeStart");
OnBridge1();
break;
case 18:
OnBridge2();
break;
case 19:
OnBridge3();
break;
case 20:
OnBridge4();
break;
case 21:
OnBridge5();
break;
case 22:
OnBridge6();
break;
case 23:
Dialogue("GraveyardStart");
OnGraveyard1();
break;
case 24:
OnGraveyard2();
break;
case 25:
OnGraveyard3();
break;
case 26:
OnGraveyard4();
break;
case 27:
OnGraveyard5();
break;
case 28:
OnGraveyard6();
break;
case 29:
Dialogue("WarehouseStart");
OnWarehouse1();
break;
case 30:
OnWarehouse2();
break;
case 31:
OnWarehouse3();
break;
case 32:
OnWarehouse4();
break;
case 33:
OnWarehouse5();
break;
case 34:
OnWarehouse6();
break;
}
}
public void Dialogue(string name)
{
// SceneManagerHelper.LoadTutorial(name);
}
public void Onhospital1 () {
PlayerPrefs.SetString(Link.StageChoose, "12");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Kunti_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "SusterNgesot_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "SusterNgesot_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "4");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "437");//401 //483 //1248
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "574");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1612");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "4");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "424");// 621 340 1317
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "547");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1900");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "4");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "421");//552 450 1044
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "423");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2358");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
//
pressed = true;
}
}
public void Onhospital2 () {
PlayerPrefs.SetString(Link.StageChoose, "13");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Kunti_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Kunti_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Kunti_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "4");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "636");//380 315 1665
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "354");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1738");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "4");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "636");// 456 421 969
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "354");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1738");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "4");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "636");// 330 487 1449
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "354");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1738");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void Onhospital3 () {
PlayerPrefs.SetString(Link.StageChoose, "14");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "SusterNgesot_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "SusterNgesot_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "SusterNgesot_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "562"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "407");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2015");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "562");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "407");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2015");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "562");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "407");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2015");
if (currentEnergy >= energyused) {
//Application.LoadLevel (Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void Onhospital4 () {
PlayerPrefs.SetString(Link.StageChoose, "15");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "499"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "322");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1889");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "253");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "575");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1988");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "499");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "322");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1889");
if (currentEnergy >= energyused) {
// Application.LoadLevel (Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void Onhospital5 () {
PlayerPrefs.SetString(Link.StageChoose, "16");
if (!pressed)
{
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Tuyul_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Tuyul_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "SusterNgesot_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "505"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "400");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2442");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "454");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "562");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2215");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "424");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "547");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1900");
if (currentEnergy >= energyused) {
//Application.LoadLevel (Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void Onhospital6 () {
PlayerPrefs.SetString(Link.StageChoose, "17");
if (!pressed)
{
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Tuyul_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Tuyul_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Tuyul_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "421"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "395");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2382");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "421");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "395");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2382");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "421");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "395");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2382");
if (currentEnergy >= energyused) {
// Application.LoadLevel (Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
//School
public void OnSchool1 () {
PlayerPrefs.SetString(Link.StageChoose, "6");
if (!pressed)
{
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Babingepet_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Tuyul_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "233");// 302 442 1518
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "543");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1708");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "400");// 322 300 1734
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "335");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2025");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "465");// 501 355 1332
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "365");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1696");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnSchool2 () {
PlayerPrefs.SetString(Link.StageChoose, "7");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Babingepet_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Jelangkung_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Kolorijo_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "322");//380 315 1665
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "474");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1798");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "362");// 456 421 969
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "510");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1420");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "533");// 330 487 1449
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "387");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1612");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnSchool3 () {
PlayerPrefs.SetString(Link.StageChoose, "8");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Kolorijo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Jelangkung_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Kolorijo_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "355"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "527");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1799");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "347");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "325");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2184");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "541");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "380");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1682");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnSchool4 () {
PlayerPrefs.SetString(Link.StageChoose, "9");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Kolorijo_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "475"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "347");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1679");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "291");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "405");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2112");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "414");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "403");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2049");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnSchool5 () {
PlayerPrefs.SetString(Link.StageChoose, "10");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Kunti_fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Kolorijo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "400"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "397");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2379");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "517");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "535");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1869");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "483");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "352");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1749");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnSchool6 () {
PlayerPrefs.SetString(Link.StageChoose, "11");
if (!pressed)
{
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Jelangkung_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Kunti_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Kunti_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "352"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "330");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2274");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "628");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "384");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1668");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "432");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "622");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1542");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void PlayTutorial () {
PlayerPrefs.SetString(Link.StageChoose, "0");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "443");// 302 442 1518
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "327");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1399");
if (currentEnergy >= energyused) {
//Application.LoadLevel (Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
//Old_Building
public void OnOld_Building1 () {
PlayerPrefs.SetString(Link.StageChoose, "0");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "443");// 302 442 1518
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "327");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1399");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "218");// 322 300 1734
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "519");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1498");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "271");// 501 355 1332
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "385");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1752");
if (currentEnergy >= energyused) {
//Application.LoadLevel (Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnOld_Building2 () {
PlayerPrefs.SetString(Link.StageChoose, "1");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "SundelBolong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "218");//380 315 1665
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "519");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1498");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "218");// 456 421 969
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "519");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1498");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "440");// 330 487 1449
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "407");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1629");
if (currentEnergy >= energyused) {
//Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;}
}
public void OnOld_Building3 () {
PlayerPrefs.SetString(Link.StageChoose, "2");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Jelangkung_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Jelangkung_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Jelangkung_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "472"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "431");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1109");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "352");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "494");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1280");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "332");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "310");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1914");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnOld_Building4 () {
PlayerPrefs.SetString(Link.StageChoose, "3");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Jelangkung_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "451"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "332");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1469");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "332");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "310");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1914");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "276");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "390");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1842");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnOld_Building5 () {
PlayerPrefs.SetString(Link.StageChoose, "4");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "SundelBolong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Jelangkung_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "228"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "535");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1638");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "450");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "417");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1809");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "480");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "436");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1179");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnOld_Building6() {
PlayerPrefs.SetString(Link.StageChoose, "5");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Jelangkung_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "357"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "502");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1350");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "459");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "337");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "1539");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "228");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "535");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1638");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
//Bridge
public void OnBridge1 () {
PlayerPrefs.SetString(Link.StageChoose, "18");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Mukarata_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "SundelBolong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "451");// 302 442 1518
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "563");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1948");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "485");// 322 300 1734
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "452");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2439");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "263");// 501 355 1332
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "591");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2128");
if (currentEnergy >=energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
}
else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnBridge2 () {
PlayerPrefs.SetString(Link.StageChoose, "19");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Kolorijo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Pocong_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "426");//380 315 1665
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "434");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2520");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "380");// 456 421 969
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "567");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2149");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "263");// 330 487 1449
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "591");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2128");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnBridge3 () {
PlayerPrefs.SetString(Link.StageChoose, "20");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Mukarata_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Mukarata_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "597"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "489");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "1841");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "523");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "377");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2099");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "456");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "571");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2018");
if (currentEnergy >= energyused) {
//Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnBridge4 () {
PlayerPrefs.SetString(Link.StageChoose, "21");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Hantutanpakepala_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Hantutanpakepala_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "375"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "610");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2144");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "375");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "610");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2144");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "431");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "439");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2610");
if (currentEnergy >= energyused) {
//Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnBridge5 () {
PlayerPrefs.SetString(Link.StageChoose, "22");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Kolorijo_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Mukarata_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "389"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "378");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2679");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "326");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "440");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2742");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "605");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "494");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1911");
if (currentEnergy >= energyused) {
//Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnBridge6 () {
PlayerPrefs.SetString(Link.StageChoose, "23");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "436"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "444");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2700");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "436");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "444");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2700");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "436");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "444");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2700");
if (currentEnergy >= energyused) {
//Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
//Graveyard
public void OnGraveyard1 () {
PlayerPrefs.SetString(Link.StageChoose, "24");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Kolorijo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Hantutanpakepala_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Genderuwo_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "ATTACK");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "395");// 302 442 1518
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "591");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2359");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "385");// 322 300 1734
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "626");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2284");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "656");// 501 355 1332
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "515");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "1954");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnGraveyard2 () {
PlayerPrefs.SetString(Link.StageChoose, "25");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Genderuwo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Pocong_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Genderuwo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "DEFEND");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "467");//380 315 1665
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "592");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2290");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "539");// 456 421 969
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "387");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2239");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "467");// 330 487 1449
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "592");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2290");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnGraveyard3 ()
{
PlayerPrefs.SetString(Link.StageChoose, "26");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Jin_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Jin_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Jin_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "375"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "418");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "3201");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "375");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "418");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "3201");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "375");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "418");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "3201");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnGraveyard4 ()
{
PlayerPrefs.SetString(Link.StageChoose, "27");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Hantutanpakepala_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Genderuwo_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Hantutanpakepala_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "DEFEND");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "426"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "415");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "3057");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "472");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "600");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2360");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "426");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "415");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "3057");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnGraveyard5 ()
{
PlayerPrefs.SetString(Link.StageChoose, "28");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Genderuwo_Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "Mukarata_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "HP");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "451"); // 370 367 1839
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "459");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2970");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "420");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "442");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "3264");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "451");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "459");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "2970");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnGraveyard6 ()
{
PlayerPrefs.SetString(Link.StageChoose, "29");
if (!pressed) {
PlayerPrefs.SetString(Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString(Link.LOKASI, lokasi);
PlayerPrefs.SetString(Link.JENIS, "SINGLE");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_FILE, "Genderuwo_Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_FILE, "Kunti_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_FILE, "SusterNgesot_Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ELEMENT, "Wind");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_MODE, "ATTACK");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_MODE, "HP");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString(Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_ATTACK, "672"); // 370 367 1839 , "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_DEFENSE, "525");
PlayerPrefs.SetString(Link.POS_1_CHAR_1_HP, "2394");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_ATTACK, "700");// 213 511 1428
PlayerPrefs.SetString(Link.POS_1_CHAR_2_DEFENSE, "429");
PlayerPrefs.SetString(Link.POS_1_CHAR_2_HP, "2598");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_ATTACK, "461");// 376 350 1572
PlayerPrefs.SetString(Link.POS_1_CHAR_3_DEFENSE, "463");
PlayerPrefs.SetString(Link.POS_1_CHAR_3_HP, "3078");
if (currentEnergy >= energyused) {
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
//WareHouse
public void OnWarehouse1 () {
PlayerPrefs.SetString(Link.StageChoose, "30");
if (!pressed) {
if (currentEnergy >= energyused) {
PlayerPrefs.SetString (Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString (Link.LOKASI, lokasi);
PlayerPrefs.SetString (Link.JENIS, "SINGLE");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "Babingepet_Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Jelangkung_Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Kolorijo_Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Fire");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString (Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "302");// 302 442 1518
PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "442");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "1518");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "322");// 322 300 1734
PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "300");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "1734");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "501");// 501 355 1332
PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "355");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "1332");
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnWarehouse2 () {
PlayerPrefs.SetString(Link.StageChoose, "31");
if (!pressed) {
if (currentEnergy >= energyused) {
PlayerPrefs.SetString (Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString (Link.LOKASI, lokasi);
PlayerPrefs.SetString (Link.JENIS, "SINGLE");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "Babingepet_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Jelangkung_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Kolorijo_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Water");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString (Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "380");//380 315 1665
PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "315");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "1665");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "456");// 456 421 969
PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "421");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "969");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "330");// 330 487 1449
PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "487");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "1449");
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnWarehouse3 () {
PlayerPrefs.SetString(Link.StageChoose, "32");
if (!pressed) {
if (currentEnergy >= energyused) {
PlayerPrefs.SetString (Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString (Link.LOKASI, lokasi);
PlayerPrefs.SetString (Link.JENIS, "SINGLE");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "Kunti_fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Leak_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Genderuwo_Wind");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Wind");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString (Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "370"); // 370 367 1839
PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "367");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "1839");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "213");// 213 511 1428
PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "511");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "1428");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "376");// 376 350 1572
PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "350");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "1572");
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnWarehouse4 () {
PlayerPrefs.SetString(Link.StageChoose, "33");
if (!pressed) {
if (currentEnergy >= energyused) {
PlayerPrefs.SetString (Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString (Link.LOKASI, lokasi);
PlayerPrefs.SetString (Link.JENIS, "SINGLE");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "Kunti_fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Leak_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Genderuwo_Wind");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Wind");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString (Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "370"); // 370 367 1839
PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "367");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "1839");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "213");// 213 511 1428
PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "511");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "1428");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "376");// 376 350 1572
PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "350");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "1572");
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnWarehouse5 () {
PlayerPrefs.SetString(Link.StageChoose, "34");
if (!pressed) {
if (currentEnergy >= energyused) {
PlayerPrefs.SetString (Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString (Link.LOKASI, lokasi);
PlayerPrefs.SetString (Link.JENIS, "SINGLE");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "Kunti_fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Leak_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Genderuwo_Wind");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Wind");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString (Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "370"); // 370 367 1839
PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "367");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "1839");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "213");// 213 511 1428
PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "511");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "1428");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "376");// 376 350 1572
PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "350");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "1572");
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
public void OnWarehouse6 () {
PlayerPrefs.SetString(Link.StageChoose, "35");
if (!pressed) {
if (currentEnergy >= energyused) {
PlayerPrefs.SetString (Link.SEARCH_BATTLE, "SINGLE");
PlayerPrefs.SetString (Link.LOKASI, lokasi);
PlayerPrefs.SetString (Link.JENIS, "SINGLE");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "Kunti_fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Leak_Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Genderuwo_Wind");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Fire");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Water");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Wind");
//DISESUAIKAN DENGAN KEBUTUHAN YANG BERSANGKUTAN + EXCEL MAS TONI
PlayerPrefs.SetString (Link.POS_1_CHAR_1_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "370"); // 370 367 1839
PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "367");
PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "1839");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "213");// 213 511 1428
PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "511");
PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "1428");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_GRADE, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_LEVEL, "1");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "376");// 376 350 1572
PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "350");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "1572");
// Application.LoadLevel(Link.PilihCharacter);
GameScript.KurangEnergy();
} else {
NoEnergyGUI.SetActive (true);
}
pressed = true;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using ProjetoFinalDM106.Models;
using System.Diagnostics;
namespace ProjetoFinalDM106.Controllers
{
public class ProductsController : ApiController
{
private ProjetoFinalDM106Context db = new ProjetoFinalDM106Context();
// GET: api/Products
[Authorize]
public IQueryable<Product> GetProducts()
{
return db.Products;
}
// GET: api/Products/5
[Authorize]
[ResponseType(typeof(Product))]
public IHttpActionResult GetProduct(int id)
{
Product product = db.Products.Find(id);
if (product == null)
{
return NotFound();
}
return Ok(product);
}
// PUT: api/Products/5
[Authorize(Roles = "ADMIN")]
[ResponseType(typeof(void))]
public IHttpActionResult PutProduct(int id, Product product)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != product.Id)
{
return BadRequest();
}
if (ModeloOuCodigoJaPresenteNaTabela(product, true))
{
return BadRequest("Modelo e/ou codigo já presente na tabela!");
}
db.Entry(product).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!ProductExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
// POST: api/Products
[Authorize(Roles = "ADMIN")]
[ResponseType(typeof(Product))]
public IHttpActionResult PostProduct(Product product)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (ModeloOuCodigoJaPresenteNaTabela(product, false))
{
return BadRequest("Modelo e/ou codigo já presente na tabela!");
}
db.Products.Add(product);
db.SaveChanges();
return CreatedAtRoute("DefaultApi", new { id = product.Id }, product);
}
// DELETE: api/Products/5
[Authorize(Roles = "ADMIN")]
[ResponseType(typeof(Product))]
public IHttpActionResult DeleteProduct(int id)
{
Product product = db.Products.Find(id);
if (product == null)
{
return NotFound();
}
db.Products.Remove(product);
db.SaveChanges();
return Ok(product);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
private bool ProductExists(int id)
{
return db.Products.Count(e => e.Id == id) > 0;
}
private bool ModeloOuCodigoJaPresenteNaTabela(Product product, Boolean isPutOperation)
{
if (isPutOperation)
{
//Criando uma nova tabela excluindo o produto a ser modificado
var productsFiltered = from Product in db.Products
where Product.Id != product.Id
select Product;
return (productsFiltered.Count(p => p.modelo.Equals(product.modelo)) > 0) || (productsFiltered.Count(p => p.codigo.Equals(product.codigo)) > 0);
}
return (db.Products.Count(p => p.modelo.Equals(product.modelo)) > 0) || (db.Products.Count(p => p.codigo.Equals(product.codigo)) > 0);
}
}
} |
using System;
using Adapter.Interfaces;
namespace Adapter.Classes
{
public class WildTurkey : ITurkey
{
public void Gobble() => Console.WriteLine("Wild Turkey Gobble");
public void Fly() => Console.WriteLine("Wild Turkey Fly");
}
} |
using FluentNHibernate.Mapping;
using Skaele.Domain.Cards;
namespace Data.Mappings
{
public class CardMap : ClassMap<Card>
{
public CardMap()
{
Table("Cards");
Id(x => x.Id);
Map(x => x.SetNumber)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.Name)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.SearchName)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.Description)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Nullable();
Map(x => x.Flavor)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Nullable();
HasManyToMany(x => x.Colors)
.Table("Colors")
.Element("Color")
.Access.CamelCaseField(Prefix.Underscore)
.AsSet()
.Not.LazyLoad();
Map(x => x.Manacost)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.ConvertedManaCost)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.CardSetName)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.Type)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.SubType)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.Power)
.Access.CamelCaseField(Prefix.Underscore)
.Nullable();
Map(x => x.Toughness)
.Access.CamelCaseField(Prefix.Underscore)
.Nullable();
Map(x => x.Loyalty)
.Access.CamelCaseField(Prefix.Underscore)
.Nullable();
Map(x => x.Rarity)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.Artist)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
Map(x => x.CardSetId)
.Length(9999)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
HasMany(x => x.Rulings)
.Table("Rulings")
.AsSet()
.Access.CamelCaseField(Prefix.Underscore)
.Not.LazyLoad();
HasMany(x => x.Formats)
.Table("Formats")
.Element("Format")
.Access.CamelCaseField(Prefix.Underscore)
.AsSet()
.Not.LazyLoad();
Map(x => x.ReleasedAt)
.Access.CamelCaseField(Prefix.Underscore)
.Not.Nullable();
}
}
public class RulingMap : ClassMap<Ruling>
{
public RulingMap()
{
Table("Rulings");
Id(x => x.Id);
Map(x => x.Date)
.Nullable();
Map(x => x.Rule)
.Length(9999)
.Nullable();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exercicio29
{
class TempoMedioCargas
{
static void Main(string[] args)
{
{
double Medh = 0; int C = 0;
Console.Write("Tempo médio do camionista (0 para terminar) ");
double Tempomed = Convert.ToInt16(Console.ReadLine());
while (Tempomed != 0)
{
C++;
Medh += 1 / Tempomed;
Console.Write("Tempo médio do camionista (0 para terminar)");
Tempomed = Convert.ToInt16(Console.ReadLine());
}
Console.WriteLine("Tempo médio por carga dos {0} camionistas" + "={1,4:F2} horas", C, C / Medh);
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Freecam : MonoBehaviour
{
[SerializeField] float scrollSpeed = 15f, scrollThreshold = 10f, zoomSpeed = 15f;
[SerializeField] float width = 40f, height = 40f;
[SerializeField] float startSize = 5f, minSize = 5f, maxSize;
// Assign invwidth and rightwidth to 0 when menus arent present
[SerializeField] float invWidth = 150f, rightWidth = 150f;
int canvasWidth = Screen.width;
float minX, maxX, minY, maxY;
Camera cam;
GridGenerator grid;
void Start()
{
BuildManager.Instance.onDimensionsChanged += DimensionUpdate;
grid = FindObjectOfType<GridGenerator>();
cam = GetComponent<Camera>();
cam.orthographicSize = startSize;
minX = startSize * cam.aspect - 0.5f;
maxX = width - minX - 1f;
minY = startSize - 0.5f;
maxY = height - minY - 1f;
float leftOffset = invWidth / canvasWidth * 2 * startSize * cam.aspect;
float rightOffset = rightWidth / canvasWidth * 2 * startSize * cam.aspect;
minX -= leftOffset;
maxX += rightOffset;
CalculateBounds();
CalculateMaxSize();
cam.transform.position = new Vector3(minX, cam.transform.position.y, cam.transform.position.z);
}
void Update()
{
Zoom();
Move();
}
void Zoom()
{
Vector2 dScroll = Input.mouseScrollDelta;
if (dScroll == Vector2.zero)
return;
float targetSize = cam.orthographicSize + -dScroll.y * zoomSpeed * Time.deltaTime;
cam.orthographicSize = Mathf.Clamp(targetSize, minSize, maxSize);
CalculateBounds();
grid.MultiplyLineWidth(cam.orthographicSize / startSize);
}
void Move()
{
Vector2 mousePos = Input.mousePosition;
Vector3 targetPos = transform.position;
if (mousePos.x < scrollThreshold)
{
targetPos.x -= scrollSpeed * Time.deltaTime;
}
else if (mousePos.x > Screen.width - scrollThreshold)
{
targetPos.x += scrollSpeed * Time.deltaTime;
}
if (mousePos.y < scrollThreshold)
{
targetPos.y -= scrollSpeed * Time.deltaTime;
}
else if (mousePos.y > Screen.height - scrollThreshold)
{
targetPos.y += scrollSpeed * Time.deltaTime;
}
transform.position = new Vector3(Mathf.Clamp(targetPos.x, minX, maxX),
Mathf.Clamp(targetPos.y, minY, maxY), transform.position.z);
}
public void DimensionUpdate(int width, int height)
{
this.width = width;
this.height = height;
CalculateMaxSize();
cam.orthographicSize = Mathf.Clamp(cam.orthographicSize, minSize, maxSize);
grid.MultiplyLineWidth(cam.orthographicSize / startSize);
CalculateBounds();
}
private void CalculateMaxSize()
{
float maxXSize = Screen.height / (2 * (canvasWidth - Mathf.RoundToInt(invWidth) - Mathf.RoundToInt(rightWidth)) / width);
float maxYSize = height / 2;
maxSize = Mathf.Min(maxXSize, maxYSize);
}
private void CalculateBounds()
{
float size = cam.orthographicSize;
float leftOffset = invWidth / canvasWidth * 2 * size * cam.aspect;
float rightOffset = rightWidth / canvasWidth * 2 * size * cam.aspect;
minX = size * cam.aspect - 0.5f - leftOffset;
maxX = width - (size * cam.aspect - 0.5f) - 1f + rightOffset;
minY = size - 0.5f;
maxY = height - minY - 1f;
if (maxX < minX)
maxX = minX;
if (maxY < minY)
maxY = minY;
}
}
|
namespace Hidistro.UI.SaleSystem.CodeBehind
{
using Hidistro.Core;
using Hidistro.Entities.Members;
using Hidistro.SaleSystem.Vshop;
using Hidistro.UI.Common.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
[ParseChildren(true)]
public class DistributorRequest : VMemberTemplatedWebControl
{
private Literal litBackImg;
protected override void AttachChildControls()
{
PageTitle.AddSiteNameTitle("申请分销");
this.litBackImg = (Literal) this.FindControl("litBackImg");
this.Page.Session["stylestatus"] = "2";
DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(MemberProcessor.GetCurrentMember().UserId);
if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
{
this.Page.Response.Redirect("DistributorCenter.aspx", true);
}
if (this.litBackImg != null)
{
List<string> list = SettingsManager.GetMasterSettings(false).DistributorBackgroundPic.Split(new char[] { '|' }).ToList<string>();
foreach (string str in list)
{
if (!string.IsNullOrEmpty(str))
{
this.litBackImg.Text = this.litBackImg.Text + "<div><span class=\"mark\"></span><img src=\"" + str + "\" /></div>";
}
}
}
}
protected override void OnInit(EventArgs e)
{
if (this.SkinName == null)
{
this.SkinName = "Skin-VDistributorRequest.html";
}
base.OnInit(e);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.Data.Entity;
using BE;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.EntityFrameworkCore.SqlServer;
using Microsoft.Data.SqlClient;
namespace DAL
{
class IceCreamDB : DbContext
{
public DbSet<Shop> Shops { get; set; }
public DbSet<IceCream> IceCreams { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"Server=.\SQLEXPRESS;Database=(localdb)\MSSQLLocalDB;Trusted_Connection=True;");
}
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<IceCream>().HasKey(s => new { s.Id, s.ShopId });
/* builder.Entity<IceCream>()
.Property(e => e.Comments)
.HasConversion(v => string.Join(",", v), v => v.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
builder.Entity<IceCream>()
.Property(e => e.Taste)
.HasConversion(v => string.Join(";", v), v => v.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
builder.Entity<IceCream>()
.Property(e => e.Images)
.HasConversion(v => string.Join(";", v), v => v.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
var converter = new ValueConverter<int[], String>(
v => String.Join(";", v),
v => v.Split(';').Select(val => int.Parse(val)).ToArray());
builder.Entity<IceCream>()
.Property(e => e.Marks)
.HasConversion(converter);
builder.Entity<Shop>()
.Property(e => e.Images)
.HasConversion(v => string.Join(";", v), v => v.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));*/
}
}
}
|
using System;
using System.Windows.Threading;
using SpeedSlidingTrainer.Application.Infrastructure;
namespace SpeedSlidingTrainer.Desktop.Infrastructure
{
public sealed class TimerAdapter : ITimer
{
private readonly DispatcherTimer timer;
public TimerAdapter(TimeSpan interval, Action onTick)
{
this.timer = new DispatcherTimer { Interval = interval };
this.timer.Tick += (sender, e) => onTick();
}
public void Start()
{
this.timer.Start();
}
public void Stop()
{
this.timer.Stop();
}
}
}
|
using System.Collections.Generic;
using Tomelt.ContentManagement;
using Tomelt.Core.Navigation.Models;
namespace Tomelt.Core.Navigation.Services {
public interface IMenuService : IDependency {
IEnumerable<MenuPart> Get();
IEnumerable<MenuPart> GetMenuParts(int menuId);
MenuPart Get(int id);
IContent GetMenu(int menuId);
IContent GetMenu(string name);
IEnumerable<ContentItem> GetMenus();
IContent Create(string name);
void Delete(MenuPart menuPart);
}
} |
using System;
using OpenQA.Selenium.Remote;
using RestSharp;
namespace Common.SauceLabs
{
public class Rdc
{
public void UpdateTestStatus(bool isTestPassed, SessionId sessionId)
{
var client = new RestClient
{
BaseUrl = new Uri("https://app.testobject.com/api/rest")
};
var request = new RestRequest($"/v2/appium/session/{sessionId}/test", Method.PUT)
{
RequestFormat = DataFormat.Json
};
request.AddJsonBody(new { passed = isTestPassed });
client.Execute(request);
}
}
} |
using BezierMasterNS.MeshesCreating;
using BezierMasterNS;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(CylinderMeshCreator))]
public class CyllinderCreatorEditor : MeshCreatorEditor
{
protected SerializedProperty capStartProperty;
protected SerializedProperty capEndProperty;
string capStartPropertyName = "capStart";
string capEndPropertyName = "capEnd";
public override void Setup(BezierMaster bezierMaster)
{
base.Setup(bezierMaster);
capStartProperty = serializedObject.FindProperty(capStartPropertyName);
capEndProperty = serializedObject.FindProperty(capEndPropertyName);
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(lenghtSegmentsProperty);
lenghtSegmentsProperty.intValue = Mathf.Clamp(lenghtSegmentsProperty.intValue, 3, 1000);
EditorGUILayout.PropertyField(widhtSegmentsProperty);
widhtSegmentsProperty.intValue = Mathf.Clamp(widhtSegmentsProperty.intValue, 2, 100);
GUILayout.Space(5);
EditorGUILayout.PropertyField(widthProperty, new GUIContent("Radius"));
GUILayout.Space(5);
if (!master.spline.Loop)
{
EditorGUILayout.PropertyField(capStartProperty);
EditorGUILayout.PropertyField(capEndProperty);
}
GUILayout.Space(5);
EditorGUILayout.PropertyField(textureOrientationProperty);
EditorGUILayout.PropertyField(fixTextureStretchProperty);
GUILayout.Space(5);
EditorGUILayout.PropertyField(TextureScaleProperty);
GUILayout.Space(5);
DrawCopyPasteMenu();
GUILayout.Space(5);
if (serializedObject.hasModifiedProperties)
{
serializedObject.ApplyModifiedProperties();
}
}
}
|
using UnityEngine;
using System.Collections;
public class UnitController : MonoBehaviour {
NavMeshAgent agent;
private bool selectedByClick = false; //Variable for whether or not the unit was selected by a click
private float distance;
public bool isSelected = false; //Variable for if the unit is currently selected
void Start () {
agent = GetComponent<NavMeshAgent>();
}
void Update () {
if (GetComponent<Renderer>().isVisible && Input.GetMouseButton(0)) {
if (!selectedByClick){
Vector3 camPos = Camera.main.WorldToScreenPoint(transform.position); //Test for if the unit is currently not selected, the mouse button is down,
camPos.y = CameraController.InvertMouseY(camPos.y); //and if the unit is currently in the selection box, if so set isSelected to true
isSelected = CameraController.selection.Contains(camPos);
}
}
if (isSelected) {
GetComponent<Renderer> ().material.color = Color.red; //If the unit is selected set the color to red
if (Input.GetMouseButtonDown (1)) { //and detect if the right mouse button has been pressed and where on the environment
RaycastHit hit; // it should move to, then set the isMoving variable to true if it is moving
if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 100)) {
agent.destination = hit.point;
}
}
}
else {
GetComponent<Renderer> ().material.color = Color.white; //If not currently selected set color to white
}
distance = Vector3.Distance (agent.destination, transform.position);
if (distance < 0.15f) {
agent.destination = transform.position;
}
}
void OnMouseDown(){
selectedByClick = true; //If the unit itself is clicked set selectedByClick and isSelected to true
isSelected = true;
}
void OnMouseUp(){
if (selectedByClick) { //Checking if the mouse button has been released and if the unit was selected by a click
isSelected = true; //Then keep it selected
}
selectedByClick = false;
}
}
|
/********************************************************************************
ShareSkill Class is implemented according to the Design Pattern POM with
PageFactory to reuse the Code at Maximum. The Concept is One Class is for One
WebPage.The ShareSkill Class Consist of the elements operations present in
ShareSkill Webpage.
*****************************************************************************/
using MarsFramework.Config;
using MarsFramework.Global;
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;
using RelevantCodes.ExtentReports;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Linq;
using System.Windows.Forms;
using MarsFramework.Pages;
using MarsFramework;
namespace MarsFramework
{
internal class ShareSkill
{
public static int RowCount = Int32.Parse(MarsResource.RowNum);
int count = 1;
public ShareSkill()
{
PageFactory.InitElements(Global.GlobalDefinitions.driver, this);
}
#region Initialize Web Elements
//Define ShareSkill button
[FindsBy(How = How.LinkText, Using = "Share Skill")]
private IWebElement ShareSkillButton { get; set; }
//Define Title Field
[FindsBy(How = How.Name, Using = "title")]
private IWebElement Title { get; set; }
//Define Description Field
[FindsBy(How = How.Name, Using = "description")]
private IWebElement Description { get; set; }
//Define Category Dropdown Field
[FindsBy(How = How.XPath, Using = "//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div/select")]
private IWebElement CategoryDrop { get; set; }
//Define SubCategory
[FindsBy(How = How.Name, Using = "subcategoryId")]
private IWebElement Subcategory { get; set; }
//Define Tags
[FindsBy(How = How.ClassName, Using = "ReactTags__tagInputField")]
private IWebElement Tags { get; set; }
//Define ServiceType
[FindsBy(How = How.XPath, Using = "//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[2]/div/input")]
private IWebElement ServiceType { get; set; }
//Define ServiceTypeText
[FindsBy(How = How.XPath, Using = "//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[2]/div/label")]
private IWebElement ServiceTypeText { get; set; }
//Define LocationType
[FindsBy(How = How.XPath, Using = "//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")]
private IWebElement LocationType { get; set; }
//Define StartDate
[FindsBy(How = How.Name, Using = "startDate")]
private IWebElement StartDate{ get; set; }
//Define EndDate
[FindsBy(How = How.Name, Using = "endDate")]
private IWebElement EndDate { get; set; }
//Define Skill-Exchange Tag
[FindsBy(How = How.XPath, Using = "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]//input")]
private IWebElement SkillTag { get; set; }
//Define Worksample upload
[FindsBy(How = How.XPath, Using = "//*[@id='service-listing-section']//span/i")]
private IWebElement WorkSample { get; set; }
//Define Save Button
[FindsBy(How = How.XPath, Using = "//input[contains(@class, 'ui teal button')]")]
private IWebElement Save { get; set; }
//Define Cancel Button
[FindsBy(How = How.XPath, Using = "//input[contains(@class, 'ui button')]")]
private IWebElement Cancel { get; set; }
//Define View Button
[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[1]//i[1]")]
private IWebElement View { get; set; }
//Define Manage Listings
[FindsBy(How = How.XPath, Using = "//*[@id='service-detail-section']/section[1]//a[3]")]
private IWebElement ManageListings { get; set; }
//Define SearchBar Button
[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[1]//input")]
private IWebElement SearchBar { get; set; }
//Define Search Button
[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[1]/div[1]/i")]
private IWebElement SearchButton { get; set; }
//Define Search User
[FindsBy(How = How.XPath, Using = "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[3]//input")]
private IWebElement SearchUser { get; set; }
//Define SelectUser
[FindsBy(How = How.XPath, Using = "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[3]/div[1]/div/div[2]/div[1]//span")]
private IWebElement SelectUser { get; set; }
#endregion
/** ShareASkill Method to handle the ShareSkill page details**/
internal void ShareASkill(string option)
{
string date, imagePath, fullimagePath, actualResult, expectResult, user;
string[] startDate;
string[] endDate;
string[] exResult;
int imageCount =1, i=0;
bool verifyAdd;
string expectedResult = "Manage Listings";
string expectedResult_Cancel = "Mars Logo";
string expected_valid = "Special characters are not allowed.";
string message = "Share A Skill";
string message_cancel = "Cancel the share skill form";
string message_char = "Restriciting special Characters in Title Filed";
try
{
//Populate the data from Excel Sheet
GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
Thread.Sleep(1000);
//Click ShareSkill Button
ShareSkillButton.Click();
Thread.Sleep(500);
//Enter the Title
//If user input is special char, take the data from 3rd row of excelsheet
if(option.Equals("spchar"))
{
Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(RowCount+1, "Title"));
GlobalDefinitions.wait(5);
goto finish;
}
else
{
Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(RowCount, "Title"));
GlobalDefinitions.wait(5);
}
//Enter the Description
Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(RowCount, "Description"));
GlobalDefinitions.wait(5);
//Select Category Option
Thread.Sleep(1000);
Actions action = new Actions(GlobalDefinitions.driver);
action.MoveToElement(CategoryDrop).Click().Perform();
Thread.Sleep(500);
IList<IWebElement> Categoryselect = CategoryDrop.FindElements(By.TagName("option"));
int count = Categoryselect.Count;
for ( i = 0; i < count; i++)
{
if (Categoryselect[i].Text == GlobalDefinitions.ExcelLib.ReadData(RowCount, "Category"))
{
Categoryselect[i].Click();
Base.test.Log(LogStatus.Info, "Select the available category");
break;
}
}
//Select SubCategory Option
Thread.Sleep(1000);
action.MoveToElement(Subcategory).Click().Perform();
Thread.Sleep(500);
IList<IWebElement> SubCategoryselect = Subcategory.FindElements(By.TagName("option"));
int subcount = SubCategoryselect.Count;
for ( i = 0; i < subcount; i++)
{
if (SubCategoryselect[i].Text == GlobalDefinitions.ExcelLib.ReadData(RowCount, "Subcategory"))
{
SubCategoryselect[i].Click();
Base.test.Log(LogStatus.Info, "Select the available Subcategory");
break;
}
}
Thread.Sleep(1000);
//Enter Tags
Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(RowCount, "Tags"));
Tags.SendKeys(OpenQA.Selenium.Keys.Enter);
Thread.Sleep(1000);
//Scroll down the webpage
IJavaScriptExecutor jse = (IJavaScriptExecutor)GlobalDefinitions.driver;
jse.ExecuteScript("scroll(0, 450)");
//Select Service Type "One-Off service"
ServiceType.Click();
//Select Location Type "On-Site"
LocationType.Click();
/*Enter the StartDate. Since the date format getting from excel sheet includes
time as well, so need to split it to get the date alone*/
date = GlobalDefinitions.ExcelLib.ReadData(RowCount, "StartDate");
startDate = date.Split(' ');
StartDate.Click();
StartDate.SendKeys(startDate[0]);
Thread.Sleep(1000);
//Enter the EndDate
date = GlobalDefinitions.ExcelLib.ReadData(RowCount, "EndDate");
endDate = date.Split(' ');
EndDate.Click();
EndDate.SendKeys(endDate[0]);
// DatePicker using Javascrip Executer
//jse.ExecuteScript("arguments[0].setAttribute('value','"+strDate+"');", StartDate);
//Enter Skill-Exchange Tag
SkillTag.Click();
SkillTag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(RowCount, "SkillTag"));
SkillTag.SendKeys(OpenQA.Selenium.Keys.Enter);
Thread.Sleep(1000);
//If User input is "moresample", upload more than 5 samples.By default imageCount is 1
if (option.Equals("moresample"))
{
imageCount = 7;
}
i = 0;
while (i < imageCount)
{
//Verify the Worksample button is displayed after adding 5 samples
if(WorkSample.Displayed)
{
//Click on Worksample
WorkSample.Click();
//Upload 5 work Samples
imagePath = GlobalDefinitions.ExcelLib.ReadData(RowCount+i, "WorkSamplePath");
fullimagePath = System.IO.Path.GetFullPath(imagePath);
// Console.WriteLine(fullimagePath);
Thread.Sleep(3000);
SendKeys.SendWait(@fullimagePath);
Thread.Sleep(3000);
SendKeys.SendWait(@"{Enter}");
Thread.Sleep(3000);
i++;
}
else
{
/*Bug- ErrorMessage should display to restrict the uploading of more than 5 work samples.
* Due to Lack of error message verifying the same is not possible*/
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Restricting upload of more than 5 samples Successful");
}
}
finish:
switch (option)
{
//Share a Service
case "create":
/*Bug- With Worksample, after creating the service , it isnot navigating to next page.Hence removed
* the sample to verify the basic functionality of ShareSkill*/
Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]//div/i")).Click();
expectResult = ServiceTypeText.Text;
exResult = expectResult.Split(' ');
// Clicking the Save Button
Save.Click();
Thread.Sleep(2000);
actualResult = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']//h2")).Text;
AssertMethod assert = new AssertMethod();
// True for creating first time, False for resharing the service
verifyAdd = assert.Assert_Method(expectedResult, actualResult, message);
/* If the Skill is already shared, Clicking the save button will generate error,
Hence no need to verify service in manage listing page*/
/*If the sharing of the skill is success, Verify the same is displayed on "Manage Listing" page
and Search Result*****/
if ((verifyAdd == true) && (this.count== 1))
{
Thread.Sleep(2000);
//View the details of the Service
View.Click();
Thread.Sleep(1000);
//Verify the service is displayed on Manage Listings Page
actualResult = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-detail-section']/div[2]/div/div[2]/div[1]/div[1]/div[2]/div[2]/div/div/div[2]/div/div[3]//div[2]")).Text;
if(actualResult.Equals(exResult[0]))
{
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test Passed, Service is listed on Manage Listing page");
this.count++;
}
else
{
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Service is not listed on Manage Listing page");
break;
}
//Verify the Service is displayed on Searching
actualResult = GlobalDefinitions.ExcelLib.ReadData(RowCount, "Title");
user = GlobalDefinitions.ExcelLib.ReadData(RowCount, "User");
ManageListings.Click();
Thread.Sleep(1500);
//Calling SearchAService method to Search the service
SearchAService(actualResult, user);
}
// Resharing a skill is restricted
else if ((verifyAdd == false) && (this.count == 2))
{
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test Passed, Restricted resharing a skill");
}
// Resharing a skill is not restricted
else if ((verifyAdd == true) && (this.count == 2))
{
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Not able to Restrict resharing a skill");
}
Thread.Sleep(1500);
break;
case "cancel":
// Clicking the Cancel Button
Cancel.Click();
Thread.Sleep(1500);
actualResult = Global.GlobalDefinitions.driver.FindElement(By.LinkText("Mars Logo")).Text;
AssertMethod assert_close = new AssertMethod();
assert_close.Assert_Method(expectedResult_Cancel, actualResult, message_cancel);
break;
case "spchar":
actualResult = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[1]/div/div[2]/div/div[2]/div")).Text;
AssertMethod assert_char = new AssertMethod();
assert_char.Assert_Method(expected_valid, actualResult, message_char);
break;
}
}
catch(Exception e)
{
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Not able to share a skill", e.Message);
}
}
/******* SearchAService Method to search a Service******/
internal bool SearchAService(string service, string user)
{
string actualValue;
string message = "Search A Service";
try
{
//Enter the value in the search bar
SearchBar.Click();
SearchBar.SendKeys(service);
Thread.Sleep(2000);
//Click on the search button
SearchButton.Click();
Global.GlobalDefinitions.driver.Navigate().Refresh();
SearchUser.Clear();
SearchUser.SendKeys(user);
SelectUser.Click();
Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.driver, By.XPath("//*[@id='service-search-section']/div[2]/div/section/div/div[2]/div/div[2]/div/div/div[1]//p"), 10);
Thread.Sleep(2000);
actualValue = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-search-section']/div[2]/div/section/div/div[2]/div/div[2]/div/div/div[1]//p")).Text;
AssertMethod assert = new AssertMethod();
return (assert.Assert_Method(service, actualValue, message));
}
catch (Exception e)
{
Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Service Not found", e.Message);
return false;
}
}
}
}
|
using System;
using TheZhazha.Models;
namespace TheZhazha
{
public static class Zhazha
{
public static string MasterHandle { get; set; }
public static SkypeManager Manager
{
get { return _skypeMgr; }
}
private static SkypeManager _skypeMgr;
public static Random Rnd { get; private set; }
static Zhazha()
{
if (_skypeMgr == null)
_skypeMgr = new SkypeManager();
Rnd = new Random();
}
public static void Start()
{
_skypeMgr.StartListening();
}
public static void Stop()
{
_skypeMgr.StopListening();
}
}
} |
// Copyright 2006 University of Wisconsin-Madison
// Author: Jimm Domingo, FLEL
using Landis.PlugIns;
namespace Landis.Biomass.Succession.AgeOnlyDisturbances
{
/// <summary>
/// A table of pool percentages for age-only disturbances.
/// </summary>
public interface IPercentageTable
{
/// <summary>
/// Gets the pair of percentages for a particular disturbance type.
/// </summary>
PoolPercentages this[PlugInType disturbanceType]
{
get;
}
}
}
|
using GardenControlCore.Models;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace GardenControlServices.Interfaces
{
public interface IAppSettingsService
{
public Task<AppSetting> InsertAppSettingAsync(string key, string value);
public Task<IEnumerable<AppSetting>> GetAllSettingsAsync();
public Task<AppSetting> GetAppSettingByIdAsync(int id);
public Task<AppSetting> GetAppSettingByKeyAsync(string key);
public Task DeleteAppSettingAsync(int id);
public Task<AppSetting> UpdateAppSettingAsync(AppSetting appSetting);
}
}
|
using Microsoft.EntityFrameworkCore;
using TwojePrzedszkole.API.Models;
namespace TwojePrzedszkole.API.Data
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
public DbSet<Value> Values { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserGroup> UserGroups { get; set; }
public DbSet<Child> Childs { get; set; }
public DbSet<ChildGroup> ChildGroups { get; set; }
public DbSet<ChildGroupCategory> ChildGroupCategories { get; set; }
public DbSet<Task> Tasks { get; set; }
public DbSet<TaskCategory> TaskCategories { get; set; }
public DbSet<Photo> Photos { get; set; }
public DbSet<PhotoGallery> PhotoGallerys { get; set; }
}
} |
using Computer_Wifi_Remote.Command;
using NAudio.CoreAudioApi;
namespace Computer_Wifi_Remote_Library.Command
{
public class PreviousTrack : ICommand
{
public string Name => nameof(PreviousTrack);
public bool Execute(Request request)
{
Audio.PreviousTrack();
return true;
}
}
}
|
using aairvid.Utils;
using libairvidproto.types;
using System;
using System.IO;
using System.Linq;
using System.Text;
namespace libairvidproto.model
{
public abstract class FormDataGen : IFormDataGen
{
protected AirVidServer _server;
protected AirVidServer.ServiceType _serviceType;
protected AirVidServer.ActionType _actType;
protected string _itemId;
public FormDataGen(AirVidServer server,
AirVidServer.ServiceType serviceType,
AirVidServer.ActionType actType, string itemId)
{
_server = server;
_serviceType = serviceType;
_actType = actType;
_itemId = itemId;
}
public byte[] GetFormData()
{
using (var stream = new MemoryStream())
{
using (var writer = new BinaryWriter(stream, Encoding.UTF8))
{
var en = new libairvidproto.types.Encoder(writer);
var root = new RootObj(RootObj.EmObjType.ConnectRequest);
root.Add(new StringValue("clientIdentifier", _server._clientId.ToString()));
root.Add(new StringValue("passwordDigest", _server.PasswordDigest));
root.Add(new StringValue("methodName", AirVidServer.ActionTypeDesc[_actType]));
root.Add(new StringValue("requestURL", _server._endpoint));
var paramList = GetParamList();
root.Add(new EncodableValue("parameters", paramList));
root.Add(new IntValue("clientVersion", 240));
root.Add(new StringValue("serviceName", AirVidServer.ServiceTypeDesc[_serviceType]));
root.Encode(en);
return stream.ToArray();
}
}
}
protected abstract EncodableList GetParamList();
}
public class FormDataGenForNestItem : FormDataGen
{
public FormDataGenForNestItem(AirVidServer server,
AirVidServer.ServiceType serviceType,
AirVidServer.ActionType actType, string itemId)
:base(server, serviceType, actType, itemId)
{
}
protected override EncodableList GetParamList()
{
var paramList = new EncodableList();
var reqMediaInfo = new StringValue(null, _itemId);
paramList.Add(reqMediaInfo);
return paramList;
}
}
public class FormDataGenForPlayback : FormDataGenForNestItem
{
public FormDataGenForPlayback(AirVidServer server,
AirVidServer.ServiceType serviceType,
AirVidServer.ActionType actType, string itemId)
: base(server, serviceType, actType, itemId)
{
}
}
public class FormDataGenForPlaybackWithConv : FormDataGen
{
SubtitleStream _sub;
MediaInfo _mediaInfo;
ICodecProfile _codecProfile;
AudioStream _audio;
public FormDataGenForPlaybackWithConv(AirVidServer server,
AirVidServer.ServiceType serviceType,
AirVidServer.ActionType actType,
string itemId, MediaInfo mediaInfo, SubtitleStream sub,
AudioStream audio,
ICodecProfile codecProfile)
: base(server, serviceType, actType, itemId)
{
_sub = sub;
_mediaInfo = mediaInfo;
_codecProfile = codecProfile;
_audio = audio;
}
protected override EncodableList GetParamList()
{
var paramList = new EncodableList();
var convReq = new RootObj(RootObj.EmObjType.ConversionRequest);
convReq.Add(new StringValue("itemId", _itemId));
var audioIndex = _audio == null? 1 : _audio.index;
convReq.Add(new IntValue("audioStream", audioIndex));
convReq.Add(new BitratesValue("allowedBitratesLocal", _codecProfile.Bitrate.ToString()));
convReq.Add(new BitratesValue("allowedBitratesRemote", _codecProfile.Bitrate.ToString()));
convReq.Add(new DoubleValue("audioBoost", 0));
convReq.Add(new IntValue("cropRight", 0));
convReq.Add(new IntValue("cropLeft", 0));
var vidStream = _mediaInfo.VideoStreams.First();
var proposalWidth = Math.Min(_codecProfile.Width, vidStream.Width);
var ratio = (float)vidStream.Width / (float)vidStream.Height;
var proposalHeight = Math.Min(_codecProfile.Height, vidStream.Height);
var width = proposalWidth;
var height = proposalHeight;
var desiredWidth = (int)(proposalHeight * ratio);
if (desiredWidth > proposalWidth)
{
height = (int)((float)proposalWidth / ratio);
}
else
{
width = desiredWidth;
}
System.Diagnostics.Debug.WriteLine("{0} * {1}", width, height);
convReq.Add(new IntValue("resolutionWidth", width));
convReq.Add(new IntValue("videoStream", 0));
convReq.Add(new IntValue("cropBottom", 0));
convReq.Add(new IntValue("cropTop", 0));
convReq.Add(new DoubleValue("quality", 0.7));
if (_sub == null)
{
convReq.Add(new StringValue("subtitleInfo", null));
}
else
{
convReq.Add(new EncodableValue("subtitleInfo", _sub.SubtitleInfoFromServer));
}
convReq.Add(new DoubleValue("offset", 0.0));
convReq.Add(new IntValue("resolutionHeight", height));
DeviceInfoValue devInfo = new DeviceInfoValue("metaData");
devInfo.Add(new StringValue(null, "device"));
devInfo.Add(new StringValue(null, "iPad"));
devInfo.Add(new StringValue(null, "clientVersion"));
devInfo.Add(new StringValue(null, "2.4.13"));
devInfo.Add(new StringValue(null, "h264Passthrough"));
var passthrough = "1";
if (_sub != null)
{
passthrough = "0";
}
else
{
passthrough = _codecProfile.H264Passthrough ? "1" : "0";
}
devInfo.Add(new StringValue(null, passthrough));
convReq.Add(devInfo);
paramList.Add(convReq);
return paramList;
}
}
public class FormDataGenForGetResources : FormDataGen
{
public FormDataGenForGetResources(AirVidServer server,
AirVidServer.ServiceType serviceType,
AirVidServer.ActionType actType, string itemId)
: base(server, serviceType, actType, itemId)
{
}
protected override EncodableList GetParamList()
{
var paramList = new EncodableList();
var browserReq = new RootObj(RootObj.EmObjType.BrowserRequest);
browserReq.Add(new StringValue("folderId", _itemId));
browserReq.Add(new IntValue("preloadDetails", 1));
browserReq.Add(new IntValue("sortField", 0));
browserReq.Add(new IntValue("sortDirection", 0));
paramList.Add(browserReq);
return paramList;
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace dat2csv
{
class DatFileHead
{
public int Version { get; set; }
public int DDOffset { get; set; }
public int DDLength { get; set; }
public int IndexOffset { get; set; }
public int IndexLength { get; set; }
public int DataOffset { get; set; }
public int DataLength { get; set; }
}
}
|
using RSAEncryptionLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ISE.SM.Utility
{
public class TokenSignFactory
{
static RSAEncryptionCreator encryption = new RSAEncryptionCreator();
public static string SignToken(string token){
string signedToken = string.Empty;
string hashData = HashFactory.GetHash(token);
signedToken = encryption.PrivateEncryption(hashData);
return signedToken;
}
public static string GetHashData(string signedData)
{
string plainData = encryption.PublicDecryption(signedData);
return plainData;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Wba.StovePalace.Data;
using Wba.StovePalace.Helpers;
using Wba.StovePalace.Models;
namespace Wba.StovePalace.Pages.Baskets
{
public class IndexModel : PageModel
{
private readonly Wba.StovePalace.Data.StoveContext _context;
public IndexModel(Wba.StovePalace.Data.StoveContext context)
{
_context = context;
}
public IList<Basket> Baskets { get;set; }
public Availability Availability { get; set; }
public ActionResult OnGet()
{
int userId;
Availability = new Availability(_context, HttpContext);
if (string.IsNullOrEmpty(Availability.UserId))
{
return RedirectToPage("../Users/Login");
}
else
{
userId = int.Parse(Availability.UserId);
}
IQueryable<Basket> query = _context.Basket
.Include(b => b.Stove)
.Include(b => b.Stove.Brand)
.Include(f => f.Stove.Fuel)
.Include(b => b.User);
query = query.Where(b => b.UserId.Equals(userId));
Baskets = query.ToList();
if(Baskets == null)
{
return NotFound();
}
return Page();
}
public ActionResult OnPost(string basketId, string newAmount, int? delete)
{
int userId;
Availability = new Availability(_context, HttpContext);
if (string.IsNullOrEmpty(Availability.UserId))
{
return RedirectToPage("../Users/Login");
}
else
{
userId = int.Parse(Availability.UserId);
}
if(delete != null)
{
newAmount = "0";
}
if (newAmount != null && basketId != null)
{
int amount=0;
int id = 0;
try
{
amount = int.Parse(newAmount);
id = int.Parse(basketId);
}
catch
{
return Page();
}
if (amount == 0)
{
Basket basket = GetBasket(id);
if (basket != null)
{
_context.Basket.Remove(basket);
_context.SaveChanges();
}
}
else
{
Basket basket = GetBasket(id);
basket.Count = amount;
_context.Attach(basket).State = EntityState.Modified;
try
{
_context.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!BasketExists(basket.Id))
{
return NotFound();
}
else
{
throw;
}
}
}
}
IQueryable<Basket> query = _context.Basket
.Include(b => b.Stove)
.Include(b => b.Stove.Brand)
.Include(f => f.Stove.Fuel)
.Include(b => b.User);
query = query.Where(b => b.UserId.Equals(userId));
Baskets = query.ToList();
if (Baskets == null)
{
return NotFound();
}
return Page();
}
private bool BasketExists(int id)
{
return _context.Basket.Any(e => e.Id == id);
}
private Basket GetBasket(int id)
{
Basket basket = _context.Basket.FirstOrDefault(b=>b.Id == id);
return basket;
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Drill : MonoBehaviour
{
public Camera mainC;
Vector3 next_destination;
Vector3 vertical;
Vector3 horizontal;
public float speed=1f;
float drill_level;
public float dig_level;
public string log;
public string dig;
public int ClickCounter;
GameObject logUI;
public GameObject inputText;
// Start is called before the first frame update
void Start()
{
if(this.transform.parent.gameObject.name=="Ship1"){
ClickCounter=1;
}
else{
ClickCounter=0;
}
inputText=this.transform.parent.GetChild(0).GetChild(1).gameObject;
logUI=this.transform.parent.GetChild(0).GetChild(0).gameObject;
//next_destination=transform.position;
drill_level=transform.position.y;
dig_level=drill_level;
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0)){
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray,out hit,500)){
ClickCounter++;
if(ClickCounter%2==0){
// inputText. .ActivateInputField();
}
if(ClickCounter%2==1){
//inputText.DeactivateInputField();
}
}
}
if(Vector3.Distance(transform.position,next_destination)<1f){
log=transform.position.ToString()+": "+dig+'\n';
logUI.GetComponent<UnityEngine.UI.Text>().text=log;
}
Dig(dig_level);
}
public void Dig(float DigLevel){
if(transform.position.y<dig_level)
{
transform.position += new Vector3(0.0f, speed * Time.deltaTime,0.0f);
}
}
void Retrieve(){
}
void OnTriggerStay(Collider other) {
dig=other.gameObject.GetComponent<UnityEngine.UI.Text>().text;
}
}
|
namespace Merchello.UkFest.Web.Resolvers
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Routing;
/// <summary>
/// A base class for content resolvers.
/// </summary>
internal abstract class ContentResolverBase
{
/// <summary>
/// The content reference hash.
/// </summary>
private static readonly ConcurrentDictionary<int, int> ContentHash = new ConcurrentDictionary<int, int>();
/// <summary>
/// Gets the <see cref="UmbracoContext"/>.
/// </summary>
protected static UmbracoContext UmbracoContext
{
get
{
if (UmbracoContext.Current == null)
{
var nullReference = new NullReferenceException("UmbracoContext was null");
LogHelper.Error<ContentResolverBase>("The ContentResolver requires a current UmbracoContext", nullReference);
throw nullReference;
}
return UmbracoContext.Current;
}
}
/// <summary>
/// Removes hash references to ids.
/// </summary>
/// <param name="ids">
/// The ids.
/// </param>
internal void RemoveByIds(IEnumerable<int> ids)
{
ids.ForEach(this.RemoveById);
}
/// <summary>
/// The remove reference.
/// </summary>
/// <param name="id">
/// The content id.
/// </param>
internal void RemoveById(int id)
{
//// Remove all references to the id
foreach (var key in ContentHash.Where(x => x.Value == id).Select(x => x.Key))
{
int value;
ContentHash.TryRemove(key, out value);
}
}
/// <summary>
/// Attempts to get a unique page from contextual cache based on a alias reference hash.
/// </summary>
/// <param name="alias">
/// The alias.
/// </param>
/// <param name="getter">
/// A function to retrieve the content if the reference is not found.
/// </param>
/// <returns>
/// The <see cref="IPublishedContent"/>.
/// </returns>
internal IPublishedContent GetByAlias(string alias, Func<IPublishedContent> getter)
{
var hashCode = GetAliasBaseHashCode(alias);
if (ContentHash.ContainsKey(hashCode)) return GetFromContextualCache(ContentHash[hashCode]);
var content = getter.Invoke();
if (content == null)
{
LogAndThrow(string.Format("No IPublishedContent found for GetByAlias getter Func with alias {0}", alias), string.Format("Could not find {0} aliased content node", alias));
}
StashAsAliased(alias, content);
return content;
}
/// <summary>
/// Attempts to get a unique page from contextual cache based on a unique content type reference hash.
/// </summary>
/// <param name="contentTypeAlias">
/// The content type alias.
/// </param>
/// <param name="getter">
/// The getter.
/// </param>
/// <returns>
/// The <see cref="IPublishedContent"/>.
/// </returns>
protected static IPublishedContent TryGetUniquePageContent(string contentTypeAlias, Func<IPublishedContent> getter)
{
var hashCode = GetUniquePageHashCode(contentTypeAlias);
if (ContentHash.ContainsKey(hashCode)) return GetFromContextualCache(ContentHash[hashCode]);
var content = getter.Invoke();
if (content == null)
{
LogAndThrow(string.Format("No IPublishedContent found for {0}", contentTypeAlias), string.Format("Could not find {0} content node", contentTypeAlias));
}
StashAsUnique(content);
return content;
}
/// <summary>
/// Attempts to get content from contextual cache based on a URL based reference hash.
/// </summary>
/// <param name="url">
/// The url.
/// </param>
/// <param name="getter">
/// The getter.
/// </param>
/// <returns>
/// The <see cref="IPublishedContent"/>.
/// </returns>
protected static IPublishedContent TryGetUrlBasedContent(string url, Func<IPublishedContent> getter)
{
var hashCode = GetUrlBasedHashCode(url);
if (ContentHash.ContainsKey(hashCode)) return GetFromContextualCache(ContentHash[hashCode]);
var content = getter.Invoke();
// Cannot throw here as other content finders may find the content.
if (content == null) return null;
StashAsUrlBased(content);
return content;
}
/// <summary>
/// Gets the <see cref="IPublishedContent"/> from contextual cache or null.
/// </summary>
/// <param name="id">
/// The id.
/// </param>
/// <returns>
/// The <see cref="IPublishedContent"/>.
/// </returns>
/// <remarks>
/// This will throw a logged exception if the UmbracoContext is null.
/// </remarks>
protected static IPublishedContent GetFromContextualCache(int? id)
{
return id != null ? UmbracoContext.ContentCache.GetById(id.Value) : null;
}
/// <summary>
/// Gets a hash code for a unique type of content. e.g. Website, Checkout, Cart
/// </summary>
/// <param name="contentTypeAlias">
/// The content type alias.
/// </param>
/// <returns>
/// The hash code.
/// </returns>
protected static int GetUniquePageHashCode(string contentTypeAlias)
{
return contentTypeAlias.GetHashCode();
}
/// <summary>
/// Gets an alias based HashCode.
/// </summary>
/// <param name="alias">
/// The alias.
/// </param>
/// <returns>
/// The <see cref="int"/>.
/// </returns>
/// <remarks>
/// Aliases should be unique across all sites
/// </remarks>
protected static int GetAliasBaseHashCode(string alias)
{
return alias.GetHashCode();
}
/// <summary>
/// Gets a hash code for a URL based content lookups. e.g. Used in FRS custom <see cref="IContentFinder"/>s
/// </summary>
/// <param name="url">
/// The url.
/// </param>
/// <returns>
/// The <see cref="int"/>.
/// </returns>
protected static int GetUrlBasedHashCode(string url)
{
return string.Format("slug:{0}", url.EnsureNotStartsOrEndsWith('/')).GetHashCode();
}
/// <summary>
/// Stores a reference to a unique page of content. e.g. Website, Cart, Checkout
/// </summary>
/// <param name="content">
/// The content to be referenced.
/// </param>
private static void StashAsUnique(IPublishedContent content)
{
if (content == null) return;
var hashCode = GetUniquePageHashCode(content.ContentType.Alias);
Stash(hashCode, content.Id);
}
/// <summary>
/// Stores a reference to content that by a UNIQUE alias.
/// </summary>
/// <param name="alias">
/// The alias.
/// </param>
/// <param name="content">
/// The content to be referenced.
/// </param>
private static void StashAsAliased(string alias, IPublishedContent content)
{
if (content == null) return;
var hashCode = GetAliasBaseHashCode(alias);
Stash(hashCode, content.Id);
}
/// <summary>
/// Stores a URL based reference to a page of content.
/// </summary>
/// <param name="content">
/// The content.
/// </param>
private static void StashAsUrlBased(IPublishedContent content)
{
if (content == null) return;
var hashCode = GetUrlBasedHashCode(content.Url);
Stash(hashCode, content.Id);
}
/// <summary>
/// Stashes the reference to the content in the dictionary.
/// </summary>
/// <param name="hashCode">
/// The hash code.
/// </param>
/// <param name="id">
/// The id.
/// </param>
private static void Stash(int hashCode, int id)
{
if (ContentHash.ContainsKey(hashCode))
{
LogHelper.Debug<ContentResolverBase>("Hash code was already found for Unique content type. Overwritting value");
}
ContentHash.AddOrUpdate(hashCode, id, (x, y) => id);
}
/// <summary>
/// Logs an exception to the log file and throws a null reference exception.
/// </summary>
/// <param name="nullRefMessage">
/// The message for the null reference exception.
/// </param>
/// <param name="loggerMessage">
/// The message for the <see cref="LogHelper"/>.
/// </param>
/// <exception cref="NullReferenceException">
/// Throws the null reference exception
/// </exception>
private static void LogAndThrow(string nullRefMessage, string loggerMessage)
{
var nullReference = new NullReferenceException(nullRefMessage);
LogHelper.Error<ContentResolverBase>(loggerMessage, nullReference);
throw nullReference;
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.