public HttpResponseMessage Post(GenerateFile model)
        {
            ModelInfo modelInfo = model.ModelInfo;
            int       id        = model.TemplateId;

            GetMicrosoftDatabaseSchemaDetails microsoftDatabaseSchemaDetails = new GetMicrosoftDatabaseSchemaDetails();
            List <IModelInfoTemplate>         templates = templateFactory.GetModelInfoTemplates(modelInfo);
            IModelInfoTemplate template = templates.FirstOrDefault(c => c.GetClassId() == id);

            string documentText = "Error no template found!";

            if (template != null)
            {
                documentText = template.TransformText();
            }

            var result = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new ByteArrayContent(Encoding.ASCII.GetBytes(documentText))
            };

            result.Content.Headers.ContentDisposition =
                new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
            {
                FileName = "CertificationCard.cs"
            };

            result.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain");

            return(result);
        }
 //Start function
 void Start()
 {
     loadedFiles = GenerateFile.loadFiles();
     for (int i = 0; i < loadedFiles.Length; i++)
     {
         GameFile   temp         = JsonUtility.FromJson <GameFile>(loadedFiles[i]);
         GameObject analyzePanel = Instantiate(fileAnalyzeTemplate) as GameObject;
         analyzePanel.SetActive(true);
         analyzePanel.GetComponent <fileAnalyzeElement>().setText(temp.getGameFileName(), temp.getGameFilePath(), temp.getGameFileDate(), temp.getGameFileExtension(), temp.getGameFileSize(), temp.getGameFileID().ToString());
         analyzePanel.transform.SetParent(fileAnalyzeTemplate.transform.parent, false);
     }
 }
Example #3
0
    public void Start()
    {
        loadedFiles = GenerateFile.loadFiles();
        string formattedSize = "";

        for (int i = 0; i < loadedFiles.Length; i++)
        {
            GameFile   fileToPrint = JsonUtility.FromJson <GameFile>(loadedFiles[i]);
            GameObject filePanel   = Instantiate(fileSelectTemplate) as GameObject;
            filePanel.SetActive(true);
            formattedSize = formatSize(fileToPrint.getGameFileSize());
            filePanel.GetComponent <FileSelectElement>().setTMP(fileToPrint.getGameFileName() + fileToPrint.getGameFileExtension(), formattedSize, fileToPrint.getGameFileID().ToString());
            filePanel.transform.SetParent(fileSelectTemplate.transform.parent, false);
        }
    }
    public void startHash()
    {
        int selectedFileId = Int32.Parse(PlayerPrefs.GetString("chosenFileId"));

        loadedFiles = GenerateFile.loadFiles();
        for (int i = 0; i < loadedFiles.Length; i++)
        {
            GameFile fileToPrint = JsonUtility.FromJson <GameFile>(loadedFiles[i]);
            if (fileToPrint.getGameFileID().ToString() == selectedFileId.ToString())
            {
                selectedFile = fileToPrint;
            }
        }
        if (md5Toggle.isOn)
        {
            md5OutputField.GetComponent <TMP_InputField>().text = md5Hash(selectedFile.ToString());
        }
        else
        {
            md5OutputField.GetComponent <TMP_InputField>().text = "";
        }
        if (sha1Toggle.isOn)
        {
            sha1OutputField.GetComponent <TMP_InputField>().text = sha1Hash(selectedFile.ToString());
        }
        else
        {
            sha1OutputField.GetComponent <TMP_InputField>().text = "";
        }
        if (sha256Toggle.isOn)
        {
            sha256OutputField.GetComponent <TMP_InputField>().text = sha256Hash(selectedFile.ToString());
        }
        else
        {
            sha256OutputField.GetComponent <TMP_InputField>().text = "";
        }
        if (sha512Toggle.isOn)
        {
            sha512OutputField.GetComponent <TMP_InputField>().text = sha512Hash(selectedFile.ToString());
        }
        else
        {
            sha512OutputField.GetComponent <TMP_InputField>().text = "";
        }
    }
    public static void printFile()
    {
        string fileInfo       = PlayerPrefs.GetString("chosenFileId");
        int    selectedFileId = Int32.Parse(PlayerPrefs.GetString("chosenFileId"));

        string[] newLoadedFiles = GenerateFile.loadFiles();
        for (int i = 0; i < newLoadedFiles.Length; i++)
        {
            GameFile fileToPrint = JsonUtility.FromJson <GameFile>(newLoadedFiles[i]);
            if (fileToPrint.getGameFileID().ToString() == selectedFileId.ToString())
            {
                selectedFile = fileToPrint;
            }
        }
        filePrint.text      = selectedFile.getGameFileName() + selectedFile.getGameFileExtension();
        filePrint.color     = new Color32(0, 0, 0, 255);
        filePrint.fontStyle = FontStyles.Normal;
    }
