public MainWindow() { InitializeComponent(); SetupWatcher(); dbase = new SQ(); tmpdb = new SQ("filewatcher.tmpdb"); }
public override void DoLoad() { //DXライブラリのリソースを破棄 Media.ClearResources(); //内部DB this.FlagBySystem = true; base.DoLoad(); this.ApplyToManager <mgrDBEffect, mgrDBEffect.EffectOneData>(this.mgr); //独自コマンドとして使用するスクリプトのリスト this.mgr.UserCommandScripts.Clear(); using (var R = new StreamReader(Common.OpenFileReadOnly(ProjectManager.ProjectPath + Resources.Path_DBs_EffectScriptCenter), Common.SJIS)) { var buf = R.ReadLine(); //1行目:コメント buf = R.ReadLine(); while (buf != null) { this.mgr.UserCommandScripts.Add(SQ.CutDoubleQuotation(SQ.GetArgumentListByCall(buf)[0]).Replace("\\\\", "\\")); buf = R.ReadLine(); } } this.mgr.IsUserCommandsDirty = false; //単独エフェクトスクリプト foreach (var effect in this.mgr.Data) { effect.LoadFile(); } this.edittingListChanged(this, null); this.FlagBySystem = false; this.IsDirty = false; }
/// <summary> /// 【非同期】コード解析を実行します。 /// </summary> private async void doCodeAnalyze() { if (this.uctlOneText.IsDirty && MessageBox.Show(Resources.MsgQ_Confirm.Replace("$", "現在のファイルを保存") + "\r\n保存しない場合は計算できません。", Resources.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } //最新のファイルを読み込むため、解析前に一旦保存する this.uctlOneText.DoSave(); this.ctlSwitchScriptAnalyze(false); //関数探索を実行 var funcFinder = await Task.Run(() => { return(SQ.GetFunctionList(this.uctlOneText.FileName)); }); //変数探索を実行 var valFinder = await Task.Run(() => { return(SQ.GetValueList(this.uctlOneText.FileName)); }); //処理結果を画面に反映 this.ltvScriptFuncList.Items.AddRange(funcFinder.ToArray()); this.ltvScriptValueList.Items.AddRange(valFinder.ToArray()); //System.Media.SystemSounds.Asterisk.Play(); this.ctlSwitchScriptAnalyze(true); }
/// <summary> /// 【非同期】コードメトリックス計算を実行します。 /// </summary> private async void doCodeMetrics() { if (this.uctlOneText.IsDirty && MessageBox.Show(Resources.MsgQ_Confirm.Replace("$", "現在のファイルを保存") + "\r\n保存しない場合は計算できません。", Resources.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } //最新のファイルを読み込むため、解析前に一旦保存する this.uctlOneText.DoSave(); //現在の関数リストを一時的に記憶する var funcFinder = new List <ListViewItem>(); foreach (ListViewItem item in this.ltvScriptFuncList.Items) { funcFinder.Add(item); } this.ctlSwitchScriptCodeMetrics(false); //コードメトリックス計算を実行 await Task.Run(() => { SQ.CalcCodeMetrics(this.uctlOneText.FileName, funcFinder); }); //処理結果を画面に反映 this.ltvScriptFuncList.Items.AddRange(funcFinder.ToArray()); System.Media.SystemSounds.Asterisk.Play(); this.ctlSwitchScriptCodeMetrics(true); //結果が見える程度にスプリッター境界線を広げる this.splText1.SplitterDistance = 350; }
public override VR CreateVR(string str, Rule rule, int length) { VR vr; vr = new SQ(rule, length); return(vr); }
/// <summary> /// テストコマンドをドロップダウンしたときに関数リストを更新する /// </summary> private void tolTestCommand_DropDown(object sender, EventArgs e) { //現在のスクリプトの関数リストを生成する this.tolTestCommand.BeginUpdate(); this.tolTestCommand.Items.Clear(); var list = SQ.GetFunctionList(this.FileName); foreach (var item in list) { if (item.Text.Length > 0 && item.Text.Substring(0, 1) == "(") { //無名関数はスキップ continue; } var buf = item.Text + "("; var args = item.Tag as string[]; for (var i = 0; i < args.Length; i++) { buf += "/*" + args[i] + "*/"; if (i < args.Length - 1) { buf += ", "; } } buf += ");"; this.tolTestCommand.Items.Add(buf); } this.tolTestCommand.EndUpdate(); }
/// <summary> /// 速度変更 /// </summary> private void btnMoveSpeed_Click(object sender, EventArgs e) { this.AddTask( $"速さ: 移動速度を変更 [{Map.GetSpeedList()[this.cmbSpeed.SelectedIndex]}]", Map.EventMoveTask.SetMoveSpeed, this.cmbSpeed.SelectedIndex, SQ.ToSQEnum(typeof(Map.Speed), this.cmbSpeed.SelectedIndex) ); }
/// <summary> /// コマンドツリーをセットアップします。 /// これはプロジェクトが読み込まれた後に呼び出して下さい。 /// </summary> public void Setup(CtrlComponent.Database.ctlDatabaseEditor dbCtl, CtrlComponent.Map.mgrMapObject mgrMap) { this.dbCtl = dbCtl; this.mgrMap = mgrMap; var subNodes = new List <TreeNode>(); //オートコンプリートのソースを更新 //組み込みオブジェクトは 定数・列挙体・変数 ノード以下に絞る AutoCompleteSource.Clear(); subNodes.AddRange(Common.GetNodeListToFlat(this.trvTree.Nodes[NodeNameCppObject].Nodes[NodeNameCppObjConst])); subNodes.AddRange(Common.GetNodeListToFlat(this.trvTree.Nodes[NodeNameCppObject].Nodes[NodeNameCppObjEnum])); subNodes.AddRange(Common.GetNodeListToFlat(this.trvTree.Nodes[NodeNameCppObject].Nodes[NodeNameCppObjValue])); AutoCompleteSource.AddRange(subNodes); foreach (var node1 in subNodes) { AutoCompleteSourceAll.Add(ctlCommandTree.GetCode(node1)); } //プロジェクト関連のスクリプトからノード生成する this.trvTree.BeginUpdate(); foreach (TreeNode node in this.trvTree.Nodes) { switch (node.Text) { case NodeSQConst: //定数定義スクリプトを読み込む SQ.SetSQConstantsTree(node, Resources.Path_Scripts_Constants); break; case NodeSQFunc: //関数定義スクリプトを読み込む SQ.SetSQFunctionsTree(node, Resources.Path_Scripts_Functions); break; } //オートコンプリートのソースに追加 subNodes = Common.GetNodeListToFlat(node); AutoCompleteSource.AddRange(subNodes); foreach (var node2 in subNodes) { AutoCompleteSourceAll.Add(ctlCommandTree.GetCode(node2)); } } //コマンドツリーの並び替え実行 this.trvTree.TreeViewNodeSorter = new CommandTreeSorter(); this.trvTree.EndUpdate(); ////オートコンプリートのノード情報リストの並び替え実行 //AutoCompleteSource.Sort((x, y) => { // //コードの文字列逆順にする // var xcode = GetCode(x); // var ycode = GetCode(y); // return -string.Compare(xcode, ycode); //}); }
private void saveTmpDb() { watcher.EnableRaisingEvents = false; SQ dbase = new SQ(); string tmpDB = Directory.GetCurrentDirectory() + "\\filewatcher.tmpdb"; dbase.executeCommand("attach '" + tmpDB + "' as source"); dbase.executeCommand("insert into main.FileInfo select * from source.FileInfo"); this.tmpdb.clearDB(); watcher.EnableRaisingEvents = true; }
protected bool ExistsInBucket(SQ.Repository.File file) { /*foreach (RemoteFile remote in remoteFiles){ Console.WriteLine (remote.AbsolutePath+" "+ file.AbsolutePath); // if (remote.AbsolutePath == file.AbsolutePath || remote.FullLocalName.Contains(file.FullLocalName)){ //return true; //} }//return false;*/ return remoteFiles.Where (rf => rf.AbsolutePath == file.AbsolutePath || rf.FullLocalName.Contains ( file.FullLocalName)).Any (); }
bool CreateFile(SQ.Repository.File file) { try { if (file.IsAFolder) RemoteRepo.CreateFolder (new Folder (file.FullLocalName)); else RemoteRepo.Upload (file); return true; } catch (Exception e) { Console.WriteLine (e.Message); Console.WriteLine (e.StackTrace); return false; } }
bool DeleteFile(SQ.Repository.File file) { try { List<RemoteFile> filesInFolder = remoteFiles.Where (remo => remo.AbsolutePath.Contains(file.AbsolutePath+Constant.DELIMITER)).ToList<RemoteFile>(); if (filesInFolder.Count >= 1){ file = new Folder (file.FullLocalName+Constant.DELIMITER); foreach (RemoteFile r in filesInFolder) { if(file.IsIgnoreFile) continue; if (r.AbsolutePath != file.AbsolutePath) RemoteRepo.MoveToTrash (r); } } RemoteRepo.MoveToTrash (file); } catch { return false; } return true; }
public override void LoadFile() { var fileName = Resources.Path_DBs_EffectScripts + this.FixedID + Resources.Extension_SQ; if (!File.Exists(ProjectManager.ProjectPath + fileName)) { return; //ファイルが見つからない場合は初期状態 } //読み込み開始 using (var R = new StreamReader(Common.OpenFileReadOnly(ProjectManager.ProjectPath + fileName), Common.SJIS)) { var buf = ""; R.ReadLine(); //1行目:共通スクリプトインクルード R.ReadLine(); //2行目:空行 R.ReadLine(); //3行目:コメント R.ReadLine(); //4行目:関数名 R.ReadLine(); //5行目:local Effect = ... R.ReadLine(); //6行目:switch分岐 R.ReadLine(); //7行目:case -1: ... //以降読み込み開始 buf = R.ReadLine(); var i = 0; //現在のフレームインデックス while (buf.Replace("\t", "").Replace(" ", "") != "}") { buf = buf.Substring(buf.IndexOf(":") + 1); //case N: の後ろ以降に絞る //文ごとに区切る var spl = buf.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (spl != null) { for (var n = 0; n < spl.Length; n++) { if ((spl[n] + ";") == Resources.SQ_BlockBreak) { continue; //break; は無視する } var args = SQ.GetArgumentListByCall(spl[n]); //引数リストにする if (n < this.Layers.Count) { //各レイヤーのフレーム情報 this.Layers[int.Parse(args[0])].Frames[i] = new mgrDBEffect.EffectOneData.EffectLayer.EffectFrame( new Point(int.Parse(args[1]), int.Parse(args[2])), new Point(int.Parse(args[3]), int.Parse(args[4])), (Media.BlendMode) int.Parse(args[5]), int.Parse(args[6]), int.Parse(args[7]), int.Parse(args[8]) ); } else { //命令情報 var funcName = SQ.GetFunctionNameByCall(spl[n]); if (funcName == SQ.GetFunctionNameByCall(Resources.SQ_EffectSound)) { var pars = new string[Common.GetEnumCount <mgrDBEffect.EffectOneData.EffectOrder.SoundOptionIndices>()]; for (var p = 0; p < pars.Length; p++) { if (p == (int)mgrDBEffect.EffectOneData.EffectOrder.SoundOptionIndices.IDName) { //この時点では空白にする pars[p] = ""; } else { pars[p] = args[p]; } } this.AddOrder(new mgrDBEffect.EffectOneData.EffectOrder(null, i, mgrDBEffect.EffectOneData.EffectOrder.OrderType.Sound, pars )); } else if (funcName == SQ.GetFunctionNameByCall(Resources.SQ_EffectFlash)) { var pars = new string[Common.GetEnumCount <mgrDBEffect.EffectOneData.EffectOrder.FlashOptionIndices>()]; for (var p = 0; p < pars.Length; p++) { if (p == (int)mgrDBEffect.EffectOneData.EffectOrder.FlashOptionIndices.Color) { pars[p] = Common.LinkStringArray(SQ.GetArgumentListByCall(args[p]), Resources.Split_ColorRGB.ToCharArray()[0]); } else { pars[p] = args[p]; } } this.AddOrder(new mgrDBEffect.EffectOneData.EffectOrder(null, i, mgrDBEffect.EffectOneData.EffectOrder.OrderType.Flash, pars )); } else if (funcName == SQ.GetFunctionNameByCall(Resources.SQ_EffectShake)) { this.AddOrder(new mgrDBEffect.EffectOneData.EffectOrder(null, i, mgrDBEffect.EffectOneData.EffectOrder.OrderType.Shake, new string[] { args[0] }) ); } else if (funcName == SQ.GetFunctionNameByCall(Resources.SQ_EffectWaitBreak)) { this.AddOrder(new mgrDBEffect.EffectOneData.EffectOrder(null, i, mgrDBEffect.EffectOneData.EffectOrder.OrderType.WaitBreak, new string[] { "" }) ); } else { this.AddOrder(new mgrDBEffect.EffectOneData.EffectOrder(null, i, mgrDBEffect.EffectOneData.EffectOrder.OrderType.User, new string[] { spl[n] }) ); } } } } buf = R.ReadLine(); i++; } } this.IsDirty = false; }
private void btnMoveWest_Click(object sender, EventArgs e) { this.AddTask("移動: [←]", Map.EventMoveTask.Move, (int)Map.Direction4.West, SQ.ToSQEnum(typeof(Map.Direction4), (int)Map.Direction4.West)); }
private void btnDirEast_Click(object sender, EventArgs e) { this.AddTask("方向: [→]", Map.EventMoveTask.Direction, (int)Map.Direction4.East, SQ.ToSQEnum(typeof(Map.Direction4), (int)Map.Direction4.East)); }
public VR GetVR(string key) { //如果对象存在,则直接从享元池获取 if (VRs.ContainsKey(key)) { return((VR)VRs[key]); } //如果对象不存在,先创建一个新的对象添加到享元池中,然后返回 else { VR fw = null; switch (key) { case "SS": fw = new SS(isBE, false); break; case "US": fw = new US(isBE); break; case "SL": fw = new SL(isBE, false); break; case "UL": fw = new UL(isBE, false); break; case "FL": fw = new FL(isBE, false); break; case "FD": fw = new FD(isBE, false); break; case "DA": fw = new DA(isBE, false); break; case "TM": fw = new TM(isBE, false); break; case "DT": fw = new DT(isBE, false); break; case "AS": fw = new AS(isBE, false); break; case "OB": fw = new OB(isBE); break; case "OF": fw = new OF(isBE, true); break; case "OW": fw = new OW(isBE); break; case "SQ": fw = new SQ(isBE, true); break; case "LO": fw = new LO(isBE, true); break; case "UI": fw = new UI(isBE, true); break; case "SH": fw = new SH(isBE, true); break; case "AE": fw = new AE(isBE, true); break; case "CS": fw = new CS(isBE, true); break; case "PN": fw = new PN(isBE, true); break; case "DS": fw = new DS(isBE); break; case "IS": fw = new IS(isBE, true); break; //default for text //default: fw = new ST(isBE, false); break; } VRs.Add(key, fw); return(fw); } }
/// <summary> /// コンストラクター /// </summary> public ctlCommandTree() { this.InitializeComponent(); Common.EnableDoubleBuffering(this); //リソースから読み込んでコマンドツリーを生成する //ただし、定数定義スクリプトのノードはプロジェクトが読み込まれた後に手動で生成する CodeContainers.Clear(); CodeMembers.Clear(); this.trvTree.BeginUpdate(); foreach (TreeNode node in this.trvTree.Nodes) { switch (node.Text) { case NodeSQStatement: SQ.SetSQStatementsTree(node); break; case NodeCPPObj: SQ.SetCPPObjectsTree(node); node.Expand(); //ノードをコンテナー系とメンバー系に振り分ける・重複を許可しない var subNodes = Common.GetNodeListToFlat(node); foreach (var subNode in subNodes) { var obj = subNode.Tag as SQObject; if (subNode.Tag != null && obj == null) { //文字列で格納されているものはコンテナーに分類する CodeContainers.Add(subNode.Tag.ToString()); continue; } else if (obj == null) { //対象外のノード continue; } switch (obj.SubType) { case GenerateGlueCode.GenerateCPPDocument.ObjectSubType.Class: case GenerateGlueCode.GenerateCPPDocument.ObjectSubType.Enum: case GenerateGlueCode.GenerateCPPDocument.ObjectSubType.MemberProperty: //コンテナー系 if (!CodeContainers.Contains(obj.Name)) { CodeContainers.Add(obj.Name); } break; default: //メンバー系 if (!CodeMembers.Contains(obj.Name)) { CodeMembers.Add(obj.Name); } break; } } CodeContainers.Sort(); CodeMembers.Sort(); break; case NodeTool: //ツール群はよく使うので展開しておく node.Expand(); break; } } //「組み込みオブジェクト:変数」は最もよく使うので展開しておく this.trvTree.Nodes[NodeNameCppObject].Nodes[NodeNameCppObjValue].Expand(); this.trvTree.EndUpdate(); }
private void btnDirSouth_Click(object sender, EventArgs e) { this.AddTask("方向: [↓]", Map.EventMoveTask.Direction, (int)Map.Direction4.South, SQ.ToSQEnum(typeof(Map.Direction4), (int)Map.Direction4.South)); }
public void DeleteInTrash(SQ.Repository.File file) { GenericDelete (file.TrashAbsolutePath); }
protected bool ExistsVersion(SQ.Repository.File file) { return RemoteRepo.TrashFiles.Where (tf => tf.AbsolutePath == file.AbsolutePath+"(1)").Any (); }
public void CopyToTrash(SQ.Repository.File source) { string destinationName; if (source.IsAFolder) destinationName = source.Name; else destinationName = source.Name+"(0)"; GenericCopy (bucketName, source.AbsolutePath, source.TrashRelativePath, destinationName); }
/// <summary> /// 指定した方向へ移動 /// </summary> private void btnMoveNorth_Click(object sender, EventArgs e) { this.AddTask("移動: [↑]", Map.EventMoveTask.Move, (int)Map.Direction4.North, SQ.ToSQEnum(typeof(Map.Direction4), (int)Map.Direction4.North)); }
/// <summary> /// コンストラクター /// </summary> public dlgOrder(AllDB DBList, EffectOrder baseOrder, int frameLength, int targetFrame, bool enabledEditFrameNum, List <string> SQList) { this.InitializeComponent(); this.numTargetFrame.Enabled = enabledEditFrameNum; this.numTargetFrame.Maximum = frameLength - 1; this.DBList = DBList; //効果音リストの生成 Database.CreateComboBoxListFromSrcDB(this.cmbSEList, DBList[Database.DBIndices.Material].DBs[(int)Database.DBMaterialIndices.Sound], false); //独自コマンドの関数リストを生成 this.cmbCommand.Items.Clear(); foreach (var sqFile in SQList) { var funcs = SQ.GetFunctionList(sqFile); foreach (var func in funcs) { this.cmbCommand.Items.Add(func.SubItems[(int)SQ.FuncListColumns.Name].Text); } } this.tips.SetToolTip(this.cmbCommand, $"同一フレームの実行カウンターは {Resources.SQ_EffectSameCounter} です。\r\nこれは特定のフレームが最初に実行されるときだけ処理したい場合などに使います。"); //既定値のセット this.numTargetFrame.Value = (this.numTargetFrame.Maximum >= targetFrame) ? targetFrame : this.numTargetFrame.Maximum; if (baseOrder == null) { return; } if (baseOrder.Frame < frameLength) { //有効なフレーム番号のときだけ既定値からセットする this.numTargetFrame.Value = baseOrder.Frame; } switch (baseOrder.Type) { case EffectOrder.OrderType.Sound: //一致する効果音ファイルを探す for (var i = 0; i < this.cmbSEList.Items.Count; i++) { if (((SoundItem)this.cmbSEList.Items[i]).Value.ToString() == baseOrder.Options[(int)EffectOrder.SoundOptionIndices.FixedID]) { this.cmbSEList.SelectedIndex = i; this.uctlSEEditor.SoundData = new Media.SoundObject( DBList[Database.DBIndices.Material].DBs[(int)Database.DBMaterialIndices.Sound].Rows[i].Cells[(int)Database.DBDefaultColumnIndices.Count].Value?.ToString(), int.Parse(baseOrder.Options[(int)EffectOrder.SoundOptionIndices.Volume]), int.Parse(baseOrder.Options[(int)EffectOrder.SoundOptionIndices.Pitch]), int.Parse(baseOrder.Options[(int)EffectOrder.SoundOptionIndices.Pan]) ); break; } } this.rdbSE.Checked = true; break; case EffectOrder.OrderType.Shake: this.numShakeStrength.Value = int.Parse(baseOrder.Options[0]); this.rdbShake.Checked = true; break; case EffectOrder.OrderType.Flash: this.pnlFlashColor.BackColor = Common.StringToColor(baseOrder.Options[(int)EffectOrder.FlashOptionIndices.Color]); this.numFlashStrength.Value = int.Parse(baseOrder.Options[(int)EffectOrder.FlashOptionIndices.Strength]); this.numFlashCount.Value = int.Parse(baseOrder.Options[(int)EffectOrder.FlashOptionIndices.Count]); this.rdbFlash.Checked = true; break; case EffectOrder.OrderType.WaitBreak: this.rdbWaitBreak.Checked = true; break; case EffectOrder.OrderType.User: this.cmbCommand.Text = baseOrder.Options[0]; this.rdbScript.Checked = true; break; } }
/// <summary> /// コード逆探索 /// </summary> private void tolInsertReserchCode_Click(object sender, EventArgs e) { //カーソル部分の単語を抽出する var doc = this.azkEditor.Document; this.azkEditor.Document.GetSelection(out var x, out var y); string word, line; try { line = Common.CutHeadTabs(this.azkEditor.Document.GetLineContent( this.azkEditor.Document.GetLineIndexFromCharIndex(this.azkEditor.Document.AnchorIndex))) .Trim(); if (x == y && x > 0) { //カーソルにある単語を選択状態にする word = this.azkEditor.Document.GetTextInRange( this.azkEditor.Document.WordProc.PrevWordStart(this.azkEditor.Document, x - 1), this.azkEditor.Document.WordProc.NextWordStart(this.azkEditor.Document, x)) .Replace("\r\n", ""); this.azkEditor.Document.SetSelection( this.azkEditor.Document.WordProc.PrevWordStart(this.azkEditor.Document, x - 1), this.azkEditor.Document.WordProc.NextWordStart(this.azkEditor.Document, x) ); } else { word = this.azkEditor.Document.GetTextInRange(x, y); } if (string.IsNullOrEmpty(word)) { //見つからなかった throw new Exception(); } else if (word.Length > 2 && word.Substring(0, 2) == "0x") { //16進数と見られる文字列は接頭辞を削除する word = word.Substring(2); } if (int.TryParse(word, System.Globalization.NumberStyles.AllowHexSpecifier, null, out var id) || int.TryParse(word, out id)) { //数値の場合はデータベースのIDとして検索する var list = this.DBCtrl.FindDBRow(id); if (list.Count > 0) { var index = 0; if (list.Count > 1) { //複数見つかった場合は重複解決ダイアログを開く var Dlg = new Dialog.Common.dlgSelectInList("データベースの選択"); for (var i = 0; i < list.Count; i++) { Dlg.AddItem(i + 1, list[i].Item2.Tag?.ToString()); } if (Dlg.ShowDialog() != DialogResult.OK) { //キャンセル中断 return; } index = Dlg.GetResultID(); } MessageBox.Show("次のデータベース項目に該当しました:\r\n" + list[index].Item2.Tag?.ToString() + "\r\n" + list[index].Item1, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { //見つからなかった throw new Exception(); } } else if (line.IndexOf(Resources.SQ_EVMessage.Substring(0, Resources.SQ_EVMessage.IndexOf("("))) != -1) { //メッセージ表示のコマンドがある場合 this.azkEditor.Document.SetSelection( this.azkEditor.Document.GetLineHeadIndexFromCharIndex(x), this.azkEditor.Document.GetLineEndIndexFromCharIndex( this.azkEditor.Document.GetLineHeadIndex(this.azkEditor.Document.GetLineIndexFromCharIndex(x)) ) - 2 ); this.FoundCommandNode?.Invoke(this, new FoundCommandNodeEventArgs(CtrlComponent.Text.ctlCommandTree.TagToolMessage, line)); } else if (line.IndexOf(Resources.SQ_ChangeMap.Substring(0, Resources.SQ_ChangeMap.IndexOf("("))) != -1) { //場所移動のコマンドがある場合 this.azkEditor.Document.SetSelection( this.azkEditor.Document.GetLineHeadIndexFromCharIndex(x), this.azkEditor.Document.GetLineEndIndexFromCharIndex( this.azkEditor.Document.GetLineHeadIndex(this.azkEditor.Document.GetLineIndexFromCharIndex(x)) ) - 2 ); this.FoundCommandNode?.Invoke(this, new FoundCommandNodeEventArgs(CtrlComponent.Text.ctlCommandTree.TagToolChangeMap, line)); } else { //文字列の場合はコードとみなしてコマンドツリーで検索にかける var foundNodes = ctlCommandTree.FindNodes(word); var targetIndex = 0; if (foundNodes == null || foundNodes.Count == 0) { //見つからなかった throw new Exception(); } if (foundNodes.Count > 1) { // 複数見つかったときはユーザーに選ばせる var Dlg = new dlgSelectInList("複数の候補 - コード逆探索"); var count = 1; foreach (var node in foundNodes) { Dlg.AddItem(count, node.FullPath); count++; } if (Dlg.ShowDialog() != DialogResult.OK) { return; } targetIndex = Dlg.GetResultIndex(); } //引数リストもすべて選択する var foundNode = foundNodes[targetIndex]; var start = line.IndexOf(word) + word.Length; var depth = 0; string[] args = null; if (line.IndexOf("(", start) == start) { //すぐ後ろに引数リストがある場合は選択範囲を伸ばす //ただし、閉じ括弧がないときは伸ばさない for (var index = start + 1; index < line.Length; index++) { var temp = line.Substring(index, 1); if (temp == "(") { depth++; continue; } if (temp == ")") { depth--; } if (depth < 0) { //関数呼び出しの括弧が閉じられたらここで終わる word += line.Substring(start, index - start + 1); //引数リストを取得 args = SQ.GetArgumentListByCall(word); //選択範囲を伸ばす this.azkEditor.Document.SetSelection( this.azkEditor.Document.AnchorIndex, this.azkEditor.Document.AnchorIndex + word.Length ); break; } } } this.FoundCommandNode?.Invoke(this, new FoundCommandNodeEventArgs(foundNode, args)); } } catch { //見つからなかったらビープ音を鳴らす System.Media.SystemSounds.Beep.Play(); } }
public void Download(SQ.Repository.File file) { try { string sourcekey = file.AbsolutePath;//file.AbsolutePath.Substring (1, file.AbsolutePath.Length-1); Logger.LogInfo ("Connection", "Download the file " + sourcekey + "."); GetObjectRequest objectRequest = new GetObjectRequest (){ BucketName = bucketName, Key = sourcekey }; using (GetObjectResponse response = Connect ().GetObject (objectRequest)) { response.WriteResponseStreamToFile (file.FullLocalName); } } catch (Exception e) { Logger.LogInfo ("Error", e); } }
bool UpdateFile(SQ.Repository.File file) { try { RemoteFile remoteFile = (RemoteFile)LocalFile.Get (file, remoteFiles.Cast <SQ.Repository.File> ().ToList ()); if (!FilesIsSync ((LocalFile)file, remoteFile)) { // indica que a versao mais atual eh a local remoteFile.RecentVersion = file; // envia para o trash a versao desatualizada RemoteRepo.MoveToTrash (remoteFile); // faz o upload da versao recente RemoteRepo.Upload (file); } return true; } catch { return false; } }
public DBWindow() { InitializeComponent(); dbase = new SQ(); FillDataGrid(); }
public void Upload(SQ.Repository.File file) { Logger.LogInfo ("Connection","Uploading the file "+ file.FullLocalName+" to bucket."); if (!System.IO.File.Exists(file.FullLocalName)) return; GenericUpload ( file.RelativePathInBucket, file.Name, file.FullLocalName); }
public void Delete(SQ.Repository.File file) { Logger.LogInfo ("Connection", "Deleting " + file.AbsolutePath + " from bucket."); GenericDelete (file.AbsolutePath); }
bool RenameFile(SQ.Repository.File file) { if (remoteFiles.Where (rf => rf.AbsolutePath == file.AbsolutePath).Any ()) { try { if (file.IsAFolder) SynchronizeUploadRenameFolder ((Folder)file); else SynchronizeUploadRenameFile ((LocalFile)file); } catch { return false; } return true; } else return CreateFile (file); }
public void UploadToTrash(SQ.Repository.File file) { Logger.LogInfo ("Connection","Uploading the file "+ file.Name+" to bucket."); if (!System.IO.File.Exists(file.FullLocalName)) return; string key; if ( file.IsAFolder) { key = file.Name; } else { key = file.Name + "(0)"; } Logger.LogInfo ("Connection","Uploading the file "+key+" to trash."); GenericUpload ( file.TrashRelativePath, key, file.FullLocalName); }
public void Copy(SQ.Repository.File source, SQ.Repository.File destination) { //string sourcekey = source.AbsolutePath.Substring (1,source.AbsolutePath.Length-1); GenericCopy (bucketName, source.AbsolutePath, destination.RelativePathInBucket, destination.Name); }
public void CopyInTrash(SQ.Repository.File source, SQ.Repository.File destination) { GenericCopy (bucketName, source.TrashAbsolutePath, destination.TrashRelativePath, destination.Name); }
bool HandleMove(SQ.Repository.File newVersion, SQ.Repository.File oldVersion) { if (oldVersion == null) return false; List<Change> oldcreates = LocalRepo.PendingChanges.Where (c=> c.File.FullLocalName == oldVersion.FullLocalName && c.Event == System.IO.WatcherChangeTypes.Created).ToList<Change>(); List<Change> oldrenames = LocalRepo.PendingChanges.Where (c=> c.File.FullLocalName == oldVersion.FullLocalName && c.Event == System.IO.WatcherChangeTypes.Renamed).ToList<Change>(); if(oldrenames.Count > 0){ //apagar o rename antigo Change renameChange = oldrenames [0]; Console.WriteLine (DateTime.Now.ToUniversalTime () + " - Replace rename - " + renameChange.File.FullLocalName +" to "+newVersion.FullLocalName); // apagar o delete que inicou o rename atual Change deletedChange = LocalRepo.PendingChanges.Where (c=> c.File.AbsolutePath == oldVersion.AbsolutePath && c.Event == System.IO.WatcherChangeTypes.Deleted).First(); LocalRepo.PendingChanges.Remove (deletedChange); LocalRepo.Files.Remove (oldVersion); oldVersion = renameChange.File.OldVersion; LocalRepo.PendingChanges.Remove (renameChange); LocalRepo.Files.Remove (renameChange.File); //create o novo rename newVersion.OldVersion = oldVersion; LocalRepo.PendingChanges.Add (new Change (newVersion, System.IO.WatcherChangeTypes.Renamed)); LocalRepo.Files.Add (newVersion); } else if (oldcreates.Count>0) { Console.WriteLine (DateTime.Now.ToUniversalTime () + " - Creating new version - " + oldVersion.FullLocalName +" to "+newVersion.FullLocalName); Change deletedChange = LocalRepo.PendingChanges.Where (c=> c.File.AbsolutePath == oldVersion.AbsolutePath && c.Event == System.IO.WatcherChangeTypes.Deleted).First(); LocalRepo.PendingChanges.Remove (deletedChange); LocalRepo.Files.Remove (oldVersion); Change createOldChange = oldcreates[0]; LocalRepo.Files.Remove (createOldChange.File); LocalRepo.PendingChanges.Remove (createOldChange); if (oldVersion.TimeOfLastChange.Subtract(Repo.LastSyncTime).TotalSeconds >0){ newVersion.OldVersion = createOldChange.File; LocalRepo.PendingChanges.Add (new Change(newVersion, System.IO.WatcherChangeTypes.Renamed)); } else{ LocalRepo.PendingChanges.Add (new Change(newVersion, System.IO.WatcherChangeTypes.Created)); } LocalRepo.Files.Add (newVersion); } else { newVersion.OldVersion = oldVersion; Change deletedChange = LocalRepo.PendingChanges.Where (c=> c.File.AbsolutePath == oldVersion.AbsolutePath && c.Event == System.IO.WatcherChangeTypes.Deleted).First(); LocalRepo.PendingChanges.Remove ( deletedChange); LocalRepo.PendingChanges.Add (new Change (newVersion, System.IO.WatcherChangeTypes.Renamed)); LocalRepo.Files.Remove (oldVersion); LocalRepo.Files.Add (newVersion); } return true; }
/// <summary> /// スクリプト用の列挙体として指示内容を取得する /// </summary> public static string GetMoveTypeCode(Map.EventMoveTask taskType) { return(SQ.ToSQEnum(typeof(Map.EventMoveTask), (int)taskType)); }