public static List <TransformSequenceAlignment> GetRepeatFilteredTransformAlignments( IChain chain1, bool fuseEndsOnly1, IChain chain2, bool fuseEndsOnly2, SS allowedTypes, int minAlignmentLength = DefaultMinAlignmentLength, float maxRmsd = DefaultRmsdThreshold) { List <TransformSequenceAlignment> alignments = GetTransformAlignments(chain1, chain2, allowedTypes, minAlignmentLength, maxRmsd); if (fuseEndsOnly1) { int repeatLength1; if (Sequence.TryGetInternalRepeatLength(chain1, out repeatLength1) && repeatLength1 > 15) { alignments.RemoveAll(a => (a.Range1.Start > 1.15 * repeatLength1) && (a.Range1.End < chain1.Count - 1.15 * repeatLength1)); } } if (fuseEndsOnly2) { int repeatLength2; if (Sequence.TryGetInternalRepeatLength(chain2, out repeatLength2) && repeatLength2 > 15) { alignments.RemoveAll(a => (a.Range2.Start > 1.15 * repeatLength2) && (a.Range2.End < chain1.Count - 1.15 * repeatLength2)); } } return(alignments); }
} // Cancel() /// <summary> /// /// </summary> /// <param name="key"></param> protected override void ReactionKeyDo(Keys key) { if (key == Keys.Escape || key == Keys.D0) { Cancel(); } else if (key == Keys.Enter || Helper.IsGreenKey(key)) { SS.OnReport(new ReportEventArgs("Обновляю...")); Init(); return; } else if (key == Keys.D1) { if ((int)TaskList.Rows[0]["allowed"] == 1) { JumpTo(new RefillSet(SS, this)); } } else if (key == Keys.D2) { if ((int)TaskList.Rows[1]["allowed"] == 1) { JumpTo(new RefillLayout(SS, this)); } } } // ReactionKeyDo
public override void Visit(KdNode<HotPixel> node) { var hp = node.Data; /* * If the hot pixel is not a node, and it contains one of the segment vertices, * then that vertex is the source for the hot pixel. * To avoid over-noding a node is not added at this point. * The hot pixel may be subsequently marked as a node, * in which case the intersection will be added during the final vertex noding phase. */ if (!hp.IsNode) { if (hp.Intersects(P0) || hp.Intersects(P1)) return; } /* * Add a node if the segment intersects the pixel. * Mark the HotPixel as a node (since it may not have been one before). * This ensures the vertex for it is added as a node during the final vertex noding phase. */ if (hp.Intersects(P0, P1)) { //System.out.println("Added intersection: " + hp.getCoordinate()); SS.AddIntersection(hp.Coordinate, SegIndex); hp.IsNode = true; } }
} // Init internal override ABaseMode Cancel() { string TextQuery; if (Task.TypeMove == 1) { //Это отмена задания на спуск - удаляем физически, т.к. при запросе задания запись создастся вновь TextQuery = "delete from $Спр.ПеремещенияПаллет where id = :id"; } else if (Task.TypeMove == 2 || Task.TypeMove == 3 || Task.TypeMove == 4 || Task.TypeMove == 5) { //А это отмена задания подъема или спуска с антресоли. Т.к. при выдаче задания ничего не создается, // а просто заполняется данными, то и при отмене нужно просто очистить все TextQuery = "update $Спр.ПеремещенияПаллет set " + "$Спр.ПеремещенияПаллет.Сотрудник1 = :EmptyID, " + "$Спр.ПеремещенияПаллет.ФлагОперации = 0, " + "$Спр.ПеремещенияПаллет.Дата10 = :EmptyDate, " + "$Спр.ПеремещенияПаллет.Время10 = 0 " + "where id = :id"; } else { return(Negative("Нельзя отменить данный тип задания")); } SQL1S.QuerySetParam(ref TextQuery, "id", Task.ID); SS.ExecuteWithoutReadNew(TextQuery); return(base.Cancel()); } // Cancel
} // ChoiseWorkSample (constructor) protected override void ReactionKeyDo(Keys key) { Mode DesireMode; if (key == Keys.D0 || key == Keys.Escape) { Cancel(); return; } else if (key == Keys.D1 && Employer.CanGiveSample) { DesireMode = Mode.SampleSet; // режим отбора образцов } else if (key == Keys.D2 && Employer.CanLayOutSample) { DesireMode = Mode.SamplePut; // режим выкладки образцов } else { return; } SS.OnReport(new ReportEventArgs("Задача выбрана...")); if (!SS.ChoiseWork(DesireMode)) { Negative(SS.ExcStr); return; } Positive(); } // ReactionKeyDo()
} // ReactionKeyDo //------------------------------ /// <summary> /// /// </summary> /// <returns></returns> protected bool FindDocAP(bool IsSet) { string TextQuery = "select top 1 " + (IsSet ? "substring(DocAP.$АдресПеремещение.ДокументОснование , 5, 9)" : " DocAP.iddoc") + " as iddoc " + "from _1sjourn as journ (nolock) " + "inner join DH$АдресПеремещение as DocAP (nolock) " + "on DocAP.iddoc = journ.iddoc " + "left join DT$АдресПеремещение as DocAPTab (nolock) " + "on DocAP.iddoc = DocAPTab.iddoc " + "where " + "journ.date_time_iddoc < '19800101Z' " + "and journ.ismark = 0 " + "and journ.$Автор = :employer " + "and DocAP.$АдресПеремещение.ТипДокумента = 13 " + "and DocAP.$АдресПеремещение.Склад = :warehouse " + //От параметра IsSet зависит что мы ищем набор или выкладку "and DocAPTab.iddoc " + (IsSet ? "is null" : "is not null"); SQL1S.QuerySetParam(ref TextQuery, "employer", Employer.ID); SQL1S.QuerySetParam(ref TextQuery, "warehouse", Employer.Warehouse.ID); DataTable DT; SS.ExecuteWithReadNew(TextQuery, out DT); if (DT.Rows.Count == 0) { return(false); } DocAP = Doc.GiveDocById(DT.Rows[0]["iddoc"].ToString(), SS); return(DocAP.Selected); } // FindDocAP
public static List <SSBlock> GetPhiPsiSSBlocksOfType(IChain peptide, SS allowedTypes, int minStructureLength = 1) { List <SSBlock> list = GetPhiPsiSSBlocks(peptide, minStructureLength); List <SSBlock> matchingTypeList = list.Where(block => (block.SS & allowedTypes) != 0).ToList(); return(matchingTypeList); }
static void Main(string[] args) { float S; // somme initiale placée sur un compte float I; // intérêt offert par la banque int N; // nombre d'années de placement de somme S double SS; // somme simple double SC; // somme composée Console.WriteLine("Quelle somme est placée sur le compte ?"); S = float.Parse(Console.ReadLine()); Console.WriteLine("Indiquez l'intérêt offert par la banque "); I = float.Parse(Console.ReadLine()) / 100; Console.WriteLine("Nombre d'année de placement "); N = int.Parse(Console.ReadLine()); SS = S * (1 + N * I); SC = S * Math.Pow((1 + I), N); Console.WriteLine("La valeur acquise avec un intérêt simple est de : " + SS.ToString("##,###.00")); Console.WriteLine("La valeur acquise avec un intérêt composée est de : {0:##,###.00}", SC); Console.ReadKey(); }
} // Init() protected override void ReactionKeyDo(Keys key) { Mode DesireMode; if (key == Keys.Escape || key == Keys.D0) { Cancel(); return; } else if (key == Keys.D1 && Employer.CanAcceptance) { DesireMode = Mode.Acceptance; } else if (key == Keys.D2 && Employer.CanAcceptance) { DesireMode = Mode.AcceptanceCross; } else { return; } SS.OnReport(new ReportEventArgs("Задача выбрана...")); if (!SS.ChoiseWork(DesireMode)) { Negative(SS.ExcStr); return; } Positive(); } // ReactionKey
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void ReactionSCItemDo(ReactionSCEventArgs e) { if (CurrentAction != ActionSet.ScanItem) { Negative("Неверно! " + SS.WhatUNeed(CurrentAction)); return; } RefItem item = e.Ref as RefItem; DataRow[] DR = RemainItems.Select("item = '" + item.ID + "'"); if (DR.Length == 0) { Negative("Товар " + item.InvCode + " не найден. Возможно уже выложили?"); return; } //Всасываем все говно в наши объекты Adress0.FoundID(DR[0]["Adress0"].ToString()); Amount = (int)(decimal)DR[0]["Amount"]; Item = item; lineno_ = (short)DR[0]["lineno_"]; CurrentAction = ActionSet.ScanAdress; Positive(SS.WhatUNeed(CurrentAction)); } // ReactionSCItemDo
private async void MakeSound(Button KEY, int AMP, int FREQ, int REL, int DEC, int VOL, int ATK) { bool check = false; if (KEY.Text.EndsWith("#")) { KEY.BackColor = Color.Gray; } else { KEY.BackColor = Color.LightGray; } foreach (Sound SS in SList) { if (SS.KEYY == KEY) { check = true; SS.FREQQ = FREQ; SS.PLAYS(REL, ATK, (float)AMP, DEC, (float)VOL); } } if (check == false) { Sound S = new Sound(KEY, (float)AMP, (float)FREQ, REL, (float)VOL); SList.Add(S); S.PLAYS(REL, ATK, (float)AMP, DEC, (float)VOL); } await Task.Delay(3); }
/// <summary> /// Takes a playlist and scales it by the given width and height. /// </summary> public override void Run( ) { string bdir = "maps/scaled/" + Height + "x" + Width + "/"; Directory.CreateDirectory(bdir); StreamReader pl = new StreamReader(new FileStream( Playlist, FileMode.Open, FileAccess.Read)); string pll; while ((pll = pl.ReadLine( )) != null) { var ppls = pll.Split( ); StreamReader I = new StreamReader( new FileStream(ppls[0], FileMode.Open, FileAccess.Read)); GenericGridWorldStaticState SS; GenericGridWorldDynamicState DS; Loader.Load(I, out SS, out DS); SS.InitialDynamicState = DS; SS.Scale(Width, Height); int l = ppls[0].LastIndexOf("/"); string d = ppls[0].Substring(0, l); Directory.CreateDirectory(bdir + d); StreamWriter O = new StreamWriter( new FileStream(bdir + ppls[0], FileMode.Create, FileAccess.Write)); O.Write(GridWorldFormat.ToFileString(SS, DS)); O.Close( ); I.Close( ); } pl.Close( ); }
private static void ConnectionMade(SS ss, object payload) { SSListener server = (SSListener)payload; server.BeginAcceptSS(ConnectionMade, server); new SocketComm(ss); }
}//free video private void Video_Timer_Tick(object sender, EventArgs e) { string HH, MM, SS; if (Video_Timer_Enable) { VideoPosition = (int)vid.CurrentPosition; trackBar.Value = 10 * VideoPosition; hour = VideoPosition / 3600; minute = (VideoPosition - hour * 3600) / 60; second = (VideoPosition - hour * 3600 - minute * 60); HH = ("00" + hour.ToString()); HH = HH.Substring(HH.Length - 2, 2); MM = ("00" + minute.ToString()); MM = MM.Substring(MM.Length - 2, 2); SS = ("00" + second.ToString()); SS = SS.Substring(SS.Length - 2, 2); curTime.Text = HH + ":" + MM + ":" + SS; if (curTime.Text == Video_Time) { audio_stop_Click(null, null); } } }
private static void ConnectionMade(SS ss, object payload) { SSListener server = (SSListener)payload; server.BeginAcceptSS(ConnectionMade, server); new RequestHandler(ss); }
private ABaseMode Refresh() { if (ControlCC == null) { return(Positive()); } GoodsCC.Clear(); IndexTableItem = 0; String TextQuery = "SELECT " + "DocCC.LineNo_ as Number, " + "Goods.$Спр.Товары.Артикул as Artikul, " + "Goods.Descr as NameItem, " + "Goods.ID as ID, " + "DocCC.$КонтрольНабора.Количество as Count " + "FROM DT$КонтрольНабора as DocCC (nolock) " + "JOIN $Спр.Товары as Goods (nolock) " + "ON Goods.Id = DocCC.$КонтрольНабора.Товар " + "WHERE " + "DocCC.iddoc = :iddoc"; SQL1S.QuerySetParam(ref TextQuery, "iddoc", ControlCC); if (!SS.ExecuteWithRead(TextQuery, out GoodsCC)) { return(Negative()); } if (GoodsCC.Rows.Count == 0) { return(Negative("В сборочном нет товара!")); } return(Positive()); } // Refresh
public static void Main() { SimpleStruct ss = new SimpleStruct(); ss.X = 5; ss.DisplayX(); SS si = (SS)ss; si.X = 90; si.DisplayX(); ss = (SimpleStruct)si; ss.X = 5; ss.DisplayX(); SimpleClass ss1 = new SimpleClass(); ss1.X = 5; ss1.DisplayX(); try { ss1 = (SimpleClass)si; ss1.X = 5; ss1.DisplayX(); } catch (Exception) { Console.WriteLine("Failed to cast"); } }
public void MakeFP() { int i, j, v; logH = (int)Math.Log(n, 2) + 1; fp = SS.Init(n, logH + 1, false, 0); for (i = 0; i < n; i++) { v = ordem[i]; fp[v][0] = pai[v]; for (j = 1; j <= logH; j++) { fp[v][j] = -1; if (fp[v][j - 1] != -1) { fp[v][j] = fp[fp[v][j - 1]][j - 1]; } } } }
} // RefItem (constructor) public bool FoundBarcode(string Barcode) { string TextQuery = "select top 1 PARENTEXT as ID from $Спр.ЕдиницыШК (nolock) where $Спр.ЕдиницыШК.Штрихкод = :barcode"; SQL1S.QuerySetParam(ref TextQuery, "barcode", Barcode); DataTable DT; if (!SS.ExecuteWithRead(TextQuery, out DT)) { return(false); } if (DT.Rows.Count == 0) { return(false); } FID = DT.Rows[0]["ID"].ToString(); FName = null; Refresh(); if (FName != null) { return(true); } else { return(false); } } // FoundBarcode
} // ReactionKeyDo /// <summary> /// /// </summary> /// <param name="e"></param> protected override void ReactionSCSectionDo(RefSection e) { //Проверки зон!!! if (!e.AdressZone.Selected) { Negative("Нельзя! Адбрес без зоны!"); return; } DataTable DT; string TextQuery = "SELECT VALUE as val FROM _1sconst (nolock) WHERE ID = $Константа.ЗонаВременногоТовара "; if (!SS.ExecuteWithRead(TextQuery, out DT)) { return; } string IDTempZone = DT.Rows[0]["val"].ToString(); //Проверка if (e.AdressZone.ID.ToString() != IDTempZone) { //НЕ та зона Negative("Нельзя! Адрес другой зоны!"); } Adress = e; Positive("Адрес принят! Продолжайте ..."); } // ReactionSCSectionDo
} // ReactionKeyDo /// <summary> /// /// </summary> /// <param name="e"></param> protected override void ReactionSCDo(ReactionSCEventArgs e) { if (CurrentAction == ActionSet.ScanAdress) { if (e.Ref.GetType() != new RefSection(SS).GetType()) { Negative("Неверно! " + SS.WhatUNeed(CurrentAction)); return; } RefSection Section = e.Ref as RefSection; AdressUnLoad.FoundID(Section.ID); string TextQuery = "UPDATE $Спр.МестаПогрузки " + "SET " + "$Спр.МестаПогрузки.Адрес9 = :AdressID ," + "$Спр.МестаПогрузки.Сотрудник8 = :EmployerID ," + "$Спр.МестаПогрузки.Дата9 = :Date ," + "$Спр.МестаПогрузки.Время9 = :Time " + "WHERE "; if (DocUnload.Selected) { TextQuery += " $Спр.МестаПогрузки .КонтрольНабора = :DocUnload "; SQL1S.QuerySetParam(ref TextQuery, "DocUnload", DocUnload.ID); } else { TextQuery += " $Спр.МестаПогрузки .ID = :ID "; SQL1S.QuerySetParam(ref TextQuery, "ID", BoxUnLoad.ID); } SQL1S.QuerySetParam(ref TextQuery, "AdressID", AdressUnLoad.ID); SQL1S.QuerySetParam(ref TextQuery, "EmployerID", Employer.ID); SQL1S.QuerySetParam(ref TextQuery, "Date", DateTime.Now); SQL1S.QuerySetParam(ref TextQuery, "Time", APIManager.NowSecond()); if (!SS.ExecuteWithoutRead(TextQuery)) { Negative("Не удалось зафиксировать! " + SS.WhatUNeed(CurrentAction)); return; } CurrentAction = ActionSet.ScanBox; Refresh(); return; } else if (CurrentAction != ActionSet.ScanBox) { Negative("Неверно! " + SS.WhatUNeed(CurrentAction)); return; } if (e.Ref.GetType() != new RefBox(SS).GetType()) { Negative("Неверно! " + SS.WhatUNeed(CurrentAction)); return; } RefBox Box = e.Ref as RefBox; BoxUnLoad.FoundID(Box.ID); DocUnload = new Doc(SS); CurrentAction = ActionSet.ScanAdress; AdressUnLoad = new RefSection(SS); Refresh(); }
public override void OnAuthorization(AuthorizationContext filterContext) { //base.OnAuthorization(filterContext); try { if (isCheckLogin) { //获取用户 string user = SS.GetUser(filterContext.HttpContext); //用户登录信息不匹配 if (string.IsNullOrEmpty(user)) { filterContext.Result = myGetResult("请重新登陆", isPage); } else { // 校验 用户 ,页面权限 if (!string.IsNullOrEmpty(pageName) || !string.IsNullOrEmpty(limitName)) { /*将用户拥有的该页面的权限存在session,用于页面权限控制*/ /* 校验用户权限,并返回用户拥有该页面的权限 */ //校验通过,则不进行操作,会进入到控制器的Action函数内 } // 刷新用户session时间 } } } catch { filterContext.Result = myGetResult("Error!", isPage); } }
private void YEHEY_Click(object sender, EventArgs e) { Date.Text = DateTime.Now.ToString(); NameOutput.Text = NameInput.Text; SS.Show(); YEHEY.Hide(); }
} // RefillSet (constructor) /// <summary> /// /// </summary> /// <returns></returns> internal override ABaseMode Init() { if (!DocAP.Selected) { //Такой вот костыль, не знаю как обыграть пока ABaseMode tmp = GoTransportTask(); if (Result == MMResult.Positive) { FExcStr = tmp.ExcStr; return(tmp); } SS.OnReport(new ReportEventArgs("Запрашиваю задание у 1С...")); //Нет заданий кидаем для одинесины хуйню Dictionary <string, object> DataMapWrite = new Dictionary <string, object>(); DataMapWrite["Спр.СинхронизацияДанных.ДатаСпрВход1"] = SS.ExtendID(Employer.ID, "Спр.Сотрудники"); string resultMessage; if (!SS.ExecCommandOnlyResultNew("RefillSetAddItem1", DataMapWrite, out resultMessage)) { return(Negative(resultMessage)); } //Попытка перейти опять сюда (в набор) if (!FindDocAP(true)) { return(Negative("Не удалось получить задание через 1С робота!")); } } // !FindDocAP() return(Refresh()); } // Init
static void newattrtest() { SS[] test = { null }; SS a = null; Console.Write(test?[0]?.Name); }
public void run(int port) { Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); String line = ""; ManualResetEvent mre = new ManualResetEvent(false); StringSocket sender = null; SS receiver = null; try { sender = new StringSocket(s1, new UTF8Encoding()); receiver = new SS(s2, new UTF8Encoding()); StringBuilder text = new StringBuilder(); for (int i = 0; i < 100000; i++) { text.Append(i); } String str = text.ToString(); text.Append('\n'); sender.BeginSend(text.ToString(), (e, p) => { }, null); receiver.BeginReceive((s, e, p) => { line = s; mre.Set(); }, null); mre.WaitOne(); Assert.AreEqual(str, line); } finally { CloseSockets(server, sender, receiver); } }
static int Main(string[] args) { ShellSocket SS; #if !(NETSTANDARD2_0 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2) if (IsOSPlatform(OSPlatform.Linux) || IsOSPlatform(OSPlatform.FreeBSD) || IsOSPlatform(OSPlatform.OSX)) #else if (IsOSPlatform(OSPlatform.Linux) || IsOSPlatform(OSPlatform.OSX)) #endif { SS = new ShellSocket("bash -c \"yes hi 1>&2\"", "hi"); } else { SS = new ShellSocket("cmd", " /c \"echo hi 1>&2\""); } System.Console.WriteLine("Starting..."); SS.RedirectErrorsToConsole = true; SS.Start(); Stream S = SS.GetStream(); System.Console.WriteLine("ShellSocket created..."); pair P = new pair(new StreamReader(Console.OpenStandardInput()), new StreamWriter(Console.OpenStandardOutput())); System.Console.WriteLine("Pair created..."); System.Console.WriteLine("{0}", new StreamWriter(Console.OpenStandardOutput())); System.Console.WriteLine("Binding..."); System.Console.WriteLine("P:{0} S:{1}", P, S); Rishi.PairStream.pair.BindStreams(P, S); return(0); }
} // ReactionDocDo internal override ABaseMode Init() { if (!SQL1S.IsVoidDate((DateTime)DocCC.GetAttributeHeader("Дата3"))) { return(Negative("Сборочный уже скомплектован!")); } if (SQL1S.IsVoidDate((DateTime)DocCC.GetAttributeHeader("Дата2"))) { return(Negative("Сборочный не собран!")); } if (!SS.LockDoc(DocCC.ID)) { return(Negative(SS.ExcStr)); } if (SQL1S.IsVoidDate((DateTime)DocCC.GetAttributeHeader("Дата4")) && TransferWindow.Selected) { //Если предкомплектация еще не задана, а окно выдачи уже задано, то делаем предкомплектацию DocCC.SetAttributeHeader("Дата4", DateTime.Now); DocCC.SetAttributeHeader("Время4", APIManager.NowSecond()); DocCC.SetAttributeHeader("Комплектовщик2", Employer.ID); DocCC.Save(); //Если окно задано - то даем команду выводить на табло SendToTablo(1); } return(Positive()); } // ReactionSCEmployersDo
public void run(int port) { Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); String line = ""; ManualResetEvent mre = new ManualResetEvent(false); SS sender = null; StringSocket receiver = null; try { sender = new SS(s1, new UTF8Encoding()); receiver = new StringSocket(s2, new UTF8Encoding()); sender.BeginSend("Hello\n", (e, p) => { }, null); receiver.BeginReceive((s, e, p) => { line = s; mre.Set(); }, null); mre.WaitOne(); Assert.AreEqual("Hello", line); } finally { CloseSockets(server, receiver, sender); } }
public void run(int port) { int LIMIT = 1000; int count = LIMIT; Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); List <int> lines = new List <int>(); for (int i = 0; i < LIMIT; i++) { lines.Add(-1); } StringSocket sender = null; SS receiver = null; try { sender = new StringSocket(s1, new UTF8Encoding()); receiver = new SS(s2, new UTF8Encoding()); for (int i = 0; i < LIMIT / 4; i++) { int j = i; receiver.BeginReceive((s, e, p) => { lock (lines) { lines[j] = Int32.Parse(s); } Interlocked.Decrement(ref count); }, null); } for (int i = 0; i < LIMIT / 2; i++) { sender.BeginSend(i.ToString() + "\n", (e, p) => { }, null); } for (int i = LIMIT / 4; i < 3 * LIMIT / 4; i++) { int j = i; receiver.BeginReceive((s, e, p) => { lock (lines) { lines[j] = Int32.Parse(s); } Interlocked.Decrement(ref count); }, null); } for (int i = LIMIT / 2; i < LIMIT; i++) { sender.BeginSend(i.ToString() + "\n", (e, p) => { }, null); } for (int i = 3 * LIMIT / 4; i < LIMIT; i++) { int j = i; receiver.BeginReceive((s, e, p) => { lock (lines) { lines[j] = Int32.Parse(s); Interlocked.Decrement(ref count); } }, null); } if (!SpinWait.SpinUntil(() => count == 0, 5000)) { Assert.Fail(); } for (int i = 0; i < LIMIT; i++) { Assert.AreEqual(i, lines[i]); } } finally { CloseSockets(server, sender, receiver); } }
// Master Ovverride public static GameObject Create(string name, SS.Pivot pivot, Vector2 size, Material material, TextAsset data) { GameObject go = new GameObject(); go.AddComponent<MeshFilter>().sharedMesh = NewMesh(pivot, size); go.AddComponent<MeshRenderer>().material = material; Sprite sprite = go.AddComponent<Sprite>(); SpriteSheet sheetInfo = new SpriteSheet(material, data); Debug.Log("Names " + sheetInfo.AnimationNames()[0]); return go; }
public OpenF(SS.Form1 form1, bool f) { InitializeComponent(); first = f; //******testing******** // form1.fileList.Add("test1"); //form1.fileList.Add("test2"); //form1.fileList.Add("test3"); this.listOfSavedFiles.DataSource = form1.fileList; this.form1 = form1; this.Visible = true; }
private void spreadsheetPanel1_SelectionChanged(SS.SpreadsheetPanel panel) { // Column A = 0, Row 1 = 0 thus A1 = 00 // use ascii value for columns, 65 + column value to get char then call toString // for rows, 1 + row value int row, col; panel.GetSelection(out col, out row); label1.Text = "Current Cell: " + ((char)(65 + col)).ToString() + (1 + row); label2.Text = "Cell Value: " + model.GetCellValue(getCell(col, row)).ToString(); if (model.GetCellContents(getCell(col, row)) is Formula) { string content = "=" + model.GetCellContents(getCell(col, row)).ToString(); textBox3.Text = content; } else { textBox3.Text = model.GetCellContents(getCell(col, row)).ToString(); } }
internal static HandleRef getCPtr(SS obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
private void II(ref UInt32 a, UInt32 b, UInt32 c, UInt32 d, UInt32 x, SS s, UInt32 ac ) { unchecked { #if !XX_inOneInstruction a += I(b, c, d) + x + ac; a = a.RotateLeft((int)s); a += b; #else a = (a += I(b, c, d) + x + ac).RotateLeft((int)s) + b; #endif } }
IAutoFilter ISheet.SetAutoFilter(SS.Util.CellRangeAddress range) { throw new System.NotImplementedException(); }
public void run(int port) { Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); String line = ""; ManualResetEvent mre = new ManualResetEvent(false); try { StringSocket sender = new StringSocket(s1, new UTF8Encoding()); SS receiver = new SS(s2, new UTF8Encoding()); foreach (char c in "Hello\n") { sender.BeginSend(c.ToString(), (e, p) => { }, null); } receiver.BeginReceive((s, e, p) => { line = s; mre.Set(); }, null); mre.WaitOne(); Assert.AreEqual("Hello", line); } finally { //CloseSockets(server, s1, s2); } }
public void run(int port) { Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); String line = ""; ManualResetEvent mre = new ManualResetEvent(false); try { StringSocket sender = new StringSocket(s1, new UTF8Encoding()); SS receiver = new SS(s2, new UTF8Encoding()); StringBuilder text = new StringBuilder(); for (int i = 0; i < 100000; i++) { text.Append(i); } String str = text.ToString(); text.Append('\n'); sender.BeginSend(text.ToString(), (e, p) => { }, null); receiver.BeginReceive((s, e, p) => { line = s; mre.Set(); }, null); mre.WaitOne(); Assert.AreEqual(str, line); } finally { //CloseSockets(server, s1, s2); } }
public void run(int port) { int LIMIT = 1000; Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); String[] lines = new String[LIMIT]; ManualResetEvent mre = new ManualResetEvent(false); int count = 0; try { StringSocket sender = new StringSocket(s1, new UTF8Encoding()); SS receiver = new SS(s2, new UTF8Encoding()); for (int i = 0; i < LIMIT; i++) { receiver.BeginReceive((s, e, p) => { lines[(int)p] = s; Interlocked.Increment(ref count); }, i); } for (int i = 0; i < LIMIT; i++) { sender.BeginSend(i.ToString() + "\n", (e, p) => { }, null); } SpinWait.SpinUntil(() => count == LIMIT); for (int i = 0; i < LIMIT; i++) { Assert.AreEqual(i.ToString(), lines[i]); } } finally { //CloseSockets(server, s1, s2); } }
public void response_sequenceTest(SS ss) { rss = ss; callback.called(); }
public SS get_state(string state) { SS ret = new SS(CoolPropPINVOKE.AbstractState_get_state(swigCPtr, state), false); if (CoolPropPINVOKE.SWIGPendingException.Pending) throw CoolPropPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public override void sequenceTest_async(AMD_TestIntf_sequenceTest cb, SS1 p1, SS2 p2, Ice.Current current) { SS ss = new SS(); ss.c1 = p1; ss.c2 = p2; cb.ice_response(ss); }
/// <summary> /// Changes the cell value to the provided contents. Returns true if no /// problems were encountered, false if an exception was thrown /// and caught. /// </summary> private bool ChangeCellValueGivenContent(SS.SpreadsheetPanel ss, String name, String contents) { ISet<string> set = new HashSet<string>(); try { //TESTS: //spreadsheet.NormalizeNValidate("a1++a2"); //spreadsheet.SetContentsOfCell("a1", "=a2+a3"); // Set the contents of the spreadsheet cell set = spreadsheet.SetContentsOfCell(name, contents); foreach (string s in set) { DisplayValueInTable(s); } // Display the new value in both the cell and the Value text box DisplayValueInTable(name); //this.Invoke(new MethodInvoker(this.ChangeValueTextBox(name))); // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.valueTextBox.InvokeRequired) { SetTextCallback d = new SetTextCallback(ChangeValueTextBox); this.Invoke(d, new object[] { name }); } else { this.valueTextBox.Text = name; } //this.valueTextBox.Text = GetValue(name); } catch (SS.CircularException e) { MessageBox.Show( "ERROR: The formula you entered causes a circular dependency.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } catch (SpreadsheetUtilities.FormulaFormatException e) { MessageBox.Show( e.Message, "Formula Format Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } // Set title to have asterisk if the file is changed SetTitle(); return true; }
public NewF(SS.Form1 form1) { InitializeComponent(); this.form1 = form1; this.Visible = true; }
public override SS sequenceTest(SS1 p1, SS2 p2, Ice.Current current) { SS ss = new SS(); ss.c1 = p1; ss.c2 = p2; return ss; }
// TODO - Modify this to accept different planes (most urgently X Z for top down) public static Mesh NewMesh(SS.Pivot pivot, Vector2 dimensions) { Mesh m = new Mesh(); Vector3 p0 = new Vector3(); Vector3 p1 = new Vector3(); Vector3 p2 = new Vector3(); Vector3 p3 = new Vector3(); // TODO This method triangulates vertices in a weird way- fix it switch(pivot) { case SS.Pivot.CenterMiddle: p0 = new Vector3(-(dimensions.x/2), -(dimensions.y/2), 0); p1 = new Vector3((dimensions.x/2), -(dimensions.y/2), 0); p2 = new Vector3(-(dimensions.x/2), (dimensions.y/2), 0); p3 = new Vector3((dimensions.x/2), (dimensions.y/2), 0); break; case SS.Pivot.BottomLeft: p0 = new Vector3(0, 0, 0); p1 = new Vector3(dimensions.x, 0, 0); p2 = new Vector3(0, dimensions.y, 0); p3 = new Vector3(dimensions.x, dimensions.y, 0); break; case SS.Pivot.BottomMiddle: p0 = new Vector3(-(dimensions.x/2), 0, 0); p1 = new Vector3((dimensions.x/2), 0, 0); p2 = new Vector3(-(dimensions.x/2), dimensions.y, 0); p3 = new Vector3((dimensions.x/2), dimensions.y, 0); break; case SS.Pivot.BottomRight: p0 = new Vector3(-dimensions.x, 0, 0); p1 = new Vector3(0, 0, 0); p2 = new Vector3(-dimensions.x, dimensions.y, 0); p3 = new Vector3(0, dimensions.y, 0); break; case SS.Pivot.CenterLeft: p0 = new Vector3(0, -(dimensions.y/2), 0); p1 = new Vector3(dimensions.x, -(dimensions.y/2), 0); p2 = new Vector3(0, (dimensions.y/2), 0); p3 = new Vector3(dimensions.x, (dimensions.y/2), 0); break; case SS.Pivot.CenterRight: p0 = new Vector3(-dimensions.x, -(dimensions.y/2), 0); p1 = new Vector3(0, -(dimensions.y/2), 0); p2 = new Vector3(-dimensions.x, (dimensions.y/2), 0); p3 = new Vector3(0, (dimensions.y/2), 0); break; case SS.Pivot.TopLeft: p0 = new Vector3(0, -dimensions.y, 0); p1 = new Vector3(dimensions.x, -dimensions.y, 0); p2 = new Vector3(0, 0, 0); p3 = new Vector3(dimensions.x, 0, 0); break; case SS.Pivot.TopMiddle: p0 = new Vector3(-(dimensions.x/2), -dimensions.y, 0); p1 = new Vector3((dimensions.x/2), -dimensions.y, 0); p2 = new Vector3(-(dimensions.x/2), 0, 0); p3 = new Vector3((dimensions.x/2), 0, 0); break; case SS.Pivot.TopRight: p0 = new Vector3(-dimensions.x, -dimensions.y, 0); p1 = new Vector3(0, -dimensions.y, 0); p2 = new Vector3(-dimensions.x, 0, 0); p3 = new Vector3(0, 0, 0); break; } m.vertices = new Vector3[] { p1, p0, p2, p1, p2, p3 }; m.triangles = new int[] { 0, 1, 2, 3, 4, 5 }; Vector2 uv0 = new Vector2(0f,0f); Vector2 uv1 = new Vector2(1f,0f); Vector2 uv2 = new Vector2(0f,1f); Vector2 uv3 = new Vector2(1f,1f); m.uv = new Vector2[] { uv1, uv0, uv2, uv1, uv2, uv3 }; m.name = "SpriteMesh"; m.RecalculateNormals(); m.RecalculateBounds(); m.Optimize(); return m; }
/// <summary> /// Detects when user changes the selection and populates the Text boxes /// </summary> /// <param name="sender"></param> private void spreadsheetPanel1_SelectionChanged(SS.SpreadsheetPanel sender) { //int mycol; //int myRow; int colLetter; //string myVal; object content; try { //this.textBox1.Invoke(new Action(()=>this.textBox1.Clear())); //textBox1.Clear(); this.textBox1.Clear(); this.spreadsheetPanel1.Invoke(new Action(()=> spreadsheetPanel1.GetSelection(out mycol2, out myRow2))); content = mySheet.GetCellContents(GetCellName(mycol2, myRow2)); if (content is Formula) { //this.textBox1.Invoke(new Action(()=>textBox1.Text = "=" + content.ToString())); this.textBox1.Text = "=" + content.ToString(); } else { //this.textBox1.Invoke(new Action(()=>textBox1.Text = content.ToString())); this.textBox1.Text = content.ToString(); } this.spreadsheetPanel1.Invoke(new Action(()=> spreadsheetPanel1.GetValue(mycol2, myRow2, out myval2))); colLetter = mycol2 + 65; this.textBox2.Invoke(new Action(()=> textBox2.Text = ((char)colLetter).ToString() + (myRow2 + 1).ToString() + "= " + myval2)); } catch (CircularException) { MessageBox.Show("Cannot use current cell as part of formula", "CircularException", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR FROM SPREADSHEET", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void run(int port) { int LIMIT = 1000; Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); List<int> lines = new List<int>(); try { StringSocket sender = new StringSocket(s1, new UTF8Encoding()); SS receiver = new SS(s2, new UTF8Encoding()); for (int i = 0; i < LIMIT; i++) { receiver.BeginReceive((s, e, p) => { lock (lines) { lines.Add(Int32.Parse(s)); } }, null); } for (int i = 0; i < LIMIT; i++) { String s = i.ToString(); ThreadPool.QueueUserWorkItem(x => sender.BeginSend(s + "\n", (e, p) => { }, null)); } SpinWait.SpinUntil(() => { lock (lines) { return lines.Count == LIMIT; } }); lines.Sort(); for (int i = 0; i < LIMIT; i++) { Assert.AreEqual(i, lines[i]); } } finally { //CloseSockets(server, s1, s2); } }
public virtual SS get_reducing_state() { SS ret = new SS(CoolPropPINVOKE.AbstractState_get_reducing_state(swigCPtr), false); if (CoolPropPINVOKE.SWIGPendingException.Pending) throw CoolPropPINVOKE.SWIGPendingException.Retrieve(); return ret; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SS obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
int ISheet.AddMergedRegion(SS.Util.CellRangeAddress region) { throw new System.NotImplementedException(); }
ICellRange<ICell> ISheet.SetArrayFormula(string formula, SS.Util.CellRangeAddress range) { throw new System.NotImplementedException(); }
bool ISheet.IsMergedRegion(SS.Util.CellRangeAddress mergedRegion) { throw new System.NotImplementedException(); }
/// <summary> /// Constructs a new spreadsheet /// </summary> public Form1(string filename, string save, SS.Spreadsheet sheet) { InitializeComponent(); spreadsheet = sheet; spreadsheetPanel1.SelectionChanged += DisplaySelectedCell; // Initialize all of the non-empty cells HashSet<string> cells = new HashSet<string>(spreadsheet.GetNamesOfAllNonemptyCells()); foreach (string name in cells) DisplayValueInTable(name); spreadsheetPanel1.SetSelection(0, 0); saveFile = filename; titleFile = save; // Perform an initial save Save(); SetTitle(); InsertMode = true; }
/// <summary> /// Changes the cell value to it's contents. Returns true if no /// problems were encountered, false if an exception was thrown /// and caught. /// </summary> private bool ChangeCellValue(SS.SpreadsheetPanel ss) { int row, col; ss.GetSelection(out col, out row); string name = GetCellName(col, row); ISet<string> set = new HashSet<string>(); try { //Set the contents of the spreadsheet cell set = spreadsheet.SetContentsOfCell(name, contentsTextBox.Text); foreach (string s in set) { DisplayValueInTable(s); } // Display the new value in both the cell and the Value text box DisplayValueInTable(name); valueTextBox.Text = GetValue(name); } catch (SS.CircularException e) { MessageBox.Show( "ERROR: The formula you entered causes a circular dependency.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } catch (SpreadsheetUtilities.FormulaFormatException e) { MessageBox.Show( e.Message, "Formula Format Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } // Set title to have asterisk if the file is changed SetTitle(); return true; }
/************************** LOGIC CODE **************************/ /// <summary> /// Changes the cell value to it's contents. Returns true if no /// problems were encountered, false if an exception was thrown /// and caught. /// </summary> private bool ChangeCellValuebyServer(SS.SpreadsheetPanel ss) { int row, col; ss.GetSelection(out col, out row); string name = GetCellName(col, row); ISet<string> set = new HashSet<string>(); String CellCont = contentsTextBox.Text; try { CellCont = spreadsheet.NormalizeNValidate(CellCont); } catch (SpreadsheetUtilities.FormulaFormatException e) { MessageBox.Show( e.Message, "Formula Format Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } //Send the edit to the server //ENTER[esc]version_number[esc]cell_name[esc]cell_content\n client.SendMessage("ENTER" + esc + versionNumber + esc + name + esc + CellCont + "\n"); //Set the spreadsheet edited flag to true.s SSEdit = true; return true; }
public void run(int port) { Socket s1, s2; TcpListener server; OpenSockets(port, out server, out s1, out s2); object payload = null; ManualResetEvent mre = new ManualResetEvent(false); try { StringSocket sender = new StringSocket(s1, new UTF8Encoding()); SS receiver = new SS(s2, new UTF8Encoding()); sender.BeginSend("Hello\n", (e, p) => { payload = p; mre.Set(); }, "Payload"); mre.WaitOne(); Assert.AreEqual("Payload", payload); } finally { //CloseSockets(server, s1, s2); } }
/*** Selected Cell ***/ /// <summary> /// Displays the selected cell in the non editable cell box. /// </summary> private void DisplaySelectedCell(SS.SpreadsheetPanel ss) { int row, col; // Save the users selection ss.GetSelection(out col, out row); // Get the old cell and set it's value, skipping if it's the first // selection seen so far int oldRow, oldCol; GetCellCoords(selectedCellText.Text, out oldCol, out oldRow); // oldRow and oldCol will be -1 if this is the first selection seen so far if (oldRow >= 0 && oldCol >= 0) { ss.SetSelection(oldCol, oldRow); // Check if the contents have changed, doing nothing if they haven't if (CheckForChanges(oldCol, oldRow)) ChangeCellValuebyServer(ss); // Restore the selection to the user selection ss.SetSelection(col, row); } // Display the cell name in the Cell text box string name = GetCellName(col, row); selectedCellText.Text = name; // Set the valueTextBox to the cell value valueTextBox.Text = GetValue(name); // Set the cellContents text box to the cell contents contentsTextBox.Text = GetContents(name); // Make sure focus is in the correct spot InsertMode = InsertMode; }
//Display the appropriate Cell, Value and Content in each text box. private void DisplaySelection(SS.SpreadsheetPanel sender) { string cell = SelectionToCell(sender); string contents = _sheet.GetCellContents(cell).ToString(); string value = _sheet.GetCellValue(cell).ToString(); CellTextbox.Text = cell; ContentsTextbox.Text = contents; ValueTextbox.Text = value; }