Example #6
0
 void Start()
 {
     loadedFiles = GenerateFile.loadFiles();
     fileSelectDropdown.options.Clear();
     attackerDropdown.options.Clear();
     dateDropdown.options.Clear();
     for (int i = 0; i < loadedFiles.Length; i++)
     {
         GameFile fileToPrint = JsonUtility.FromJson <GameFile>(loadedFiles[i]);
         setFile(fileToPrint.getGameFileName() + fileToPrint.getGameFileExtension());
         if (!uniqueNames.Contains(fileToPrint.getGameFileOwner()))
         {
             uniqueNames.Add(fileToPrint.getGameFileOwner());
         }
     }
     parseOwners(uniqueNames);
     setDate();
     fileSelectDropdown.RefreshShownValue();
     attackerDropdown.RefreshShownValue();
     dateDropdown.RefreshShownValue();
 }
Example #7
0
        private void InitUI()
        {
            Debug.WriteLine("Initializing UI objects.");

            #region Editor and Canvas

            Debug.WriteLine("Loading canvas...");
            this.editor = new DefaultEditor();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.editor);

            ICanvas canvas = new DefaultCanvas();
            canvas.Name = "Pattern Design";
            this.editor.AddCanvas(canvas);

            #endregion

            #region Commands

            //command di menubar file
            GenerateFile addGenerateFile = new GenerateFile(canvas);
            Save         save            = new Save(canvas);
            OpenFile     open            = new OpenFile(canvas);
            Exit         exit            = new Exit();

            //command di menubar edit
            undo  = new Undo(canvas);
            redo  = new Redo(canvas);
            copy  = new Copy(canvas);
            paste = new Paste(canvas);

            //command di menubar generate
            AddPattern1         addPattern1         = new AddPattern1(canvas);
            AddFactoryPattern   addFactoryPattern   = new AddFactoryPattern(canvas);
            AddCommandPattern   addCommandPattern   = new AddCommandPattern(canvas);
            AddCompositePattern addCompositePattern = new AddCompositePattern(canvas);
            AddFacadePattern    addFacadePattern    = new AddFacadePattern(canvas);
            AddMementoPattern   addMementroPattern  = new AddMementoPattern(canvas);
            AddSingletonPattern addSingletonPattern = new AddSingletonPattern(canvas);

            #endregion

            #region Menubar

            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            //menubar file
            DefaultMenuItem fileMenuItem = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(fileMenuItem);

            DefaultMenuItem generateFile = new DefaultMenuItem("Generate Class File");
            generateFile.SetCommand(addGenerateFile);
            fileMenuItem.AddMenuItem(generateFile);

            DefaultMenuItem openItem = new DefaultMenuItem("Open");
            openItem.SetCommand(open);
            fileMenuItem.AddMenuItem(openItem);

            DefaultMenuItem saveItem = new DefaultMenuItem("Save");
            saveItem.SetCommand(save);
            fileMenuItem.AddMenuItem(saveItem);

            fileMenuItem.AddSeparator();

            DefaultMenuItem exitMenuItem = new DefaultMenuItem("Exit");
            exitMenuItem.SetCommand(exit);
            fileMenuItem.AddMenuItem(exitMenuItem);

            //menubar edit
            DefaultMenuItem editMenuItem = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(editMenuItem);

            DefaultMenuItem undoItem = new DefaultMenuItem("Undo");
            undoItem.SetCommand(undo);
            editMenuItem.AddMenuItem(undoItem);

            DefaultMenuItem redoItem = new DefaultMenuItem("Redo");
            redoItem.SetCommand(redo);
            editMenuItem.AddMenuItem(redoItem);

            DefaultMenuItem copyItem = new DefaultMenuItem("Copy");
            copyItem.SetCommand(copy);
            editMenuItem.AddMenuItem(copyItem);

            DefaultMenuItem pasteItem = new DefaultMenuItem("Paste");
            pasteItem.SetCommand(paste);
            editMenuItem.AddMenuItem(pasteItem);

            //menubar generate
            DefaultMenuItem generateMenuItem = new DefaultMenuItem("Generate");
            this.menubar.AddMenuItem(generateMenuItem);

            DefaultMenuItem creationalSubMenu = new DefaultMenuItem("Creational Pattern");
            generateMenuItem.AddMenuItem(creationalSubMenu);

            DefaultMenuItem structuralSubMenu = new DefaultMenuItem("Structural Pattern");
            generateMenuItem.AddMenuItem(structuralSubMenu);

            DefaultMenuItem behavioralSubMenu = new DefaultMenuItem("Behavioral Pattern");
            generateMenuItem.AddMenuItem(behavioralSubMenu);

            DefaultMenuItem factoryMenuItem = new DefaultMenuItem("Factory Pattern");
            factoryMenuItem.SetCommand(addFactoryPattern);
            creationalSubMenu.AddMenuItem(factoryMenuItem);

            DefaultMenuItem singletonMenuItem = new DefaultMenuItem("Singleton Pattern");
            singletonMenuItem.SetCommand(addSingletonPattern);
            creationalSubMenu.AddMenuItem(singletonMenuItem);

            DefaultMenuItem compositeMenuItem = new DefaultMenuItem("Composite Pattern");
            compositeMenuItem.SetCommand(addCompositePattern);
            structuralSubMenu.AddMenuItem(compositeMenuItem);

            DefaultMenuItem facadeMenuItem = new DefaultMenuItem("Facade Pattern");
            facadeMenuItem.SetCommand(addFacadePattern);
            structuralSubMenu.AddMenuItem(facadeMenuItem);

            DefaultMenuItem commandMenuItem = new DefaultMenuItem("Command Pattern");
            commandMenuItem.SetCommand(addCommandPattern);
            behavioralSubMenu.AddMenuItem(commandMenuItem);

            DefaultMenuItem mementoMenuItem = new DefaultMenuItem("Memento Pattern");
            mementoMenuItem.SetCommand(addMementroPattern);
            behavioralSubMenu.AddMenuItem(mementoMenuItem);

            #endregion

            #region Toolbox

            // Initializing toolbox
            Debug.WriteLine("Loading toolbox...");
            this.toolbox = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);
            this.editor.Toolbox = toolbox;

            #endregion

            #region Tools


            // Initializing tools
            Debug.WriteLine("Loading tools...");
            this.toolbox.AddTool(new SelectionTool());
            this.toolbox.AddSeparator();
            //this.toolbox.AddTool(new LineTool());
            this.toolbox.AddTool(new ClassTool());
            this.toolbox.AddSeparator();
            this.toolbox.AddTool(new AssociationTool());
            this.toolbox.AddTool(new DirectedTool());
            this.toolbox.AddTool(new GeneralizationTool());
            this.toolbox.AddTool(new DependencyTool());
            this.toolbox.AddTool(new RealizationTool());
            this.toolbox.AddSeparator();
            //this.toolbox.AddTool(new DeleteTool());
            this.toolbox.ToolSelected += Toolbox_ToolSelected;

            #endregion

            #region Toolbar

            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            UndoToolItem undoToolItem = new UndoToolItem(canvas);
            undoToolItem.SetCommand(undo);
            RedoToolItem redoToolItem = new RedoToolItem(canvas);
            redoToolItem.SetCommand(redo);
            SaveToolbarItem saveToolItem = new SaveToolbarItem(canvas);
            saveToolItem.SetCommand(save);

            OpenToolbarItem openToolItem = new OpenToolbarItem(canvas);
            openToolItem.SetCommand(open);

            CopyToolbarItem copyToolItem = new CopyToolbarItem(canvas);
            copyToolItem.SetCommand(copy);
            PasteToolbarItem pasteToolItem = new PasteToolbarItem(canvas);
            pasteToolItem.SetCommand(paste);


            this.toolbar.AddToolbarItem(openToolItem);
            this.toolbar.AddToolbarItem(saveToolItem);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(undoToolItem);
            this.toolbar.AddToolbarItem(redoToolItem);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(copyToolItem);
            this.toolbar.AddToolbarItem(pasteToolItem);


            #endregion
        }
 public void Start()
 {
     loadedFiles = GenerateFile.loadFiles();
     EventSystem.current.SetSelectedGameObject(inputField.gameObject, null);
 }
Example #9
0
 void OnGenerateFile() => GenerateFile?.Invoke(this, EventArgs.Empty);