├── App.config
├── App.xaml
├── App.xaml.cs
├── Dlls
├── ICSharpCode.AvalonEdit.dll
└── Secode.Base.dll
├── LICENSE
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── OpcodeGUI.csproj
├── OpcodeGUI.csproj.user
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── Protoc
├── App
│ └── protoc.exe
├── Output
│ ├── FrameMessage.cs
│ ├── HotfixMessage.cs
│ └── OuterMessage.cs
└── Sources
│ ├── FrameMessage.proto
│ ├── HotfixMessage.proto
│ └── OuterMessage.proto
├── README.md
├── Setting.xaml
├── Setting.xaml.cs
├── TextInput.xaml
├── TextInput.xaml.cs
├── Xshd
├── CSharpHighlighting.xshd
└── ProtocHighlighting.xshd
└── logo.ico
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace OpcodeGUI
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Dlls/ICSharpCode.AvalonEdit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecodeCN/OpcodeGUI/f919836fefe1b61a9b1ae7db63f09f83909cc8cb/Dlls/ICSharpCode.AvalonEdit.dll
--------------------------------------------------------------------------------
/Dlls/Secode.Base.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecodeCN/OpcodeGUI/f919836fefe1b61a9b1ae7db63f09f83909cc8cb/Dlls/Secode.Base.dll
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 kkc001
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Forms;
4 | using System.Windows.Controls;
5 | using System.IO;
6 | using System.Collections.Generic;
7 | using System.Text.RegularExpressions;
8 | using System.Windows.Media;
9 |
10 | using System.Xml;
11 | using ICSharpCode.AvalonEdit.CodeCompletion;
12 | using ICSharpCode.AvalonEdit.Folding;
13 | using ICSharpCode.AvalonEdit.Highlighting;
14 | using ICSharpCode.AvalonEdit.Search;
15 | using System.Windows.Threading;
16 | using ICSharpCode.AvalonEdit.Document;
17 | using System.Windows.Input;
18 | using ICSharpCode.AvalonEdit.Editing;
19 |
20 | namespace Secode
21 | {
22 | ///
23 | /// MainWindow.xaml 的交互逻辑
24 | ///
25 | public partial class MainWindow : Window
26 | {
27 | #region 路径参数
28 |
29 | ///
30 | /// 当前编辑项目
31 | ///
32 | public string CurrentOption
33 | {
34 | get
35 | {
36 | if (!DataSet.Contain("OpcodeGUI_CurrentOption")) return "";
37 | return DataSet.GetString("OpcodeGUI_CurrentOption");
38 | }
39 | set
40 | {
41 | DataSet.Set("OpcodeGUI_CurrentOption", value);
42 | }
43 | }
44 |
45 | ///
46 | /// Protoc目录
47 | ///
48 | public static string ProtocPath
49 | {
50 | get
51 | {
52 | if (!DataSet.Contain("OpcodeGUI_ProtocPath"))
53 | {
54 | return Path.Combine(Environment.CurrentDirectory, "Protoc");
55 | }
56 | return DataSet.GetString("OpcodeGUI_ProtocPath");
57 | }
58 | set
59 | {
60 | DataSet.Set("OpcodeGUI_ProtocPath", value);
61 | }
62 | }
63 |
64 | ///
65 | /// Protoc.exe应用路径
66 | ///
67 | public static string AppPath
68 | {
69 | get
70 | {
71 | var path = "";
72 | if (!DataSet.Contain("OpcodeGUI_AppPath"))
73 | {
74 | path = Path.Combine(ProtocPath, "App", "protoc.exe");
75 | }
76 | else
77 | {
78 | path = DataSet.GetString("OpcodeGUI_AppPath");
79 | }
80 | var finfo = new FileInfo(path);
81 | if (!finfo.Exists) return null;
82 | return path;
83 | }
84 | set
85 | {
86 | DataSet.Set("OpcodeGUI_AppPath", value);
87 | }
88 | }
89 |
90 | ///
91 | /// 源文件保存路径
92 | ///
93 | public static string SourcesPath
94 | {
95 | get
96 | {
97 | var path = "";
98 | if (!DataSet.Contain("OpcodeGUI_SourcesPath"))
99 | {
100 | path = Path.Combine(ProtocPath, "Sources");
101 | }
102 | else
103 | {
104 | path = DataSet.GetString("OpcodeGUI_SourcesPath");
105 | }
106 | var dinfo = new DirectoryInfo(path);
107 | if (!dinfo.Exists) dinfo.Create();
108 | return path;
109 | }
110 | set
111 | {
112 | DataSet.Set("OpcodeGUI_SourcesPath", value);
113 | }
114 | }
115 |
116 | ///
117 | /// 输出路径
118 | ///
119 | public static string OutputPath
120 | {
121 | get
122 | {
123 | var path = "";
124 | if (!DataSet.Contain("OpcodeGUI_OutputPath"))
125 | {
126 | path = Path.Combine(ProtocPath, "Output");
127 | }
128 | else
129 | {
130 | path = DataSet.GetString("OpcodeGUI_OutputPath");
131 | }
132 | var dinfo = new DirectoryInfo(path);
133 | if (!dinfo.Exists) dinfo.Create();
134 | return path;
135 | }
136 | set
137 | {
138 | DataSet.Set("OpcodeGUI_OutputPath", value);
139 | }
140 | }
141 |
142 | #endregion
143 |
144 | #region 初始化
145 |
146 | public MainWindow()
147 | {
148 | InitializeComponent();
149 | InitControl();
150 | }
151 |
152 | ///
153 | /// 初始化组件
154 | ///
155 | public void InitControl()
156 | {
157 | InitContentEditor();
158 |
159 | LoadList();
160 | LoadContent();
161 |
162 | OptionListBox.SelectionChanged += delegate
163 | {
164 | if (OptionListBox.SelectedItem == null) return;
165 | CurrentOption = ((ListBoxItem)OptionListBox.SelectedItem).Content.ToString();
166 | LoadContent();
167 | };
168 |
169 | ContentText.TextChanged += delegate
170 | {
171 | SaveContent();
172 | };
173 |
174 | NewButton.Click += delegate
175 | {
176 | New();
177 | };
178 |
179 | DeleteButton.Click += delegate
180 | {
181 | Delete();
182 | };
183 |
184 | OpenProtocPathButton.Click += delegate
185 | {
186 | OpenProtocPath();
187 | };
188 |
189 | SettingButton.Click += delegate
190 | {
191 | OpenSettingPanel();
192 | };
193 |
194 | RefreshButton.Click += delegate
195 | {
196 | LoadList();
197 | LoadContent();
198 | Log("重新加载完成");
199 | };
200 |
201 | SaveButton.Click += delegate
202 | {
203 | Save();
204 | };
205 | }
206 |
207 | #endregion
208 |
209 | #region 加载
210 |
211 | #region 初始化文本编辑器
212 |
213 | ///
214 | /// 初始化文本编辑器
215 | ///
216 | public void InitContentEditor()
217 | {
218 | #region 加载高亮配置
219 | IHighlightingDefinition protocHighlighting = LoadHighlighting("ProtocHighlighting");
220 | IHighlightingDefinition csharpHighlighting = LoadHighlighting("CSharpHighlighting");
221 | #endregion
222 |
223 | #region 注册高亮配置
224 | //HighlightingManager.Instance.RegisterHighlighting("Protoc", new string[] { ".proto" }, protocHighlighting);
225 | #endregion
226 |
227 | #region 配置文本格式化类型
228 | this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
229 | #endregion
230 |
231 | #region 注册输入提示事件
232 | ContentText.TextArea.TextEntering += ContentText_TextArea_TextEntering;
233 | ContentText.TextArea.TextEntered += ContentText_TextArea_TextEntered;
234 | #endregion
235 |
236 | #region 配置文本高亮设置
237 | ContentText.SyntaxHighlighting = protocHighlighting;
238 | GenerateText.SyntaxHighlighting = csharpHighlighting;
239 | OpcodeText.SyntaxHighlighting = csharpHighlighting;
240 | #endregion
241 |
242 | #region 配置搜索设置
243 | SearchPanel.Install(ContentText);
244 | #endregion
245 |
246 | #region Folder 配置初始化
247 |
248 | FoldingStrategys = new Dictionary();
249 | FoldingManagers = new Dictionary();
250 | FoldingUpdateTimer = new DispatcherTimer();
251 | FoldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
252 |
253 | InitFoldings(ContentText);
254 | InitFoldings(GenerateText);
255 | InitFoldings(OpcodeText);
256 |
257 | FoldingUpdateTimer.Start();
258 |
259 | #endregion
260 | }
261 |
262 | #region 加载高亮配置
263 |
264 | ///
265 | /// 加载高亮配置
266 | ///
267 | ///
268 | ///
269 | public IHighlightingDefinition LoadHighlighting(string key)
270 | {
271 | IHighlightingDefinition protocHighlighting;
272 | using (Stream s = typeof(MainWindow).Assembly.GetManifestResourceStream("Secode.Xshd." + key + ".xshd"))
273 | {
274 | if (s == null)
275 | {
276 | Console.WriteLine("Could not find embedded resource: " + key);
277 | return null;
278 | }
279 | else
280 | {
281 | using (XmlReader reader = new XmlTextReader(s))
282 | {
283 | protocHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.
284 | HighlightingLoader.Load(reader, HighlightingManager.Instance);
285 | }
286 | }
287 | }
288 | return protocHighlighting;
289 | }
290 |
291 | #endregion
292 |
293 | #region Folder 配置
294 |
295 | private Dictionary FoldingManagers;
296 | private Dictionary FoldingStrategys;
297 | private DispatcherTimer FoldingUpdateTimer;
298 |
299 | ///
300 | /// 初始化编辑器的Folder合并
301 | ///
302 | ///
303 | public void InitFoldings(ICSharpCode.AvalonEdit.TextEditor editor)
304 | {
305 | FoldingStrategys.Add(editor, new BraceFoldingStrategy());
306 | FoldingManagers.Add(editor, FoldingManager.Install(editor.TextArea));
307 | FoldingUpdateTimer.Tick += delegate { UpdateFoldings(editor); };
308 | }
309 |
310 | ///
311 | /// 更新Folder合并
312 | ///
313 | ///
314 | public void UpdateFoldings(ICSharpCode.AvalonEdit.TextEditor editor)
315 | {
316 | if (!FoldingStrategys.ContainsKey(editor)) return;
317 |
318 | if (FoldingStrategys[editor] is BraceFoldingStrategy)
319 | {
320 | ((BraceFoldingStrategy)FoldingStrategys[editor]).UpdateFoldings(FoldingManagers[editor], editor.Document);
321 | }
322 | if (FoldingStrategys[editor] is XmlFoldingStrategy)
323 | {
324 | ((XmlFoldingStrategy)FoldingStrategys[editor]).UpdateFoldings(FoldingManagers[editor], editor.Document);
325 | }
326 | }
327 |
328 | #endregion
329 |
330 | #region 注册输入提示事件
331 |
332 | public void ContentText_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
333 | {
334 | switch (e.Text)
335 | {
336 | case "\n":
337 | if (CurrentLineParse.Length == 0)
338 | {
339 | ShowCompletionWindow(new Dictionary()
340 | {
341 | { "syntax", "Protoc类型" },
342 | { "message", "消息名称" },
343 | { "package", "命名空间" },
344 | });
345 | }
346 | else
347 | {
348 | if (CurrentLineText.Length < CurrentLineParse.Length)
349 | CurrentWrite(CurrentLineParse.Substring(CurrentLineText.Length));
350 | ShowCompletionWindow(new Dictionary()
351 | {
352 | { "int32", "32位int" },
353 | { "int64", "64位int" },
354 | { "float", "浮点型" },
355 | { "string", "字符串" },
356 | { "bytes", "二进制数据" },
357 | { "repeated", "队列,可为多项的" },
358 | });
359 | }
360 | break;
361 | case "=":
362 | if (CurrentLineContent == "syntax=")
363 | {
364 | ShowCompletionWindow(new Dictionary()
365 | {
366 | { "\"proto3\";", "Proto3模式" },
367 | { "\"proto2\";", "Proto2模式" },
368 | });
369 | }
370 | break;
371 | case " ":
372 | if (CurrentLineContent == "repeated")
373 | {
374 | ShowCompletionWindow(new Dictionary()
375 | {
376 | { "int32", "32位int" },
377 | { "int64", "64位int" },
378 | { "float", "浮点型" },
379 | { "string", "字符串" },
380 | { "bytes", "二进制数据" },
381 | });
382 | }
383 | break;
384 | case "{":
385 | case ";":
386 | case "}":
387 | AutoFormat();
388 | break;
389 | }
390 | }
391 |
392 | public void ContentText_TextArea_TextEntering(object sender, TextCompositionEventArgs e)
393 | {
394 | if (e.Text.Length > 0 && completionWindow != null)
395 | {
396 | if (!char.IsLetterOrDigit(e.Text[0]))
397 | {
398 | // Whenever a non-letter is typed while the completion window is open,
399 | // insert the currently selected element.
400 | completionWindow.CompletionList.RequestInsertion(e);
401 | }
402 | }
403 | }
404 |
405 | #region 执行方法
406 |
407 | private CompletionWindow completionWindow;
408 |
409 | public void ShowCompletionWindow(Dictionary pairs)
410 | {
411 | // open code completion after the user has pressed dot:
412 | completionWindow = new CompletionWindow(ContentText.TextArea);
413 | // provide AvalonEdit with the data:
414 | IList data = completionWindow.CompletionList.CompletionData;
415 |
416 | foreach (var key in pairs)
417 | {
418 | data.Add(new CompletionData(key.Key, key.Value));
419 | }
420 |
421 | completionWindow.Show();
422 |
423 | if (completionWindow.CompletionList.ScrollViewer != null)
424 | {
425 | completionWindow.CompletionList.ScrollViewer.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF2D2D30"));
426 | completionWindow.CompletionList.ScrollViewer.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF"));
427 | }
428 |
429 | completionWindow.Closed += delegate
430 | {
431 | completionWindow = null;
432 | };
433 | }
434 |
435 | ///
436 | /// 光标所在行内容
437 | ///
438 | public string CurrentLineContent
439 | {
440 | get
441 | {
442 | return CurrentLineText.Replace("\t", "").Replace(" ", "");
443 | }
444 | }
445 |
446 | ///
447 | /// 光标所在行完整文本
448 | ///
449 | public string CurrentLineText
450 | {
451 | get
452 | {
453 | var str = ContentText.Text;
454 | str = str.Substring(0, ContentText.CaretOffset);
455 | var lines = str.Split('\n');
456 | return lines[lines.Length - 1];
457 | }
458 | }
459 |
460 | ///
461 | /// 光标所在行内容
462 | ///
463 | public string CurrentLineParse
464 | {
465 | get
466 | {
467 | var str = ContentText.Text;
468 | str = str.Substring(0, ContentText.CaretOffset);
469 | var len = str.Replace("{", "{{").Replace("}", "").Length - str.Length;
470 | var parse = "";
471 | for (int i = 0; i < len; i++) parse += "\t";
472 | return parse;
473 | }
474 | }
475 |
476 | ///
477 | /// 光标所在处添加内容光标后移
478 | ///
479 | ///
480 | public void CurrentWrite(string text)
481 | {
482 | var index = ContentText.CaretOffset;
483 | var str = ContentText.Text;
484 | var str1 = str.Substring(0, index);
485 | var str2 = str.Substring(index);
486 | ContentText.Text = str1 + text + str2;
487 | ContentText.CaretOffset = index + text.Length;
488 | ContentText.Focus();
489 | }
490 |
491 | #endregion
492 |
493 | #endregion
494 |
495 | #region 自动格式化
496 |
497 | ///
498 | /// 自动格式化
499 | ///
500 | ///
501 | public void AutoFormat()
502 | {
503 | var index = ContentText.CaretOffset;
504 |
505 | var text = ContentText.Text;
506 | var tempkey = "" + ((char)1);
507 | var tempkey2 = "" + ((char)2) + ((char)2);
508 | var tempkey3 = "" + ((char)3) + ((char)3);
509 | text = text.Replace("\\", tempkey);
510 | text = text.Replace(tempkey + tempkey, tempkey2);
511 | text = text.Replace(tempkey + "\"", tempkey3);
512 | var result = "";
513 | var strs = text.Split('\"');
514 | var parse = "";
515 | for (int i = 0; i < strs.Length; i += 1)
516 | {
517 | if (i % 2 == 1)
518 | {
519 | result += "\"" + strs[i] + "\"";
520 | }
521 | else
522 | {
523 | if (result.Length + strs[i].Length <= index)
524 | {
525 | var formatstr = Format(strs[i], ref parse);
526 | index += formatstr.Length - strs[i].Length;
527 | result += formatstr;
528 | }
529 | else if (result.Length < index)
530 | {
531 | var str1 = strs[i].Substring(0, index - result.Length);
532 | var str2 = strs[i].Substring(index - result.Length);
533 | var formatstr = Format(str1, ref parse);
534 | index += formatstr.Length - str1.Length;
535 | if (formatstr.EndsWith("\n\n") && str2.StartsWith("\n"))
536 | {
537 | formatstr = formatstr.Substring(0, formatstr.Length - 1);
538 | index -= 1;
539 | }
540 | else if (formatstr.EndsWith(";\n") && str2.StartsWith("\n"))
541 | {
542 | formatstr = formatstr.Substring(0, formatstr.Length - 1);
543 | index -= 1;
544 | }
545 | result += formatstr;
546 | result += Format(str2, ref parse);
547 | }
548 | else
549 | {
550 | result += Format(strs[i], ref parse);
551 | }
552 | }
553 | }
554 | result = result.Replace(tempkey3, tempkey + "\"");
555 | result = result.Replace(tempkey2, tempkey + tempkey);
556 | result = result.Replace(tempkey, "\\");
557 |
558 | ContentText.Text = result;
559 |
560 | ContentText.CaretOffset = index;
561 | ContentText.Focus();
562 | }
563 |
564 | public string Format(string text, ref string parse)
565 | {
566 | text = text.Replace("\r", "");
567 | text = text.Replace("\t", "");
568 | text = text.Replace("{", "\n{\n");
569 | text = text.Replace("}", "\n}\n");
570 | text = text.Replace("//", " // ");
571 | text = text.Replace("=", " = ");
572 | text = text.Replace(";", ";");
573 | while (text.Contains("\n\n")) text = text.Replace("\n\n", "\n");
574 | while (text.Contains(" ")) text = text.Replace(" ", " ");
575 | while (text.Contains("\n ")) text = text.Replace("\n ", "\n");
576 | text = text.Replace(" ;", ";");
577 | text = text.Replace("}", "}\n");
578 | var lines = text.Split('\n');
579 | var result = "";
580 | foreach (var line in lines)
581 | {
582 | if (line == "{")
583 | {
584 | result += (string.IsNullOrEmpty(result) ? "" : parse) + line + "\n";
585 | parse += "\t";
586 | }
587 | else if (line == "}")
588 | {
589 | var len = parse.Length - 1;
590 | if (len < 0) len = 0;
591 | parse = parse.Substring(0, len);
592 | result += (string.IsNullOrEmpty(result) ? "" : parse) + line + "\n";
593 | }
594 | else if (parse.Length != 0 && line.StartsWith("//"))
595 | {
596 | result = result.Substring(0, result.Length - 1);
597 | result += " " + line + "\n";
598 | }
599 | else
600 | {
601 | result += (string.IsNullOrEmpty(result) ? "" : parse) + line + "\n";
602 | }
603 | }
604 |
605 | result = result.Substring(0, result.Length - 1);
606 |
607 | return result;
608 | }
609 |
610 | #endregion
611 |
612 | #endregion
613 |
614 | #region 加载列表和内容
615 |
616 | ///
617 | /// 加载队列
618 | ///
619 | public void LoadList()
620 | {
621 | var dinfo = new DirectoryInfo(SourcesPath);
622 | if (!dinfo.Exists) dinfo.Create();
623 |
624 | OptionListBox.Items.Clear();
625 |
626 | var files = dinfo.GetFiles();
627 | foreach (var file in files)
628 | {
629 | if (file.Extension != ".proto") continue;
630 | var item = new ListBoxItem();
631 | item.Content = file.Name.Replace(".proto", "");
632 | OptionListBox.Items.Add(item);
633 | if (item.Content.ToString() == CurrentOption)
634 | {
635 | OptionListBox.SelectedItem = item;
636 | }
637 | }
638 |
639 | if (OptionListBox.SelectedItem == null && OptionListBox.Items.Count > 0)
640 | {
641 | OptionListBox.SelectedIndex = 0;
642 | CurrentOption = ((ListBoxItem)OptionListBox.SelectedItem).Content.ToString();
643 | }
644 | }
645 |
646 | ///
647 | /// 加载内容
648 | ///
649 | public void LoadContent()
650 | {
651 | var path = Path.Combine(SourcesPath, CurrentOption + ".proto");
652 | if (!File.Exists(path)) return;
653 | var text = File.ReadAllText(path);
654 | ContentText.Text = text;
655 | Run();
656 | }
657 |
658 | #endregion
659 |
660 | #endregion
661 |
662 | #region 功能
663 |
664 | ///
665 | /// 新增
666 | ///
667 | public void New()
668 | {
669 | var dialog = new TextInput("请输入新建源文件名称");
670 | var ans = dialog.ShowDialog();
671 | if (ans == true)
672 | {
673 | var name = dialog.InputText.Text;
674 | if (string.IsNullOrEmpty(name)) return;
675 | if (!name.EndsWith("Message"))
676 | {
677 | Log("新建源文件失败,必须以'Message'结尾命名");
678 | return;
679 | }
680 | var path = Path.Combine(SourcesPath, name + ".proto");
681 | if (File.Exists(path)) return;
682 | File.WriteAllText(path, ContentText.Text);
683 | CurrentOption = name;
684 | LoadList();
685 | LoadContent();
686 | Log("新建源文件“" + name + "”成功");
687 | }
688 | }
689 |
690 | ///
691 | /// 删除
692 | ///
693 | public void Delete()
694 | {
695 | var path = Path.Combine(SourcesPath, CurrentOption + ".proto");
696 | if (!File.Exists(path)) return;
697 | File.Delete(path);
698 | Log("删除源文件“" + CurrentOption + "”成功");
699 | LoadList();
700 | LoadContent();
701 | }
702 |
703 | ///
704 | /// 打开Protoc目录
705 | ///
706 | public void OpenProtocPath()
707 | {
708 | System.Diagnostics.Process.Start("Explorer.exe", ProtocPath);
709 | }
710 |
711 | ///
712 | /// 打开设置面板
713 | ///
714 | public void OpenSettingPanel()
715 | {
716 | var dialog = new Setting();
717 | var ans = dialog.ShowDialog();
718 | if (ans == true)
719 | {
720 | LoadList();
721 | LoadContent();
722 | Log("重新加载数据成功");
723 | }
724 | }
725 |
726 | ///
727 | /// 保存
728 | ///
729 | public void Save()
730 | {
731 | SaveFileDialog dialog = new SaveFileDialog();
732 | dialog.Title = "保存生成的脚本";
733 | dialog.DefaultExt = ".cs";
734 | dialog.Filter = "C#文件|*.cs";
735 | dialog.AddExtension = true;
736 | dialog.FileName = CurrentOption + ".cs";
737 |
738 | if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
739 | {
740 | var path = dialog.FileName;
741 | var sourcepath = Path.Combine(OutputPath, CurrentOption + ".cs");
742 | File.Copy(sourcepath, path, true);
743 | var finfo = new FileInfo(path);
744 | var dpath = finfo.Directory.FullName;
745 | var oppath = Path.Combine(dpath, CurrentOption.Replace("Message", "Opcode") + ".cs");
746 | File.WriteAllText(oppath, OpcodeText.Text);
747 | System.Diagnostics.Process.Start("Explorer.exe", dpath);
748 | Log("保存生成脚本完成");
749 | }
750 | }
751 |
752 | #endregion
753 |
754 | #region 执行方法
755 |
756 | ///
757 | /// 保存内容
758 | ///
759 | public void SaveContent()
760 | {
761 | var path = Path.Combine(SourcesPath, CurrentOption + ".proto");
762 | File.WriteAllText(path, ContentText.Text);
763 | Run();
764 | }
765 |
766 | ///
767 | /// 执行
768 | ///
769 | public void Run()
770 | {
771 | Run(CurrentOption);
772 | GenerateOpcode();
773 | }
774 |
775 | ///
776 | /// 全部执行
777 | ///
778 | public void AllRun()
779 | {
780 | foreach (var key in OptionListBox.Items)
781 | {
782 | Run(((ListBoxItem)key).Content.ToString());
783 | }
784 | }
785 |
786 | ///
787 | /// 执行制定生成
788 | ///
789 | ///
790 | public void Run(string op)
791 | {
792 | if (AppPath == null) return;
793 |
794 | var path = Path.Combine(OutputPath, CurrentOption + ".cs");
795 | if (File.Exists(path))
796 | {
797 | File.Delete(path);
798 | }
799 |
800 | System.Diagnostics.Process p = new System.Diagnostics.Process();
801 | p.StartInfo.FileName = "cmd.exe";
802 | p.StartInfo.UseShellExecute = false; //是否使用操作系统shell启动
803 | p.StartInfo.RedirectStandardInput = true;//接受来自调用程序的输入信息
804 | p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
805 | p.StartInfo.RedirectStandardError = true;//重定向标准错误输出
806 | p.StartInfo.CreateNoWindow = true;//不显示程序窗口
807 | p.Start();//启动程序
808 |
809 | //向cmd窗口发送输入信息
810 | p.StandardInput.WriteLine(AppPath.Replace("\\", "/") + " --csharp_out=\"" + OutputPath.Replace("\\", "/") + "/\" --proto_path=\"" + SourcesPath.Replace("\\", "/") + "/\" " + op + ".proto" + "&exit");
811 | p.StandardInput.AutoFlush = true;
812 |
813 | var ans = p.WaitForExit(1000);
814 | p.Close();
815 |
816 | if (!ans)
817 | {
818 | GenerateText.Text = "";
819 | return;
820 | }
821 |
822 | //Log(op + "生成完成." );
823 |
824 | path = Path.Combine(OutputPath, CurrentOption + ".cs");
825 | if (File.Exists(path))
826 | {
827 | var text = File.ReadAllText(path);
828 | var index = GenerateText.CaretOffset;
829 | GenerateText.Text = text.Replace("global::Google.Protobuf", "global::Secode.Protobuf");
830 | GenerateText.CaretOffset = index;
831 | File.WriteAllText(path, GenerateText.Text);
832 | }
833 | }
834 |
835 | ///
836 | /// 生成Opcode
837 | ///
838 | public void GenerateOpcode()
839 | {
840 | var Index = 0;
841 | var NameSpace = "Secode.Network";
842 | var OpcodeClass = CurrentOption.Replace("Message", "Opcode");
843 | var lines = File.ReadAllLines(Path.Combine(SourcesPath, CurrentOption + ".proto"));
844 |
845 | #region Get Index
846 | foreach (var line in lines)
847 | {
848 | var temp = line.Replace("/", "").Replace(" ", "");
849 | if (temp.Length > 0 && Regex.IsMatch(temp, @"^\d*$"))
850 | {
851 | Index = int.Parse(temp);
852 | break;
853 | }
854 | }
855 | #endregion
856 |
857 | #region Get NameSpace
858 |
859 | var NameSpaceRegex = new Regex("package (.*?);");
860 | foreach (var line in lines)
861 | {
862 | MatchCollection mc = NameSpaceRegex.Matches(line);
863 | if (mc != null && mc.Count > 0)
864 | {
865 | NameSpace = mc[0].Groups[1].Value;
866 | break;
867 | }
868 | }
869 |
870 | #endregion
871 |
872 | #region Append Message Start
873 | OpcodeText.Text = "";
874 | OpcodeText.AppendText("namespace " + NameSpace);
875 | OpcodeText.AppendText(Environment.NewLine);
876 | OpcodeText.AppendText("{");
877 | OpcodeText.AppendText(Environment.NewLine);
878 | #endregion
879 |
880 | #region Append Message Content
881 |
882 | var MessageRegex = new Regex(@"^message\s+(.*?)\s*//\s*(.*?)$");
883 | var MessageRegex2 = new Regex(@"^message\s+(.*?)\s*$");
884 | foreach (var line in lines)
885 | {
886 | MatchCollection mc = MessageRegex.Matches(line);
887 | if (mc == null || mc.Count == 0) mc = MessageRegex2.Matches(line);
888 | if (mc == null || mc.Count == 0) continue;
889 | var msgclass = mc[0].Groups[1].Value;
890 | var typeclass = mc[0].Groups[2].Value;
891 | OpcodeText.AppendText(" [Message(" + OpcodeClass + "." + msgclass + ")]");
892 | OpcodeText.AppendText(Environment.NewLine);
893 | if (!string.IsNullOrWhiteSpace(typeclass))
894 | {
895 | OpcodeText.AppendText(" public partial class " + msgclass + " : " + typeclass + " { }");
896 | }
897 | else
898 | {
899 | OpcodeText.AppendText(" public partial class " + msgclass + " { }");
900 | }
901 | OpcodeText.AppendText(Environment.NewLine);
902 | OpcodeText.AppendText(Environment.NewLine);
903 | }
904 |
905 | #endregion
906 |
907 | #region Append Message End
908 | OpcodeText.AppendText("}");
909 | OpcodeText.AppendText(Environment.NewLine);
910 | #endregion
911 |
912 | #region Append Opcode Start
913 | OpcodeText.AppendText("namespace " + NameSpace);
914 | OpcodeText.AppendText(Environment.NewLine);
915 | OpcodeText.AppendText("{");
916 | OpcodeText.AppendText(Environment.NewLine);
917 | OpcodeText.AppendText(" public static partial class " + OpcodeClass);
918 | OpcodeText.AppendText(Environment.NewLine);
919 | OpcodeText.AppendText(" {");
920 | OpcodeText.AppendText(Environment.NewLine);
921 | #endregion
922 |
923 | #region Append Opcode Content
924 |
925 | foreach (var line in lines)
926 | {
927 | MatchCollection mc = MessageRegex.Matches(line);
928 | if (mc == null || mc.Count == 0) mc = MessageRegex2.Matches(line);
929 | if (mc == null || mc.Count == 0) continue;
930 | var msgclass = mc[0].Groups[1].Value;
931 | Index += 1;
932 | OpcodeText.AppendText(" public const ushort " + msgclass + " = " + Index + ";");
933 | OpcodeText.AppendText(Environment.NewLine);
934 | }
935 |
936 | #endregion
937 |
938 | #region Append Opcode End
939 | OpcodeText.AppendText(" }");
940 | OpcodeText.AppendText(Environment.NewLine);
941 | OpcodeText.AppendText("}");
942 | OpcodeText.AppendText(Environment.NewLine);
943 | #endregion
944 | }
945 |
946 | #region Log
947 |
948 | ///
949 | /// Log输出
950 | ///
951 | ///
952 | public void Log(object msg)
953 | {
954 | LogText.AppendText(msg.ToString());
955 | LogText.AppendText(Environment.NewLine);
956 | LogText.ScrollToVerticalOffset(LogText.ExtentHeight);
957 | }
958 |
959 | #endregion
960 |
961 | #endregion
962 |
963 | #region BraceFoldingStrategy
964 |
965 | ///
966 | /// Allows producing foldings from a document based on braces.
967 | ///
968 | public class BraceFoldingStrategy
969 | {
970 | ///
971 | /// Gets/Sets the opening brace. The default value is '{'.
972 | ///
973 | public char OpeningBrace { get; set; }
974 |
975 | ///
976 | /// Gets/Sets the closing brace. The default value is '}'.
977 | ///
978 | public char ClosingBrace { get; set; }
979 |
980 | ///
981 | /// Creates a new BraceFoldingStrategy.
982 | ///
983 | public BraceFoldingStrategy()
984 | {
985 | this.OpeningBrace = '{';
986 | this.ClosingBrace = '}';
987 | }
988 |
989 | public void UpdateFoldings(FoldingManager manager, TextDocument document)
990 | {
991 | int firstErrorOffset;
992 | IEnumerable newFoldings = CreateNewFoldings(document, out firstErrorOffset);
993 | manager.UpdateFoldings(newFoldings, firstErrorOffset);
994 | }
995 |
996 | ///
997 | /// Create s for the specified document.
998 | ///
999 | public IEnumerable CreateNewFoldings(TextDocument document, out int firstErrorOffset)
1000 | {
1001 | firstErrorOffset = -1;
1002 | return CreateNewFoldings(document);
1003 | }
1004 |
1005 | ///
1006 | /// Create s for the specified document.
1007 | ///
1008 | public IEnumerable CreateNewFoldings(ITextSource document)
1009 | {
1010 | List newFoldings = new List();
1011 |
1012 | Stack startOffsets = new Stack();
1013 | int lastNewLineOffset = 0;
1014 | char openingBrace = this.OpeningBrace;
1015 | char closingBrace = this.ClosingBrace;
1016 | for (int i = 0; i < document.TextLength; i++)
1017 | {
1018 | char c = document.GetCharAt(i);
1019 | if (c == openingBrace)
1020 | {
1021 | startOffsets.Push(i);
1022 | }
1023 | else if (c == closingBrace && startOffsets.Count > 0)
1024 | {
1025 | int startOffset = startOffsets.Pop();
1026 | // don't fold if opening and closing brace are on the same line
1027 | if (startOffset < lastNewLineOffset)
1028 | {
1029 | newFoldings.Add(new NewFolding(startOffset, i + 1));
1030 | }
1031 | }
1032 | else if (c == '\n' || c == '\r')
1033 | {
1034 | lastNewLineOffset = i + 1;
1035 | }
1036 | }
1037 | newFoldings.Sort((a, b) => a.StartOffset.CompareTo(b.StartOffset));
1038 | return newFoldings;
1039 | }
1040 | }
1041 |
1042 | #endregion
1043 |
1044 | #region CompletionData
1045 |
1046 | ///
1047 | /// Implements AvalonEdit ICompletionData interface to provide the entries in the completion drop down.
1048 | ///
1049 | public class CompletionData : ICompletionData
1050 | {
1051 | public CompletionData(string text, string Description = null)
1052 | {
1053 | this.Text = text;
1054 | this.Description = Description;
1055 | }
1056 |
1057 | public System.Windows.Media.ImageSource Image
1058 | {
1059 | get { return null; }
1060 | }
1061 |
1062 | public string Text { get; private set; }
1063 |
1064 | public object Description { get; private set; }
1065 |
1066 | public object Content
1067 | {
1068 | get { return this.Text; }
1069 | }
1070 |
1071 | public double Priority { get { return 0; } }
1072 |
1073 | public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
1074 | {
1075 | textArea.Document.Replace(completionSegment, this.Text);
1076 | }
1077 | }
1078 |
1079 | #endregion
1080 | }
1081 | }
1082 |
--------------------------------------------------------------------------------
/OpcodeGUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3CBAECD3-135C-4C34-98FD-D698D06E0731}
8 | WinExe
9 | Secode
10 | OpcodeGUI
11 | v4.6
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 | logo.ico
39 |
40 |
41 |
42 | False
43 | H:\ftp\dlls\ICSharpCode.AvalonEdit.dll
44 |
45 |
46 | False
47 | H:\ftp\dlls\Secode.Base.dll
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | 4.0
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | MSBuild:Compile
68 | Designer
69 |
70 |
71 | Setting.xaml
72 |
73 |
74 | TextInput.xaml
75 |
76 |
77 | MSBuild:Compile
78 | Designer
79 |
80 |
81 | App.xaml
82 | Code
83 |
84 |
85 | MainWindow.xaml
86 | Code
87 |
88 |
89 | MSBuild:Compile
90 | Designer
91 |
92 |
93 | Designer
94 | MSBuild:Compile
95 |
96 |
97 |
98 |
99 | Code
100 |
101 |
102 | True
103 | True
104 | Resources.resx
105 |
106 |
107 | True
108 | Settings.settings
109 | True
110 |
111 |
112 | ResXFileCodeGenerator
113 | Resources.Designer.cs
114 |
115 |
116 | SettingsSingleFileGenerator
117 | Settings.Designer.cs
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/OpcodeGUI.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ProjectFiles
5 |
6 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("OpcodeGUI")]
11 | [assembly: AssemblyDescription("Secode系列工具之Opcode编辑器")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Secode")]
14 | [assembly: AssemblyProduct("Secode系列工具之Opcode编辑器")]
15 | [assembly: AssemblyCopyright("Copyright © Secode 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Secode.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Secode.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 重写当前线程的 CurrentUICulture 属性
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Secode.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Protoc/App/protoc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecodeCN/OpcodeGUI/f919836fefe1b61a9b1ae7db63f09f83909cc8cb/Protoc/App/protoc.exe
--------------------------------------------------------------------------------
/Protoc/Output/FrameMessage.cs:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: FrameMessage.proto
3 | #pragma warning disable 1591, 0612, 3021
4 | #region Designer generated code
5 |
6 | using pb = global::Secode.Protobuf;
7 | using pbc = global::Secode.Protobuf.Collections;
8 | using scg = global::System.Collections.Generic;
9 | namespace Secode.Network {
10 |
11 | #region Messages
12 | public partial class OneFrameMessage : pb::IMessage {
13 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (OneFrameMessage)MessagePool.Instance.Fetch(typeof(OneFrameMessage)));
14 | public static pb::MessageParser Parser { get { return _parser; } }
15 |
16 | private int rpcId_;
17 | public int RpcId {
18 | get { return rpcId_; }
19 | set {
20 | rpcId_ = value;
21 | }
22 | }
23 |
24 | private long actorId_;
25 | public long ActorId {
26 | get { return actorId_; }
27 | set {
28 | actorId_ = value;
29 | }
30 | }
31 |
32 | private int op_;
33 | public int Op {
34 | get { return op_; }
35 | set {
36 | op_ = value;
37 | }
38 | }
39 |
40 | private pb::ByteString aMessage_ = pb::ByteString.Empty;
41 | public pb::ByteString AMessage {
42 | get { return aMessage_; }
43 | set {
44 | aMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
45 | }
46 | }
47 |
48 | public void WriteTo(pb::CodedOutputStream output) {
49 | if (Op != 0) {
50 | output.WriteRawTag(8);
51 | output.WriteInt32(Op);
52 | }
53 | if (AMessage.Length != 0) {
54 | output.WriteRawTag(18);
55 | output.WriteBytes(AMessage);
56 | }
57 | if (RpcId != 0) {
58 | output.WriteRawTag(208, 5);
59 | output.WriteInt32(RpcId);
60 | }
61 | if (ActorId != 0L) {
62 | output.WriteRawTag(232, 5);
63 | output.WriteInt64(ActorId);
64 | }
65 | }
66 |
67 | public int CalculateSize() {
68 | int size = 0;
69 | if (RpcId != 0) {
70 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
71 | }
72 | if (ActorId != 0L) {
73 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(ActorId);
74 | }
75 | if (Op != 0) {
76 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Op);
77 | }
78 | if (AMessage.Length != 0) {
79 | size += 1 + pb::CodedOutputStream.ComputeBytesSize(AMessage);
80 | }
81 | return size;
82 | }
83 |
84 | public void MergeFrom(pb::CodedInputStream input) {
85 | op_ = 0;
86 | rpcId_ = 0;
87 | actorId_ = 0;
88 | uint tag;
89 | while ((tag = input.ReadTag()) != 0) {
90 | switch(tag) {
91 | default:
92 | input.SkipLastField();
93 | break;
94 | case 8: {
95 | Op = input.ReadInt32();
96 | break;
97 | }
98 | case 18: {
99 | AMessage = input.ReadBytes();
100 | break;
101 | }
102 | case 720: {
103 | RpcId = input.ReadInt32();
104 | break;
105 | }
106 | case 744: {
107 | ActorId = input.ReadInt64();
108 | break;
109 | }
110 | }
111 | }
112 | }
113 |
114 | }
115 |
116 | public partial class FrameMessage : pb::IMessage {
117 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (FrameMessage)MessagePool.Instance.Fetch(typeof(FrameMessage)));
118 | public static pb::MessageParser Parser { get { return _parser; } }
119 |
120 | private int rpcId_;
121 | public int RpcId {
122 | get { return rpcId_; }
123 | set {
124 | rpcId_ = value;
125 | }
126 | }
127 |
128 | private long actorId_;
129 | public long ActorId {
130 | get { return actorId_; }
131 | set {
132 | actorId_ = value;
133 | }
134 | }
135 |
136 | private int frame_;
137 | public int Frame {
138 | get { return frame_; }
139 | set {
140 | frame_ = value;
141 | }
142 | }
143 |
144 | private static readonly pb::FieldCodec _repeated_message_codec
145 | = pb::FieldCodec.ForMessage(18, global::Secode.Network.OneFrameMessage.Parser);
146 | private pbc::RepeatedField message_ = new pbc::RepeatedField();
147 | public pbc::RepeatedField Message {
148 | get { return message_; }
149 | set { message_ = value; }
150 | }
151 |
152 | public void WriteTo(pb::CodedOutputStream output) {
153 | if (Frame != 0) {
154 | output.WriteRawTag(8);
155 | output.WriteInt32(Frame);
156 | }
157 | message_.WriteTo(output, _repeated_message_codec);
158 | if (RpcId != 0) {
159 | output.WriteRawTag(208, 5);
160 | output.WriteInt32(RpcId);
161 | }
162 | if (ActorId != 0L) {
163 | output.WriteRawTag(232, 5);
164 | output.WriteInt64(ActorId);
165 | }
166 | }
167 |
168 | public int CalculateSize() {
169 | int size = 0;
170 | if (RpcId != 0) {
171 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
172 | }
173 | if (ActorId != 0L) {
174 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(ActorId);
175 | }
176 | if (Frame != 0) {
177 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Frame);
178 | }
179 | size += message_.CalculateSize(_repeated_message_codec);
180 | return size;
181 | }
182 |
183 | public void MergeFrom(pb::CodedInputStream input) {
184 | frame_ = 0;
185 | for (int i = 0; i < message_.Count; i++) { MessagePool.Instance.Recycle(message_[i]); }
186 | message_.Clear();
187 | rpcId_ = 0;
188 | actorId_ = 0;
189 | uint tag;
190 | while ((tag = input.ReadTag()) != 0) {
191 | switch(tag) {
192 | default:
193 | input.SkipLastField();
194 | break;
195 | case 8: {
196 | Frame = input.ReadInt32();
197 | break;
198 | }
199 | case 18: {
200 | message_.AddEntriesFrom(input, _repeated_message_codec);
201 | break;
202 | }
203 | case 720: {
204 | RpcId = input.ReadInt32();
205 | break;
206 | }
207 | case 744: {
208 | ActorId = input.ReadInt64();
209 | break;
210 | }
211 | }
212 | }
213 | }
214 |
215 | }
216 |
217 | #endregion
218 |
219 | }
220 |
221 | #endregion Designer generated code
222 |
--------------------------------------------------------------------------------
/Protoc/Output/HotfixMessage.cs:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: HotfixMessage.proto
3 | #pragma warning disable 1591, 0612, 3021
4 | #region Designer generated code
5 |
6 | using pb = global::Secode.Protobuf;
7 | using pbc = global::Secode.Protobuf.Collections;
8 | using scg = global::System.Collections.Generic;
9 | namespace Secode.Network {
10 |
11 | #region Messages
12 | ///
13 | /// 三维坐标信息
14 | ///
15 | public partial class Vector3Info : pb::IMessage {
16 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Vector3Info)MessagePool.Instance.Fetch(typeof(Vector3Info)));
17 | public static pb::MessageParser Parser { get { return _parser; } }
18 |
19 | private float x_;
20 | public float X {
21 | get { return x_; }
22 | set {
23 | x_ = value;
24 | }
25 | }
26 |
27 | private float y_;
28 | public float Y {
29 | get { return y_; }
30 | set {
31 | y_ = value;
32 | }
33 | }
34 |
35 | private float z_;
36 | public float Z {
37 | get { return z_; }
38 | set {
39 | z_ = value;
40 | }
41 | }
42 |
43 | public void WriteTo(pb::CodedOutputStream output) {
44 | if (X != 0F) {
45 | output.WriteRawTag(13);
46 | output.WriteFloat(X);
47 | }
48 | if (Y != 0F) {
49 | output.WriteRawTag(21);
50 | output.WriteFloat(Y);
51 | }
52 | if (Z != 0F) {
53 | output.WriteRawTag(29);
54 | output.WriteFloat(Z);
55 | }
56 | }
57 |
58 | public int CalculateSize() {
59 | int size = 0;
60 | if (X != 0F) {
61 | size += 1 + 4;
62 | }
63 | if (Y != 0F) {
64 | size += 1 + 4;
65 | }
66 | if (Z != 0F) {
67 | size += 1 + 4;
68 | }
69 | return size;
70 | }
71 |
72 | public void MergeFrom(pb::CodedInputStream input) {
73 | x_ = 0f;
74 | y_ = 0f;
75 | z_ = 0f;
76 | uint tag;
77 | while ((tag = input.ReadTag()) != 0) {
78 | switch(tag) {
79 | default:
80 | input.SkipLastField();
81 | break;
82 | case 13: {
83 | X = input.ReadFloat();
84 | break;
85 | }
86 | case 21: {
87 | Y = input.ReadFloat();
88 | break;
89 | }
90 | case 29: {
91 | Z = input.ReadFloat();
92 | break;
93 | }
94 | }
95 | }
96 | }
97 |
98 | }
99 |
100 | ///
101 | /// 四元数坐标信息
102 | ///
103 | public partial class QuaternionInfo : pb::IMessage {
104 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (QuaternionInfo)MessagePool.Instance.Fetch(typeof(QuaternionInfo)));
105 | public static pb::MessageParser Parser { get { return _parser; } }
106 |
107 | private float x_;
108 | public float X {
109 | get { return x_; }
110 | set {
111 | x_ = value;
112 | }
113 | }
114 |
115 | private float y_;
116 | public float Y {
117 | get { return y_; }
118 | set {
119 | y_ = value;
120 | }
121 | }
122 |
123 | private float z_;
124 | public float Z {
125 | get { return z_; }
126 | set {
127 | z_ = value;
128 | }
129 | }
130 |
131 | private float w_;
132 | public float W {
133 | get { return w_; }
134 | set {
135 | w_ = value;
136 | }
137 | }
138 |
139 | public void WriteTo(pb::CodedOutputStream output) {
140 | if (X != 0F) {
141 | output.WriteRawTag(13);
142 | output.WriteFloat(X);
143 | }
144 | if (Y != 0F) {
145 | output.WriteRawTag(21);
146 | output.WriteFloat(Y);
147 | }
148 | if (Z != 0F) {
149 | output.WriteRawTag(29);
150 | output.WriteFloat(Z);
151 | }
152 | if (W != 0F) {
153 | output.WriteRawTag(37);
154 | output.WriteFloat(W);
155 | }
156 | }
157 |
158 | public int CalculateSize() {
159 | int size = 0;
160 | if (X != 0F) {
161 | size += 1 + 4;
162 | }
163 | if (Y != 0F) {
164 | size += 1 + 4;
165 | }
166 | if (Z != 0F) {
167 | size += 1 + 4;
168 | }
169 | if (W != 0F) {
170 | size += 1 + 4;
171 | }
172 | return size;
173 | }
174 |
175 | public void MergeFrom(pb::CodedInputStream input) {
176 | x_ = 0f;
177 | y_ = 0f;
178 | z_ = 0f;
179 | w_ = 0f;
180 | uint tag;
181 | while ((tag = input.ReadTag()) != 0) {
182 | switch(tag) {
183 | default:
184 | input.SkipLastField();
185 | break;
186 | case 13: {
187 | X = input.ReadFloat();
188 | break;
189 | }
190 | case 21: {
191 | Y = input.ReadFloat();
192 | break;
193 | }
194 | case 29: {
195 | Z = input.ReadFloat();
196 | break;
197 | }
198 | case 37: {
199 | W = input.ReadFloat();
200 | break;
201 | }
202 | }
203 | }
204 | }
205 |
206 | }
207 |
208 | ///
209 | /// 变换信息
210 | ///
211 | public partial class TransformInfo : pb::IMessage {
212 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (TransformInfo)MessagePool.Instance.Fetch(typeof(TransformInfo)));
213 | public static pb::MessageParser Parser { get { return _parser; } }
214 |
215 | private int rpcId_;
216 | public int RpcId {
217 | get { return rpcId_; }
218 | set {
219 | rpcId_ = value;
220 | }
221 | }
222 |
223 | private global::Secode.Network.Vector3Info position_;
224 | ///
225 | /// 位置
226 | ///
227 | public global::Secode.Network.Vector3Info Position {
228 | get { return position_; }
229 | set {
230 | position_ = value;
231 | }
232 | }
233 |
234 | private global::Secode.Network.QuaternionInfo rotation_;
235 | ///
236 | /// 旋转
237 | ///
238 | public global::Secode.Network.QuaternionInfo Rotation {
239 | get { return rotation_; }
240 | set {
241 | rotation_ = value;
242 | }
243 | }
244 |
245 | private global::Secode.Network.Vector3Info scale_;
246 | ///
247 | /// 放缩
248 | ///
249 | public global::Secode.Network.Vector3Info Scale {
250 | get { return scale_; }
251 | set {
252 | scale_ = value;
253 | }
254 | }
255 |
256 | public void WriteTo(pb::CodedOutputStream output) {
257 | if (position_ != null) {
258 | output.WriteRawTag(10);
259 | output.WriteMessage(Position);
260 | }
261 | if (rotation_ != null) {
262 | output.WriteRawTag(18);
263 | output.WriteMessage(Rotation);
264 | }
265 | if (scale_ != null) {
266 | output.WriteRawTag(26);
267 | output.WriteMessage(Scale);
268 | }
269 | if (RpcId != 0) {
270 | output.WriteRawTag(208, 5);
271 | output.WriteInt32(RpcId);
272 | }
273 | }
274 |
275 | public int CalculateSize() {
276 | int size = 0;
277 | if (RpcId != 0) {
278 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
279 | }
280 | if (position_ != null) {
281 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Position);
282 | }
283 | if (rotation_ != null) {
284 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Rotation);
285 | }
286 | if (scale_ != null) {
287 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Scale);
288 | }
289 | return size;
290 | }
291 |
292 | public void MergeFrom(pb::CodedInputStream input) {
293 | if (position_ != null) MessagePool.Instance.Recycle(position_); position_ = null;
294 | if (rotation_ != null) MessagePool.Instance.Recycle(rotation_); rotation_ = null;
295 | if (scale_ != null) MessagePool.Instance.Recycle(scale_); scale_ = null;
296 | rpcId_ = 0;
297 | uint tag;
298 | while ((tag = input.ReadTag()) != 0) {
299 | switch(tag) {
300 | default:
301 | input.SkipLastField();
302 | break;
303 | case 10: {
304 | if (position_ == null) {
305 | position_ = new global::Secode.Network.Vector3Info();
306 | }
307 | input.ReadMessage(position_);
308 | break;
309 | }
310 | case 18: {
311 | if (rotation_ == null) {
312 | rotation_ = new global::Secode.Network.QuaternionInfo();
313 | }
314 | input.ReadMessage(rotation_);
315 | break;
316 | }
317 | case 26: {
318 | if (scale_ == null) {
319 | scale_ = new global::Secode.Network.Vector3Info();
320 | }
321 | input.ReadMessage(scale_);
322 | break;
323 | }
324 | case 720: {
325 | RpcId = input.ReadInt32();
326 | break;
327 | }
328 | }
329 | }
330 | }
331 |
332 | }
333 |
334 | ///
335 | /// 无放缩变换信息
336 | ///
337 | public partial class TransformInfoNoScale : pb::IMessage {
338 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (TransformInfoNoScale)MessagePool.Instance.Fetch(typeof(TransformInfoNoScale)));
339 | public static pb::MessageParser Parser { get { return _parser; } }
340 |
341 | private int rpcId_;
342 | public int RpcId {
343 | get { return rpcId_; }
344 | set {
345 | rpcId_ = value;
346 | }
347 | }
348 |
349 | private global::Secode.Network.Vector3Info position_;
350 | ///
351 | /// 位置
352 | ///
353 | public global::Secode.Network.Vector3Info Position {
354 | get { return position_; }
355 | set {
356 | position_ = value;
357 | }
358 | }
359 |
360 | private global::Secode.Network.QuaternionInfo rotation_;
361 | ///
362 | /// 旋转
363 | ///
364 | public global::Secode.Network.QuaternionInfo Rotation {
365 | get { return rotation_; }
366 | set {
367 | rotation_ = value;
368 | }
369 | }
370 |
371 | public void WriteTo(pb::CodedOutputStream output) {
372 | if (position_ != null) {
373 | output.WriteRawTag(10);
374 | output.WriteMessage(Position);
375 | }
376 | if (rotation_ != null) {
377 | output.WriteRawTag(18);
378 | output.WriteMessage(Rotation);
379 | }
380 | if (RpcId != 0) {
381 | output.WriteRawTag(208, 5);
382 | output.WriteInt32(RpcId);
383 | }
384 | }
385 |
386 | public int CalculateSize() {
387 | int size = 0;
388 | if (RpcId != 0) {
389 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
390 | }
391 | if (position_ != null) {
392 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Position);
393 | }
394 | if (rotation_ != null) {
395 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Rotation);
396 | }
397 | return size;
398 | }
399 |
400 | public void MergeFrom(pb::CodedInputStream input) {
401 | if (position_ != null) MessagePool.Instance.Recycle(position_); position_ = null;
402 | if (rotation_ != null) MessagePool.Instance.Recycle(rotation_); rotation_ = null;
403 | rpcId_ = 0;
404 | uint tag;
405 | while ((tag = input.ReadTag()) != 0) {
406 | switch(tag) {
407 | default:
408 | input.SkipLastField();
409 | break;
410 | case 10: {
411 | if (position_ == null) {
412 | position_ = new global::Secode.Network.Vector3Info();
413 | }
414 | input.ReadMessage(position_);
415 | break;
416 | }
417 | case 18: {
418 | if (rotation_ == null) {
419 | rotation_ = new global::Secode.Network.QuaternionInfo();
420 | }
421 | input.ReadMessage(rotation_);
422 | break;
423 | }
424 | case 720: {
425 | RpcId = input.ReadInt32();
426 | break;
427 | }
428 | }
429 | }
430 | }
431 |
432 | }
433 |
434 | ///
435 | /// VR角色信息
436 | ///
437 | public partial class PlayerInfo : pb::IMessage {
438 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (PlayerInfo)MessagePool.Instance.Fetch(typeof(PlayerInfo)));
439 | public static pb::MessageParser Parser { get { return _parser; } }
440 |
441 | private int rpcId_;
442 | public int RpcId {
443 | get { return rpcId_; }
444 | set {
445 | rpcId_ = value;
446 | }
447 | }
448 |
449 | private long playerId_;
450 | ///
451 | /// 玩家的临时ID
452 | ///
453 | public long PlayerId {
454 | get { return playerId_; }
455 | set {
456 | playerId_ = value;
457 | }
458 | }
459 |
460 | private global::Secode.Network.TransformInfoNoScale head_;
461 | ///
462 | /// 头盔
463 | ///
464 | public global::Secode.Network.TransformInfoNoScale Head {
465 | get { return head_; }
466 | set {
467 | head_ = value;
468 | }
469 | }
470 |
471 | private global::Secode.Network.TransformInfoNoScale leftHand_;
472 | ///
473 | /// 左手手柄
474 | ///
475 | public global::Secode.Network.TransformInfoNoScale LeftHand {
476 | get { return leftHand_; }
477 | set {
478 | leftHand_ = value;
479 | }
480 | }
481 |
482 | private global::Secode.Network.TransformInfoNoScale rightHand_;
483 | ///
484 | /// 右手手柄
485 | ///
486 | public global::Secode.Network.TransformInfoNoScale RightHand {
487 | get { return rightHand_; }
488 | set {
489 | rightHand_ = value;
490 | }
491 | }
492 |
493 | public void WriteTo(pb::CodedOutputStream output) {
494 | if (PlayerId != 0L) {
495 | output.WriteRawTag(8);
496 | output.WriteInt64(PlayerId);
497 | }
498 | if (head_ != null) {
499 | output.WriteRawTag(18);
500 | output.WriteMessage(Head);
501 | }
502 | if (leftHand_ != null) {
503 | output.WriteRawTag(26);
504 | output.WriteMessage(LeftHand);
505 | }
506 | if (rightHand_ != null) {
507 | output.WriteRawTag(34);
508 | output.WriteMessage(RightHand);
509 | }
510 | if (RpcId != 0) {
511 | output.WriteRawTag(208, 5);
512 | output.WriteInt32(RpcId);
513 | }
514 | }
515 |
516 | public int CalculateSize() {
517 | int size = 0;
518 | if (RpcId != 0) {
519 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
520 | }
521 | if (PlayerId != 0L) {
522 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(PlayerId);
523 | }
524 | if (head_ != null) {
525 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(Head);
526 | }
527 | if (leftHand_ != null) {
528 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(LeftHand);
529 | }
530 | if (rightHand_ != null) {
531 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(RightHand);
532 | }
533 | return size;
534 | }
535 |
536 | public void MergeFrom(pb::CodedInputStream input) {
537 | playerId_ = 0;
538 | if (head_ != null) MessagePool.Instance.Recycle(head_); head_ = null;
539 | if (leftHand_ != null) MessagePool.Instance.Recycle(leftHand_); leftHand_ = null;
540 | if (rightHand_ != null) MessagePool.Instance.Recycle(rightHand_); rightHand_ = null;
541 | rpcId_ = 0;
542 | uint tag;
543 | while ((tag = input.ReadTag()) != 0) {
544 | switch(tag) {
545 | default:
546 | input.SkipLastField();
547 | break;
548 | case 8: {
549 | PlayerId = input.ReadInt64();
550 | break;
551 | }
552 | case 18: {
553 | if (head_ == null) {
554 | head_ = new global::Secode.Network.TransformInfoNoScale();
555 | }
556 | input.ReadMessage(head_);
557 | break;
558 | }
559 | case 26: {
560 | if (leftHand_ == null) {
561 | leftHand_ = new global::Secode.Network.TransformInfoNoScale();
562 | }
563 | input.ReadMessage(leftHand_);
564 | break;
565 | }
566 | case 34: {
567 | if (rightHand_ == null) {
568 | rightHand_ = new global::Secode.Network.TransformInfoNoScale();
569 | }
570 | input.ReadMessage(rightHand_);
571 | break;
572 | }
573 | case 720: {
574 | RpcId = input.ReadInt32();
575 | break;
576 | }
577 | }
578 | }
579 | }
580 |
581 | }
582 |
583 | ///
584 | /// 登录请求信息
585 | ///
586 | public partial class C2R_Login : pb::IMessage {
587 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2R_Login)MessagePool.Instance.Fetch(typeof(C2R_Login)));
588 | public static pb::MessageParser Parser { get { return _parser; } }
589 |
590 | private int rpcId_;
591 | public int RpcId {
592 | get { return rpcId_; }
593 | set {
594 | rpcId_ = value;
595 | }
596 | }
597 |
598 | private string userID_ = "";
599 | ///
600 | /// 帐号
601 | ///
602 | public string UserID {
603 | get { return userID_; }
604 | set {
605 | userID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
606 | }
607 | }
608 |
609 | private string password_ = "";
610 | ///
611 | /// 密码
612 | ///
613 | public string Password {
614 | get { return password_; }
615 | set {
616 | password_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
617 | }
618 | }
619 |
620 | public void WriteTo(pb::CodedOutputStream output) {
621 | if (UserID.Length != 0) {
622 | output.WriteRawTag(10);
623 | output.WriteString(UserID);
624 | }
625 | if (Password.Length != 0) {
626 | output.WriteRawTag(18);
627 | output.WriteString(Password);
628 | }
629 | if (RpcId != 0) {
630 | output.WriteRawTag(208, 5);
631 | output.WriteInt32(RpcId);
632 | }
633 | }
634 |
635 | public int CalculateSize() {
636 | int size = 0;
637 | if (RpcId != 0) {
638 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
639 | }
640 | if (UserID.Length != 0) {
641 | size += 1 + pb::CodedOutputStream.ComputeStringSize(UserID);
642 | }
643 | if (Password.Length != 0) {
644 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Password);
645 | }
646 | return size;
647 | }
648 |
649 | public void MergeFrom(pb::CodedInputStream input) {
650 | userID_ = "";
651 | password_ = "";
652 | rpcId_ = 0;
653 | uint tag;
654 | while ((tag = input.ReadTag()) != 0) {
655 | switch(tag) {
656 | default:
657 | input.SkipLastField();
658 | break;
659 | case 10: {
660 | UserID = input.ReadString();
661 | break;
662 | }
663 | case 18: {
664 | Password = input.ReadString();
665 | break;
666 | }
667 | case 720: {
668 | RpcId = input.ReadInt32();
669 | break;
670 | }
671 | }
672 | }
673 | }
674 |
675 | }
676 |
677 | ///
678 | /// 登录回传信息
679 | ///
680 | public partial class R2C_Login : pb::IMessage {
681 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (R2C_Login)MessagePool.Instance.Fetch(typeof(R2C_Login)));
682 | public static pb::MessageParser Parser { get { return _parser; } }
683 |
684 | private int rpcId_;
685 | public int RpcId {
686 | get { return rpcId_; }
687 | set {
688 | rpcId_ = value;
689 | }
690 | }
691 |
692 | private int error_;
693 | public int Error {
694 | get { return error_; }
695 | set {
696 | error_ = value;
697 | }
698 | }
699 |
700 | private string message_ = "";
701 | public string Message {
702 | get { return message_; }
703 | set {
704 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
705 | }
706 | }
707 |
708 | private long key_;
709 | ///
710 | /// 连接钥匙
711 | ///
712 | public long Key {
713 | get { return key_; }
714 | set {
715 | key_ = value;
716 | }
717 | }
718 |
719 | private static readonly pb::FieldCodec _repeated_gates_codec
720 | = pb::FieldCodec.ForString(18);
721 | private pbc::RepeatedField gates_ = new pbc::RepeatedField();
722 | ///
723 | /// 房间门列表
724 | ///
725 | public pbc::RepeatedField Gates {
726 | get { return gates_; }
727 | set { gates_ = value; }
728 | }
729 |
730 | public void WriteTo(pb::CodedOutputStream output) {
731 | if (Key != 0L) {
732 | output.WriteRawTag(8);
733 | output.WriteInt64(Key);
734 | }
735 | gates_.WriteTo(output, _repeated_gates_codec);
736 | if (RpcId != 0) {
737 | output.WriteRawTag(208, 5);
738 | output.WriteInt32(RpcId);
739 | }
740 | if (Error != 0) {
741 | output.WriteRawTag(216, 5);
742 | output.WriteInt32(Error);
743 | }
744 | if (Message.Length != 0) {
745 | output.WriteRawTag(226, 5);
746 | output.WriteString(Message);
747 | }
748 | }
749 |
750 | public int CalculateSize() {
751 | int size = 0;
752 | if (RpcId != 0) {
753 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
754 | }
755 | if (Error != 0) {
756 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
757 | }
758 | if (Message.Length != 0) {
759 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
760 | }
761 | if (Key != 0L) {
762 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(Key);
763 | }
764 | size += gates_.CalculateSize(_repeated_gates_codec);
765 | return size;
766 | }
767 |
768 | public void MergeFrom(pb::CodedInputStream input) {
769 | key_ = 0;
770 | gates_.Clear();
771 | rpcId_ = 0;
772 | error_ = 0;
773 | message_ = "";
774 | uint tag;
775 | while ((tag = input.ReadTag()) != 0) {
776 | switch(tag) {
777 | default:
778 | input.SkipLastField();
779 | break;
780 | case 8: {
781 | Key = input.ReadInt64();
782 | break;
783 | }
784 | case 18: {
785 | gates_.AddEntriesFrom(input, _repeated_gates_codec);
786 | break;
787 | }
788 | case 720: {
789 | RpcId = input.ReadInt32();
790 | break;
791 | }
792 | case 728: {
793 | Error = input.ReadInt32();
794 | break;
795 | }
796 | case 738: {
797 | Message = input.ReadString();
798 | break;
799 | }
800 | }
801 | }
802 | }
803 |
804 | }
805 |
806 | ///
807 | /// 新建房间
808 | ///
809 | public partial class C2R_NewGate : pb::IMessage {
810 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2R_NewGate)MessagePool.Instance.Fetch(typeof(C2R_NewGate)));
811 | public static pb::MessageParser Parser { get { return _parser; } }
812 |
813 | private int rpcId_;
814 | public int RpcId {
815 | get { return rpcId_; }
816 | set {
817 | rpcId_ = value;
818 | }
819 | }
820 |
821 | private long key_;
822 | ///
823 | /// 连接钥匙
824 | ///
825 | public long Key {
826 | get { return key_; }
827 | set {
828 | key_ = value;
829 | }
830 | }
831 |
832 | private string name_ = "";
833 | ///
834 | /// 房间名称
835 | ///
836 | public string Name {
837 | get { return name_; }
838 | set {
839 | name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
840 | }
841 | }
842 |
843 | private string secretKey_ = "";
844 | ///
845 | /// 授权钥匙
846 | ///
847 | public string SecretKey {
848 | get { return secretKey_; }
849 | set {
850 | secretKey_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
851 | }
852 | }
853 |
854 | public void WriteTo(pb::CodedOutputStream output) {
855 | if (Key != 0L) {
856 | output.WriteRawTag(8);
857 | output.WriteInt64(Key);
858 | }
859 | if (Name.Length != 0) {
860 | output.WriteRawTag(18);
861 | output.WriteString(Name);
862 | }
863 | if (SecretKey.Length != 0) {
864 | output.WriteRawTag(26);
865 | output.WriteString(SecretKey);
866 | }
867 | if (RpcId != 0) {
868 | output.WriteRawTag(208, 5);
869 | output.WriteInt32(RpcId);
870 | }
871 | }
872 |
873 | public int CalculateSize() {
874 | int size = 0;
875 | if (RpcId != 0) {
876 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
877 | }
878 | if (Key != 0L) {
879 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(Key);
880 | }
881 | if (Name.Length != 0) {
882 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
883 | }
884 | if (SecretKey.Length != 0) {
885 | size += 1 + pb::CodedOutputStream.ComputeStringSize(SecretKey);
886 | }
887 | return size;
888 | }
889 |
890 | public void MergeFrom(pb::CodedInputStream input) {
891 | key_ = 0;
892 | name_ = "";
893 | secretKey_ = "";
894 | rpcId_ = 0;
895 | uint tag;
896 | while ((tag = input.ReadTag()) != 0) {
897 | switch(tag) {
898 | default:
899 | input.SkipLastField();
900 | break;
901 | case 8: {
902 | Key = input.ReadInt64();
903 | break;
904 | }
905 | case 18: {
906 | Name = input.ReadString();
907 | break;
908 | }
909 | case 26: {
910 | SecretKey = input.ReadString();
911 | break;
912 | }
913 | case 720: {
914 | RpcId = input.ReadInt32();
915 | break;
916 | }
917 | }
918 | }
919 | }
920 |
921 | }
922 |
923 | ///
924 | /// 新建房间回传信息
925 | ///
926 | public partial class R2C_NewGate : pb::IMessage {
927 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (R2C_NewGate)MessagePool.Instance.Fetch(typeof(R2C_NewGate)));
928 | public static pb::MessageParser Parser { get { return _parser; } }
929 |
930 | private int rpcId_;
931 | public int RpcId {
932 | get { return rpcId_; }
933 | set {
934 | rpcId_ = value;
935 | }
936 | }
937 |
938 | private int error_;
939 | public int Error {
940 | get { return error_; }
941 | set {
942 | error_ = value;
943 | }
944 | }
945 |
946 | private string message_ = "";
947 | public string Message {
948 | get { return message_; }
949 | set {
950 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
951 | }
952 | }
953 |
954 | private string gate_ = "";
955 | ///
956 | /// 房间门
957 | ///
958 | public string Gate {
959 | get { return gate_; }
960 | set {
961 | gate_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
962 | }
963 | }
964 |
965 | public void WriteTo(pb::CodedOutputStream output) {
966 | if (Gate.Length != 0) {
967 | output.WriteRawTag(10);
968 | output.WriteString(Gate);
969 | }
970 | if (RpcId != 0) {
971 | output.WriteRawTag(208, 5);
972 | output.WriteInt32(RpcId);
973 | }
974 | if (Error != 0) {
975 | output.WriteRawTag(216, 5);
976 | output.WriteInt32(Error);
977 | }
978 | if (Message.Length != 0) {
979 | output.WriteRawTag(226, 5);
980 | output.WriteString(Message);
981 | }
982 | }
983 |
984 | public int CalculateSize() {
985 | int size = 0;
986 | if (RpcId != 0) {
987 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
988 | }
989 | if (Error != 0) {
990 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
991 | }
992 | if (Message.Length != 0) {
993 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
994 | }
995 | if (Gate.Length != 0) {
996 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Gate);
997 | }
998 | return size;
999 | }
1000 |
1001 | public void MergeFrom(pb::CodedInputStream input) {
1002 | gate_ = "";
1003 | rpcId_ = 0;
1004 | error_ = 0;
1005 | message_ = "";
1006 | uint tag;
1007 | while ((tag = input.ReadTag()) != 0) {
1008 | switch(tag) {
1009 | default:
1010 | input.SkipLastField();
1011 | break;
1012 | case 10: {
1013 | Gate = input.ReadString();
1014 | break;
1015 | }
1016 | case 720: {
1017 | RpcId = input.ReadInt32();
1018 | break;
1019 | }
1020 | case 728: {
1021 | Error = input.ReadInt32();
1022 | break;
1023 | }
1024 | case 738: {
1025 | Message = input.ReadString();
1026 | break;
1027 | }
1028 | }
1029 | }
1030 | }
1031 |
1032 | }
1033 |
1034 | ///
1035 | /// 连接房间信息
1036 | ///
1037 | public partial class C2G_Link : pb::IMessage {
1038 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2G_Link)MessagePool.Instance.Fetch(typeof(C2G_Link)));
1039 | public static pb::MessageParser Parser { get { return _parser; } }
1040 |
1041 | private int rpcId_;
1042 | public int RpcId {
1043 | get { return rpcId_; }
1044 | set {
1045 | rpcId_ = value;
1046 | }
1047 | }
1048 |
1049 | private long key_;
1050 | ///
1051 | /// 连接钥匙
1052 | ///
1053 | public long Key {
1054 | get { return key_; }
1055 | set {
1056 | key_ = value;
1057 | }
1058 | }
1059 |
1060 | private string gate_ = "";
1061 | ///
1062 | /// 房间门
1063 | ///
1064 | public string Gate {
1065 | get { return gate_; }
1066 | set {
1067 | gate_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
1068 | }
1069 | }
1070 |
1071 | public void WriteTo(pb::CodedOutputStream output) {
1072 | if (Key != 0L) {
1073 | output.WriteRawTag(8);
1074 | output.WriteInt64(Key);
1075 | }
1076 | if (Gate.Length != 0) {
1077 | output.WriteRawTag(18);
1078 | output.WriteString(Gate);
1079 | }
1080 | if (RpcId != 0) {
1081 | output.WriteRawTag(208, 5);
1082 | output.WriteInt32(RpcId);
1083 | }
1084 | }
1085 |
1086 | public int CalculateSize() {
1087 | int size = 0;
1088 | if (RpcId != 0) {
1089 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1090 | }
1091 | if (Key != 0L) {
1092 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(Key);
1093 | }
1094 | if (Gate.Length != 0) {
1095 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Gate);
1096 | }
1097 | return size;
1098 | }
1099 |
1100 | public void MergeFrom(pb::CodedInputStream input) {
1101 | key_ = 0;
1102 | gate_ = "";
1103 | rpcId_ = 0;
1104 | uint tag;
1105 | while ((tag = input.ReadTag()) != 0) {
1106 | switch(tag) {
1107 | default:
1108 | input.SkipLastField();
1109 | break;
1110 | case 8: {
1111 | Key = input.ReadInt64();
1112 | break;
1113 | }
1114 | case 18: {
1115 | Gate = input.ReadString();
1116 | break;
1117 | }
1118 | case 720: {
1119 | RpcId = input.ReadInt32();
1120 | break;
1121 | }
1122 | }
1123 | }
1124 | }
1125 |
1126 | }
1127 |
1128 | ///
1129 | /// 房间连接回传信息
1130 | ///
1131 | public partial class G2C_Link : pb::IMessage {
1132 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (G2C_Link)MessagePool.Instance.Fetch(typeof(G2C_Link)));
1133 | public static pb::MessageParser Parser { get { return _parser; } }
1134 |
1135 | private int rpcId_;
1136 | public int RpcId {
1137 | get { return rpcId_; }
1138 | set {
1139 | rpcId_ = value;
1140 | }
1141 | }
1142 |
1143 | private int error_;
1144 | public int Error {
1145 | get { return error_; }
1146 | set {
1147 | error_ = value;
1148 | }
1149 | }
1150 |
1151 | private string message_ = "";
1152 | public string Message {
1153 | get { return message_; }
1154 | set {
1155 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
1156 | }
1157 | }
1158 |
1159 | private long playerId_;
1160 | ///
1161 | /// 玩家的临时ID
1162 | ///
1163 | public long PlayerId {
1164 | get { return playerId_; }
1165 | set {
1166 | playerId_ = value;
1167 | }
1168 | }
1169 |
1170 | public void WriteTo(pb::CodedOutputStream output) {
1171 | if (PlayerId != 0L) {
1172 | output.WriteRawTag(8);
1173 | output.WriteInt64(PlayerId);
1174 | }
1175 | if (RpcId != 0) {
1176 | output.WriteRawTag(208, 5);
1177 | output.WriteInt32(RpcId);
1178 | }
1179 | if (Error != 0) {
1180 | output.WriteRawTag(216, 5);
1181 | output.WriteInt32(Error);
1182 | }
1183 | if (Message.Length != 0) {
1184 | output.WriteRawTag(226, 5);
1185 | output.WriteString(Message);
1186 | }
1187 | }
1188 |
1189 | public int CalculateSize() {
1190 | int size = 0;
1191 | if (RpcId != 0) {
1192 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1193 | }
1194 | if (Error != 0) {
1195 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
1196 | }
1197 | if (Message.Length != 0) {
1198 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
1199 | }
1200 | if (PlayerId != 0L) {
1201 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(PlayerId);
1202 | }
1203 | return size;
1204 | }
1205 |
1206 | public void MergeFrom(pb::CodedInputStream input) {
1207 | playerId_ = 0;
1208 | rpcId_ = 0;
1209 | error_ = 0;
1210 | message_ = "";
1211 | uint tag;
1212 | while ((tag = input.ReadTag()) != 0) {
1213 | switch(tag) {
1214 | default:
1215 | input.SkipLastField();
1216 | break;
1217 | case 8: {
1218 | PlayerId = input.ReadInt64();
1219 | break;
1220 | }
1221 | case 720: {
1222 | RpcId = input.ReadInt32();
1223 | break;
1224 | }
1225 | case 728: {
1226 | Error = input.ReadInt32();
1227 | break;
1228 | }
1229 | case 738: {
1230 | Message = input.ReadString();
1231 | break;
1232 | }
1233 | }
1234 | }
1235 | }
1236 |
1237 | }
1238 |
1239 | ///
1240 | /// 请求用户信息
1241 | ///
1242 | public partial class C2G_Info : pb::IMessage {
1243 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2G_Info)MessagePool.Instance.Fetch(typeof(C2G_Info)));
1244 | public static pb::MessageParser Parser { get { return _parser; } }
1245 |
1246 | private int rpcId_;
1247 | public int RpcId {
1248 | get { return rpcId_; }
1249 | set {
1250 | rpcId_ = value;
1251 | }
1252 | }
1253 |
1254 | private long playerId_;
1255 | ///
1256 | /// 玩家的临时ID
1257 | ///
1258 | public long PlayerId {
1259 | get { return playerId_; }
1260 | set {
1261 | playerId_ = value;
1262 | }
1263 | }
1264 |
1265 | public void WriteTo(pb::CodedOutputStream output) {
1266 | if (PlayerId != 0L) {
1267 | output.WriteRawTag(8);
1268 | output.WriteInt64(PlayerId);
1269 | }
1270 | if (RpcId != 0) {
1271 | output.WriteRawTag(208, 5);
1272 | output.WriteInt32(RpcId);
1273 | }
1274 | }
1275 |
1276 | public int CalculateSize() {
1277 | int size = 0;
1278 | if (RpcId != 0) {
1279 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1280 | }
1281 | if (PlayerId != 0L) {
1282 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(PlayerId);
1283 | }
1284 | return size;
1285 | }
1286 |
1287 | public void MergeFrom(pb::CodedInputStream input) {
1288 | playerId_ = 0;
1289 | rpcId_ = 0;
1290 | uint tag;
1291 | while ((tag = input.ReadTag()) != 0) {
1292 | switch(tag) {
1293 | default:
1294 | input.SkipLastField();
1295 | break;
1296 | case 8: {
1297 | PlayerId = input.ReadInt64();
1298 | break;
1299 | }
1300 | case 720: {
1301 | RpcId = input.ReadInt32();
1302 | break;
1303 | }
1304 | }
1305 | }
1306 | }
1307 |
1308 | }
1309 |
1310 | ///
1311 | /// 用户信息回传
1312 | ///
1313 | public partial class G2C_Info : pb::IMessage {
1314 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (G2C_Info)MessagePool.Instance.Fetch(typeof(G2C_Info)));
1315 | public static pb::MessageParser Parser { get { return _parser; } }
1316 |
1317 | private int rpcId_;
1318 | public int RpcId {
1319 | get { return rpcId_; }
1320 | set {
1321 | rpcId_ = value;
1322 | }
1323 | }
1324 |
1325 | private int error_;
1326 | public int Error {
1327 | get { return error_; }
1328 | set {
1329 | error_ = value;
1330 | }
1331 | }
1332 |
1333 | private string message_ = "";
1334 | public string Message {
1335 | get { return message_; }
1336 | set {
1337 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
1338 | }
1339 | }
1340 |
1341 | private global::Secode.Network.PlayerInfo playerInfo_;
1342 | ///
1343 | /// 玩家数据
1344 | ///
1345 | public global::Secode.Network.PlayerInfo PlayerInfo {
1346 | get { return playerInfo_; }
1347 | set {
1348 | playerInfo_ = value;
1349 | }
1350 | }
1351 |
1352 | public void WriteTo(pb::CodedOutputStream output) {
1353 | if (playerInfo_ != null) {
1354 | output.WriteRawTag(10);
1355 | output.WriteMessage(PlayerInfo);
1356 | }
1357 | if (RpcId != 0) {
1358 | output.WriteRawTag(208, 5);
1359 | output.WriteInt32(RpcId);
1360 | }
1361 | if (Error != 0) {
1362 | output.WriteRawTag(216, 5);
1363 | output.WriteInt32(Error);
1364 | }
1365 | if (Message.Length != 0) {
1366 | output.WriteRawTag(226, 5);
1367 | output.WriteString(Message);
1368 | }
1369 | }
1370 |
1371 | public int CalculateSize() {
1372 | int size = 0;
1373 | if (RpcId != 0) {
1374 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1375 | }
1376 | if (Error != 0) {
1377 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
1378 | }
1379 | if (Message.Length != 0) {
1380 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
1381 | }
1382 | if (playerInfo_ != null) {
1383 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(PlayerInfo);
1384 | }
1385 | return size;
1386 | }
1387 |
1388 | public void MergeFrom(pb::CodedInputStream input) {
1389 | if (playerInfo_ != null) MessagePool.Instance.Recycle(playerInfo_); playerInfo_ = null;
1390 | rpcId_ = 0;
1391 | error_ = 0;
1392 | message_ = "";
1393 | uint tag;
1394 | while ((tag = input.ReadTag()) != 0) {
1395 | switch(tag) {
1396 | default:
1397 | input.SkipLastField();
1398 | break;
1399 | case 10: {
1400 | if (playerInfo_ == null) {
1401 | playerInfo_ = new global::Secode.Network.PlayerInfo();
1402 | }
1403 | input.ReadMessage(playerInfo_);
1404 | break;
1405 | }
1406 | case 720: {
1407 | RpcId = input.ReadInt32();
1408 | break;
1409 | }
1410 | case 728: {
1411 | Error = input.ReadInt32();
1412 | break;
1413 | }
1414 | case 738: {
1415 | Message = input.ReadString();
1416 | break;
1417 | }
1418 | }
1419 | }
1420 | }
1421 |
1422 | }
1423 |
1424 | ///
1425 | /// 请求用户列表
1426 | ///
1427 | public partial class C2G_Players : pb::IMessage {
1428 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2G_Players)MessagePool.Instance.Fetch(typeof(C2G_Players)));
1429 | public static pb::MessageParser Parser { get { return _parser; } }
1430 |
1431 | private int rpcId_;
1432 | public int RpcId {
1433 | get { return rpcId_; }
1434 | set {
1435 | rpcId_ = value;
1436 | }
1437 | }
1438 |
1439 | private long playerId_;
1440 | ///
1441 | /// 玩家的临时ID
1442 | ///
1443 | public long PlayerId {
1444 | get { return playerId_; }
1445 | set {
1446 | playerId_ = value;
1447 | }
1448 | }
1449 |
1450 | public void WriteTo(pb::CodedOutputStream output) {
1451 | if (PlayerId != 0L) {
1452 | output.WriteRawTag(8);
1453 | output.WriteInt64(PlayerId);
1454 | }
1455 | if (RpcId != 0) {
1456 | output.WriteRawTag(208, 5);
1457 | output.WriteInt32(RpcId);
1458 | }
1459 | }
1460 |
1461 | public int CalculateSize() {
1462 | int size = 0;
1463 | if (RpcId != 0) {
1464 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1465 | }
1466 | if (PlayerId != 0L) {
1467 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(PlayerId);
1468 | }
1469 | return size;
1470 | }
1471 |
1472 | public void MergeFrom(pb::CodedInputStream input) {
1473 | playerId_ = 0;
1474 | rpcId_ = 0;
1475 | uint tag;
1476 | while ((tag = input.ReadTag()) != 0) {
1477 | switch(tag) {
1478 | default:
1479 | input.SkipLastField();
1480 | break;
1481 | case 8: {
1482 | PlayerId = input.ReadInt64();
1483 | break;
1484 | }
1485 | case 720: {
1486 | RpcId = input.ReadInt32();
1487 | break;
1488 | }
1489 | }
1490 | }
1491 | }
1492 |
1493 | }
1494 |
1495 | ///
1496 | /// 用户列表回传
1497 | ///
1498 | public partial class G2C_Players : pb::IMessage {
1499 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (G2C_Players)MessagePool.Instance.Fetch(typeof(G2C_Players)));
1500 | public static pb::MessageParser Parser { get { return _parser; } }
1501 |
1502 | private int rpcId_;
1503 | public int RpcId {
1504 | get { return rpcId_; }
1505 | set {
1506 | rpcId_ = value;
1507 | }
1508 | }
1509 |
1510 | private int error_;
1511 | public int Error {
1512 | get { return error_; }
1513 | set {
1514 | error_ = value;
1515 | }
1516 | }
1517 |
1518 | private string message_ = "";
1519 | public string Message {
1520 | get { return message_; }
1521 | set {
1522 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
1523 | }
1524 | }
1525 |
1526 | private static readonly pb::FieldCodec _repeated_playerId_codec
1527 | = pb::FieldCodec.ForInt64(10);
1528 | private pbc::RepeatedField playerId_ = new pbc::RepeatedField();
1529 | ///
1530 | /// 玩家的临时ID列表
1531 | ///
1532 | public pbc::RepeatedField PlayerId {
1533 | get { return playerId_; }
1534 | set { playerId_ = value; }
1535 | }
1536 |
1537 | public void WriteTo(pb::CodedOutputStream output) {
1538 | playerId_.WriteTo(output, _repeated_playerId_codec);
1539 | if (RpcId != 0) {
1540 | output.WriteRawTag(208, 5);
1541 | output.WriteInt32(RpcId);
1542 | }
1543 | if (Error != 0) {
1544 | output.WriteRawTag(216, 5);
1545 | output.WriteInt32(Error);
1546 | }
1547 | if (Message.Length != 0) {
1548 | output.WriteRawTag(226, 5);
1549 | output.WriteString(Message);
1550 | }
1551 | }
1552 |
1553 | public int CalculateSize() {
1554 | int size = 0;
1555 | if (RpcId != 0) {
1556 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1557 | }
1558 | if (Error != 0) {
1559 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
1560 | }
1561 | if (Message.Length != 0) {
1562 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
1563 | }
1564 | size += playerId_.CalculateSize(_repeated_playerId_codec);
1565 | return size;
1566 | }
1567 |
1568 | public void MergeFrom(pb::CodedInputStream input) {
1569 | playerId_.Clear();
1570 | rpcId_ = 0;
1571 | error_ = 0;
1572 | message_ = "";
1573 | uint tag;
1574 | while ((tag = input.ReadTag()) != 0) {
1575 | switch(tag) {
1576 | default:
1577 | input.SkipLastField();
1578 | break;
1579 | case 10:
1580 | case 8: {
1581 | playerId_.AddEntriesFrom(input, _repeated_playerId_codec);
1582 | break;
1583 | }
1584 | case 720: {
1585 | RpcId = input.ReadInt32();
1586 | break;
1587 | }
1588 | case 728: {
1589 | Error = input.ReadInt32();
1590 | break;
1591 | }
1592 | case 738: {
1593 | Message = input.ReadString();
1594 | break;
1595 | }
1596 | }
1597 | }
1598 | }
1599 |
1600 | }
1601 |
1602 | ///
1603 | /// 用户移动消息
1604 | ///
1605 | public partial class Frame_PlayerMove : pb::IMessage {
1606 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Frame_PlayerMove)MessagePool.Instance.Fetch(typeof(Frame_PlayerMove)));
1607 | public static pb::MessageParser Parser { get { return _parser; } }
1608 |
1609 | private int rpcId_;
1610 | public int RpcId {
1611 | get { return rpcId_; }
1612 | set {
1613 | rpcId_ = value;
1614 | }
1615 | }
1616 |
1617 | private long id_;
1618 | public long Id {
1619 | get { return id_; }
1620 | set {
1621 | id_ = value;
1622 | }
1623 | }
1624 |
1625 | private global::Secode.Network.PlayerInfo playerInfo_;
1626 | public global::Secode.Network.PlayerInfo PlayerInfo {
1627 | get { return playerInfo_; }
1628 | set {
1629 | playerInfo_ = value;
1630 | }
1631 | }
1632 |
1633 | public void WriteTo(pb::CodedOutputStream output) {
1634 | if (playerInfo_ != null) {
1635 | output.WriteRawTag(10);
1636 | output.WriteMessage(PlayerInfo);
1637 | }
1638 | if (RpcId != 0) {
1639 | output.WriteRawTag(208, 5);
1640 | output.WriteInt32(RpcId);
1641 | }
1642 | if (Id != 0L) {
1643 | output.WriteRawTag(240, 5);
1644 | output.WriteInt64(Id);
1645 | }
1646 | }
1647 |
1648 | public int CalculateSize() {
1649 | int size = 0;
1650 | if (RpcId != 0) {
1651 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1652 | }
1653 | if (Id != 0L) {
1654 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(Id);
1655 | }
1656 | if (playerInfo_ != null) {
1657 | size += 1 + pb::CodedOutputStream.ComputeMessageSize(PlayerInfo);
1658 | }
1659 | return size;
1660 | }
1661 |
1662 | public void MergeFrom(pb::CodedInputStream input) {
1663 | if (playerInfo_ != null) MessagePool.Instance.Recycle(playerInfo_); playerInfo_ = null;
1664 | rpcId_ = 0;
1665 | id_ = 0;
1666 | uint tag;
1667 | while ((tag = input.ReadTag()) != 0) {
1668 | switch(tag) {
1669 | default:
1670 | input.SkipLastField();
1671 | break;
1672 | case 10: {
1673 | if (playerInfo_ == null) {
1674 | playerInfo_ = new global::Secode.Network.PlayerInfo();
1675 | }
1676 | input.ReadMessage(playerInfo_);
1677 | break;
1678 | }
1679 | case 720: {
1680 | RpcId = input.ReadInt32();
1681 | break;
1682 | }
1683 | case 752: {
1684 | Id = input.ReadInt64();
1685 | break;
1686 | }
1687 | }
1688 | }
1689 | }
1690 |
1691 | }
1692 |
1693 | #endregion
1694 |
1695 | }
1696 |
1697 | #endregion Designer generated code
1698 |
--------------------------------------------------------------------------------
/Protoc/Output/OuterMessage.cs:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: OuterMessage.proto
3 | #pragma warning disable 1591, 0612, 3021
4 | #region Designer generated code
5 |
6 | using pb = global::Secode.Protobuf;
7 | using pbc = global::Secode.Protobuf.Collections;
8 | using scg = global::System.Collections.Generic;
9 | namespace Secode.Network {
10 |
11 | #region Messages
12 | public partial class Actor_Test : pb::IMessage {
13 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Actor_Test)MessagePool.Instance.Fetch(typeof(Actor_Test)));
14 | public static pb::MessageParser Parser { get { return _parser; } }
15 |
16 | private int rpcId_;
17 | public int RpcId {
18 | get { return rpcId_; }
19 | set {
20 | rpcId_ = value;
21 | }
22 | }
23 |
24 | private long actorId_;
25 | public long ActorId {
26 | get { return actorId_; }
27 | set {
28 | actorId_ = value;
29 | }
30 | }
31 |
32 | private string info_ = "";
33 | public string Info {
34 | get { return info_; }
35 | set {
36 | info_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
37 | }
38 | }
39 |
40 | public void WriteTo(pb::CodedOutputStream output) {
41 | if (Info.Length != 0) {
42 | output.WriteRawTag(10);
43 | output.WriteString(Info);
44 | }
45 | if (RpcId != 0) {
46 | output.WriteRawTag(208, 5);
47 | output.WriteInt32(RpcId);
48 | }
49 | if (ActorId != 0L) {
50 | output.WriteRawTag(232, 5);
51 | output.WriteInt64(ActorId);
52 | }
53 | }
54 |
55 | public int CalculateSize() {
56 | int size = 0;
57 | if (RpcId != 0) {
58 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
59 | }
60 | if (ActorId != 0L) {
61 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(ActorId);
62 | }
63 | if (Info.Length != 0) {
64 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Info);
65 | }
66 | return size;
67 | }
68 |
69 | public void MergeFrom(pb::CodedInputStream input) {
70 | info_ = "";
71 | rpcId_ = 0;
72 | actorId_ = 0;
73 | uint tag;
74 | while ((tag = input.ReadTag()) != 0) {
75 | switch(tag) {
76 | default:
77 | input.SkipLastField();
78 | break;
79 | case 10: {
80 | Info = input.ReadString();
81 | break;
82 | }
83 | case 720: {
84 | RpcId = input.ReadInt32();
85 | break;
86 | }
87 | case 744: {
88 | ActorId = input.ReadInt64();
89 | break;
90 | }
91 | }
92 | }
93 | }
94 |
95 | }
96 |
97 | public partial class Actor_TestRequest : pb::IMessage {
98 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Actor_TestRequest)MessagePool.Instance.Fetch(typeof(Actor_TestRequest)));
99 | public static pb::MessageParser Parser { get { return _parser; } }
100 |
101 | private int rpcId_;
102 | public int RpcId {
103 | get { return rpcId_; }
104 | set {
105 | rpcId_ = value;
106 | }
107 | }
108 |
109 | private long actorId_;
110 | public long ActorId {
111 | get { return actorId_; }
112 | set {
113 | actorId_ = value;
114 | }
115 | }
116 |
117 | private string request_ = "";
118 | public string Request {
119 | get { return request_; }
120 | set {
121 | request_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
122 | }
123 | }
124 |
125 | public void WriteTo(pb::CodedOutputStream output) {
126 | if (Request.Length != 0) {
127 | output.WriteRawTag(10);
128 | output.WriteString(Request);
129 | }
130 | if (RpcId != 0) {
131 | output.WriteRawTag(208, 5);
132 | output.WriteInt32(RpcId);
133 | }
134 | if (ActorId != 0L) {
135 | output.WriteRawTag(232, 5);
136 | output.WriteInt64(ActorId);
137 | }
138 | }
139 |
140 | public int CalculateSize() {
141 | int size = 0;
142 | if (RpcId != 0) {
143 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
144 | }
145 | if (ActorId != 0L) {
146 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(ActorId);
147 | }
148 | if (Request.Length != 0) {
149 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Request);
150 | }
151 | return size;
152 | }
153 |
154 | public void MergeFrom(pb::CodedInputStream input) {
155 | request_ = "";
156 | rpcId_ = 0;
157 | actorId_ = 0;
158 | uint tag;
159 | while ((tag = input.ReadTag()) != 0) {
160 | switch(tag) {
161 | default:
162 | input.SkipLastField();
163 | break;
164 | case 10: {
165 | Request = input.ReadString();
166 | break;
167 | }
168 | case 720: {
169 | RpcId = input.ReadInt32();
170 | break;
171 | }
172 | case 744: {
173 | ActorId = input.ReadInt64();
174 | break;
175 | }
176 | }
177 | }
178 | }
179 |
180 | }
181 |
182 | public partial class Actor_TestResponse : pb::IMessage {
183 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Actor_TestResponse)MessagePool.Instance.Fetch(typeof(Actor_TestResponse)));
184 | public static pb::MessageParser Parser { get { return _parser; } }
185 |
186 | private int rpcId_;
187 | public int RpcId {
188 | get { return rpcId_; }
189 | set {
190 | rpcId_ = value;
191 | }
192 | }
193 |
194 | private int error_;
195 | public int Error {
196 | get { return error_; }
197 | set {
198 | error_ = value;
199 | }
200 | }
201 |
202 | private string message_ = "";
203 | public string Message {
204 | get { return message_; }
205 | set {
206 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
207 | }
208 | }
209 |
210 | private string response_ = "";
211 | public string Response {
212 | get { return response_; }
213 | set {
214 | response_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
215 | }
216 | }
217 |
218 | public void WriteTo(pb::CodedOutputStream output) {
219 | if (Response.Length != 0) {
220 | output.WriteRawTag(10);
221 | output.WriteString(Response);
222 | }
223 | if (RpcId != 0) {
224 | output.WriteRawTag(208, 5);
225 | output.WriteInt32(RpcId);
226 | }
227 | if (Error != 0) {
228 | output.WriteRawTag(216, 5);
229 | output.WriteInt32(Error);
230 | }
231 | if (Message.Length != 0) {
232 | output.WriteRawTag(226, 5);
233 | output.WriteString(Message);
234 | }
235 | }
236 |
237 | public int CalculateSize() {
238 | int size = 0;
239 | if (RpcId != 0) {
240 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
241 | }
242 | if (Error != 0) {
243 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
244 | }
245 | if (Message.Length != 0) {
246 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
247 | }
248 | if (Response.Length != 0) {
249 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Response);
250 | }
251 | return size;
252 | }
253 |
254 | public void MergeFrom(pb::CodedInputStream input) {
255 | response_ = "";
256 | rpcId_ = 0;
257 | error_ = 0;
258 | message_ = "";
259 | uint tag;
260 | while ((tag = input.ReadTag()) != 0) {
261 | switch(tag) {
262 | default:
263 | input.SkipLastField();
264 | break;
265 | case 10: {
266 | Response = input.ReadString();
267 | break;
268 | }
269 | case 720: {
270 | RpcId = input.ReadInt32();
271 | break;
272 | }
273 | case 728: {
274 | Error = input.ReadInt32();
275 | break;
276 | }
277 | case 738: {
278 | Message = input.ReadString();
279 | break;
280 | }
281 | }
282 | }
283 | }
284 |
285 | }
286 |
287 | public partial class Actor_TransferRequest : pb::IMessage {
288 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Actor_TransferRequest)MessagePool.Instance.Fetch(typeof(Actor_TransferRequest)));
289 | public static pb::MessageParser Parser { get { return _parser; } }
290 |
291 | private int rpcId_;
292 | public int RpcId {
293 | get { return rpcId_; }
294 | set {
295 | rpcId_ = value;
296 | }
297 | }
298 |
299 | private long actorId_;
300 | public long ActorId {
301 | get { return actorId_; }
302 | set {
303 | actorId_ = value;
304 | }
305 | }
306 |
307 | private int mapIndex_;
308 | public int MapIndex {
309 | get { return mapIndex_; }
310 | set {
311 | mapIndex_ = value;
312 | }
313 | }
314 |
315 | public void WriteTo(pb::CodedOutputStream output) {
316 | if (MapIndex != 0) {
317 | output.WriteRawTag(8);
318 | output.WriteInt32(MapIndex);
319 | }
320 | if (RpcId != 0) {
321 | output.WriteRawTag(208, 5);
322 | output.WriteInt32(RpcId);
323 | }
324 | if (ActorId != 0L) {
325 | output.WriteRawTag(232, 5);
326 | output.WriteInt64(ActorId);
327 | }
328 | }
329 |
330 | public int CalculateSize() {
331 | int size = 0;
332 | if (RpcId != 0) {
333 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
334 | }
335 | if (ActorId != 0L) {
336 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(ActorId);
337 | }
338 | if (MapIndex != 0) {
339 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(MapIndex);
340 | }
341 | return size;
342 | }
343 |
344 | public void MergeFrom(pb::CodedInputStream input) {
345 | mapIndex_ = 0;
346 | rpcId_ = 0;
347 | actorId_ = 0;
348 | uint tag;
349 | while ((tag = input.ReadTag()) != 0) {
350 | switch(tag) {
351 | default:
352 | input.SkipLastField();
353 | break;
354 | case 8: {
355 | MapIndex = input.ReadInt32();
356 | break;
357 | }
358 | case 720: {
359 | RpcId = input.ReadInt32();
360 | break;
361 | }
362 | case 744: {
363 | ActorId = input.ReadInt64();
364 | break;
365 | }
366 | }
367 | }
368 | }
369 |
370 | }
371 |
372 | public partial class Actor_TransferResponse : pb::IMessage {
373 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Actor_TransferResponse)MessagePool.Instance.Fetch(typeof(Actor_TransferResponse)));
374 | public static pb::MessageParser Parser { get { return _parser; } }
375 |
376 | private int rpcId_;
377 | public int RpcId {
378 | get { return rpcId_; }
379 | set {
380 | rpcId_ = value;
381 | }
382 | }
383 |
384 | private int error_;
385 | public int Error {
386 | get { return error_; }
387 | set {
388 | error_ = value;
389 | }
390 | }
391 |
392 | private string message_ = "";
393 | public string Message {
394 | get { return message_; }
395 | set {
396 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
397 | }
398 | }
399 |
400 | public void WriteTo(pb::CodedOutputStream output) {
401 | if (RpcId != 0) {
402 | output.WriteRawTag(208, 5);
403 | output.WriteInt32(RpcId);
404 | }
405 | if (Error != 0) {
406 | output.WriteRawTag(216, 5);
407 | output.WriteInt32(Error);
408 | }
409 | if (Message.Length != 0) {
410 | output.WriteRawTag(226, 5);
411 | output.WriteString(Message);
412 | }
413 | }
414 |
415 | public int CalculateSize() {
416 | int size = 0;
417 | if (RpcId != 0) {
418 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
419 | }
420 | if (Error != 0) {
421 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
422 | }
423 | if (Message.Length != 0) {
424 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
425 | }
426 | return size;
427 | }
428 |
429 | public void MergeFrom(pb::CodedInputStream input) {
430 | rpcId_ = 0;
431 | error_ = 0;
432 | message_ = "";
433 | uint tag;
434 | while ((tag = input.ReadTag()) != 0) {
435 | switch(tag) {
436 | default:
437 | input.SkipLastField();
438 | break;
439 | case 720: {
440 | RpcId = input.ReadInt32();
441 | break;
442 | }
443 | case 728: {
444 | Error = input.ReadInt32();
445 | break;
446 | }
447 | case 738: {
448 | Message = input.ReadString();
449 | break;
450 | }
451 | }
452 | }
453 | }
454 |
455 | }
456 |
457 | ///
458 | /// 单位信息
459 | ///
460 | public partial class UnitInfo : pb::IMessage {
461 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (UnitInfo)MessagePool.Instance.Fetch(typeof(UnitInfo)));
462 | public static pb::MessageParser Parser { get { return _parser; } }
463 |
464 | private long unitId_;
465 | public long UnitId {
466 | get { return unitId_; }
467 | set {
468 | unitId_ = value;
469 | }
470 | }
471 |
472 | public void WriteTo(pb::CodedOutputStream output) {
473 | if (UnitId != 0L) {
474 | output.WriteRawTag(8);
475 | output.WriteInt64(UnitId);
476 | }
477 | }
478 |
479 | public int CalculateSize() {
480 | int size = 0;
481 | if (UnitId != 0L) {
482 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(UnitId);
483 | }
484 | return size;
485 | }
486 |
487 | public void MergeFrom(pb::CodedInputStream input) {
488 | unitId_ = 0;
489 | uint tag;
490 | while ((tag = input.ReadTag()) != 0) {
491 | switch(tag) {
492 | default:
493 | input.SkipLastField();
494 | break;
495 | case 8: {
496 | UnitId = input.ReadInt64();
497 | break;
498 | }
499 | }
500 | }
501 | }
502 |
503 | }
504 |
505 | ///
506 | /// 创建单位
507 | ///
508 | public partial class Actor_CreateUnits : pb::IMessage {
509 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (Actor_CreateUnits)MessagePool.Instance.Fetch(typeof(Actor_CreateUnits)));
510 | public static pb::MessageParser Parser { get { return _parser; } }
511 |
512 | private int rpcId_;
513 | public int RpcId {
514 | get { return rpcId_; }
515 | set {
516 | rpcId_ = value;
517 | }
518 | }
519 |
520 | private long actorId_;
521 | public long ActorId {
522 | get { return actorId_; }
523 | set {
524 | actorId_ = value;
525 | }
526 | }
527 |
528 | private static readonly pb::FieldCodec _repeated_units_codec
529 | = pb::FieldCodec.ForMessage(10, global::Secode.Network.UnitInfo.Parser);
530 | private pbc::RepeatedField units_ = new pbc::RepeatedField();
531 | public pbc::RepeatedField Units {
532 | get { return units_; }
533 | set { units_ = value; }
534 | }
535 |
536 | public void WriteTo(pb::CodedOutputStream output) {
537 | units_.WriteTo(output, _repeated_units_codec);
538 | if (RpcId != 0) {
539 | output.WriteRawTag(208, 5);
540 | output.WriteInt32(RpcId);
541 | }
542 | if (ActorId != 0L) {
543 | output.WriteRawTag(232, 5);
544 | output.WriteInt64(ActorId);
545 | }
546 | }
547 |
548 | public int CalculateSize() {
549 | int size = 0;
550 | if (RpcId != 0) {
551 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
552 | }
553 | if (ActorId != 0L) {
554 | size += 2 + pb::CodedOutputStream.ComputeInt64Size(ActorId);
555 | }
556 | size += units_.CalculateSize(_repeated_units_codec);
557 | return size;
558 | }
559 |
560 | public void MergeFrom(pb::CodedInputStream input) {
561 | for (int i = 0; i < units_.Count; i++) { MessagePool.Instance.Recycle(units_[i]); }
562 | units_.Clear();
563 | rpcId_ = 0;
564 | actorId_ = 0;
565 | uint tag;
566 | while ((tag = input.ReadTag()) != 0) {
567 | switch(tag) {
568 | default:
569 | input.SkipLastField();
570 | break;
571 | case 10: {
572 | units_.AddEntriesFrom(input, _repeated_units_codec);
573 | break;
574 | }
575 | case 720: {
576 | RpcId = input.ReadInt32();
577 | break;
578 | }
579 | case 744: {
580 | ActorId = input.ReadInt64();
581 | break;
582 | }
583 | }
584 | }
585 | }
586 |
587 | }
588 |
589 | ///
590 | /// 进入Map消息
591 | ///
592 | public partial class C2G_EnterMap : pb::IMessage {
593 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2G_EnterMap)MessagePool.Instance.Fetch(typeof(C2G_EnterMap)));
594 | public static pb::MessageParser Parser { get { return _parser; } }
595 |
596 | private int rpcId_;
597 | public int RpcId {
598 | get { return rpcId_; }
599 | set {
600 | rpcId_ = value;
601 | }
602 | }
603 |
604 | public void WriteTo(pb::CodedOutputStream output) {
605 | if (RpcId != 0) {
606 | output.WriteRawTag(208, 5);
607 | output.WriteInt32(RpcId);
608 | }
609 | }
610 |
611 | public int CalculateSize() {
612 | int size = 0;
613 | if (RpcId != 0) {
614 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
615 | }
616 | return size;
617 | }
618 |
619 | public void MergeFrom(pb::CodedInputStream input) {
620 | rpcId_ = 0;
621 | uint tag;
622 | while ((tag = input.ReadTag()) != 0) {
623 | switch(tag) {
624 | default:
625 | input.SkipLastField();
626 | break;
627 | case 720: {
628 | RpcId = input.ReadInt32();
629 | break;
630 | }
631 | }
632 | }
633 | }
634 |
635 | }
636 |
637 | ///
638 | /// 进入Map回传
639 | ///
640 | public partial class G2C_EnterMap : pb::IMessage {
641 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (G2C_EnterMap)MessagePool.Instance.Fetch(typeof(G2C_EnterMap)));
642 | public static pb::MessageParser Parser { get { return _parser; } }
643 |
644 | private int rpcId_;
645 | public int RpcId {
646 | get { return rpcId_; }
647 | set {
648 | rpcId_ = value;
649 | }
650 | }
651 |
652 | private int error_;
653 | public int Error {
654 | get { return error_; }
655 | set {
656 | error_ = value;
657 | }
658 | }
659 |
660 | private string message_ = "";
661 | public string Message {
662 | get { return message_; }
663 | set {
664 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
665 | }
666 | }
667 |
668 | private long unitId_;
669 | public long UnitId {
670 | get { return unitId_; }
671 | set {
672 | unitId_ = value;
673 | }
674 | }
675 |
676 | private int count_;
677 | public int Count {
678 | get { return count_; }
679 | set {
680 | count_ = value;
681 | }
682 | }
683 |
684 | public void WriteTo(pb::CodedOutputStream output) {
685 | if (UnitId != 0L) {
686 | output.WriteRawTag(8);
687 | output.WriteInt64(UnitId);
688 | }
689 | if (Count != 0) {
690 | output.WriteRawTag(16);
691 | output.WriteInt32(Count);
692 | }
693 | if (RpcId != 0) {
694 | output.WriteRawTag(208, 5);
695 | output.WriteInt32(RpcId);
696 | }
697 | if (Error != 0) {
698 | output.WriteRawTag(216, 5);
699 | output.WriteInt32(Error);
700 | }
701 | if (Message.Length != 0) {
702 | output.WriteRawTag(226, 5);
703 | output.WriteString(Message);
704 | }
705 | }
706 |
707 | public int CalculateSize() {
708 | int size = 0;
709 | if (RpcId != 0) {
710 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
711 | }
712 | if (Error != 0) {
713 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
714 | }
715 | if (Message.Length != 0) {
716 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
717 | }
718 | if (UnitId != 0L) {
719 | size += 1 + pb::CodedOutputStream.ComputeInt64Size(UnitId);
720 | }
721 | if (Count != 0) {
722 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count);
723 | }
724 | return size;
725 | }
726 |
727 | public void MergeFrom(pb::CodedInputStream input) {
728 | unitId_ = 0;
729 | count_ = 0;
730 | rpcId_ = 0;
731 | error_ = 0;
732 | message_ = "";
733 | uint tag;
734 | while ((tag = input.ReadTag()) != 0) {
735 | switch(tag) {
736 | default:
737 | input.SkipLastField();
738 | break;
739 | case 8: {
740 | UnitId = input.ReadInt64();
741 | break;
742 | }
743 | case 16: {
744 | Count = input.ReadInt32();
745 | break;
746 | }
747 | case 720: {
748 | RpcId = input.ReadInt32();
749 | break;
750 | }
751 | case 728: {
752 | Error = input.ReadInt32();
753 | break;
754 | }
755 | case 738: {
756 | Message = input.ReadString();
757 | break;
758 | }
759 | }
760 | }
761 | }
762 |
763 | }
764 |
765 | ///
766 | /// Ping连接
767 | ///
768 | public partial class C2R_Ping : pb::IMessage {
769 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2R_Ping)MessagePool.Instance.Fetch(typeof(C2R_Ping)));
770 | public static pb::MessageParser Parser { get { return _parser; } }
771 |
772 | private int rpcId_;
773 | public int RpcId {
774 | get { return rpcId_; }
775 | set {
776 | rpcId_ = value;
777 | }
778 | }
779 |
780 | public void WriteTo(pb::CodedOutputStream output) {
781 | if (RpcId != 0) {
782 | output.WriteRawTag(208, 5);
783 | output.WriteInt32(RpcId);
784 | }
785 | }
786 |
787 | public int CalculateSize() {
788 | int size = 0;
789 | if (RpcId != 0) {
790 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
791 | }
792 | return size;
793 | }
794 |
795 | public void MergeFrom(pb::CodedInputStream input) {
796 | rpcId_ = 0;
797 | uint tag;
798 | while ((tag = input.ReadTag()) != 0) {
799 | switch(tag) {
800 | default:
801 | input.SkipLastField();
802 | break;
803 | case 720: {
804 | RpcId = input.ReadInt32();
805 | break;
806 | }
807 | }
808 | }
809 | }
810 |
811 | }
812 |
813 | ///
814 | /// Ping连接回传
815 | ///
816 | public partial class R2C_Ping : pb::IMessage {
817 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (R2C_Ping)MessagePool.Instance.Fetch(typeof(R2C_Ping)));
818 | public static pb::MessageParser Parser { get { return _parser; } }
819 |
820 | private int rpcId_;
821 | public int RpcId {
822 | get { return rpcId_; }
823 | set {
824 | rpcId_ = value;
825 | }
826 | }
827 |
828 | private int error_;
829 | public int Error {
830 | get { return error_; }
831 | set {
832 | error_ = value;
833 | }
834 | }
835 |
836 | private string message_ = "";
837 | public string Message {
838 | get { return message_; }
839 | set {
840 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
841 | }
842 | }
843 |
844 | public void WriteTo(pb::CodedOutputStream output) {
845 | if (RpcId != 0) {
846 | output.WriteRawTag(208, 5);
847 | output.WriteInt32(RpcId);
848 | }
849 | if (Error != 0) {
850 | output.WriteRawTag(216, 5);
851 | output.WriteInt32(Error);
852 | }
853 | if (Message.Length != 0) {
854 | output.WriteRawTag(226, 5);
855 | output.WriteString(Message);
856 | }
857 | }
858 |
859 | public int CalculateSize() {
860 | int size = 0;
861 | if (RpcId != 0) {
862 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
863 | }
864 | if (Error != 0) {
865 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
866 | }
867 | if (Message.Length != 0) {
868 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
869 | }
870 | return size;
871 | }
872 |
873 | public void MergeFrom(pb::CodedInputStream input) {
874 | rpcId_ = 0;
875 | error_ = 0;
876 | message_ = "";
877 | uint tag;
878 | while ((tag = input.ReadTag()) != 0) {
879 | switch(tag) {
880 | default:
881 | input.SkipLastField();
882 | break;
883 | case 720: {
884 | RpcId = input.ReadInt32();
885 | break;
886 | }
887 | case 728: {
888 | Error = input.ReadInt32();
889 | break;
890 | }
891 | case 738: {
892 | Message = input.ReadString();
893 | break;
894 | }
895 | }
896 | }
897 | }
898 |
899 | }
900 |
901 | ///
902 | /// 重新加载
903 | ///
904 | public partial class C2M_Reload : pb::IMessage {
905 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (C2M_Reload)MessagePool.Instance.Fetch(typeof(C2M_Reload)));
906 | public static pb::MessageParser Parser { get { return _parser; } }
907 |
908 | private int rpcId_;
909 | public int RpcId {
910 | get { return rpcId_; }
911 | set {
912 | rpcId_ = value;
913 | }
914 | }
915 |
916 | private string key_ = "";
917 | ///
918 | /// 请求密钥
919 | ///
920 | public string Key {
921 | get { return key_; }
922 | set {
923 | key_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
924 | }
925 | }
926 |
927 | public void WriteTo(pb::CodedOutputStream output) {
928 | if (Key.Length != 0) {
929 | output.WriteRawTag(10);
930 | output.WriteString(Key);
931 | }
932 | if (RpcId != 0) {
933 | output.WriteRawTag(208, 5);
934 | output.WriteInt32(RpcId);
935 | }
936 | }
937 |
938 | public int CalculateSize() {
939 | int size = 0;
940 | if (RpcId != 0) {
941 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
942 | }
943 | if (Key.Length != 0) {
944 | size += 1 + pb::CodedOutputStream.ComputeStringSize(Key);
945 | }
946 | return size;
947 | }
948 |
949 | public void MergeFrom(pb::CodedInputStream input) {
950 | key_ = "";
951 | rpcId_ = 0;
952 | uint tag;
953 | while ((tag = input.ReadTag()) != 0) {
954 | switch(tag) {
955 | default:
956 | input.SkipLastField();
957 | break;
958 | case 10: {
959 | Key = input.ReadString();
960 | break;
961 | }
962 | case 720: {
963 | RpcId = input.ReadInt32();
964 | break;
965 | }
966 | }
967 | }
968 | }
969 |
970 | }
971 |
972 | ///
973 | /// 重新加载回传
974 | ///
975 | public partial class M2C_Reload : pb::IMessage {
976 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => (M2C_Reload)MessagePool.Instance.Fetch(typeof(M2C_Reload)));
977 | public static pb::MessageParser Parser { get { return _parser; } }
978 |
979 | private int rpcId_;
980 | public int RpcId {
981 | get { return rpcId_; }
982 | set {
983 | rpcId_ = value;
984 | }
985 | }
986 |
987 | private int error_;
988 | public int Error {
989 | get { return error_; }
990 | set {
991 | error_ = value;
992 | }
993 | }
994 |
995 | private string message_ = "";
996 | public string Message {
997 | get { return message_; }
998 | set {
999 | message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
1000 | }
1001 | }
1002 |
1003 | public void WriteTo(pb::CodedOutputStream output) {
1004 | if (RpcId != 0) {
1005 | output.WriteRawTag(208, 5);
1006 | output.WriteInt32(RpcId);
1007 | }
1008 | if (Error != 0) {
1009 | output.WriteRawTag(216, 5);
1010 | output.WriteInt32(Error);
1011 | }
1012 | if (Message.Length != 0) {
1013 | output.WriteRawTag(226, 5);
1014 | output.WriteString(Message);
1015 | }
1016 | }
1017 |
1018 | public int CalculateSize() {
1019 | int size = 0;
1020 | if (RpcId != 0) {
1021 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(RpcId);
1022 | }
1023 | if (Error != 0) {
1024 | size += 2 + pb::CodedOutputStream.ComputeInt32Size(Error);
1025 | }
1026 | if (Message.Length != 0) {
1027 | size += 2 + pb::CodedOutputStream.ComputeStringSize(Message);
1028 | }
1029 | return size;
1030 | }
1031 |
1032 | public void MergeFrom(pb::CodedInputStream input) {
1033 | rpcId_ = 0;
1034 | error_ = 0;
1035 | message_ = "";
1036 | uint tag;
1037 | while ((tag = input.ReadTag()) != 0) {
1038 | switch(tag) {
1039 | default:
1040 | input.SkipLastField();
1041 | break;
1042 | case 720: {
1043 | RpcId = input.ReadInt32();
1044 | break;
1045 | }
1046 | case 728: {
1047 | Error = input.ReadInt32();
1048 | break;
1049 | }
1050 | case 738: {
1051 | Message = input.ReadString();
1052 | break;
1053 | }
1054 | }
1055 | }
1056 | }
1057 |
1058 | }
1059 |
1060 | #endregion
1061 |
1062 | }
1063 |
1064 | #endregion Designer generated code
1065 |
--------------------------------------------------------------------------------
/Protoc/Sources/FrameMessage.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package Secode.Network;
3 | message OneFrameMessage // IActorLocationMessage
4 | {
5 | int32 RpcId = 90;
6 | int64 ActorId = 93;
7 | int32 Op = 1;
8 | bytes AMessage = 2;
9 | }
10 |
11 | message FrameMessage // IActorMessage
12 | {
13 | int32 RpcId = 90;
14 | int64 ActorId = 93;
15 | int32 Frame = 1;
16 | repeated OneFrameMessage Message = 2;
17 | }
18 |
19 |
20 | // 10
--------------------------------------------------------------------------------
/Protoc/Sources/HotfixMessage.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package Secode.Network;
3 | // 三维坐标信息
4 | message Vector3Info
5 | {
6 | float X = 1;
7 | float Y = 2;
8 | float Z = 3;
9 | }
10 |
11 | // 四元数坐标信息
12 | message QuaternionInfo
13 | {
14 | float X = 1;
15 | float Y = 2;
16 | float Z = 3;
17 | float W = 4;
18 | }
19 |
20 | // 变换信息
21 | message TransformInfo
22 | {
23 | int32 RpcId = 90;
24 | Vector3Info Position = 1; // 位置
25 | QuaternionInfo Rotation = 2; // 旋转
26 | Vector3Info Scale = 3; // 放缩
27 | }
28 |
29 | // 无放缩变换信息
30 | message TransformInfoNoScale
31 | {
32 | int32 RpcId = 90;
33 | Vector3Info Position = 1; // 位置
34 | QuaternionInfo Rotation = 2; // 旋转
35 | }
36 |
37 | // VR角色信息
38 | message PlayerInfo
39 | {
40 | int32 RpcId = 90;
41 | int64 PlayerId = 1; // 玩家的临时ID
42 | TransformInfoNoScale Head = 2; // 头盔
43 | TransformInfoNoScale LeftHand = 3; // 左手手柄
44 | TransformInfoNoScale RightHand = 4; // 右手手柄
45 | }
46 |
47 | // 登录请求信息
48 | message C2R_Login // IRequest
49 | {
50 | int32 RpcId = 90;
51 | string UserID = 1; // 帐号
52 | string Password = 2; // 密码
53 | }
54 |
55 | // 登录回传信息
56 | message R2C_Login // IResponse
57 | {
58 | int32 RpcId = 90;
59 | int32 Error = 91;
60 | string Message = 92;
61 | int64 Key = 1; // 连接钥匙
62 | repeated string Gates = 2; // 房间门列表
63 | }
64 |
65 | // 新建房间
66 | message C2R_NewGate // IRequest
67 | {
68 | int32 RpcId = 90;
69 | int64 Key = 1; // 连接钥匙
70 | string Name = 2; // 房间名称
71 | string SecretKey = 3; // 授权钥匙
72 | }
73 |
74 | // 新建房间回传信息
75 | message R2C_NewGate // IResponse
76 | {
77 | int32 RpcId = 90;
78 | int32 Error = 91;
79 | string Message = 92;
80 | string Gate = 1; // 房间门
81 | }
82 |
83 | // 连接房间信息
84 | message C2G_Link // IRequest
85 | {
86 | int32 RpcId = 90;
87 | int64 Key = 1; // 连接钥匙
88 | string Gate = 2; // 房间门
89 | }
90 |
91 | // 房间连接回传信息
92 | message G2C_Link // IResponse
93 | {
94 | int32 RpcId = 90;
95 | int32 Error = 91;
96 | string Message = 92;
97 | int64 PlayerId = 1; // 玩家的临时ID
98 | }
99 |
100 | // 请求用户信息
101 | message C2G_Info // IRequest
102 | {
103 | int32 RpcId = 90;
104 | int64 PlayerId = 1; // 玩家的临时ID
105 | }
106 |
107 | // 用户信息回传
108 | message G2C_Info // IResponse
109 | {
110 | int32 RpcId = 90;
111 | int32 Error = 91;
112 | string Message = 92;
113 | PlayerInfo PlayerInfo = 1; // 玩家数据
114 | }
115 |
116 | // 请求用户列表
117 | message C2G_Players // IRequest
118 | {
119 | int32 RpcId = 90;
120 | int64 PlayerId = 1; // 玩家的临时ID
121 | }
122 |
123 | // 用户列表回传
124 | message G2C_Players // IResponse
125 | {
126 | int32 RpcId = 90;
127 | int32 Error = 91;
128 | string Message = 92;
129 | repeated int64 PlayerId = 1; // 玩家的临时ID列表
130 | }
131 |
132 | // 用户移动消息
133 | message Frame_PlayerMove // IFrameMessage
134 | {
135 | int32 RpcId = 90;
136 | int64 Id = 94;
137 | PlayerInfo PlayerInfo = 1;
138 | }
139 |
140 | // 10000
--------------------------------------------------------------------------------
/Protoc/Sources/OuterMessage.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package Secode.Network;
3 | message Actor_Test // IActorMessage
4 | {
5 | int32 RpcId = 90;
6 | int64 ActorId = 93;
7 | string Info = 1;
8 | }
9 |
10 | message Actor_TestRequest // IActorLocationRequest
11 | {
12 | int32 RpcId = 90;
13 | int64 ActorId = 93;
14 | string request = 1;
15 | }
16 |
17 | message Actor_TestResponse // IActorLocationResponse
18 | {
19 | int32 RpcId = 90;
20 | int32 Error = 91;
21 | string Message = 92;
22 | string response = 1;
23 | }
24 |
25 | message Actor_TransferRequest // IActorLocationRequest
26 | {
27 | int32 RpcId = 90;
28 | int64 ActorId = 93;
29 | int32 MapIndex = 1;
30 | }
31 |
32 | message Actor_TransferResponse // IActorLocationResponse
33 | {
34 | int32 RpcId = 90;
35 | int32 Error = 91;
36 | string Message = 92;
37 | }
38 |
39 | // 单位信息
40 | message UnitInfo
41 | {
42 | int64 UnitId = 1;
43 | }
44 |
45 | // 创建单位
46 | message Actor_CreateUnits // IActorMessage
47 | {
48 | int32 RpcId = 90;
49 | int64 ActorId = 93;
50 | repeated UnitInfo Units = 1;
51 | }
52 |
53 | // 进入Map消息
54 | message C2G_EnterMap // IRequest
55 | {
56 | int32 RpcId = 90;
57 | }
58 |
59 | // 进入Map回传
60 | message G2C_EnterMap // IResponse
61 | {
62 | int32 RpcId = 90;
63 | int32 Error = 91;
64 | string Message = 92;
65 | int64 UnitId = 1;
66 | int32 Count = 2;
67 | }
68 |
69 | // Ping连接
70 | message C2R_Ping // IRequest
71 | {
72 | int32 RpcId = 90;
73 | }
74 |
75 | // Ping连接回传
76 | message R2C_Ping // IResponse
77 | {
78 | int32 RpcId = 90;
79 | int32 Error = 91;
80 | string Message = 92;
81 | }
82 |
83 | // 重新加载
84 | message C2M_Reload // IRequest
85 | {
86 | int32 RpcId = 90;
87 | string Key = 1; // 请求密钥
88 | }
89 |
90 | // 重新加载回传
91 | message M2C_Reload // IResponse
92 | {
93 | int32 RpcId = 90;
94 | int32 Error = 91;
95 | string Message = 92;
96 | }
97 |
98 | // 100
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OpcodeGUI
2 | Secode系列工具之Opcode编辑器
3 |
--------------------------------------------------------------------------------
/Setting.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Setting.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.IO;
3 | using System.Windows.Media;
4 | using System;
5 | using System.Windows.Forms;
6 |
7 | namespace Secode
8 | {
9 | ///
10 | /// TextInput.xaml 的交互逻辑
11 | ///
12 | public partial class Setting : Window
13 | {
14 | public Setting()
15 | {
16 | InitializeComponent();
17 | InitControl();
18 | }
19 |
20 | public void InitControl()
21 | {
22 | Refresh();
23 |
24 | #region Protoc目录事件
25 |
26 | ProtocCheckBox.Checked += delegate
27 | {
28 | ProtocInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF"));
29 | };
30 | ProtocCheckBox.Unchecked += delegate
31 | {
32 | ProtocInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
33 | ProtocInput.Content = Path.Combine(Environment.CurrentDirectory, "Protoc");
34 | };
35 | ProtocInput.MouseLeftButtonUp += delegate
36 | {
37 | if (ProtocCheckBox.IsChecked == false) return;
38 |
39 | FolderBrowserDialog dialog = new FolderBrowserDialog();
40 | dialog.RootFolder = Environment.SpecialFolder.Desktop;
41 | dialog.SelectedPath = ProtocInput.Content.ToString();
42 | dialog.Description = "选择Protoc目录";
43 | dialog.ShowNewFolderButton = true;
44 |
45 | if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
46 | {
47 | if (!Directory.Exists(dialog.SelectedPath)) return;
48 |
49 | ProtocInput.Content = dialog.SelectedPath;
50 |
51 | if (AppCheckBox.IsChecked == false)
52 | {
53 | AppInput.Content = Path.Combine(ProtocInput.Content.ToString(), "App", "protoc.exe");
54 | }
55 | if (SourceCheckBox.IsChecked == false)
56 | {
57 | SourceInput.Content = Path.Combine(ProtocInput.Content.ToString(), "Sources");
58 | }
59 | if (OutputCheckBox.IsChecked == false)
60 | {
61 | OutputInput.Content = Path.Combine(ProtocInput.Content.ToString(), "Output");
62 | }
63 | }
64 | };
65 |
66 | #endregion
67 |
68 | #region Protoc.exe应用事件
69 |
70 | AppCheckBox.Checked += delegate
71 | {
72 | AppInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF"));
73 | };
74 | AppCheckBox.Unchecked += delegate
75 | {
76 | AppInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
77 | AppInput.Content = Path.Combine(ProtocInput.Content.ToString(), "App", "protoc.exe");
78 | };
79 | AppInput.MouseLeftButtonUp += delegate
80 | {
81 | if (AppCheckBox.IsChecked == false) return;
82 |
83 | var finfo = new FileInfo(AppInput.Content.ToString());
84 |
85 | OpenFileDialog dialog = new OpenFileDialog();
86 | dialog.Title = "选择Protoc.exe应用";
87 | dialog.CheckFileExists = true;
88 | dialog.InitialDirectory = finfo.Exists ? finfo.Directory.FullName : Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
89 | dialog.Filter = "EXE应用|*.exe";
90 | dialog.FileName = finfo.Name;
91 |
92 | if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
93 | {
94 | if (!Directory.Exists(dialog.FileName)) return;
95 |
96 | ProtocInput.Content = dialog.FileName;
97 | }
98 | };
99 |
100 | #endregion
101 |
102 | #region 源文件目录事件
103 |
104 | SourceCheckBox.Checked += delegate
105 | {
106 | SourceInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF"));
107 | };
108 | SourceCheckBox.Unchecked += delegate
109 | {
110 | SourceInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
111 | SourceInput.Content = Path.Combine(ProtocInput.Content.ToString(), "Sources");
112 | };
113 | SourceInput.MouseLeftButtonUp += delegate
114 | {
115 | if (SourceCheckBox.IsChecked == false) return;
116 |
117 | FolderBrowserDialog dialog = new FolderBrowserDialog();
118 | dialog.RootFolder = Environment.SpecialFolder.Desktop;
119 | dialog.SelectedPath = SourceInput.Content.ToString();
120 | dialog.Description = "选择源文件目录";
121 | dialog.ShowNewFolderButton = true;
122 |
123 | if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
124 | {
125 | if (!Directory.Exists(dialog.SelectedPath)) return;
126 |
127 | SourceInput.Content = dialog.SelectedPath;
128 | }
129 | };
130 |
131 | #endregion
132 |
133 | #region 输出目录事件
134 |
135 | OutputCheckBox.Checked += delegate
136 | {
137 | OutputInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFFFF"));
138 | };
139 | OutputCheckBox.Unchecked += delegate
140 | {
141 | OutputInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
142 | OutputInput.Content = Path.Combine(ProtocInput.Content.ToString(), "Output");
143 | };
144 | OutputInput.MouseLeftButtonUp += delegate
145 | {
146 | if (OutputCheckBox.IsChecked == false) return;
147 |
148 | FolderBrowserDialog dialog = new FolderBrowserDialog();
149 | dialog.RootFolder = Environment.SpecialFolder.Desktop;
150 | dialog.SelectedPath = OutputInput.Content.ToString();
151 | dialog.Description = "选择输出目录";
152 | dialog.ShowNewFolderButton = true;
153 |
154 | if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
155 | {
156 | if (!Directory.Exists(dialog.SelectedPath)) return;
157 |
158 | OutputInput.Content = dialog.SelectedPath;
159 | }
160 | };
161 |
162 | #endregion
163 | }
164 |
165 | public void Refresh()
166 | {
167 | ProtocCheckBox.IsChecked = DataSet.Contain("OpcodeGUI_ProtocPath");
168 | ProtocInput.Content = MainWindow.ProtocPath;
169 | if (ProtocCheckBox.IsChecked == false)
170 | ProtocInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
171 |
172 | AppCheckBox.IsChecked = DataSet.Contain("OpcodeGUI_AppPath");
173 | AppInput.Content = MainWindow.AppPath;
174 | if (AppCheckBox.IsChecked == false)
175 | AppInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
176 |
177 | SourceCheckBox.IsChecked = DataSet.Contain("OpcodeGUI_SourcesPath");
178 | SourceInput.Content = MainWindow.SourcesPath;
179 | if (SourceCheckBox.IsChecked == false)
180 | SourceInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
181 |
182 | OutputCheckBox.IsChecked = DataSet.Contain("OpcodeGUI_OutputPath");
183 | OutputInput.Content = MainWindow.OutputPath;
184 | if (OutputCheckBox.IsChecked == false)
185 | OutputInput.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7FFFFFFF"));
186 | }
187 |
188 | private void OKButton_Click(object sender, RoutedEventArgs e)
189 | {
190 | DialogResult = true;
191 | if (ProtocCheckBox.IsChecked == false || !Directory.Exists(ProtocInput.Content.ToString()))
192 | {
193 | DataSet.Delete("OpcodeGUI_ProtocPath");
194 | }
195 | else if (ProtocInput.Content.ToString() != MainWindow.ProtocPath)
196 | {
197 | MainWindow.ProtocPath = ProtocInput.Content.ToString();
198 | }
199 | if (AppCheckBox.IsChecked == false || !File.Exists(AppInput.Content.ToString()))
200 | {
201 | DataSet.Delete("OpcodeGUI_AppPath");
202 | }
203 | else if (AppInput.Content.ToString() != MainWindow.AppPath)
204 | {
205 | MainWindow.AppPath = AppInput.Content.ToString();
206 | }
207 | if (SourceCheckBox.IsChecked == false || !Directory.Exists(SourceInput.Content.ToString()))
208 | {
209 | DataSet.Delete("OpcodeGUI_SourcesPath");
210 | }
211 | else if (SourceInput.Content.ToString() != MainWindow.SourcesPath)
212 | {
213 | MainWindow.SourcesPath = SourceInput.Content.ToString();
214 | }
215 | if (OutputCheckBox.IsChecked == false || !Directory.Exists(OutputInput.Content.ToString()))
216 | {
217 | DataSet.Delete("OpcodeGUI_OutputPath");
218 | }
219 | else if (OutputInput.Content.ToString() != MainWindow.OutputPath)
220 | {
221 | MainWindow.OutputPath = OutputInput.Content.ToString();
222 | }
223 | Close();
224 | }
225 |
226 | private void BackButton_Click(object sender, RoutedEventArgs e)
227 | {
228 | DialogResult = false;
229 | Close();
230 | }
231 | }
232 | }
233 |
--------------------------------------------------------------------------------
/TextInput.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/TextInput.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Secode
16 | {
17 | ///
18 | /// TextInput.xaml 的交互逻辑
19 | ///
20 | public partial class TextInput : Window
21 | {
22 | public TextInput(string TipContent = "")
23 | {
24 | InitializeComponent();
25 | TipText.Content = TipContent;
26 | }
27 |
28 | private void OKButton_Click(object sender, RoutedEventArgs e)
29 | {
30 | DialogResult = true;
31 | Close();
32 | }
33 |
34 | private void BackButton_Click(object sender, RoutedEventArgs e)
35 | {
36 | DialogResult = false;
37 | Close();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Xshd/CSharpHighlighting.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | TODO
37 | FIXME
38 |
39 |
40 | HACK
41 | UNDONE
42 |
43 |
44 |
45 |
46 |
47 |
48 | \#
49 |
50 |
51 |
52 |
53 | (define|undef|if|elif|else|endif|line)\b
54 |
55 |
56 |
57 | //
58 |
59 |
60 |
61 |
62 |
63 |
64 | (region|endregion|error|warning|pragma)\b
65 |
66 |
67 |
68 |
69 |
70 |
71 | ///(?!/)
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | //
80 |
81 |
82 |
83 | /\*
84 | \*/
85 |
86 |
87 |
88 | "
89 | "
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | '
98 | '
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | @"
107 | "
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | \$"
116 | "
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | @[\w\d_]+
129 |
130 |
131 |
132 | this
133 | base
134 |
135 |
136 |
137 | as
138 | is
139 | new
140 | sizeof
141 | typeof
142 | stackalloc
143 |
144 |
145 |
146 | true
147 | false
148 |
149 |
150 |
151 | else
152 | if
153 | switch
154 | case
155 | default
156 | do
157 | for
158 | foreach
159 | in
160 | while
161 | lock
162 |
163 |
164 |
165 | break
166 | continue
167 | goto
168 | return
169 |
170 |
171 |
172 | yield
173 | partial
174 | global
175 | where
176 | select
177 | group
178 | by
179 | into
180 | from
181 | ascending
182 | descending
183 | orderby
184 | let
185 | join
186 | on
187 | equals
188 | var
189 | dynamic
190 | await
191 |
192 |
193 |
194 | try
195 | throw
196 | catch
197 | finally
198 |
199 |
200 |
201 | checked
202 | unchecked
203 |
204 |
205 |
206 | fixed
207 | unsafe
208 |
209 |
210 |
211 | bool
212 | byte
213 | char
214 | decimal
215 | double
216 | enum
217 | float
218 | int
219 | long
220 | sbyte
221 | short
222 | struct
223 | uint
224 | ushort
225 | ulong
226 |
227 |
228 |
229 | class
230 | interface
231 | delegate
232 | object
233 | string
234 | void
235 |
236 |
237 |
238 | explicit
239 | implicit
240 | operator
241 |
242 |
243 |
244 | params
245 | ref
246 | out
247 |
248 |
249 |
250 | abstract
251 | const
252 | event
253 | extern
254 | override
255 | readonly
256 | sealed
257 | static
258 | virtual
259 | volatile
260 | async
261 |
262 |
263 |
264 | public
265 | protected
266 | private
267 | internal
268 |
269 |
270 |
271 | namespace
272 | using
273 |
274 |
275 |
276 | get
277 | set
278 | add
279 | remove
280 |
281 |
282 |
283 | null
284 | value
285 |
286 |
287 |
288 | nameof
289 |
290 |
291 |
292 |
293 | \b
294 | [\d\w_]+ # an identifier
295 | (?=\s*\() # followed by (
296 |
297 |
298 |
299 |
300 | \b0[xX][0-9a-fA-F]+ # hex number
301 | |
302 | ( \b\d+(\.[0-9]+)? #number with optional floating point
303 | | \.[0-9]+ #or just starting with floating point
304 | )
305 | ([eE][+-]?[0-9]+)? # optional exponent
306 |
307 |
308 |
309 | [?,.;()\[\]{}+\-/%*<>^+~!|&]+
310 |
311 |
312 |
313 |
--------------------------------------------------------------------------------
/Xshd/ProtocHighlighting.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | "
16 | "
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | syntax
26 | message
27 | package
28 |
29 |
30 |
31 |
32 | int32
33 | int64
34 | string
35 | float
36 | bytes
37 | repeated
38 |
39 |
40 |
41 |
42 | \b0[xX][0-9a-fA-F]+ # hex number
43 | | \b
44 | ( \d+(\.[0-9]+)? #number with optional floating point
45 | | \.[0-9]+ #or just starting with floating point
46 | )
47 | ([eE][+-]?[0-9]+)? # optional exponent
48 |
49 |
50 |
--------------------------------------------------------------------------------
/logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecodeCN/OpcodeGUI/f919836fefe1b61a9b1ae7db63f09f83909cc8cb/logo.ico
--------------------------------------------------------------------------------